yuanjiajia
3 years ago
4 changed files with 54 additions and 82 deletions
-
4src/scene/texture/procedural/Brick.php
-
43src/scene/texture/procedural/Fbm.php
-
16src/scene/texture/procedural/ImageMap.php
-
71src/scene/texture/procedural/Wireframe.php
@ -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 Fbm extends TextureBase |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 分数布朗运动的程序纹理,可以生成类似大理石、花岗岩等石材纹理效果 |
||||
|
*/ |
||||
|
const TYPE_FBM = 'fbm'; |
||||
|
|
||||
|
/** |
||||
|
* @var integer 白色色块随机分布 在单位面积内 的数量比率,越小值,单位面积内分布的白色色块越少(也意味着每个色块的面积越大), |
||||
|
* 同时 roughness参数对结果的影响力越小,反之亦然,(取值1-29的整数) |
||||
|
*/ |
||||
|
public $octaves = "8"; |
||||
|
|
||||
|
/** |
||||
|
* @var string 粗糙度,控制每个色块边缘向黑色过的平滑度,值越小,越平滑,同时 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_FBM; |
||||
|
$this->id = Scene::createID(); |
||||
|
Base::__construct($config); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
?>
|
@ -1,71 +0,0 @@ |
|||||
<?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 Wireframe extends TextureBase |
|
||||
{ |
|
||||
|
|
||||
/** |
|
||||
* 线框的程序纹理 |
|
||||
*/ |
|
||||
const TYPE_WIREFRAME = 'wireframe'; |
|
||||
|
|
||||
/** |
|
||||
* @var string 线框颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|
||||
*/ |
|
||||
public $border = "0.7 0.7 0.7"; |
|
||||
|
|
||||
/** |
|
||||
* @var string 内部面颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名 |
|
||||
*/ |
|
||||
public $inside = "0.2 0.2 0.2"; |
|
||||
|
|
||||
/** |
|
||||
* @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 |
|
||||
*/ |
|
||||
public function __construct($config = []) |
|
||||
{ |
|
||||
$this->type = self::TYPE_WIREFRAME; |
|
||||
$this->id = Scene::createID(); |
|
||||
Base::__construct($config); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @param object $color 接收一个贴图对象或小数形式的色值,设置线框纹理的线框颜色 |
|
||||
*/ |
|
||||
public function setBricktex($color) |
|
||||
{ |
|
||||
if( is_object($color) ) |
|
||||
{ |
|
||||
if( $color->registerId != null ) $this->bricktex = $color->registerId; |
|
||||
else |
|
||||
{ |
|
||||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|
||||
} |
|
||||
} |
|
||||
else $this->bricktex = $color; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @param object $color 接收一个贴图对象或小数形式的色值,设置线框纹理的内部面颜色 |
|
||||
*/ |
|
||||
public function setBrickmodtex($color) |
|
||||
{ |
|
||||
if( is_object($color) ) |
|
||||
{ |
|
||||
if( $color->registerId != null ) $this->brickmodtex = $color->registerId; |
|
||||
else |
|
||||
{ |
|
||||
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); |
|
||||
} |
|
||||
} |
|
||||
else $this->brickmodtex = $color; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
?>
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue