阅读(4965) (0)

three.js DirectionalLightHelper

2022-12-26 14:05:41 更新

用于模拟场景中平行光 DirectionalLight 的辅助对象. 其中包含了表示光位置的平面和表示光方向的线段.

代码示例

const light = new THREE.DirectionalLight( 0xFFFFFF );
const helper = new THREE.DirectionalLightHelper( light, 5 );
scene.add( helper );

构造函数

DirectionalLightHelper( light : DirectionalLight, size : Number, color : Hex )

light-- 被模拟的光源.

size -- (可选的) 平面的尺寸. 默认为 1.

color -- (可选的) 如果没有设置颜色将使用光源的颜色.

属性

请到基类 Object3D 页面查看公共属性.

.lightPlane : Line

包含表示平行光方向的线网格.

.light : DirectionalLight

被模拟的光源. 请参考 directionalLight .

.matrix : Object

请参考光源的世界矩阵 matrixWorld.

.matrixAutoUpdate : Object

请查看 Object3D.matrixAutoUpdate 页面. 这里设置为 false 表示辅助对象 使用光源的 matrixWorld.

.color : hex

构造函数中传入的颜色值. 默认为 undefined. 如果改变该值, 辅助对象的颜色将在下一次 update 被调用时更新.

方法

请到基类 Object3D 页面查看公共方法.

.dispose () : undefined

销毁该平行光辅助对象.

.update () : undefined

更新辅助对象,与模拟的 directionalLight 光源的位置和方向保持一致.

源码

src/helpers/DirectionalLightHelper.js