Browse Source

新增三个材质相关类文件

master
yuanjiajia 3 years ago
parent
commit
5a9da83ccf
  1. 367
      src/scene/materials/GlossyTranslucent.php
  2. 111
      src/scene/materials/MatteTranslucent.php
  3. 93
      src/scene/materials/Mirror.php

367
src/scene/materials/GlossyTranslucent.php

@ -0,0 +1,367 @@
<?php
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\scene\Scene;
class Glossy extends MaterialsBase
{
const TYPE_GLOSSY = 'glossy';
/**
* @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kd = "0.7 0.7 0.7";
/**
* @var string 透射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kt = "0.7 0.7 0.7";
/**
* @var string 高光反射颜色,如果设置使用了 IOR 参数,此出只能固定为"1 1 1",否则是一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名;
*/
public $ks = "0.05 0.05 0.05";
/**
* @var string 吸收颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $ka = "0 0 0";
/**
* @var float 吸收颜色深度,一个大于等于0的小数,或是一个textures(贴图数组)中的某个键名
*/
public $d = 0;
/**
* @var float U向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名
*/
public $uroughness = 0.05;
/**
* @var float V向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名
*/
public $vroughness = 0.05;
/**
* @var float 菲列尔折射率,如果设置为1-2的一个小数或一个textures(贴图数组)中的某个键名,表示使用这个数值的 IOR 参数,
* 如果设置为"0 0 0",表示不使用 IOR 参数
*/
public $index = "0 0 0";
/**
* @var bool TODO:否是使用多弹射,具体作用尚未明确,(默认取值:false)
*/
public $multibounce = false;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
/**
* @var string BF高光反射颜色,如果设置使用了 IOR 参数,此出只能固定为"1 1 1",否则是一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名;
*/
public $ks_bf = "0.05 0.05 0.05";
/**
* @var string BF吸收颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $ka_bf = "0 0 0";
/**
* @var float BF吸收颜色深度,一个大于等于0的小数,或是一个textures(贴图数组)中的某个键名
*/
public $d_bf = 0;
/**
* @var float BF U向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名
*/
public $uroughness_bf = 0.05;
/**
* @var float BF V向粗糙度,一个0-0.8的小数,或是一个textures(贴图数组)中的某个键名
*/
public $vroughness_bf = 0.05;
/**
* @var float BF 菲列尔折射率,如果设置为1-2的一个小数或一个textures(贴图数组)中的某个键名,表示使用这个数值的 IOR 参数,
* 如果设置为"0 0 0",表示不使用 IOR 参数
*/
public $index_bf = "0 0 0";
/**
* @var bool TODO:BF 否是使用多弹射,具体作用尚未明确,(默认取值:false)
*/
public $multibounce_bf = false;
public function __construct($config = [])
{
$this->type = self::TYPE_GLOSSY;
$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 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;
}
public function setSpecular($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->ks = $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 setAbsorption($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->ka = $color;
}
public function setAbsorptionDepht($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->d = $color;
}
public function setIor($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->index = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->index = $color;
}
public function openMultiBounce()
{
$this->multibounce = true;
}
public function closeMultiBounce()
{
$this->multibounce = false;
}
public function setUroughness_BF($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness_bf = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->uroughness_bf = $color;
}
public function setVroughness_BF($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness_bf = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->vroughness_bf = $color;
}
public function setSpecular_BF($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks_bf = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->ks_bf = $color;
}
public function setAbsorption_BF($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka_bf = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->ka_bf = $color;
}
public function setAbsorptionDepht_BF($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d_bf = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->d_bf = $color;
}
public function setIor_BF($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->index_bf = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->index_bf = $color;
}
public function openMultiBounce_BF()
{
$this->multibounce_bf = true;
}
public function closeMultiBounce_BF()
{
$this->multibounce_bf = false;
}
}
?>

111
src/scene/materials/MatteTranslucent.php

@ -0,0 +1,111 @@
<?php
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\scene\Scene;
class Roughmatte extends MaterialsBase
{
const TYPE_MATTETRANSLUCENT = 'mattetranslucent';
/**
* @var string 反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kr = "0.7 0.7 0.7";
/**
* @var string 透射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kt = "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_MATTETRANSLUCENT;
$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 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 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;
}
}
?>

93
src/scene/materials/Mirror.php

@ -0,0 +1,93 @@
<?php
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\scene\Scene;
class Mirror extends MaterialsBase
{
const TYPE_MIRROR = 'mirror';
/**
* @var string 反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kr = "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_MIRROR;
$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 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;
}
}
?>
Loading…
Cancel
Save