1.立方体(CubeGeometry)
THREE.CubeGeometry(width, height,depth,widthSegments,heightSegments,depthSegments)
width : x 方向上的长度height: y 方向上的长度depth: z 方向上的长度
后三个参数分别是在三个方向上的分段数,如 widthSegments为3的话,代表x方向上水平分为三份。后三个参数的缺省值为 1。
(对六个面进行分段,而不是对立方体的体素分段)
2.平面(PlaneGeometry)
THREE.PlaneGeometry(width, height, widthSegments, heightSegments)
3.球体(SphereGeometry)
THREE.SphereGeometry(radius, segmentsWidth, segmentsHeight, phiStart, phiLength, thetaStart, thetaLength)
radius: 半径segmentsWidth: 表示经度上的切片segmentsHeight: 表示纬度上的切片数phiStart: 表示经度开始的弧度phiLength: 表示经度跨过的弧度thetaStart: 表示纬度开始的弧度thetaLength: 表示纬度跨过的弧度
4.圆形(CircleGeometry)
THREE.CircleGeometry(radius, segments, thetaStart, thetaLength)
5.圆柱体(CylinderGeometry)
THREE.CylinderGeometry(radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded)
radiusTop 顶面半径radiusBottom 底面半径height 圆柱体的高度;radiusSegments 与 heightSegments 可类比球体中的分段openEnded 是一个布尔值,表示是否没有顶面和底面,缺省值为 false ,表示有顶面和底面。
6.正四面体(TetrahedronGeometry)、正八面体(OctahedronGeometry)、正二十面体(IcosahedronGeometry)
THREE.TetrahedronGeometry(radius, detail)
THREE.OctahedronGeometry(radius, detail)
THREE.IcosahedronGeometry(radius, detail)
radius 半径detail 细节层次(Level of Detail)的层数,一般可以对这个值缺省
7.圆环面(TorusGeometry)
THREE.TorusGeometry(radius, tube, radialSegments, tubularSegments, arc)
radius 圆环半径
tube 管道半径
radialSegments 与 tubularSegments 分别是两个分段数
arc 圆环面的弧度,缺省值为 Math.PI * 2
8.文字形状(TextGeometry)
THREE.TextGeometry(text, parameters)
text 文字字符串parameters 是以下参数组成的对象:
- size :字号大小,一般为大写字母的高度
- height :文字的厚度
- curveSegments :弧线分段数,使得文字的曲线更加光滑
- font :字体,默认是 ‘helvetiker’ ,需对应引用的字体文件
- weight :值为 ‘normal’ 或 ‘bold’ ,表示是否加粗
- style :值为 ‘normal’ 或 ‘italics’ ,表示是否斜体
- bevelEnabled :布尔值,是否使用倒角,意为在边缘处斜切
- bevelThickness :倒角厚度
- bevelSize :倒角宽度
1 | <script type="text/javascript"> |
9.自定义形状
THREE.Geometry()
https://threejs.org/docs/index.html?q=ge#Reference/Core/Geometry