Browse Source

增加了一个类文件“HybridBackforWard”。修改了两个类文件“Path”、“PathDepth”,其他文件修改了一些注释说明

master
yuanjiajia 3 years ago
parent
commit
7a230ad8ba
  1. 3
      examples/print.php
  2. 8
      src/scene/BaseCfg.php
  3. 27
      src/scene/HybridBackforWard.php
  4. 2
      src/scene/Native.php
  5. 2
      src/scene/OpenCL.php
  6. 44
      src/scene/Path.php
  7. 21
      src/scene/PathDepth.php

3
examples/print.php

@ -18,5 +18,8 @@ echo $openCL;
$native = new Native(['threadsCount' => 64]); $native = new Native(['threadsCount' => 64]);
echo $native; echo $native;
//设置打印光线跟踪的配置参数
$path = new Path(['glossinessthreshold' => 0.999]);
echo $path;
?> ?>

8
src/scene/BaseCfg.php

@ -18,6 +18,8 @@ class BaseCfg extends Base
$object = new \ReflectionClass($this); $object = new \ReflectionClass($this);
$properties = $object->getProperties(); $properties = $object->getProperties();
//获取类名 -> 去除命名空间 -> 转成全小写 //获取类名 -> 去除命名空间 -> 转成全小写
$className = get_called_class(); $className = get_called_class();
$className = strtolower(array_reverse(explode('\\', $className))[0]); $className = strtolower(array_reverse(explode('\\', $className))[0]);
@ -36,7 +38,6 @@ 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)) {
@ -48,8 +49,9 @@ class BaseCfg extends Base
$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
{
} else if(is_float($value)){
$ret .= "{$className}.{$name} = {$value}\n";
}else{
$ret .= "{$className}.{$name} = \"unknow type\"\n"; $ret .= "{$className}.{$name} = \"unknow type\"\n";
} }
} }

27
src/scene/HybridBackforWard.php

@ -0,0 +1,27 @@
<?php
namespace Blobt\Luxcore\scene;
class HybridBackforWard extends BaseCfg
{
//打开或关闭
const OPEN = true;
const CLOSE = false;
/**
* @var bool 是否开启 自适应光线跟踪 参数设置
*/
public $enable = self::OPEN;
/**
* @var float 设置 不跟踪光线 所占最大百分比 (取值:0-1
*/
public $partition = 0.8;
/**
* @var float设置区分图像的 平坦区域和非平坦区域 的阀值 (取值:0-1
*/
public $glossinessthreshold = 0.45;
}

2
src/scene/Native.php

@ -6,7 +6,7 @@ class Native extends BaseCfg
{ {
/** /**
* @var integer //使用多少线程数(取值范围: 1 >= $threadsCount
* @var integer //使用多少线程数(取值范围: 大于或等于1的整数
*/ */
public $threadsCount = 4; public $threadsCount = 4;

2
src/scene/OpenCL.php

@ -26,7 +26,7 @@ class OpenCL extends BaseCfg
public $devicesSelect = '10'; public $devicesSelect = '10';
/** /**
* @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 0 >= $threadsCount
* @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 大于或等于0的整数
*/ */
public $nativeThreadsCount = 4; public $nativeThreadsCount = 4;

44
src/scene/Path.php

@ -1,17 +1,45 @@
<?php <?php
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Path extends BaseCfg class Path extends BaseCfg
{ {
//打开或关闭
const OPEN = true;
const CLOSE = false;
/**
* @var object 存储一个 PathDepth类 对象
*/
public $pathDepth;
/**
* @var object 存储一个 HybridBackforWard类 对象
*/
public $hybridBackforWard;
/** /**
* @var integer 光线追踪的最的深度
* @var bool 是否限制 单象素光线 最大跟踪数量
*/ */
public $pathdepthTotal = 7;
public $pathdepthDiffuse = 5;
public $pathdepthGlossy = 5;
public $pathdepthSpecular = 6;
public $hybridbackforwardEnable = 0;
public $hybridbackforwardPartition = 0;
public $hybridbackforwardGlossinessthreshold = 0.049;
public $forceblackbackgroundEnable = self::OPEN;
/**
* @var integer 单象素光线 的最大跟踪数量 (取值:大于0的整数)
*/
public $clampingVarianceMaxvalue = 1000;
/**
* 实例 PathDepth类、HybridBackforWard类的两个对象
*/
public function __construct($config = [])
{
$this->pathDepth = new PathDepth($config);
$this->hybridBackforWard= new HybridBackforWard($config);
Base::__construct($config);
}
} }

21
src/scene/PathDepth.php

@ -4,11 +4,24 @@ namespace Blobt\Luxcore\scene;
class PathDepth extends BaseCfg class PathDepth extends BaseCfg
{ {
public $total = 11;
/**
* @var integer 整体限制 漫反射、光泽反射、高光反射 的最大跟踪深度为 $total (取值:大于或等于1的整数)
*/
public $total = 6;
/**
* 限制 漫反射光线 最大跟踪深度为(取值:大于或等于1的整数)
*/
public $diffuse = 5; public $diffuse = 5;
public $glossy = 11;
/**
* 限制 光泽反射光线 最大跟踪深度为(取值:大于或等于1的整数)
*/
public $glossy = 5;
public $specular = 10;
/**
* 限制 光泽反射光线 最大跟踪深度为(取值:大于或等于1的整数)
*/
public $specular = 6;
} }
Loading…
Cancel
Save