From 7a230ad8bacc38b3165c3fdd13aecc4db9209770 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Tue, 18 Jan 2022 19:07:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E7=B1=BB=E6=96=87=E4=BB=B6=E2=80=9CHybridBackforWard=E2=80=9D?= =?UTF-8?q?=E3=80=82=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=A4=E4=B8=AA=E7=B1=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E2=80=9CPath=E2=80=9D=E3=80=81=E2=80=9CPathD?= =?UTF-8?q?epth=E2=80=9D=EF=BC=8C=E5=85=B6=E4=BB=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/print.php | 3 +++ src/scene/BaseCfg.php | 8 +++--- src/scene/HybridBackforWard.php | 27 ++++++++++++++++++++ src/scene/Native.php | 2 +- src/scene/OpenCL.php | 2 +- src/scene/Path.php | 44 +++++++++++++++++++++++++++------ src/scene/PathDepth.php | 21 +++++++++++++--- 7 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 src/scene/HybridBackforWard.php diff --git a/examples/print.php b/examples/print.php index 2153645..7b004ac 100644 --- a/examples/print.php +++ b/examples/print.php @@ -18,5 +18,8 @@ echo $openCL; $native = new Native(['threadsCount' => 64]); echo $native; +//设置打印光线跟踪的配置参数 +$path = new Path(['glossinessthreshold' => 0.999]); +echo $path; ?> diff --git a/src/scene/BaseCfg.php b/src/scene/BaseCfg.php index eb7c224..68ad050 100644 --- a/src/scene/BaseCfg.php +++ b/src/scene/BaseCfg.php @@ -18,6 +18,8 @@ class BaseCfg extends Base $object = new \ReflectionClass($this); $properties = $object->getProperties(); + + //获取类名 -> 去除命名空间 -> 转成全小写 $className = get_called_class(); $className = strtolower(array_reverse(explode('\\', $className))[0]); @@ -36,7 +38,6 @@ class BaseCfg extends Base $name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); $value = $item->getValue($this); - if (is_string($value)) { $ret .= "{$className}.{$name} = \"{$value}\"\n"; } else if (is_integer($value)) { @@ -48,8 +49,9 @@ class BaseCfg extends Base $ret .= $value->toString($className); } else if(is_null($value)){ $ret .= "{$className}.{$name} = \"null\"\n"; - } else - { + } else if(is_float($value)){ + $ret .= "{$className}.{$name} = {$value}\n"; + }else{ $ret .= "{$className}.{$name} = \"unknow type\"\n"; } } diff --git a/src/scene/HybridBackforWard.php b/src/scene/HybridBackforWard.php new file mode 100644 index 0000000..5287dc2 --- /dev/null +++ b/src/scene/HybridBackforWard.php @@ -0,0 +1,27 @@ += $threadsCount ) + * @var integer //使用多少线程数(取值范围: 大于或等于1的整数) */ public $threadsCount = 4; diff --git a/src/scene/OpenCL.php b/src/scene/OpenCL.php index 212652f..f99fb07 100644 --- a/src/scene/OpenCL.php +++ b/src/scene/OpenCL.php @@ -26,7 +26,7 @@ class OpenCL extends BaseCfg public $devicesSelect = '10'; /** - * @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 0 >= $threadsCount ) + * @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 大于或等于0的整数) */ public $nativeThreadsCount = 4; diff --git a/src/scene/Path.php b/src/scene/Path.php index a6bce24..22a1b5f 100644 --- a/src/scene/Path.php +++ b/src/scene/Path.php @@ -1,17 +1,45 @@ pathDepth = new PathDepth($config); + $this->hybridBackforWard= new HybridBackforWard($config); + Base::__construct($config); + } + } diff --git a/src/scene/PathDepth.php b/src/scene/PathDepth.php index 8805113..59180a9 100644 --- a/src/scene/PathDepth.php +++ b/src/scene/PathDepth.php @@ -4,11 +4,24 @@ namespace Blobt\Luxcore\scene; class PathDepth extends BaseCfg { - public $total = 11; - + + /** + * @var integer 整体限制 漫反射、光泽反射、高光反射 的最大跟踪深度为 $total (取值:大于或等于1的整数) + */ + public $total = 6; + + /** + * 限制 漫反射光线 最大跟踪深度为(取值:大于或等于1的整数) + */ public $diffuse = 5; - public $glossy = 11; + /** + * 限制 光泽反射光线 最大跟踪深度为(取值:大于或等于1的整数) + */ + public $glossy = 5; - public $specular = 10; + /** + * 限制 光泽反射光线 最大跟踪深度为(取值:大于或等于1的整数) + */ + public $specular = 6; }