From 8d3c4ea4fb313f37d5eade9122fdf3333e868450 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Sat, 19 Mar 2022 10:35:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=A4=E4=B8=AA=E5=A4=A9?= =?UTF-8?q?=E5=85=89=E7=B1=BB=E6=96=87=E4=BB=B6=EF=BC=8CLightBase=E3=80=81?= =?UTF-8?q?Sky=E7=B1=BB=E6=96=87=E4=BB=B6=E6=9C=89=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scene/lights/CorlorConst.php | 86 +++++++++++++++++++++++++ src/scene/lights/HdrImage.php | 104 +++++++++++++++++++++++++++++++ src/scene/lights/LightBase.php | 5 ++ src/scene/lights/Sky.php | 14 +++-- 4 files changed, 203 insertions(+), 6 deletions(-) create mode 100644 src/scene/lights/CorlorConst.php create mode 100644 src/scene/lights/HdrImage.php diff --git a/src/scene/lights/CorlorConst.php b/src/scene/lights/CorlorConst.php new file mode 100644 index 0000000..874ae8a --- /dev/null +++ b/src/scene/lights/CorlorConst.php @@ -0,0 +1,86 @@ +visibility = $visibility; + else $this->visibility = new Visibility(); + $this->type = self::TYPE_CONSTANTINFINITE; + $this->id = Scene::createID(); + Base::__construct($config); + } + + /** + * 打开天光缓存 + */ + public function openCache() + { + $this->visibilitymapcacheEnable = self::OPEN; + $this->envLightCache = new VisibilityMapCache; + } + + /** + * 关闭天光缓存 + */ + public function closeCache() + { + $this->visibilitymapcacheEnable = self::CLOSE; + $this->envLightCache = null; + } +} + +?> diff --git a/src/scene/lights/HdrImage.php b/src/scene/lights/HdrImage.php new file mode 100644 index 0000000..183383b --- /dev/null +++ b/src/scene/lights/HdrImage.php @@ -0,0 +1,104 @@ +visibility = $visibility; + else $this->visibility = new Visibility(); + $this->type = self::TYPE_INFINITE; + $this->id = Scene::createID(); + Base::__construct($config); + } + + /** + * 打开天光缓存 + */ + public function openCache() + { + $this->visibilitymapcacheEnable = self::OPEN; + $this->envLightCache = new VisibilityMapCache; + } + + /** + * 关闭天光缓存 + */ + public function closeCache() + { + $this->visibilitymapcacheEnable = self::CLOSE; + $this->envLightCache = null; + } +} + +?> diff --git a/src/scene/lights/LightBase.php b/src/scene/lights/LightBase.php index 2af1dbc..849756b 100644 --- a/src/scene/lights/LightBase.php +++ b/src/scene/lights/LightBase.php @@ -21,6 +21,11 @@ class LightBase extends BaseCfg */ public $registerId; + /** + * @var object 一个 Visibility类 的实例 + */ + public $visibility; + } ?> diff --git a/src/scene/lights/Sky.php b/src/scene/lights/Sky.php index e99e312..52ae96b 100644 --- a/src/scene/lights/Sky.php +++ b/src/scene/lights/Sky.php @@ -13,7 +13,7 @@ class Sky extends LightBase */ const TYPE_SKY2 = 'sky2'; - //以下参数值可以接收一个太阳光实例对象相同参数替换 + //以下参数值可以接收一个太阳光实例对象相同参数进行同步 /** * @var string 增益,分两种情况:1、当色彩模式开启,色温模式半闭时,这里的参数是一组小数形式RGB三通道的HDR色值,这个色值是由 UI界面中 @@ -24,13 +24,13 @@ class Sky extends LightBase public $gain = "2e-05 2e-05 2e-05"; /** - * @var float 色温模式,开关状态与色彩互斥,1、当取值为0-13000的小数时,色温模式开启,色彩模式关闭。 + * @var float 色温模式,开关状态与色彩互斥,1、当取值为0-13000的小数时(会被转化为一个普通色值),色温模式开启,色彩模式关闭。 * 2、当取值为-1时,色温模式关闭,色彩模式启。 */ public $temperature = -1; /** - * @var bool 是否将色温模式下的色温值规格化为小数形式的RGB色值(固定取值:flase) + * @var bool 是否将色温模式下的色温值规格化为小数形式的RGB色值,色温模式开启,色彩模式关闭 */ public $temperatureNormalize = self::CLOSE; @@ -45,7 +45,7 @@ class Sky extends LightBase */ public $groundalbedo = "0.5 0.5 0.5"; - //以上参数值可以接收一个太阳光实例对象相同参数替换 + //以上参数值可以接收一个太阳光实例对象相同参数进行同步 @@ -98,8 +98,10 @@ class Sky extends LightBase /** * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 */ - public function __construct($config = []) - { + public function __construct($config = [],Visibility $visibility = null) + { + if( $visibility != null )$this->visibility = $visibility; + else $this->visibility = new Visibility(); $this->type = self::TYPE_SKY2; $this->id = Scene::createID(); Base::__construct($config);