Browse Source

删除多余的类文件、修改类文件“RenderEngine.php”、“OpenCL.php”、“Native.php”和示例文件

master
yuanjiajia 3 years ago
parent
commit
2c84a53772
  1. 14
      examples/print.php
  2. 6
      src/scene/Native.php
  3. 42
      src/scene/OpenCL.php
  4. 46
      src/scene/RenderDevices.php
  5. 40
      src/scene/RenderEngine.php
  6. 34
      src/scene/TrackerEngine.php

14
examples/print.php

@ -4,16 +4,16 @@ namespace Blobt\Luxcore\scene;
include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
$renderDevices = new RenderDevices();
$trackerEngine = new TrackerEngine();
$renderEngine = new RenderEngine;
echo $renderEngine;
$renderEngineType = new RenderEngine();
echo $renderEngineType;
$openCL = new OpenCL;
$openCL = new OpenCL();
echo $openCL;
$native = new Native;
echo $native;
$cpuThreadsCount = new Native(['threadsCount' => 64]);
echo $cpuThreadsCount;
?>

6
src/scene/Native.php

@ -8,15 +8,15 @@ class Native extends BaseCfg
/**
* @var integer //使用多少线程数
*/
private $threadsCount = 4;
protected $threadsCount = 4;
/**
* 在CPU渲染模式下,设置使用多少线程数
* @var integer $setThreadsCount 传入一个控制使用多少CPU线程数的整数
*/
public function setThreadsCount($threadsCount = 4)
public function setThreadsCount($count)
{
$this->threadsCount = $threadsCount;
$this->threadsCount = $count;
}
}

42
src/scene/OpenCL.php

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

46
src/scene/RenderDevices.php

@ -1,46 +0,0 @@
<?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;
}
}

40
src/scene/RenderEngine.php

@ -5,48 +5,18 @@ namespace Blobt\Luxcore\scene;
class RenderEngine extends BaseCfg
{
//打开或关闭
const OPEN = 1;
const CLOSE = 0;
/**
* @var string 使用何种渲染引擎
*/
private static $type = 'PATHOCL';
public function __construct()
{
self::refreshConfig();
}
private $type = 'PATHOCL';
/**
* 更新字符串变量“$type”
* 设置渲染引擎类型
* @var string $engineStr 传入一个表示渲染引擎类型的字符串
*/
public static function refreshConfig()
{
if( TrackerEngine::$Engine == 'PATH')
{
self::$type = TrackerEngine::$Engine;
if( RenderDevices::$cpuSwitch == self::OPEN )
{
self::$type = self::$type.'CPU';
}
else if ( RenderDevices::$gpuSwitch == self::OPEN )
{
self::$type = self::$type.'CPU';
}
else;
}
else if( TrackerEngine::$Engine == 'BIDIR')
public function setRenderEngineType($engineStr)
{
self::$type = TrackerEngine::$Engine;
if( RenderDevices::$cpuSwitch == self::OPEN )
{
self::$type = self::$type.'CPU';
}
}
$this->type = $engineStr;
}
}

34
src/scene/TrackerEngine.php

@ -1,34 +0,0 @@
<?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