diff --git a/examples/print.php b/examples/print.php index 7b004ac..5aa2ccf 100644 --- a/examples/print.php +++ b/examples/print.php @@ -22,4 +22,11 @@ echo $native; $path = new Path(['glossinessthreshold' => 0.999]); echo $path; + + +//设置打印 采样器 配置参数 +$sampler = new Sampler(['imagemutationrate' => 0.888]); +$sampler->random->overlapping = 32; +echo $sampler; + ?> diff --git a/src/core/Base.php b/src/core/Base.php index 3afd41a..ff525d3 100644 --- a/src/core/Base.php +++ b/src/core/Base.php @@ -4,6 +4,12 @@ namespace Blobt\Luxcore\core; class Base { + + + //打开或关闭 + const OPEN = true; + const CLOSE = false; + /** * 实现自动配置 */ @@ -15,4 +21,5 @@ class Base } } } + } diff --git a/src/scene/BaseCfg.php b/src/scene/BaseCfg.php index 68ad050..a9b96ea 100644 --- a/src/scene/BaseCfg.php +++ b/src/scene/BaseCfg.php @@ -38,20 +38,32 @@ class BaseCfg extends Base $name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); $value = $item->getValue($this); - if (is_string($value)) { + if (is_string($value)) + { $ret .= "{$className}.{$name} = \"{$value}\"\n"; - } else if (is_integer($value)) { + } + else if (is_integer($value)) + { $ret .= "{$className}.{$name} = {$value}\n"; - } else if (is_bool($value)) { + } + else if (is_bool($value)) + { $value = $value ? 1 : 0; $ret .= "{$className}.{$name} = {$value}\n"; - } else if (is_object($value) && $value instanceof BaseCfg) { + } + else if (is_object($value) && $value instanceof BaseCfg) + { $ret .= $value->toString($className); - } else if(is_null($value)){ + } + else if(is_null($value)) + { $ret .= "{$className}.{$name} = \"null\"\n"; - } else if(is_float($value)){ + } else if(is_float($value)) + { $ret .= "{$className}.{$name} = {$value}\n"; - }else{ + } + else + { $ret .= "{$className}.{$name} = \"unknow type\"\n"; } } diff --git a/src/scene/HybridBackforWard.php b/src/scene/HybridBackforWard.php index 5287dc2..7fbcc25 100644 --- a/src/scene/HybridBackforWard.php +++ b/src/scene/HybridBackforWard.php @@ -5,10 +5,6 @@ namespace Blobt\Luxcore\scene; class HybridBackforWard extends BaseCfg { - //打开或关闭 - const OPEN = true; - const CLOSE = false; - /** * @var bool 是否开启 自适应光线跟踪 参数设置 */ diff --git a/src/scene/Metropolis.php b/src/scene/Metropolis.php new file mode 100644 index 0000000..ea6c371 --- /dev/null +++ b/src/scene/Metropolis.php @@ -0,0 +1,26 @@ + diff --git a/src/scene/OpenCL.php b/src/scene/OpenCL.php index f99fb07..76a1d14 100644 --- a/src/scene/OpenCL.php +++ b/src/scene/OpenCL.php @@ -4,19 +4,14 @@ namespace Blobt\Luxcore\scene; class OpenCL extends BaseCfg { - - - //打开或关闭 - const OPEN = 1; - const CLOSE = 0; /** - * @var integral 是否使用cpu渲染,默认是 + * @var bool 是否使用cpu渲染,默认是 */ public $cpuUse = self::CLOSE; /** - * @var integral 是否使用gpu渲染,默认否 + * @var bool 是否使用gpu渲染,默认否 */ public $gpuUse = self::OPEN; diff --git a/src/scene/Path.php b/src/scene/Path.php index 22a1b5f..7044a28 100644 --- a/src/scene/Path.php +++ b/src/scene/Path.php @@ -6,11 +6,6 @@ use Blobt\Luxcore\core\Base; class Path extends BaseCfg { - - //打开或关闭 - const OPEN = true; - const CLOSE = false; - /** * @var object 存储一个 PathDepth类 对象 */ @@ -31,6 +26,10 @@ class Path extends BaseCfg */ public $clampingVarianceMaxvalue = 1000; + /** + * @var integer $maxdepth 当渲染引擎为 BIDIR 时,光线跟踪的最大深度(取值:大于0的整数) + */ + public $maxdepth = 10; /** * 实例 PathDepth类、HybridBackforWard类的两个对象 diff --git a/src/scene/Random.php b/src/scene/Random.php new file mode 100644 index 0000000..33609a1 --- /dev/null +++ b/src/scene/Random.php @@ -0,0 +1,52 @@ + diff --git a/src/scene/Sampler.php b/src/scene/Sampler.php new file mode 100644 index 0000000..5c1349e --- /dev/null +++ b/src/scene/Sampler.php @@ -0,0 +1,43 @@ +sobol = new Sobol($config); + $this->random = new Random($config); + $this->metropolis = new Metropolis($config); + Base::__construct($config); + } + +} diff --git a/src/scene/Sobol.php b/src/scene/Sobol.php new file mode 100644 index 0000000..911a589 --- /dev/null +++ b/src/scene/Sobol.php @@ -0,0 +1,51 @@ + \ No newline at end of file