Browse Source

新增三个程序纹理类文件中,Scene类文件修正testAbnormal函数返回值错误的问题,Fbm.php文件修了部分注释

master
yuanjiajia 3 years ago
parent
commit
8546916515
  1. 2
      src/scene/Scene.php
  2. 63
      src/scene/texture/procedural/Checkerboard2d.php
  3. 63
      src/scene/texture/procedural/Checkerboard3d.php
  4. 2
      src/scene/texture/procedural/Fbm.php
  5. 53
      src/scene/texture/procedural/Marble.php

2
src/scene/Scene.php

@ -57,7 +57,7 @@ class Scene extends BaseCfg
{
if( $value->registerId != null )
{
return $value;
return $value->registerId;
}
else
{

63
src/scene/texture/procedural/Checkerboard2d.php

@ -0,0 +1,63 @@
<?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 Checkerboard2d extends TextureBase
{
/**
* 2D棋盘格的程序纹理,
*/
const TYPE_CHECKERBOARD2D = 'checkerboard2d';
/**
* @var string 棋盘格子颜色1,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $texture1 = "0.1 0.1 0.1";
/**
* @var string 棋盘格子颜色2,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $texture2 = "0.6 0.6 0.6";
/**
* @var object 铺贴参数,一个Mapping类对象
*/
public $mapping;
/**
* @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_CHECKERBOARD2D;
$this->id = Scene::createID();
Base::__construct($config);
}
/**
* @param object $color 接收一个贴图对象或小数形式的色值,设置棋盘格子颜色1
*/
public function setTexture1($color)
{
$this->texture1 = Scene::testAbnormal($color);
}
/**
* @param object $color 接收一个贴图对象或小数形式的色值,设置棋盘格子颜色2
*/
public function setTexture2($color)
{
$this->texture2 = Scene::testAbnormal($color);
}
}
?>

63
src/scene/texture/procedural/Checkerboard3d.php

@ -0,0 +1,63 @@
<?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 Checkerboard3d extends TextureBase
{
/**
* 3D棋盘格的程序纹理,
*/
const TYPE_CHECKERBOARD3D = 'checkerboard3d';
/**
* @var string 棋盘格子颜色1,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $texture1 = "0.1 0.1 0.1";
/**
* @var string 棋盘格子颜色2,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $texture2 = "0.6 0.6 0.6";
/**
* @var object 铺贴参数,一个Mapping类对象
*/
public $mapping;
/**
* @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_CHECKERBOARD3D;
$this->id = Scene::createID();
Base::__construct($config);
}
/**
* @param object $color 接收一个贴图对象或小数形式的色值,设置棋盘格子颜色1
*/
public function setTexture1($color)
{
$this->texture1 = Scene::testAbnormal($color);
}
/**
* @param object $color 接收一个贴图对象或小数形式的色值,设置棋盘格子颜色2
*/
public function setTexture2($color)
{
$this->texture2 = Scene::testAbnormal($color);
}
}
?>

2
src/scene/texture/procedural/Fbm.php

@ -21,7 +21,7 @@ class Fbm extends TextureBase
public $octaves = "8";
/**
* @var string 粗糙度,控制每个色块边缘向黑色过的平滑度,值越小,越平滑,同时 octaves参数对结果的影响力越小,反之亦然,(0-1的小数)
* @var string 粗糙度,控制每个色块边缘向黑色过的平滑度,值越小,越平滑,同时 octaves参数对结果的影响力越小,反之亦然,(0-1的小数)
*/
public $roughness = 0.5;

53
src/scene/texture/procedural/Marble.php

@ -0,0 +1,53 @@
<?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 Marble extends TextureBase
{
/**
* 大理石模拟的程序纹理,以分数布朗运动生成类似大理石纹理
*/
const TYPE_MARBLE = 'marble';
/**
* @var integer 花纹随机分布 在单位面积内 的数量比率,越小值,单位面积内分布的花纹块越少(也意味着每个花纹块的面积越大),
* 同时 roughness参数对结果的影响力越小,反之亦然,(取值1-29的整数)
*/
public $octaves = "8";
/**
* @var float 粗糙度,控制每个花纹块边缘向邻近花纹块过渡的平滑度,值越小,越平滑,同时 octaves参数对结果的影响力越小,反之亦然,(0-1的小数)
*/
public $roughness = 0.5;
/**
* @var string 缩放每个单位面积大小的参数,取值为 大于等于0 的小数
*/
public $scale = 1;
/**
* @var float 扭曲程度,控制花纹块扭曲程度,(0-1的小数)
*/
public $variation = 0.2;
/**
* @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_MARBLE;
$this->id = Scene::createID();
Base::__construct($config);
}
}
?>
Loading…
Cancel
Save