ShapeGeometry 自定义形状模型

—> Geometry

用路径图形 Shape 来创建平面的自定义形状.

function ShapeGeometry( shapes, curveSegments ) { } var shape = new THREE.Shape(); shape.quadraticCurveTo(3, 5, 9, 1); shape.quadraticCurveTo(11, -1, 12, 3); shape.quadraticCurveTo(13, 0, 12, -3); shape.quadraticCurveTo(11, 1, 9, -1); shape.quadraticCurveTo(3, -5, 0, 0); var eye = new THREE.Path(); eye.arc(2, 0, 0.5); shape.holes.push(eye); var geometry = new THREE.ShapeGeometry(shape), material = new THREE.MeshBasicMaterial({color: 0x663399, side: THREE.DoubleSide}), fish = new THREE.Mesh(geometry, material); scene.add(fish);

Parameters

shapes curveSegments
new THREE.Shape() 12
形状 分段数

Methods 继承自 Geometry 并自动调用

fromBufferGeometry( new ShapeBufferGeometry( shapes, curveSegments ) )
mergeVertices( )

ShapeBufferGeometry

function ShapeBufferGeometry( shapes, curveSegments ) { } var shape = new THREE.Shape(); ... ... var geometry = new THREE.ShapeBufferGeometry(shape), material = new THREE.MeshBasicMaterial({color: 0x663399, side: THREE.DoubleSide}), fish = new THREE.Mesh(geometry, material); scene.add(fish);

Methods 继承自 BufferGeometry 并自动调用

setIndex( )
addAttribute( )

图解API

纹理Texture来渲染自定义形状模型. 点开查看