three.js BoxGeometry

2023-02-16 17:33 更新

BoxGeometry是四邊形的原始幾何類,它通常使用構(gòu)造函數(shù)所提供的“width”、“height”、“depth”參數(shù)來創(chuàng)建立方體或者不規(guī)則四邊形。

示例

代碼示例

const geometry = new THREE.BoxGeometry( 1, 1, 1 );
const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );

構(gòu)造器

BoxGeometry(width : Float, height : Float, depth : Float, widthSegments : Integer, heightSegments : Integer, depthSegments : Integer)

width — X軸上面的寬度,默認(rèn)值為1。
height — Y軸上面的高度,默認(rèn)值為1。
depth — Z軸上面的深度,默認(rèn)值為1。
widthSegments — (可選)寬度的分段數(shù),默認(rèn)值是1。
heightSegments — (可選)高度的分段數(shù),默認(rèn)值是1。
depthSegments — (可選)深度的分段數(shù),默認(rèn)值是1。

屬性

共有屬性請(qǐng)參見其基類BufferGeometry。

.parameters : Object

一個(gè)包含著構(gòu)造函數(shù)中每個(gè)參數(shù)的對(duì)象。在對(duì)象實(shí)例化之后,對(duì)該屬性的任何修改都不會(huì)改變這個(gè)幾何體。

方法(Methods)

共有方法請(qǐng)參見其基類BufferGeometry。

源代碼

src/geometries/BoxGeometry.js


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)