Browse Source

“新增了“ImageSaver.php”、“LightStrategy.php”、“FileSaver.php”三个类文件,其他类文件稍有小改动”

master
yuanjiajia 3 years ago
parent
commit
4975384c6b
  1. 11
      examples/print.php
  2. 4
      src/scene/BaseCfg.php
  3. 20
      src/scene/FileSaver.php
  4. 5
      src/scene/Film.php
  5. 5
      src/scene/Filter.php
  6. 21
      src/scene/ImageSaver.php
  7. 16
      src/scene/LightStrategy.php
  8. 1
      src/scene/Metropolis.php
  9. 1
      src/scene/NoiseEstimation.php
  10. 1
      src/scene/Path.php
  11. 1
      src/scene/Random.php
  12. 5
      src/scene/Sampler.php
  13. 1
      src/scene/Sobol.php
  14. 10
      src/utils/StringHelper.php

11
examples/print.php

@ -27,13 +27,20 @@ echo $path;
$sampler = new Sampler(['imagemutationrate' => 0.888]); $sampler = new Sampler(['imagemutationrate' => 0.888]);
$sampler->random->overlapping = 32; $sampler->random->overlapping = 32;
echo $sampler; echo $sampler;
$lightStrategy = new LightStrategy();
echo $lightStrategy;
*/ */
$filesaver = new FileSaver();
echo $filesaver;
$film = new Film();
echo "$film\n";
$film = new Film();
$film->outputs[3]['index'] = '中国最牛'; $film->outputs[3]['index'] = '中国最牛';
echo $film; echo $film;

4
src/scene/BaseCfg.php

@ -30,7 +30,6 @@ class BaseCfg extends Base
$object = new \ReflectionClass($this); $object = new \ReflectionClass($this);
$properties = $object->getProperties(); $properties = $object->getProperties();
//var_dump($properties);
//获取类名 -> 去除命名空间 -> 转成全小写 //获取类名 -> 去除命名空间 -> 转成全小写
@ -40,6 +39,7 @@ class BaseCfg extends Base
$className = "{$parentClassName}.$className"; $className = "{$parentClassName}.$className";
} }
$ret = ""; $ret = "";
foreach ($properties as $item) { foreach ($properties as $item) {
@ -64,7 +64,7 @@ class BaseCfg extends Base
$value = $value ? 1 : 0; $value = $value ? 1 : 0;
$ret .= "{$className}.{$name} = {$value}\n"; $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); $ret .= $value->toString($className);
} }

20
src/scene/FileSaver.php

@ -0,0 +1,20 @@
<?php
namespace Blobt\Luxcore\scene;
class FileSaver extends BaseCfg
{
const TYPE_PATHCPU = 'PATHCPU';
const TYPE_PATHGPU = 'PATHGPU';
/**
* @var string 渲染结果以 二进制或文本 方式保存(固定以文本方式保存)
*/
public $format = "TXT";
/**
* @var string
*/
public $renderengineType = self::TYPE_PATHGPU;
}
?>

5
src/scene/Film.php

