yuanjiajia
3 years ago
26 changed files with 405 additions and 188 deletions
-
2.vscode/launch.json
-
61examples/PrintRender.php
-
79examples/PrintScene.php
-
12src/scene/Scene.php
-
24src/scene/materials/CarPaint.php
-
118src/scene/materials/Cloth.php
-
34src/scene/materials/Disney.php
-
12src/scene/materials/Glass.php
-
10src/scene/materials/GlassArch.php
-
14src/scene/materials/GlassRough.php
-
14src/scene/materials/Glossy.php
-
14src/scene/materials/GlossyCoating.php
-
28src/scene/materials/GlossyTranslucent.php
-
14src/scene/materials/MaterialsBase.php
-
2src/scene/materials/Matte.php
-
4src/scene/materials/MatteRough.php
-
4src/scene/materials/MatteTranslucent.php
-
6src/scene/materials/Metal.php
-
2src/scene/materials/Mirror.php
-
6src/scene/materials/Mix.php
-
111src/scene/materials/Velvet.php
-
4src/scene/objects/Objects.php
-
2src/scene/texture/TextureBase.php
-
4src/scene/volumes/HeteroGeneous.php
-
4src/scene/volumes/HomoGeneous.php
-
8src/scene/volumes/VolumesBase.php
@ -0,0 +1,61 @@ |
|||
<?php |
|||
|
|||
|
|||
|
|||
namespace Blobt\Luxcore\scene; |
|||
|
|||
|
|||
include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; |
|||
|
|||
//设置打印 渲染引擎 的配置参数
|
|||
$renderEngine = new render\RenderEngine(); |
|||
echo $renderEngine; |
|||
|
|||
//设置打印GPU渲染设备的配置参数
|
|||
$openCL = new render\OpenCL(); |
|||
echo $openCL; |
|||
|
|||
//设置打印光线跟踪的配置参数
|
|||
$path = new render\Path(); |
|||
echo $path; |
|||
|
|||
//设置打印 采样器 配置参数
|
|||
$sampler = new render\Sampler(); |
|||
echo $sampler; |
|||
|
|||
//设置打印 灯光策略 配置参数
|
|||
$lightStrategy = new render\LightStrategy(); |
|||
echo $lightStrategy; |
|||
|
|||
//设置打印 文件储存格式 配置参数
|
|||
$filesaver = new render\FileSaver(); |
|||
echo $filesaver; |
|||
|
|||
//设置打印 渲染终止 配置参数
|
|||
$batch = new render\Batch(); |
|||
echo $batch; |
|||
|
|||
//设置打印 场景属性 配置参数
|
|||
$scene = new render\Scene(); |
|||
echo $scene; |
|||
|
|||
|
|||
|
|||
//设置打印 “胶片” 配置参数
|
|||
$film = new render\Film();//添加一个胶片,
|
|||
|
|||
$img = new render\Image(); |
|||
$img->effect = [new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()]; |
|||
$film->addImage($img); |
|||
|
|||
$film->addImage(new render\Image(['type' => 'ALBEDO'])); |
|||
$film->addImage(new render\Image(['type' => 'AVG_SHADING_NORMAL'])); |
|||
|
|||
$img = new render\Image(); |
|||
$img->effect = [new render\effect\NoiseReducerOIDN(),new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()]; |
|||
$film->addImage($img); |
|||
|
|||
|
|||
echo $film; |
|||
|
|||
?>
|
@ -0,0 +1,118 @@ |
|||
<?php |
|||
|
|||
namespace Blobt\Luxcore\scene\materials; |
|||
use Blobt\Luxcore\core\Base; |
|||
use Blobt\Luxcore\scene\Scene; |
|||
|
|||
class Cloth extends MaterialsBase |
|||
{ |
|||
|
|||
const TYPE_CLOTH = 'cloth'; |
|||
|
|||
/** |
|||
* 预设的布料, |
|||
*/ |
|||
const TTPE_DENIM = 'denim'; |
|||
const TTPE_SILK_CHARMEUSE = 'silk_charmeuse'; |
|||
const TTPE_COTTON_TWILL = 'cotton_twill'; |
|||
const TTPE_WOOL_GABARDINE = 'wool_gabardine'; |
|||
const TTPE_POLYESTER_LINING_CLOTH = 'polyester_lining_cloth'; |
|||
const TTPE_SILK_SHANTUNG = 'silk_shantung'; |
|||
|
|||
/** |
|||
* @var string 经向漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $warp_kd = "0.7 0.05 0.05"; |
|||
|
|||
/** |
|||
* @var string 经向高光反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $warp_ks = "0.04 0.04 0.04"; |
|||
|
|||
/** |
|||
* @var string 纬向漫颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $weft_kd = "0.64 0.64 0.64"; |
|||
|
|||
/** |
|||
* @var string 纬向高光颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $weft_ks = "0.04 0.04 0.04"; |
|||
|
|||
/** |
|||
* @var float U单位向重复次数,(取值:大于等于0的小数) |
|||
*/ |
|||
public $repeat_u = 100; |
|||
|
|||
/** |
|||
* @var float V单位向重复次数,(取值:大于等于0的小数) |
|||
*/ |
|||
public $repeat_v = 100; |
|||
|
|||
/** |
|||
* @var string 预设的布料,(取值:预设布料的某一字符串常量) |
|||
*/ |
|||
public $preset = self::TTPE_DENIM; |
|||
|
|||
public function __construct($config = []) |
|||
{ |
|||
$this->type = self::TYPE_CLOTH; |
|||
$this->id = Scene::createID(); |
|||
Base::__construct($config); |
|||
} |
|||
|
|||
public function setWarpBaseColor($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->warp_kd = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->warp_kd = $color; |
|||
} |
|||
|
|||
public function setWeftBaseColor($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->weft_kd = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->weft_kd = $color; |
|||
} |
|||
|
|||
public function setWarpSpecular($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->warp_ks = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->warp_ks = $color; |
|||
} |
|||
|
|||
public function setWeftSpecular($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->weft_ks = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->weft_ks = $color; |
|||
} |
|||
|
|||
} |
|||
|
|||
?>
|
@ -0,0 +1,111 @@ |
|||
<?php |
|||
|
|||
namespace Blobt\Luxcore\scene\materials; |
|||
use Blobt\Luxcore\core\Base; |
|||
use Blobt\Luxcore\scene\Scene; |
|||
|
|||
class Velvet extends MaterialsBase |
|||
{ |
|||
|
|||
const TYPE_VELVET = 'velvet'; |
|||
|
|||
/** |
|||
* @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $kd = "0.7 0.05 0.05"; |
|||
|
|||
/** |
|||
* @var float TODO:具体作用尚未明确,(取值:任意自然数) |
|||
*/ |
|||
public $p1 = "-2"; |
|||
|
|||
/** |
|||
* @var float TODO:具体作用尚未明确,(取值:任意自然数) |
|||
*/ |
|||
public $p2 = "20"; |
|||
|
|||
/** |
|||
* @var float TODO:具体作用尚未明确,(取值:任意自然数) |
|||
*/ |
|||
public $p3 = "2"; |
|||
|
|||
/** |
|||
* @var float 丝绒厚度,(取值:0-1的小数) |
|||
*/ |
|||
public $thickness = "0.1"; |
|||
|
|||
public function __construct($config = []) |
|||
{ |
|||
$this->type = self::TYPE_VELVET; |
|||
$this->id = Scene::createID(); |
|||
Base::__construct($config); |
|||
} |
|||
|
|||
public function setBaseColor($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->kd = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->kd = $color; |
|||
} |
|||
|
|||
public function setP1($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->p1 = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->p1 = $color; |
|||
} |
|||
|
|||
public function setP2($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->p2 = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->p2 = $color; |
|||
} |
|||
|
|||
public function setP3($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->p3 = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->p3 = $color; |
|||
} |
|||
|
|||
public function setThickness($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->registerId != null ) $this->thickness = $color->registerId; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->thickness = $color; |
|||
} |
|||
|
|||
} |
|||
|
|||
?>
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue