標籤:資料視覺效果 webgl 圖形 three.js 三維
商域無疆 (http://blog.csdn.net/omni360/)
本文遵循“署名-非商業用途-保持一致”創作公用協議
轉載請保留此句:商域無疆 - 本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。
俺也是剛開始學,好多地兒肯定不對還請見諒.
以下代碼是THREE.JS 源碼檔案中materials/PointCloudMaterial.js檔案的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
/** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ * * parameters = { * color: <hex>, * opacity: <float>, * map: new THREE.Texture( <Image> ), * * size: <float>, * * blending: THREE.NormalBlending, * depthTest: <bool>, * depthWrite: <bool>, * * vertexColors: <bool>, * * fog: <bool> * } *//*///PointCloudMaterial方法根據參數parameters建立用於點雲(粒子系統)的材質類型,///parameters參數的格式看上面.PointCloudMaterial對象的功能函數採用,定義構造的函數原型對象來實現.大部分屬性方法繼承自材質的基類Material.*////<summary>PointCloudMaterial</summary>///<param name ="parameters" type="String">string類型的JSON格式材質屬性參數</param>///<returns type="PointCloudMaterial">返回PointCloudMaterial,點雲材質.</returns>THREE.PointCloudMaterial = function ( parameters ) {THREE.Material.call( this );//調用Material對象的call方法,將原本屬於Material的方法交給當前對象SpriteMaterial來使用this.color = new THREE.Color( 0xffffff ); // 顏色,預設初始化為0xffffff,白色this.map = null;//普通貼圖貼圖,預設為nullthis.size = 1;//點雲(粒子)點的大小,預設初始化為1.this.sizeAttenuation = true;//粒子衰減,預設初始化為true.this.vertexColors = THREE.NoColors;//頂點顏色,預設初始化為THREE.NoColors.當然還可以有 THREE.VertexColors / THREE.FaceColors等選項,這裡顯示出了javascript的靈活性了.this.fog = true;//霧效,預設初始化為true.//TODO: PointCloudMaterial為啥有霧效屬性,而且為啥預設初始化為true?????????this.setValues( parameters );//調用Material類的setValues方法,將參數parameters賦值給當前PointCloudMaterial材質的屬性.};/*****************************************************************下面是PointCloudMaterial對象的方法屬性定義,繼承自Material*************************************************************/THREE.PointCloudMaterial.prototype = Object.create( THREE.Material.prototype );/*clone方法///clone方法複製PointCloudMaterial對象,*////<summary>clone</summary>///<param name ="material" type="PointCloudMaterial">PointCloudMaterial對象,可有可無.</param>///<returns type="PointCloudMaterial">返回複製的PointCloudMaterial對象</returns>THREE.PointCloudMaterial.prototype.clone = function () {//以下是將材質的屬性一一進行複製var material = new THREE.PointCloudMaterial();THREE.Material.prototype.clone.call( this, material );material.color.copy( this.color );material.map = this.map;material.size = this.size;material.sizeAttenuation = this.sizeAttenuation;material.vertexColors = this.vertexColors;material.fog = this.fog;return material;//返回複製的PointCloudMaterial對象};// backwards compatibility 向後相容/*///ParticleBasicMaterial方法被THREE.PointCloudMaterial方法替換.*/THREE.ParticleBasicMaterial = function ( parameters ) {console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.' );return new THREE.PointCloudMaterial( parameters );};/*///ParticleSystemMaterial方法被THREE.PointCloudMaterial方法替換.*/THREE.ParticleSystemMaterial = function ( parameters ) {console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.' );return new THREE.PointCloudMaterial( parameters );};
商域無疆 (http://blog.csdn.net/omni360/)
本文遵循“署名-非商業用途-保持一致”創作公用協議
轉載請保留此句:商域無疆 - 本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。
以下代碼是THREE.JS 源碼檔案中materials/PointCloudMaterial.js檔案的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
three.js 源碼注釋(五十六)Material /PointCloudMaterial.js