@ -54,12 +54,12 @@ class Film extends BaseCfg
public function __construct($config = []) public function __construct($config = [])
{ {
$this->noiseEstimation = new NoiseEstimation($config); $this->noiseEstimation = new NoiseEstimation($config);
$this->filter = new Filter($config);
//$this->filter = new Filter($config);
$this->imagepipelines = array( $this->imagepipelines = array(
'000' =>array( '000' =>array(
'0' => array( '0' => array(
'type' => "NOP",
new Filter($config),
), ),
'1' => array( '1' => array(
'type' => "TONEMAP_LINEAR", 'type' => "TONEMAP_LINEAR",
@ -108,7 +108,6 @@ class Film extends BaseCfg
) )
); );
$this->outputs = array( $this->outputs = array(
'0' => array( '0' => array(
'type' => 'RGB_IMAGEPIPELINE', 'type' => 'RGB_IMAGEPIPELINE',

5
src/scene/Filter.php

@ -1,7 +1,6 @@
<?php <?php
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Filter extends BaseCfg class Filter extends BaseCfg
{ {
@ -26,12 +25,12 @@ class Filter extends BaseCfg
public $width = 1.5; public $width = 1.5;
/** /**
* 高斯类型抗锯齿过滤器的透明度(取值:0.10-10的浮点数)
* @var float 高斯类型抗锯齿过滤器的透明度(取值:0.10-10的浮点数)
*/ */
public $gaussianAlpha = 2; public $gaussianAlpha = 2;
/** /**
* TODO:具体作用尚不明确,(取值:0.10-8的浮点数)
* @var float “SINC”类型抗锯齿过滤器的参数,TODO:具体作用尚不明确,(取值:0.10-8的浮点数)
*/ */
public $sincTau = 1; public $sincTau = 1;

21
src/scene/ImageSaver.php

@ -0,0 +1,21 @@
<?php
namespace Blobt\Luxcore\scene;
class ImageSaver extends BaseCfg
{
const TYPE_PATHCPU = 'PATHCPU';
const TYPE_PATHGPU = 'PATHGPU';
/**
* @var string 使用何种渲染引擎(可取值是 PATHCPU、PATHGPU、BIDIRCPU 三个字符串之一)
*/
public $type = self::TYPE_PATHGPU;
/**
* @var float 随机种子(取值:大于0的整数)
*/
public $filename = "RGB_IMAGEPIPELINE_0.png";
}

16
src/scene/LightStrategy.php

@ -0,0 +1,16 @@
<?php
namespace Blobt\Luxcore\scene;
class LightStrategy extends BaseCfg
{
const TYPE_LOG_POWER = 'LOG_POWER';
const TYPE_POWER = 'POWER';
const TYPE_UNIFORM = 'UNIFORM';
/**
* @var string 使用何种灯光策略(可取值是 LOG_POWER、POWER、UNIFORM 三个字符串之一)
*/
public $type = self::TYPE_LOG_POWER;
}

1
src/scene/Metropolis.php

@ -1,7 +1,6 @@
<?php <?php
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Metropolis extends BaseCfg class Metropolis extends BaseCfg
{ {

1
src/scene/NoiseEstimation.php

@ -1,7 +1,6 @@
<?php <?php
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class NoiseEstimation extends BaseCfg class NoiseEstimation extends BaseCfg
{ {

1
src/scene/Path.php

@ -26,6 +26,7 @@ class Path extends BaseCfg
*/ */
public $clampingVarianceMaxvalue = 1000; public $clampingVarianceMaxvalue = 1000;
/** /**
* 实例 PathDepth类、HybridBackforWard类的两个对象 * 实例 PathDepth类、HybridBackforWard类的两个对象
*/ */

1
src/scene/Random.php

@ -1,7 +1,6 @@
<?php <?php
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Random extends BaseCfg class Random extends BaseCfg
{ {

5
src/scene/Sampler.php

@ -12,9 +12,6 @@ class Sampler extends BaseCfg
const TYPE_RANDOM = 'RANDOM'; const TYPE_RANDOM = 'RANDOM';
/** /**
* @var string 使用何种采样类型,默认是 SOBOL * @var string 使用何种采样类型,默认是 SOBOL
*/ */
@ -35,8 +32,6 @@ class Sampler extends BaseCfg
*/ */
public $metropolis; public $metropolis;
/** /**
* 实例 PathDepth类、HybridBackforWard类的两个对象 * 实例 PathDepth类、HybridBackforWard类的两个对象
*/ */

1
src/scene/Sobol.php

@ -1,7 +1,6 @@
<?php <?php
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Sobol extends BaseCfg class Sobol extends BaseCfg
{ {

10
src/utils/StringHelper.php

@ -1,6 +1,8 @@
<?php <?php
namespace Blobt\Luxcore\utils; namespace Blobt\Luxcore\utils;
use Blobt\Luxcore\scene\BaseCfg;
class StringHelper class StringHelper
{ {
@ -45,6 +47,14 @@ class StringHelper
} }
} }
else if(is_object($value) && $value instanceof BaseCfg)
{
foreach( explode("\n", $value->toString()) as $value )
{
if(!empty($value))$retStr[] = $value;
}
}
else else
{ {
$retStr[] = "{$key} = {$value}"; $retStr[] = "{$key} = {$value}";

Loading…
Cancel
Save