yuanjiajia
3 years ago
8 changed files with 475 additions and 68 deletions
-
43src/scene/materials/Glass.php
-
172src/scene/materials/GlassArch.php
-
206src/scene/materials/GlassRough.php
-
2src/scene/materials/Glossy.php
-
4src/scene/materials/MaterialsBase.php
-
93src/scene/materials/Matte.php
-
2src/scene/materials/MatteRough.php
-
21src/scene/materials/Metal.php
@ -0,0 +1,172 @@ |
|||
<?php |
|||
|
|||
namespace Blobt\Luxcore\scene\materials; |
|||
use Blobt\Luxcore\core\Base; |
|||
use Blobt\Luxcore\scene\Scene; |
|||
|
|||
class GlassArch extends MaterialsBase |
|||
{ |
|||
|
|||
/** |
|||
* 一种没色散属性的薄的透明材质类型,使用这种类型的材质,色散参必须要被禁用。用于薄薄的玻璃窗,折射不重 |
|||
* 要的地方(在传输过程中跳过折射,传播alpha和阴影光线。如果不使用此选项,还可以将输出节点中的阴影颜色 |
|||
* 设置为白色,从而实现相同的效果,同时保持相机光线的折射,如果玻璃板的边缘可见,效果会更好。) |
|||
*/ |
|||
const TYPE_ARCHGLASS = 'archglass'; |
|||
|
|||
/** |
|||
* @var string 透射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $kt = "1 1 1"; |
|||
|
|||
/** |
|||
* @var string 反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $kr = "1 1 1"; |
|||
|
|||
/** |
|||
* @var float 内部折射率,一个1-2的小数或一个textures(贴图数组)中的某个键名, |
|||
*/ |
|||
public $interiorior = 1.5; |
|||
|
|||
/** |
|||
* @var float 薄膜厚度,一个大于等于0的小数,或是一个textures(贴图数组)中的某个键名(默认:300),如果启用此参数,则当前材质被当作一个 |
|||
* 内部空心的薄膜材质 |
|||
*/ |
|||
public $filmthickness; |
|||
|
|||
/** |
|||
* @var float 薄膜折射率,一个0-1的小数,或是一个textures(贴图数组)中的某个键名,(默认:1.5),如果启用此参数,则当前材质被当作一个 |
|||
* 内部空心的薄膜材质 |
|||
*/ |
|||
public $filmior; |
|||
|
|||
/** |
|||
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $transparencyFront = 1; |
|||
|
|||
/** |
|||
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $transparencyBack = 1; |
|||
|
|||
/** |
|||
* @var key 是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $bumptex; |
|||
|
|||
public function __construct($config = []) |
|||
{ |
|||
$this->type = self::TYPE_ARCHGLASS; |
|||
$this->id = Scene::createID(); |
|||
Base::__construct($config); |
|||
} |
|||
|
|||
public function setTransparencyFront($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->transparencyFront = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->transparencyFront = $color; |
|||
} |
|||
|
|||
public function setTransparencyBack($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->transparencyBack = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->transparencyBack = $color; |
|||
} |
|||
|
|||
public function setBumptex($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->bumptex = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->bumptex = $color; |
|||
} |
|||
|
|||
public function setFilmthickness($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->filmthickness = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->filmthickness = $color; |
|||
} |
|||
|
|||
public function setFilmior($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->filmior = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->filmior = $color; |
|||
} |
|||
|
|||
public function setTransmission($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->kt = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->kt = $color; |
|||
} |
|||
|
|||
public function setRefraction($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->kr = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->kr = $color; |
|||
} |
|||
|
|||
public function setInteriorIor($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->interiorior = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->interiorior = $color; |
|||
} |
|||
|
|||
} |
|||
|
|||
?>
|
@ -0,0 +1,206 @@ |
|||
<?php |
|||
|
|||
namespace Blobt\Luxcore\scene\materials; |
|||
use Blobt\Luxcore\core\Base; |
|||
use Blobt\Luxcore\scene\Scene; |
|||
|
|||
class GlassRough extends MaterialsBase |
|||
{ |
|||
|
|||
/** |
|||
* 粗糙度玻离材质类型 |
|||
*/ |
|||
const TYPE_ROUGHGLASS = 'roughglass'; |
|||
|
|||
/** |
|||
* @var string 透射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $kt = "1 1 1"; |
|||
|
|||
/** |
|||
* @var string 反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $kr = "1 1 1"; |
|||
|
|||
/** |
|||
* @var float 内部折射率,一个1-2的小数或一个textures(贴图数组)中的某个键名, |
|||
*/ |
|||
public $interiorior = 1.5; |
|||
|
|||
/** |
|||
* @var float U向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $uroughness = 0.05; |
|||
|
|||
/** |
|||
* @var float V向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $vroughness = 0.05; |
|||
|
|||
/** |
|||
* @var float 薄膜厚度,一个大于等于0的小数,或是一个textures(贴图数组)中的某个键名(默认:300),如果启用此参数,则当前材质被当作一个 |
|||
* 内部空心的薄膜材质 |
|||
*/ |
|||
public $filmthickness; |
|||
|
|||
/** |
|||
* @var float 薄膜折射率,一个0-1的小数,或是一个textures(贴图数组)中的某个键名,(默认:1.5),如果启用此参数,则当前材质被当作一个 |
|||
* 内部空心的薄膜材质 |
|||
*/ |
|||
public $filmior; |
|||
|
|||
/** |
|||
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $transparencyFront; |
|||
|
|||
/** |
|||
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $transparencyBack; |
|||
|
|||
/** |
|||
* @var key 是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $bumptex; |
|||
|
|||
public function __construct($config = []) |
|||
{ |
|||
$this->type = self::TYPE_ROUGHGLASS; |
|||
$this->id = Scene::createID(); |
|||
Base::__construct($config); |
|||
} |
|||
|
|||
public function setUroughness($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->uroughness = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->uroughness = $color; |
|||
} |
|||
|
|||
public function setVroughness($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->vroughness = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->vroughness = $color; |
|||
} |
|||
|
|||
public function setTransparencyFront($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->transparencyFront = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->transparencyFront = $color; |
|||
} |
|||
|
|||
public function setTransparencyBack($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->transparencyBack = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->transparencyBack = $color; |
|||
} |
|||
|
|||
public function setBumptex($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->bumptex = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->bumptex = $color; |
|||
} |
|||
|
|||
public function setFilmthickness($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->filmthickness = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->filmthickness = $color; |
|||
} |
|||
|
|||
public function setFilmior($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->filmior = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->filmior = $color; |
|||
} |
|||
|
|||
public function setTransmission($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->kt = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->kt = $color; |
|||
} |
|||
|
|||
public function setRefraction($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->kr = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->kr = $color; |
|||
} |
|||
|
|||
public function setInteriorIor($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->interiorior = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->interiorior = $color; |
|||
} |
|||
|
|||
} |
|||
|
|||
?>
|
@ -0,0 +1,93 @@ |
|||
<?php |
|||
|
|||
namespace Blobt\Luxcore\scene\materials; |
|||
use Blobt\Luxcore\core\Base; |
|||
use Blobt\Luxcore\scene\Scene; |
|||
|
|||
class Matte extends MaterialsBase |
|||
{ |
|||
|
|||
const TYPE_MATTE = 'matte'; |
|||
|
|||
/** |
|||
* @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $kd = "0.7 0.7 0.7"; |
|||
|
|||
/** |
|||
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $transparencyFront = 1; |
|||
|
|||
/** |
|||
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $transparencyBack = 1; |
|||
|
|||
/** |
|||
* @var key 是一个textures(贴图数组)中的某个键名 |
|||
*/ |
|||
public $bumptex; |
|||
|
|||
public function __construct($config = []) |
|||
{ |
|||
$this->type = self::TYPE_MATTE; |
|||
$this->id = Scene::createID(); |
|||
Base::__construct($config); |
|||
} |
|||
|
|||
public function setTransparencyFront($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->transparencyFront = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->transparencyFront = $color; |
|||
} |
|||
|
|||
public function setTransparencyBack($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->transparencyBack = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->transparencyBack = $color; |
|||
} |
|||
|
|||
public function setBumptex($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->bumptex = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->bumptex = $color; |
|||
} |
|||
|
|||
public function setBaseColor($color) |
|||
{ |
|||
if( is_object($color) ) |
|||
{ |
|||
if( $color->cards != null ) $this->kd = $color->cards; |
|||
else |
|||
{ |
|||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|||
} |
|||
} |
|||
else $this->kd = $color; |
|||
} |
|||
|
|||
} |
|||
|
|||
?>
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue