diff --git a/.gitignore b/.gitignore index 80cb2c7..c268805 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ phpunit.phar /.vagrant vendor.zip /vagrant + +composer.lock diff --git a/examples/print.php b/examples/print.php index 91ea267..61d5100 100644 --- a/examples/print.php +++ b/examples/print.php @@ -4,18 +4,14 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; +$temp = new Native(); -$opencl = new OpenCL(); -$opencl->useGpu(); +//$temp->usePidir(); -echo $opencl; +echo $temp; -$pathDepth = new PathDepth([ - "total" => 12 -]); -$depth = new Path([ - "pathdepth" => $pathDepth -]); -echo $depth; + + +?> diff --git a/src/scene/Native.php b/src/scene/Native.php new file mode 100644 index 0000000..a6e0727 --- /dev/null +++ b/src/scene/Native.php @@ -0,0 +1,22 @@ +threadsCount = $threadsCount; + } + +} diff --git a/src/scene/OpenCL.php b/src/scene/OpenCL.php index 3c945b6..f030d4f 100644 --- a/src/scene/OpenCL.php +++ b/src/scene/OpenCL.php @@ -2,36 +2,64 @@ namespace Blobt\Luxcore\scene; +use ParentIterator; + class OpenCL extends BaseCfg { - //打开或关闭 - const OPEN = 1; - const CLOSE = 0; - /** * @var integral 是否使用cpu渲染,默认是 */ - private $cpuUse = self::OPEN; + private static $cpuUse; /** * @var integral 是否使用gpu渲染,默认否 */ - private $gpuUse = self::CLOSE; + private static $gpuUse; + + /** + * @var string 在GPU渲染模式下,使用哪些GPU设备 + */ + public $devicesSelect = '10'; + + /** + * @var integer 在GPU渲染模式下,CPU是否渲染,并以多少线程渲染 + */ + private $nativeThreadsCount = 4; + + + + /** + * 以 RenderDevices类 的两个静态属性初始化变量 “$cpuUse”和“$gpuUse” + */ + public function __construct() + { + self::$cpuUse = RenderDevices::$cpuSwitch; + self::$gpuUse = RenderDevices::$gpuSwitch; + } + + public static function refreshConfig() + { + self::$cpuUse = RenderDevices::$cpuSwitch; + self::$gpuUse = RenderDevices::$gpuSwitch; + } /** - * 使用cpu渲染 + * 在GPU渲染模式下,设置使用哪些GPU设备 + * @var string $devicesSelect 传入一个控制使用哪些GPU设备的字符串 */ - public function useCpu(){ - $this->cpuUse = self::OPEN; - $this->gpuUse = self::CLOSE; + public function selectDevices($devicesSelect = '10') + { + $this->devicesSelect = $devicesSelect; } /** - * 使用gpu渲染 + * 在GPU渲染模式下,设置CPU是否渲染,并以多少线程渲染 + * @var integer $nativeThreadsCount 传入一个控制CPU是否渲染,并以多少线程渲染的整数 */ - public function useGpu(){ - $this->cpuUse = self::CLOSE; - $this->gpuUse = self::OPEN; + public function setNativeThreadsCount($nativeThreadsCount = 4) + { + $this->nativeThreadsCount = $nativeThreadsCount; } + } diff --git a/src/scene/RenderDevices.php b/src/scene/RenderDevices.php new file mode 100644 index 0000000..60d8659 --- /dev/null +++ b/src/scene/RenderDevices.php @@ -0,0 +1,46 @@ +