diff --git a/src/scene/materials/Glass.php b/src/scene/materials/Glass.php index 56561f0..0d1ff0d 100644 --- a/src/scene/materials/Glass.php +++ b/src/scene/materials/Glass.php @@ -6,13 +6,6 @@ use Blobt\Luxcore\scene\Scene; class Glass extends MaterialsBase { - - /** - * 一种没色散属性的薄的透明材质类型,使用这种类型的材质,色散参必须要被禁用。用于薄薄的玻璃窗,折射不重 - * 要的地方(在传输过程中跳过折射,传播alpha和阴影光线。如果不使用此选项,还可以将输出节点中的阴影颜色 - * 设置为白色,从而实现相同的效果,同时保持相机光线的折射,如果玻璃板的边缘可见,效果会更好。) - */ - const TYPE_ARCHGLASS = 'archglass'; /** * 普通的透明材质类型 @@ -40,16 +33,6 @@ class Glass extends MaterialsBase */ public $cauchyb; - /** - * @var float U向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名 - */ - public $uroughness; - - /** - * @var float V向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名 - */ - public $vroughness; - /** * @var float 薄膜厚度,一个大于等于0的小数,或是一个textures(贴图数组)中的某个键名(默认:300),如果启用此参数,则当前材质被当作一个 * 内部空心的薄膜材质 @@ -84,32 +67,6 @@ class Glass extends MaterialsBase 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) ) diff --git a/src/scene/materials/GlassArch.php b/src/scene/materials/GlassArch.php new file mode 100644 index 0000000..760fd67 --- /dev/null +++ b/src/scene/materials/GlassArch.php @@ -0,0 +1,172 @@ +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; + } + +} + +?> diff --git a/src/scene/materials/GlassRough.php b/src/scene/materials/GlassRough.php new file mode 100644 index 0000000..a241494 --- /dev/null +++ b/src/scene/materials/GlassRough.php @@ -0,0 +1,206 @@ +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; + } + +} + +?> diff --git a/src/scene/materials/Glossy.php b/src/scene/materials/Glossy.php index 8c63cc9..250dc4a 100644 --- a/src/scene/materials/Glossy.php +++ b/src/scene/materials/Glossy.php @@ -7,7 +7,7 @@ use Blobt\Luxcore\scene\Scene; class Glossy extends MaterialsBase { - const TYPE_GLOSSY = 'glossy'; + const TYPE_GLOSSY = 'glossy2'; /** * @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 diff --git a/src/scene/materials/MaterialsBase.php b/src/scene/materials/MaterialsBase.php index 3fb73e6..4696ca7 100644 --- a/src/scene/materials/MaterialsBase.php +++ b/src/scene/materials/MaterialsBase.php @@ -8,12 +8,10 @@ use Blobt\Luxcore\scene\BaseCfg; class MaterialsBase extends BaseCfg { - const TYPE_MATTE = 'matte'; - /** * @var string 材质类型 */ - public $type = self::TYPE_MATTE; + public $type; /** * @var string 此参数控制材质与光线作用时,产生阴影的透明度,或控制阴影的颜色(取值,小数形式的色值) diff --git a/src/scene/materials/Matte.php b/src/scene/materials/Matte.php new file mode 100644 index 0000000..6a83215 --- /dev/null +++ b/src/scene/materials/Matte.php @@ -0,0 +1,93 @@ +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; + } + +} + +?> diff --git a/src/scene/materials/Roughmatte.php b/src/scene/materials/MatteRough.php similarity index 98% rename from src/scene/materials/Roughmatte.php rename to src/scene/materials/MatteRough.php index 2465b9f..7830c33 100644 --- a/src/scene/materials/Roughmatte.php +++ b/src/scene/materials/MatteRough.php @@ -4,7 +4,7 @@ namespace Blobt\Luxcore\scene\materials; use Blobt\Luxcore\core\Base; use Blobt\Luxcore\scene\Scene; -class Roughmatte extends MaterialsBase +class MatteRough extends MaterialsBase { const TYPE_ROUGHMATTE = 'roughmatte'; diff --git a/src/scene/materials/Metal.php b/src/scene/materials/Metal.php index 50ff45d..073262e 100644 --- a/src/scene/materials/Metal.php +++ b/src/scene/materials/Metal.php @@ -7,12 +7,7 @@ use Blobt\Luxcore\scene\Scene; class Metal extends MaterialsBase { - const TYPE_METAL = 'matal'; - - /** - * @var string 反射颜色,一个小数色值,或是一个textures(贴图数组)中的某个键名 - */ - public $kr = '0.7 0.7 0.7'; + const TYPE_METAL = 'matal2'; /** * @var string 菲列尔参数,一个textures(贴图数组)中的某个键名,只能是“fresnelconst(预设的菲列尔参数)”、 @@ -52,20 +47,6 @@ class Metal extends MaterialsBase core\Base::__construct($config); } - 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 setFresnel($color) { if( is_object($color) )