標籤:webgl javascript three.js web3d 源碼
商域無疆 (http://blog.csdn.net/omni360/)
本文遵循“署名-非商業用途-保持一致”創作公用協議
轉載請保留此句:商域無疆 - 本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。
俺也是剛開始學,好多地兒肯定不對還請見諒.
以下代碼是THREE.JS 源碼檔案中Light/PointLight.js檔案的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
/** * @author mrdoob / http://mrdoob.com/ */ /*///PointLight方法根據設定燈光的顏屬性color, 強度屬性intensity,距離屬性 distance 建立點光源.PointLight對象的功能函數採用/// 定義構造的函數原型對象來實現./// TODO: PointLight類型燈光在這個版本內還沒有實現陰影.???/// Example:/// var light = new THREE.PointLight(0xff0000,1,100);//建立燈光對象/// light.position.set(50,50,30);//設定位置///scene.add(lignt);//加入情境*////<summary>PointLight</summary>///<param name ="color" type="THREE.Color">燈光的顏色屬性</param>///<param name ="intensity" type="Number">燈光的強度,預設是1</param>///<param name ="distance" type="Number">燈光的長度屬性,從燈光的position位置,開始衰減,衰減到distance的長度,預設是0</param>///<returns type="PointLight">返回PointLight,點光源.</returns>THREE.PointLight = function ( color, intensity, distance ) {THREE.Light.call( this, color );//調用Light對象的call方法,將原本屬於Light的方法交給當前對象PointLight來使用.this.intensity = ( intensity !== undefined ) ? intensity : 1;//燈光的顏色屬性,如果不指定,初始化為1.this.distance = ( distance !== undefined ) ? distance : 0;//燈光的強度,如果不指定,初始化為0.};/******************************************************************************************下面是PointLight對象提供的功能函數定義,一部分通過prototype繼承自Light方法***************************************************************************************/THREE.PointLight.prototype = Object.create( THREE.Light.prototype );//PointLight對象從THREE.Light的原型繼承所有屬性方法/*clone方法///clone方法複製PointLight對象*////<summary>clone</summary>///<returns type="PointLight">返回複製的PointLight對象</returns>THREE.PointLight.prototype.clone = function () {var light = new THREE.PointLight();THREE.Light.prototype.clone.call( this, light );//調用THREE.Light.clone方法,複製扥光對象light.intensity = this.intensity;//複製燈光的強度屬性light.distance = this.distance;//複製燈光的距離屬性.return light;//返回複製的點光源的對象.};
商域無疆 (http://blog.csdn.net/omni360/)
本文遵循“署名-非商業用途-保持一致”創作公用協議
轉載請保留此句:商域無疆 - 本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。
以下代碼是THREE.JS 源碼檔案中Light/PointLight.js檔案的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
three.js 源碼注釋(四十)Light/PointLight.js