codecamp

three.js Light

光源的基类 - 所有其他的光类型都继承了该类描述的属性和方法。

构造器(Constructor)

Light( color : Integer, intensity : Float )

color - (可选参数) 16进制表示光的颜色。 缺省值 0xffffff (白色)。
intensity - (可选参数) 光照强度。 缺省值 1。

创造一个新的光源。注意,这并不是直接调用的(而是使用派生类之一)。

属性(Properties)

公共属性请查看基类Object3D。

.color : Color

光源的颜色。如果构造的时候没有传递,默认会创建一个新的 Color 并设置为白色。

.intensity : Float

光照的强度,或者说能量。 在 physically correct 模式下, color 和强度 的乘积被解析为以坎德拉(candela)为单位的发光强度。 默认值 - 1.0

.isLight : Boolean

只读标志,用于检查给定对象是否为 Light 类型。

Methods

公共方法请查看基类 Object3D。

.copy ( source : Light ) : this

从source复制 color, intensity 的值到当前光源对象中。

.toJSON ( meta : Object ) : Object

以JSON格式返回光数据。

meta -- 包含有元数据的对象,例如该对象的材质、纹理或图片。 将该light对象转换为 three.js JSON Object/Scene format(three.js JSON 物体/场景格式)。

源码

src/lights/Light.js


three.js HemisphereLightProbe
three.js LightProbe
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

参考

核心 / BufferAttributes

渲染器 / WebXR

开发者参考

WebGL渲染器

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }