diff --git a/examples/print.php b/examples/print.php index 41683ea..061fd88 100644 --- a/examples/print.php +++ b/examples/print.php @@ -5,8 +5,8 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; -/* +/* //设置打印渲染引擎的配置参数 $renderEngine = new RenderEngine(); echo $renderEngine; @@ -27,9 +27,9 @@ echo $path; $sampler = new Sampler(['imagemutationrate' => 0.888]); $sampler->random->overlapping = 32; echo $sampler; - */ + $film = new Film(); echo "$film\n"; diff --git a/src/scene/Path.php b/src/scene/Path.php index 7044a28..2a70fa2 100644 --- a/src/scene/Path.php +++ b/src/scene/Path.php @@ -26,11 +26,6 @@ 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 index 33609a1..1d887d9 100644 --- a/src/scene/Random.php +++ b/src/scene/Random.php @@ -29,17 +29,18 @@ class Random extends BaseCfg public $overlapping = self::PROGRESSIVE; /** - * @var integer 这是 “$overlapping”参数的倍数 + * @var integer 这是 “$overlapping”参数的倍数(此参数只在GPU渲染模式可设置) */ public $superSampling = self::POW_TWO_ZERO; /** - * @var integer TODO:具体作用尚不明确, + * @var integer TODO:具体作用尚不明确(默认16) */ public $tileSize = 16; /** - * @var integer TODO:具体作用尚不明确, + * @var integer TODO:具体作用尚不明确,(当“$overlapping”优化类型为“PROGRESSIVE”,此值被设为16; + * 当“$overlapping”优化类型为“CACHE_FRIENDLY”,此值被设为1) */ public $bucketSize = 1; diff --git a/src/scene/RenderEngine.php b/src/scene/RenderEngine.php index 569e1f4..b8eddc3 100644 --- a/src/scene/RenderEngine.php +++ b/src/scene/RenderEngine.php @@ -7,8 +7,6 @@ class RenderEngine extends BaseCfg const TYPE_PATHCPU = 'PATHCPU'; const TYPE_PATHGPU = 'PATHGPU'; - const TYPE_BIDIRCPU = 'BIDIRCPU'; - /** * @var string 使用何种渲染引擎(可取值是 PATHCPU、PATHGPU、BIDIRCPU 三个字符串之一) diff --git a/src/scene/Sobol.php b/src/scene/Sobol.php index 911a589..ff3d231 100644 --- a/src/scene/Sobol.php +++ b/src/scene/Sobol.php @@ -28,17 +28,18 @@ class Sobol extends BaseCfg public $overlapping = self::PROGRESSIVE; /** - * @var integer 这是 “$overlapping”参数的倍数 + * @var integer 这是 “$overlapping”参数的倍数(此参数只在GPU渲染模式可设置) */ public $superSampling = self::POW_TWO_ZERO; /** - * @var integer TODO:具体作用尚不明确 + * @var integer TODO:具体作用尚不明确(默认16) */ public $tileSize = 16; /** - * @var integer TODO:具体作用尚不明确 + * @var integer TODO:具体作用尚不明确,(当“$overlapping”优化类型为“PROGRESSIVE”,此值被设为16; + * 当“$overlapping”优化类型为“CACHE_FRIENDLY”,此值被设为1) */ public $bucketSize = 1; diff --git a/src/utils/StringHelper.php b/src/utils/StringHelper.php index 2722d6a..70e1298 100644 --- a/src/utils/StringHelper.php +++ b/src/utils/StringHelper.php @@ -4,46 +4,6 @@ namespace Blobt\Luxcore\utils; class StringHelper { - static public function functionNameStrToArray($functionNameStr) - { - - $functionNameArray = null; - $functionNameTemp = null; - - if ($functionNameStr != null) { - - $strLen = strlen($functionNameStr); - /* - 检查字符串内不能包含 英文字母及“_” 以外的字符 - */ - for ($i = 0; $i < $strLen; $i++) { - - if (!((ord($functionNameStr[$i]) >= 65) && (ord($functionNameStr[$i]) <= 122)) && ($functionNameStr[$i] != "_")) { - echo '解析错误: 函数名称 存在非法字符 “' . $functionNameStr[$i] . '”' . "\n"; - return null; - } - } - - /* - 将函数名字符串,以大写的首字母为分割,转换成数组 - */ - for ($i = 0; $i < $strLen; $i++) { - - $functionNameTemp[] = $functionNameStr[$i]; - if (((ord(substr($functionNameStr, $i + 1, 1)) >= 65) && (ord(substr($functionNameStr, $i + 1, 1)) <= 90)) || ($i == $strLen - 1)) { - $functionNameTemp = implode($functionNameTemp); - $functionNameArray[] = $functionNameTemp; - $functionNameTemp = null; - } - } - - return $functionNameArray; - } else { - echo '解析错误:函数名称字符串不能为空' . "\n"; - return null; - } - } - /** * 把驼峰命名字符串截成数组 */ @@ -62,48 +22,35 @@ class StringHelper */ static public function arrayToString(&$tempArr) { - static $retStr = []; - static $tempStr = []; - static $i = 0; - - if( $i < 0 )//检查递归函数是 被外部调用还是 还是函数内部调用 - { - $i = 0; - $retStr = []; - $tempStr = []; - } - + + $retStr = []; foreach($tempArr as $key => $value) { if(is_array($value)) { - $tempStr[$i] = "{$key}."; - $i++; - self::arrayToString($value); + foreach( self::arrayToString($value) as $value ) + { + $retStr[] = "{$key}.{$value}"; + } } else if( is_string($value) ) { if( mb_ereg('^[0-9]+$',str_replace('.','',str_replace(' ','',$value))) ) { - $tempStr[$i] = "{$key} = {$value}"; + $retStr[] = "{$key} = {$value}"; } else { - $tempStr[$i] = "{$key} = \"{$value}\""; + $retStr[] = "{$key} = \"{$value}\""; } - $retStr[] = implode($tempStr); + } else { - $tempStr[$i] = "{$key} = {$value}"; - $retStr[] = implode($tempStr); + $retStr[] = "{$key} = {$value}"; } - } - $tempStr[$i] = null; - $i--; return $retStr; } - } ?>