二维几何体
PlaneGeometry-矩形面
var plane = createMesh(new THREE.PlaneGeometry(10, 14, 4, 4));
varmesh = THREE.SceneUtils.createMuutiMaterialObject(plane,[aMeterial,bMaterial])
CircleGeometry-圆
circle = createMesh(3,2);
circle = createMesh(new THREE.CircleGeometry(半径, 分段默认8最少3, 从哪里开始画0~2*PI, 角度(弧度)默认x*PI));
ShapeGeometry-自定义图形
shape = createMesh(new THREE.ShapeGeometry(drawShape()));
function drawShape() {
var shape = new THREE.Shape();
shape.moveTo(10, 10);
shape.lineTo(10, 40);
shape.bezierCurveTo(15, 25, 25, 25, 30, 40);
shape.splineThru(
[new THREE.Vector2(32, 30),
new THREE.Vector2(28, 20),
new THREE.Vector2(30, 10),
]);
shape.quadraticCurveTo(20, 15, 10, 10);
var hole1 = new THREE.Path();
hole1.absellipse(16, 24, 2, 3, 0, Math.PI * 2, true);
shape.holes.push(hole1);
var hole2 = new THREE.Path();
hole2.absellipse(23, 24, 2, 3, 0, Math.PI * 2, true);
shape.holes.push(hole2);
var hole3 = new THREE.Path();
hole3.absarc(20, 16, 2, 0, Math.PI, true);
shape.holes.push(hole3);
return shape;
}
三维几何
BoxGeometry-长方体
var cube = createMesh(new THREE.BoxGeometry(x长, y长, z长));
var cube = createMesh(new THREE.BoxGeometry(x长, y长, z长, x面数理, y面数量, z面数量));
SphereGeometry-球体
sphere = createMesh(new THREE.SphereGeometry();
sphere = createMesh(new THREE.SphereGeometry(半径默认50,
垂直分段默认8越大越光滑,
水平分段,
什么地方开始画0~2*PI默认0,
画多少2*PI为整球 ,
y轴开始画的地方默认0,
画多少2*PI为整球);
CylinderGeometry-圆柱
cylinder = createMesh(new THREE.CylinderGeometry(controls.radiusTop, controls.radiusBottom, controls.height, controls.radialSegments, controls.heightSegments, controls.openEnded))
TorusGeometry-圆环
torus = createMesh(new THREE.TorusGeometry(controls.radius, controls.tube, Math.round(controls.radialSegments), Math.round(controls.tubularSegments), controls.arc))
TorusKnotGeometry-环形纽结
knot = createMesh(new THREE.TorusKnotGeometry(controls.radius, controls.tube, Math.round(controls.radialSegments), Math.round(controls.tubularSegments), Math.round(controls.p), Math.round(controls.q), controls.heightScale))
PolyhedronGeometry-多面体
polyhedron = createMesh(new THREE.PolyhedronGeometry(vertices, indices, controls.radius, controls.detail))