yuanjiajia
3 years ago
5 changed files with 144 additions and 4 deletions
-
2src/scene/texture/procedural/Fbm.php
-
42src/scene/texture/procedural/Fresnelcolor.php
-
55src/scene/texture/procedural/Fresnelconst.php
-
6src/scene/texture/procedural/Marble.php
-
43src/scene/texture/procedural/Wrinkled.php
@ -0,0 +1,42 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Blobt\Luxcore\scene\texture\procedural; |
||||
|
use Blobt\Luxcore\scene\texture\TextureBase; |
||||
|
use Blobt\Luxcore\scene\Scene; |
||||
|
use Blobt\Luxcore\core\Base; |
||||
|
use Blobt\Luxcore\scene\texture\mapping\Mapping; |
||||
|
|
||||
|
class Fresnelcolor extends TextureBase |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 金属材质的菲列尔反射参数,只适合金属度流程的金属材质 |
||||
|
*/ |
||||
|
const TYPE_FRESNELCOLOR = 'fresnelcolor'; |
||||
|
|
||||
|
/** |
||||
|
* @var string 反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
||||
|
*/ |
||||
|
public $kr = "0.7 0.7 0.7"; |
||||
|
|
||||
|
/** |
||||
|
* @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 |
||||
|
*/ |
||||
|
public function __construct($config = []) |
||||
|
{ |
||||
|
$this->type = self::TYPE_FRESNELCOLOR; |
||||
|
$this->id = Scene::createID(); |
||||
|
Base::__construct($config); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param object $color 接收一个贴图对象或小数形式的色值,设置反射颜色 |
||||
|
*/ |
||||
|
public function setRefraction($color) |
||||
|
{ |
||||
|
$this->kr = Scene::testAbnormal($color); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
?>
|
@ -0,0 +1,55 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Blobt\Luxcore\scene\texture\procedural; |
||||
|
use Blobt\Luxcore\scene\texture\TextureBase; |
||||
|
use Blobt\Luxcore\scene\Scene; |
||||
|
use Blobt\Luxcore\core\Base; |
||||
|
use Blobt\Luxcore\scene\texture\mapping\Mapping; |
||||
|
|
||||
|
class Fresnelconst extends TextureBase |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 金属材质的菲列尔反射参数,只适合金属度流程的金属材质 |
||||
|
*/ |
||||
|
const TYPE_FRESNELCONST = 'fresnelconst'; |
||||
|
|
||||
|
/** |
||||
|
* @var string TODO:反射属性 n,具体作用沿未明确,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
||||
|
*/ |
||||
|
public $n = "0 0 0"; |
||||
|
|
||||
|
/** |
||||
|
* @var string TODO:反射属性 k,具体作用沿未明确,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
||||
|
*/ |
||||
|
public $k = '0 0 0'; |
||||
|
|
||||
|
/** |
||||
|
* @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 |
||||
|
*/ |
||||
|
public function __construct($config = []) |
||||
|
{ |
||||
|
$this->type = self::TYPE_FRESNELCONST; |
||||
|
$this->id = Scene::createID(); |
||||
|
Base::__construct($config); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param object $color 接收一个贴图对象或小数形式的色值,设置反射属性 n |
||||
|
*/ |
||||
|
public function setRefractionN($color) |
||||
|
{ |
||||
|
$this->n = Scene::testAbnormal($color); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param object $color 接收一个贴图对象或小数形式的色值,设置反射属性 k |
||||
|
*/ |
||||
|
public function setRefractionK($color) |
||||
|
{ |
||||
|
$this->k = Scene::testAbnormal($color); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
?>
|
@ -0,0 +1,43 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Blobt\Luxcore\scene\texture\procedural; |
||||
|
use Blobt\Luxcore\scene\texture\TextureBase; |
||||
|
use Blobt\Luxcore\scene\Scene; |
||||
|
use Blobt\Luxcore\core\Base; |
||||
|
use Blobt\Luxcore\scene\texture\mapping\Mapping; |
||||
|
|
||||
|
class Wrinkled extends TextureBase |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 分数布朗运动的程序纹理,可以生成类似烟雾、及类似石材纹理效果 |
||||
|
*/ |
||||
|
const TYPE_WRINKLED = 'wrinkled'; |
||||
|
|
||||
|
/** |
||||
|
* @var integer 烟雾团随机分布 在单位面积内 的数量比率,越小值,单位面积内分布的烟雾团越少(也意味着每个烟雾团的面积越大), |
||||
|
* 同时 roughness参数对结果的影响力越小,反之亦然,(取值1-29的整数) |
||||
|
*/ |
||||
|
public $octaves = "8"; |
||||
|
|
||||
|
/** |
||||
|
* @var float 粗糙度,控制每个烟雾团边缘过渡平滑度,值越小,越平滑,同时 octaves参数对结果的影响力越小,反之亦然,(0-1的小数) |
||||
|
*/ |
||||
|
public $roughness = 0.5; |
||||
|
|
||||
|
/** |
||||
|
* @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 |
||||
|
* @param object $mapping 如需自定义铺贴参数,必须传入一个 Mapping类对象,否则使用一个默认的铺贴参数 |
||||
|
*/ |
||||
|
public function __construct($config = [],Mapping $mapping = null) |
||||
|
{ |
||||
|
if( $mapping != null )$this->mapping = $mapping; |
||||
|
else $this->mapping = new Mapping(); |
||||
|
$this->type = self::TYPE_WRINKLED; |
||||
|
$this->id = Scene::createID(); |
||||
|
Base::__construct($config); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
?>
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue