Game Development Reference
In-Depth Information
Type
Constructor
Description
Sphere
THREE.Sphere(radius,
horizontalSegments = 8,
verticalSegments = 6)
It is a sphere approximation
created by calculating segments.
Polyhedra
(spheroids)
THREE.Icosahedron(radius,
detail = 0);
THREE.Octahedron(radius,
detail = 0);
THREE.Tetrahedron(radius,
detail = 0);
It is a sphere approximation
based on shapes with 20, 8, or 4
sides, respectively; the detail
parameter specifies how many
times to split each edge to make
more faces, making the shape
more spherical.
Cylinder
THREE.
CylinderGeometry(radiusTop,
radiusBottom, height,
radiusSegments = 8,
heightSegments = 1, openEnded
= false)
radiusSegments is the
number of edges connecting
the top and bottom faces,
down the curved surface;
heightSegments is the
number of rings of faces around
the curved surface, and if
openEnded is true , the ends
of the cylinder will not be
rendered.
Torus
THREE.TorusGeometry(radius,
tubeWidth = 40, radialSegments
= 8, tubularSegments = 6)
It is a donut shape.
TorusKnot
THREE.
TorusKnotGeometry(radius,
tubeWidth = 40,
radialSegments,
tubularSegments, p = 2, q = 3,
heightScale = 1)
It is a knot shape, sort of like a
pretzel. p and q are integers that
affect how many twists are in
the knot.
You can try changing the spinning icosahedron example we built in the last
chapter to use different geometries by changing the IcosahedronGeometry
constructor to one of the options in the preceding table. There is also a geometry
viewer at http://threejsplaygnd.brangerbriz.net/gui/ that allows you to
tweak the constructor parameters to see the result and also copy the code required
to generate the shape you're viewing.
Search WWH ::




Custom Search