Browse Source

增加了四个类文件Sampler、Sobol、Random、Metropolis;修改了print.php;其他部分文修改了注释说明

master
yuanjiajia 3 years ago
parent
commit
a820910501
  1. 7
      examples/print.php
  2. 7
      src/core/Base.php
  3. 26
      src/scene/BaseCfg.php
  4. 4
      src/scene/HybridBackforWard.php
  5. 26
      src/scene/Metropolis.php
  6. 9
      src/scene/OpenCL.php
  7. 9
      src/scene/Path.php
  8. 52
      src/scene/Random.php
  9. 43
      src/scene/Sampler.php
  10. 51
      src/scene/Sobol.php

7
examples/print.php

@ -22,4 +22,11 @@ echo $native;
$path = new Path(['glossinessthreshold' => 0.999]); $path = new Path(['glossinessthreshold' => 0.999]);
echo $path; echo $path;
//设置打印 采样器 配置参数
$sampler = new Sampler(['imagemutationrate' => 0.888]);
$sampler->random->overlapping = 32;
echo $sampler;
?> ?>

7
src/core/Base.php

@ -4,6 +4,12 @@ namespace Blobt\Luxcore\core;
class Base class Base
{ {
//打开或关闭
const OPEN = true;
const CLOSE = false;
/** /**
* 实现自动配置 * 实现自动配置
*/ */
@ -15,4 +21,5 @@ class Base
} }
} }
} }
} }

26
src/scene/BaseCfg.php

@ -38,20 +38,32 @@ class BaseCfg extends Base
$name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); $name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name)));
$value = $item->getValue($this); $value = $item->getValue($this);
if (is_string($value)) {
if (is_string($value))
{
$ret .= "{$className}.{$name} = \"{$value}\"\n"; $ret .= "{$className}.{$name} = \"{$value}\"\n";
} else if (is_integer($value)) {
}
else if (is_integer($value))
{
$ret .= "{$className}.{$name} = {$value}\n"; $ret .= "{$className}.{$name} = {$value}\n";
} else if (is_bool($value)) {
}
else if (is_bool($value))
{
$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);
} else if(is_null($value)){
}
else if(is_null($value))
{
$ret .= "{$className}.{$name} = \"null\"\n"; $ret .= "{$className}.{$name} = \"null\"\n";
} else if(is_float($value)){
} else if(is_float($value))
{
$ret .= "{$className}.{$name} = {$value}\n"; $ret .= "{$className}.{$name} = {$value}\n";
}else{
}
else
{
$ret .= "{$className}.{$name} = \"unknow type\"\n"; $ret .= "{$className}.{$name} = \"unknow type\"\n";
} }
} }

4
src/scene/HybridBackforWard.php

