From 07b008d4882c563aeba700212cdcb593e9ea1f22 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Mon, 14 Feb 2022 01:15:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86print.php=E3=80=81Ba?= =?UTF-8?q?seCfg.php=E3=80=81Film.php=E3=80=81StringHelper.php=E5=9B=9B?= =?UTF-8?q?=E4=B8=AA=E7=B1=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/print.php | 16 ++++++---------- src/scene/BaseCfg.php | 9 ++++++++- src/scene/Film.php | 3 ++- src/utils/StringHelper.php | 7 +++---- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/examples/print.php b/examples/print.php index 636490a..714ae93 100644 --- a/examples/print.php +++ b/examples/print.php @@ -6,7 +6,7 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; -/* + //设置打印渲染引擎的配置参数 $renderEngine = new RenderEngine(); echo $renderEngine; @@ -28,20 +28,16 @@ $sampler = new Sampler(['imagemutationrate' => 0.888]); $sampler->random->overlapping = 32; echo $sampler; - +//设置打印 灯光策略 配置参数 $lightStrategy = new LightStrategy(); echo $lightStrategy; - - +//设置打印 文件储存格式 配置参数 $filesaver = new FileSaver(); - echo $filesaver; -*/ - -$img = new Film(); - -echo $img; +//设置打印 “胶片” 配置参数 +$film = new Film(); +echo $film; ?> diff --git a/src/scene/BaseCfg.php b/src/scene/BaseCfg.php index bf4684f..4006d02 100644 --- a/src/scene/BaseCfg.php +++ b/src/scene/BaseCfg.php @@ -53,7 +53,14 @@ class BaseCfg extends Base $value = $item->getValue($this); if (is_string($value)) { - $ret .= "{$className}.{$name} = \"{$value}\"\n"; + if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) ) + { + $ret .= "{$className}.{$name} = \"{$value}\"\n"; + } + else + { + $ret .= "{$className}.{$name} = {$value}\n"; + } } else if (is_integer($value)) { diff --git a/src/scene/Film.php b/src/scene/Film.php index 01e9586..7bf0768 100644 --- a/src/scene/Film.php +++ b/src/scene/Film.php @@ -56,7 +56,8 @@ class Film extends BaseCfg $this->noiseEstimation = new NoiseEstimation($config); $this->filter = new Filter($config); - $this->imagepipelines = []; + $this->imagepipelines[] = new NoiseReducerOIDN(); + $this->imagepipelines[] = new NoiseReducerBCD(); $this->outputs[] = new ImageSaverBase(); $this->outputs[] = new ImageSaverNumber(); diff --git a/src/utils/StringHelper.php b/src/utils/StringHelper.php index 739a883..b301d98 100644 --- a/src/utils/StringHelper.php +++ b/src/utils/StringHelper.php @@ -37,18 +37,17 @@ class StringHelper } else if( is_string($value) ) { - if( mb_ereg('^[0-9]+$',str_replace('.','',str_replace(' ','',$value))) ) + if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) ) { - $retStr[] = "{$key} = {$value}"; + $retStr[] = "{$key} = \"{$value}\""; } else { - $retStr[] = "{$key} = \"{$value}\""; + $retStr[] = "{$key} = {$value}"; } } else if(is_object($value) && $value instanceof BaseCfg) { - foreach( explode("\n", $value->toString()) as $value ) { if(!empty($value))