three.js 源碼註釋(八十)extras/geometries/OctahedronGeometry.js

商域無疆 (http://blog.csdn.net/omni360/)

本文遵循“署名-非商業用途-保持一致”創作公用協議

轉載請保留此句:商域無疆 -  本博客專注於 敏捷開發及移動和物聯設備研究:數據可視化、GOLANG、Html5、WEBGL、THREE.JS否則,出自本博客的文章拒絕轉載或再轉載,謝謝合作。


俺也是剛開始學,好多地兒肯定不對還請見諒.

以下代碼是THREE.JS 源碼文件中extras/geometries/OctahedronGeometry.js文件的註釋.

更多更新在 : https://github.com/omni360/three.js.sourcecode


/**
 * @author timothypratley / https://github.com/timothypratley
 */
/*
///OctahedronGeometry用來在三維空間內創建一個八面體對象.
///
///	用法: var geometry = new THREE.OctahedronGeometry(70);	
/// 	  var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
/// 	  var icos = new THREE.Mesh(geometry,material);
/// 	  scene.add(icos);
*/
///<summary>OctahedronGeometry</summary>
///<param name ="radius" type="float">八面體半徑</param>
///<param name ="detail" type="int">細節因子,默認爲0,當超過0將會有更多的頂點,當前的幾何體就不會是八面體,當參數detail大於1,將會變成一個球體.</param>
THREE.OctahedronGeometry = function ( radius, detail ) {

	this.parameters = {
		radius: radius,	//八面體半徑
		detail: detail	//細節因子,默認爲0,當超過0將會有更多的頂點,當前的幾何體就不會是八面體,當參數detail大於1,將會變成一個球體.
	};

	var vertices = [
		1, 0, 0,   - 1, 0, 0,    0, 1, 0,    0,- 1, 0,    0, 0, 1,    0, 0,- 1
	]; //頂點數組

	var indices = [
		0, 2, 4,    0, 4, 3,    0, 3, 5,    0, 5, 2,    1, 2, 5,    1, 5, 3,    1, 3, 4,    1, 4, 2
	];	//頂點索引

	THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );
};
/*************************************************
****下面是IcosahedronGeometry對象的方法屬性定義,繼承自Geometry對象.
**************************************************/
THREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );


商域無疆 (http://blog.csdn.net/omni360/)

本文遵循“署名-非商業用途-保持一致”創作公用協議

轉載請保留此句:商域無疆 -  本博客專注於 敏捷開發及移動和物聯設備研究:數據可視化、GOLANG、Html5、WEBGL、THREE.JS否則,出自本博客的文章拒絕轉載或再轉載,謝謝合作。


以下代碼是THREE.JS 源碼文件中extras/geometries/OctahedronGeometry.js文件的註釋.

更多更新在 : https://github.com/omni360/three.js.sourcecode

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章