three.js源码翻译-Light.js
说明
Light.js是three中所有光源的基类,即所有光源继承自该方法类,同时Light方法同样的继承自Object3D。在three中基础光源有四类:环境光、方向光、pointLight/spotLight、半球光(模拟室外光源)。目前拓展的光源有区域光(区域光目前只对pbr流程的材质有效果,同时需要相应的shader)。在这些光源中可以创建阴影的光源有方向光和pointLight/spotLight,其他的光源无法创建阴影。
源码位置及翻译
源码位置
src/light/Light.js
源码翻译
/**
* three 灯光的基类,该基类也是继承自object3d对象
* 该对象接受两个参数分别为灯光的强度和灯光的颜色
* @param {Color} color
* @param {Number} intensity
*/
function Light( color, intensity ) {
Object3D.call( this );
//设置类型
this.type = 'Light';
this.color = new Color( color );
this.intensity = intensity !== undefined