Browse Source

增加了“TrackerEngine”、“RenderDevices”、“Native”三个类,修改了“OpenCL”类

master
yuanjiajia 3 years ago
parent
commit
522c14df0a
  1. 2
      .gitignore
  2. 16
      examples/print.php
  3. 22
      src/scene/Native.php
  4. 56
      src/scene/OpenCL.php
  5. 46
      src/scene/RenderDevices.php
  6. 34
      src/scene/TrackerEngine.php

2
.gitignore

@ -36,3 +36,5 @@ phpunit.phar
/.vagrant
vendor.zip
/vagrant
composer.lock

16
examples/print.php

@ -4,18 +4,14 @@ namespace Blobt\Luxcore\scene;
include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
$temp = new Native();
$opencl = new OpenCL();
$opencl->useGpu();
//$temp->usePidir();
echo $opencl;
echo $temp;
$pathDepth = new PathDepth([
"total" => 12
]);
$depth = new Path([
"pathdepth" => $pathDepth
]);
echo $depth;
?>

22
src/scene/Native.php

@ -0,0 +1,22 @@
<?php
namespace Blobt\Luxcore\scene;
class Native extends BaseCfg
{
/**
* @var integer //使用多少线程数
*/
private $threadsCount = 4;
/**
* 在CPU渲染模式下,设置使用多少线程数
* @var integer $setThreadsCount 传入一个控制使用多少CPU线程数的整数
*/
public function setThreadsCount($threadsCount = 4)
{
$this->threadsCount = $threadsCount;
}
}

56
src/scene/OpenCL.php

@ -2,36 +2,64 @@
namespace Blobt\Luxcore\scene;
use ParentIterator;
class OpenCL extends BaseCfg
{
//打开或关闭
const OPEN = 1;
const CLOSE = 0;
/**
* @var integral 是否使用cpu渲染,默认是
*/
private $cpuUse = self::OPEN;
private static $cpuUse;
/**
* @var integral 是否使用gpu渲染,默认否
*/
private $gpuUse = self::CLOSE;
private static $gpuUse;
/**
* @var string 在GPU渲染模式下,使用哪些GPU设备
*/
public $devicesSelect = '10';
/**
* @var integer 在GPU渲染模式下,CPU是否渲染,并以多少线程渲染
*/
private $nativeThreadsCount = 4;
/**
* RenderDevices类 的两个静态属性初始化变量 $cpuUse”和“$gpuUse”
*/
public function __construct()
{
self::$cpuUse = RenderDevices::$cpuSwitch;
self::$gpuUse = RenderDevices::$gpuSwitch;
}
public static function refreshConfig()
{
self::$cpuUse = RenderDevices::$cpuSwitch;
self::$gpuUse = RenderDevices::$gpuSwitch;
}
/**
* 使用cpu渲染
* 在GPU渲染模式下,设置使用哪些GPU设备
* @var string $devicesSelect 传入一个控制使用哪些GPU设备的字符串
*/
public function useCpu(){
$this->cpuUse = self::OPEN;
$this->gpuUse = self::CLOSE;
public function selectDevices($devicesSelect = '10')
{
$this->devicesSelect = $devicesSelect;
}
/**
* 使用gpu渲染
* 在GPU渲染模式下,设置CPU是否渲染,并以多少线程渲染
* @var integer $nativeThreadsCount 传入一个控制CPU是否渲染,并以多少线程渲染的整数
*/
public function useGpu(){
$this->cpuUse = self::CLOSE;
$this->gpuUse = self::OPEN;
public function setNativeThreadsCount($nativeThreadsCount = 4)
{
$this->nativeThreadsCount = $nativeThreadsCount;
}
}

46
src/scene/RenderDevices.php

@ -0,0 +1,46 @@
<?php
namespace Blobt\Luxcore\scene;
class RenderDevices extends BaseCfg
{
public function __toString()
{
return "错误,不能返回当前类的属性。\n";
}
//打开或关闭
const OPEN = 1;
const CLOSE = 0;
/**
* @var integral 是否使用cpu渲染,默认是
*/
public static $cpuSwitch = self::OPEN;
/**
* @var integral 是否使用gpu渲染,默认否
*/
public static $gpuSwitch = self::CLOSE;
/**
* 使用cpu渲染
*/
public function useCpu()
{
self::$cpuSwitch = self::OPEN;
self::$gpuSwitch = self::CLOSE;
}
/**
* 使用gpu渲染
*/
public function useGpu()
{
self::$cpuSwitch = self::CLOSE;
self::$gpuSwitch = self::OPEN;
}
}

34
src/scene/TrackerEngine.php

@ -0,0 +1,34 @@
<?php
namespace Blobt\Luxcore\scene;
class TrackerEngine extends BaseCfg
{
public function __toString()
{
return "错误,不能返回当前类的属性。\n";
}
/**
* @var integral 使用何种光线跟踪引擎
*/
public static $Engine = 'PATH';
/**
* 设置使用 “PATH” 光线跟踪引擎
*/
public function usePath(){
self::$Engine = 'PATH';
}
/**
* 设置使用 “BIDIR” 光线跟踪引擎
*/
public function usePidir(){
self::$Engine = 'BIDIR';
}
}
Loading…
Cancel
Save