Blender渲染
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

163 lines
4.9 KiB

<?php
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\scene\Scene;
class Glossy extends MaterialsBase
{
const TYPE_GLOSSY = 'glossy2';
/**
* @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kd = "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 = self::CLOSE;
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->registerId != null ) $this->uroughness = $color->registerId;
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->registerId != null ) $this->vroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->vroughness = $color;
}
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 setSpecular($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->ks = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->ks = $color;
}
public function setAbsorption($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->ka = $color->registerId;
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->registerId != null ) $this->d = $color->registerId;
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->registerId != null ) $this->index = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->index = $color;
}
public function openMultiBounce()
{
$this->multibounce = self::OPEN;
}
public function closeMultiBounce()
{
$this->multibounce = self::CLOSE;
}
}
?>