Browse Source

新增了四个材质相关的类文件,其他材质类文件修改了部分默认参数

master
yuanjiajia 3 years ago
parent
commit
9118f2fba0
  1. 43
      src/scene/materials/Glass.php
  2. 172
      src/scene/materials/GlassArch.php
  3. 206
      src/scene/materials/GlassRough.php
  4. 2
      src/scene/materials/Glossy.php
  5. 4
      src/scene/materials/MaterialsBase.php
  6. 93
      src/scene/materials/Matte.php
  7. 2
      src/scene/materials/MatteRough.php
  8. 21
      src/scene/materials/Metal.php

43
src/scene/materials/Glass.php

@ -7,13 +7,6 @@ use Blobt\Luxcore\scene\Scene;
class Glass extends MaterialsBase class Glass extends MaterialsBase
{ {
/**
* 一种没色散属性的薄的透明材质类型,使用这种类型的材质,色散参必须要被禁用。用于薄薄的玻璃窗,折射不重
* 要的地方(在传输过程中跳过折射,传播alpha和阴影光线。如果不使用此选项,还可以将输出节点中的阴影颜色
* 设置为白色,从而实现相同的效果,同时保持相机光线的折射,如果玻璃板的边缘可见,效果会更好。)
*/
const TYPE_ARCHGLASS = 'archglass';
/** /**
* 普通的透明材质类型 * 普通的透明材质类型
*/ */
@ -40,16 +33,6 @@ class Glass extends MaterialsBase
*/ */
public $cauchyb; 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),如果启用此参数,则当前材质被当作一个 * @var float 薄膜厚度,一个大于等于0的小数,或是一个textures(贴图数组)中的某个键名(默认:300),如果启用此参数,则当前材质被当作一个
* 内部空心的薄膜材质 * 内部空心的薄膜材质
@ -84,32 +67,6 @@ class Glass extends MaterialsBase
Base::__construct($config); 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) public function setTransparencyFront($color)
{ {
if( is_object($color) ) if( is_object($color) )

172
src/scene/materials/GlassArch.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;
}
}
?>

206
src/scene/materials/GlassRough.php

@ -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;
}
}
?>

2
src/scene/materials/Glossy.php

@ -7,7 +7,7 @@ use Blobt\Luxcore\scene\Scene;
class Glossy extends MaterialsBase class Glossy extends MaterialsBase
{ {
const TYPE_GLOSSY = 'glossy';
const TYPE_GLOSSY = 'glossy2';
/** /**
* @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 * @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名

4
src/scene/materials/MaterialsBase.php

@ -8,12 +8,10 @@ use Blobt\Luxcore\scene\BaseCfg;
class MaterialsBase extends BaseCfg class MaterialsBase extends BaseCfg
{ {
const TYPE_MATTE = 'matte';
/** /**
* @var string 材质类型 * @var string 材质类型
*/ */
public $type = self::TYPE_MATTE;
public $type;
/** /**
* @var string 此参数控制材质与光线作用时,产生阴影的透明度,或控制阴影的颜色(取值,小数形式的色值) * @var string 此参数控制材质与光线作用时,产生阴影的透明度,或控制阴影的颜色(取值,小数形式的色值)

93
src/scene/materials/Matte.php

@ -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;
}
}
?>

src/scene/materials/Roughmatte.php → src/scene/materials/MatteRough.php

21
src/scene/materials/Metal.php

@ -7,12 +7,7 @@ use Blobt\Luxcore\scene\Scene;
class Metal extends MaterialsBase 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(预设的菲列尔参数)”、 * @var string 菲列尔参数,一个textures(贴图数组)中的某个键名,只能是“fresnelconst(预设的菲列尔参数)”、
@ -52,20 +47,6 @@ class Metal extends MaterialsBase
core\Base::__construct($config); 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) public function setFresnel($color)
{ {
if( is_object($color) ) if( is_object($color) )

Loading…
Cancel
Save