標籤:webgl javascript three.js 源碼 web3d
商域無疆 (http://blog.csdn.net/omni360/)
本文遵循“署名-非商業用途-保持一致”創作公用協議
轉載請保留此句:商域無疆 - 本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。
俺也是剛開始學,好多地兒肯定不對還請見諒.
以下代碼是THREE.JS 源碼檔案中Material/LineDashedMaterial.js檔案的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
/** * @author alteredq / http://alteredqualia.com/ * * parameters = { * color: <hex>, * opacity: <float>, * * blending: THREE.NormalBlending, * depthTest: <bool>, * depthWrite: <bool>, * * linewidth: <float>, * * scale: <float>, * dashSize: <float>, * gapSize: <float>, * * vertexColors: <bool> * * fog: <bool> * } *//*///LineDashedMaterial方法根據參數parameters建立線段的虛線線型材質,parameters參數的格式看上面.LineDashedMaterial對象的功能函數採用/// 定義構造的函數原型對象來實現.大部分屬性方法繼承自材質的基類Material.用材質來定義線性,第一次見,真的很有想象力.簡直就是對繪圖軟體的終結.*////<summary>LineDashedMaterial</summary>///<param name ="parameters" type="String">string類型的JSON格式材質屬性參數</param>///<returns type="LineDashedMaterial">返回LineDashedMaterial,虛線線段材質.</returns>THREE.LineDashedMaterial = function ( parameters ) {THREE.Material.call( this );//調用Material對象的call方法,將原本屬於Material的方法交給當前對象LineDashedMaterial來使用.this.color = new THREE.Color( 0xffffff );//材質的顏色屬性.this.linewidth = 1;//虛線的線寬屬性this.scale = 1;//虛線的線型比例屬性,用過AutoCAD,Microstation類繪圖軟體的應該比較熟悉.this.dashSize = 3;//虛線(點化線),線段的長度.this.gapSize = 1;//虛線(點化線)的線段間距長度.this.vertexColors = false;//頂點顏色,預設初始化為false.當然還可以有THREE.NoColors / THREE.VertexColors / THREE.FaceColors等選項,這裡顯示出了javascript的靈活性了.this.fog = true;//霧效,預設初始化為true.//TODO: LineDashedMaterial為啥有霧效屬性,而且為啥預設初始化為true?????????this.setValues( parameters );//調用Material類的setValues方法,將參數parameters賦值給當前LienDashedMaterial材質的屬性.};/*****************************************************************下面是LineDashedMaterial對象的方法屬性定義,繼承自Material*************************************************************/THREE.LineDashedMaterial.prototype = Object.create( THREE.Material.prototype );/*clone方法///clone方法複製LineDashedMaterial對象,*////<summary>clone</summary>///<param name ="material" type="LineDashedMaterial">LineDashedMaterial對象,可有可無.</param>///<returns type="LineDashedMaterial">返回複製的LineDashedMaterial對象</returns>THREE.LineDashedMaterial.prototype.clone = function () {//以下是將材質的屬性一一進行複製.var material = new THREE.LineDashedMaterial();THREE.Material.prototype.clone.call( this, material );material.color.copy( this.color );material.linewidth = this.linewidth;material.scale = this.scale;material.dashSize = this.dashSize;material.gapSize = this.gapSize;material.vertexColors = this.vertexColors;material.fog = this.fog;return material;//返回複製的LineDashedMaterial對象};
商域無疆 (http://blog.csdn.net/omni360/)
本文遵循“署名-非商業用途-保持一致”創作公用協議
轉載請保留此句:商域無疆 - 本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。
以下代碼是THREE.JS 源碼檔案中Material/LineDashedMaterial.js檔案的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
three.js 源碼注釋(四十七)Material /LineDashedMaterial.js