diff --git a/examples/print.php b/examples/print.php index 9759d7d..e8e9fd1 100644 --- a/examples/print.php +++ b/examples/print.php @@ -4,16 +4,16 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; -$renderDevices = new RenderDevices(); -$trackerEngine = new TrackerEngine(); -$renderEngine = new RenderEngine; -echo $renderEngine; +$renderEngineType = new RenderEngine(); +echo $renderEngineType; -$openCL = new OpenCL; +$openCL = new OpenCL(); echo $openCL; -$native = new Native; -echo $native; +$cpuThreadsCount = new Native(['threadsCount' => 64]); + +echo $cpuThreadsCount; + ?> diff --git a/src/scene/Native.php b/src/scene/Native.php index a6e0727..1e7aae9 100644 --- a/src/scene/Native.php +++ b/src/scene/Native.php @@ -8,15 +8,15 @@ class Native extends BaseCfg /** * @var integer //使用多少线程数 */ - private $threadsCount = 4; + protected $threadsCount = 4; /** * 在CPU渲染模式下,设置使用多少线程数 * @var integer $setThreadsCount 传入一个控制使用多少CPU线程数的整数 */ - public function setThreadsCount($threadsCount = 4) + public function setThreadsCount($count) { - $this->threadsCount = $threadsCount; + $this->threadsCount = $count; } } diff --git a/src/scene/OpenCL.php b/src/scene/OpenCL.php index 6b74226..e199ba7 100644 --- a/src/scene/OpenCL.php +++ b/src/scene/OpenCL.php @@ -5,61 +5,67 @@ namespace Blobt\Luxcore\scene; class OpenCL extends BaseCfg { + + //打开或关闭 + const OPEN = 1; + const CLOSE = 0; + /** * @var integral 是否使用cpu渲染,默认是 */ - private static $cpuUse; + protected $cpuUse = self::CLOSE; /** * @var integral 是否使用gpu渲染,默认否 */ - private static $gpuUse; + protected $gpuUse = self::OPEN; /** * @var string 在GPU渲染模式下,使用哪些GPU设备 */ - private $devicesSelect = '10'; + protected $devicesSelect = '10'; /** - * @var integer 在GPU渲染模式下,CPU是否渲染,并以多少线程渲染 + * @var integral 在GPU渲染模式下,CPU是否渲染,并以多少线程渲染 */ - private $nativeThreadsCount = 4; - + protected $nativeThreadsCount = 4; /** - * 以 RenderDevices类 的两个静态属性初始化变量 “$cpuUse”和“$gpuUse”参数 + * 使用cpu渲染 */ - public function __construct() + public function useCpu() { - self::refreshConfig(); + $this->cpuUse = self::OPEN; + $this->gpuUse = self::CLOSE; } /** - * 从 RenderDevices类 的两个静态属性刷新变量 “$cpuUse”和“$gpuUse”参数 + * 使用gpu渲染 */ - public static function refreshConfig() + public function useGpu() { - self::$cpuUse = RenderDevices::$cpuSwitch; - self::$gpuUse = RenderDevices::$gpuSwitch; + $this->cpuUse = self::CLOSE; + $this->gpuUse = self::OPEN; } + /** * 在GPU渲染模式下,设置使用哪些GPU设备 - * @var string $devicesSelect 传入一个控制使用哪些GPU设备的字符串 + * @var string $gpuIdStr 传入一个控制使用哪些GPU设备的字符串 */ - public function selectDevices($devicesSelect = '10') + public function selectDevices($gpuIdStr) { - $this->devicesSelect = $devicesSelect; + $this->devicesSelect = $gpuIdStr; } /** * 在GPU渲染模式下,设置CPU是否渲染,并以多少线程渲染 * @var integer $nativeThreadsCount 传入一个控制CPU是否渲染,并以多少线程渲染的整数 */ - public function setNativeThreadsCount($nativeThreadsCount = 4) + public function setNativeThreadsCount($count) { - $this->nativeThreadsCount = $nativeThreadsCount; + $this->nativeThreadsCount = $count; } } diff --git a/src/scene/RenderDevices.php b/src/scene/RenderDevices.php deleted file mode 100644 index 60d8659..0000000 --- a/src/scene/RenderDevices.php +++ /dev/null @@ -1,46 +0,0 @@ -type = $engineStr; } } diff --git a/src/scene/TrackerEngine.php b/src/scene/TrackerEngine.php deleted file mode 100644 index 42dc057..0000000 --- a/src/scene/TrackerEngine.php +++ /dev/null @@ -1,34 +0,0 @@ -