@ -5,10 +5,6 @@ namespace Blobt\Luxcore\scene;
class HybridBackforWard extends BaseCfg class HybridBackforWard extends BaseCfg
{ {
//打开或关闭
const OPEN = true;
const CLOSE = false;
/** /**
* @var bool 是否开启 自适应光线跟踪 参数设置 * @var bool 是否开启 自适应光线跟踪 参数设置
*/ */

26
src/scene/Metropolis.php

@ -0,0 +1,26 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Metropolis extends BaseCfg
{
/**
* @var float TODO:具体作用尚不明确,(取值:0-1
*/
public $largesteprate = 0.4;
/**
* @var integer TODO:具体作用尚不明确,(取值:大于0的整数)
*/
public $maxconsecutivereject = 512;
/**
* @var float TODO:具体作用尚不明确,(取值:0-1
*/
public $imagemutationrate = 0.1;
}
?>

9
src/scene/OpenCL.php

@ -5,18 +5,13 @@ namespace Blobt\Luxcore\scene;
class OpenCL extends BaseCfg class OpenCL extends BaseCfg
{ {
//打开或关闭
const OPEN = 1;
const CLOSE = 0;
/** /**
* @var integral 是否使用cpu渲染,默认是
* @var bool 是否使用cpu渲染,默认是
*/ */
public $cpuUse = self::CLOSE; public $cpuUse = self::CLOSE;
/** /**
* @var integral 是否使用gpu渲染,默认否
* @var bool 是否使用gpu渲染,默认否
*/ */
public $gpuUse = self::OPEN; public $gpuUse = self::OPEN;

9
src/scene/Path.php

@ -6,11 +6,6 @@ use Blobt\Luxcore\core\Base;
class Path extends BaseCfg class Path extends BaseCfg
{ {
//打开或关闭
const OPEN = true;
const CLOSE = false;
/** /**
* @var object 存储一个 PathDepth类 对象 * @var object 存储一个 PathDepth类 对象
*/ */
@ -31,6 +26,10 @@ class Path extends BaseCfg
*/ */
public $clampingVarianceMaxvalue = 1000; public $clampingVarianceMaxvalue = 1000;
/**
* @var integer $maxdepth 当渲染引擎为 BIDIR 时,光线跟踪的最大深度(取值:大于0的整数)
*/
public $maxdepth = 10;
/** /**
* 实例 PathDepth类、HybridBackforWard类的两个对象 * 实例 PathDepth类、HybridBackforWard类的两个对象

52
src/scene/Random.php

@ -0,0 +1,52 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Random extends BaseCfg
{
/**
* “progressive”的优化类型,每过程每像素采样1个样本
*/
const PROGRESSIVE = 1;
/**
* “cache-friendly”的优化类型,每过程每像素采样32个样本
*/
const CACHE_FRIENDLY = 32;
//2的n次方
const POW_TWO_ZERO = 1;
const POW_TWO_TWO = 4;
const POW_TWO_THREE = 8;
const POW_TWO_FOUR = 16;
const POW_TWO_FIVE = 32;
const POW_TWO_SIX = 64;
/**
* @var integer TODO:初步分析为每过程每像素采样的样本数
*/
public $overlapping = self::PROGRESSIVE;
/**
* @var integer 这是 $overlapping”参数的倍数
*/
public $superSampling = self::POW_TWO_ZERO;
/**
* @var integer TODO:具体作用尚不明确,
*/
public $tileSize = 16;
/**
* @var integer TODO:具体作用尚不明确,
*/
public $bucketSize = 1;
/**
* @var float 区分完全采样与自适应彩样的阀值(取值0-0.95的小数)
*/
public $adaptiveStrength = 0.9;
}
?>

43
src/scene/Sampler.php

@ -0,0 +1,43 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Sampler extends BaseCfg
{
//渲染器的两个采样类型:SOBOL和RANDOM
const TYPE_SOBOL = 'SOBOL';
const TYPE_METROPOLIS = 'METROPOLIS';
const TYPE_RANDOM = 'RANDOM';
const TYPE_TILEPATHSAMPLER = 'TILEPATHSAMPLER';
/**
* @var string 使用何种采样类型,默认是 SOBOL
*/
public $type = self::TYPE_SOBOL;
/**
* @var object 一个 Random类 Sobol类 的实例对象
*/
public $sobol;
public $random;
public $metropolis;
/**
* 实例 PathDepth类、HybridBackforWard类的两个对象
*/
public function __construct($config = [])
{
$this->sobol = new Sobol($config);
$this->random = new Random($config);
$this->metropolis = new Metropolis($config);
Base::__construct($config);
}
}

51
src/scene/Sobol.php

@ -0,0 +1,51 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Sobol extends BaseCfg
{
/**
* “progressive”的优化类型,每过程每像素采样1个样本
*/
const PROGRESSIVE = 1;
/**
* “cache-friendly”的优化类型,每过程每像素采样32个样本
*/
const CACHE_FRIENDLY = 32;
//2的n次方
const POW_TWO_ZERO = 1;
const POW_TWO_TWO = 4;
const POW_TWO_THREE = 8;
const POW_TWO_FOUR = 16;
const POW_TWO_FIVE = 32;
const POW_TWO_SIX = 64;
/**
* @var integer TODO:初步判断为每过程每像素采样的样本数
*/
public $overlapping = self::PROGRESSIVE;
/**
* @var integer 这是 $overlapping”参数的倍数
*/
public $superSampling = self::POW_TWO_ZERO;
/**
* @var integer TODO:具体作用尚不明确
*/
public $tileSize = 16;
/**
* @var integer TODO:具体作用尚不明确
*/
public $bucketSize = 1;
/**
* @var float 在图像中区分完全采样与自适应彩样的阀值(取值0-0.95的小数)
*/
public $adaptiveStrength = 0.9;
}
?>
Loading…
Cancel
Save