Browse Source

修改了print.php、BaseCfg.php、Film.php、StringHelper.php四个类文件

master
yuanjiajia 3 years ago
parent
commit
07b008d488
  1. 16
      examples/print.php
  2. 9
      src/scene/BaseCfg.php
  3. 3
      src/scene/Film.php
  4. 7
      src/utils/StringHelper.php

16
examples/print.php

@ -6,7 +6,7 @@ namespace Blobt\Luxcore\scene;
include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
/*
//设置打印渲染引擎的配置参数 //设置打印渲染引擎的配置参数
$renderEngine = new RenderEngine(); $renderEngine = new RenderEngine();
echo $renderEngine; echo $renderEngine;
@ -28,20 +28,16 @@ $sampler = new Sampler(['imagemutationrate' => 0.888]);
$sampler->random->overlapping = 32; $sampler->random->overlapping = 32;
echo $sampler; echo $sampler;
//设置打印 灯光策略 配置参数
$lightStrategy = new LightStrategy(); $lightStrategy = new LightStrategy();
echo $lightStrategy; echo $lightStrategy;
//设置打印 文件储存格式 配置参数
$filesaver = new FileSaver(); $filesaver = new FileSaver();
echo $filesaver; echo $filesaver;
*/
$img = new Film();
echo $img;
//设置打印 “胶片” 配置参数
$film = new Film();
echo $film;
?> ?>

9
src/scene/BaseCfg.php

@ -53,7 +53,14 @@ class BaseCfg extends Base
$value = $item->getValue($this); $value = $item->getValue($this);
if (is_string($value)) 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)) else if (is_integer($value))
{ {

3
src/scene/Film.php

@ -56,7 +56,8 @@ class Film extends BaseCfg
$this->noiseEstimation = new NoiseEstimation($config); $this->noiseEstimation = new NoiseEstimation($config);
$this->filter = new Filter($config); $this->filter = new Filter($config);
$this->imagepipelines = [];
$this->imagepipelines[] = new NoiseReducerOIDN();
$this->imagepipelines[] = new NoiseReducerBCD();
$this->outputs[] = new ImageSaverBase(); $this->outputs[] = new ImageSaverBase();
$this->outputs[] = new ImageSaverNumber(); $this->outputs[] = new ImageSaverNumber();

7
src/utils/StringHelper.php

@ -37,18 +37,17 @@ class StringHelper
} }
else if( is_string($value) ) 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 else
{ {
$retStr[] = "{$key} = \"{$value}\"";
$retStr[] = "{$key} = {$value}";
} }
} }
else if(is_object($value) && $value instanceof BaseCfg) else if(is_object($value) && $value instanceof BaseCfg)
{ {
foreach( explode("\n", $value->toString()) as $value ) foreach( explode("\n", $value->toString()) as $value )
{ {
if(!empty($value)) if(!empty($value))

Loading…
Cancel
Save