t3d. CylinderGeometry

A class for generating cylinder geometries.

Constructor

new CylinderGeometry(radiusTopopt, radiusBottomopt, heightopt, radialSegmentsopt, heightSegmentsopt, openEndedopt, thetaStartopt, thetaLengthopt)

Parameters:
NameTypeAttributesDefaultDescription
radiusTopNumber<optional>
1— Radius of the cylinder at the top.
radiusBottomNumber<optional>
1— Radius of the cylinder at the bottom.
heightNumber<optional>
1— Height of the cylinder.
radialSegmentsNumber<optional>
8— Number of segmented faces around the circumference of the cylinder.
heightSegmentsNumber<optional>
1— Number of rows of faces along the height of the cylinder.
openEndedNumber<optional>
false— A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.
thetaStartNumber<optional>
0— Start angle for first segment, default = 0 (three o'clock position).
thetaLengthNumber<optional>
2*Pi— The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder.

Extends

Members

attributes :Object

This hashmap has as id the name of the attribute to be set and as value the buffer to set it to. Rather than accessing this property directly, use t3d.Geometry#addAttribute and t3d.Geometry#getAttribute to access attributes of this geometry.
Type:
  • Object

boundingBox :t3d.Box3

Bounding box for the bufferGeometry, which can be calculated with t3d.Geometry#computeBoundingBox.
Default Value
  • t3d.Box3()

boundingSphere :t3d.Sphere

Bounding sphere for the bufferGeometry, which can be calculated with t3d.Geometry#computeBoundingSphere.
Default Value
  • t3d.Sphere()

groups :Array

Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry. Each group is an object of the form: { start: Integer, count: Integer, materialIndex: Integer }, or { multiDrawStarts: Integer[], multiDrawCounts: Integer[], multiDrawCount: Integer, materialIndex: Integer } if multiDraw is available.
Type:
  • Array
Default Value
  • []

(readonly) id :Number

Unique number for this geometry instance.
Type:
  • Number

index :t3d.Attribute|Null

Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles" and each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face. If this attribute is not set, the renderer assumes that each three contiguous positions represent a single triangle.
Type:

instanceCount :Number

The number of instances to be rendered. If set to -1 (default), instanced rendering is disabled. This property is used for instanced rendering, where multiple copies of the geometry are drawn with a single draw call.
Type:
  • Number
Default Value
  • -1

morphAttributes :Object

Hashmap of Attributes Array for morph targets.
Type:
  • Object

(readonly) uuid :String

UUID of this geometry instance. This gets automatically assigned, so this shouldn't be edited.
Type:
  • String

version :Number

A version number, incremented every time the attribute object or index object changes to mark VAO drity.
Type:
  • Number
Default Value
  • 0

Methods

addAttribute(name, attribute)

Adds an attribute to this geometry. Use this rather than the attributes property.
Parameters:
NameTypeDescription
nameString
attributet3d.Attribute

addEventListener(type, listener, thisObjectopt)

Adds a listener to an event type.
Parameters:
NameTypeAttributesDefaultDescription
typeStringThe type of event to listen to.
listenerfunctionThe function that gets called when the event is fired.
thisObjectObject<optional>
thisThe Object of calling listener method.

addGroup(start, count, materialIndexopt)

Adds a group to this geometry; see the t3d.Geometry#groups for details.
Parameters:
NameTypeAttributesDefaultDescription
startNumber
countNumber
materialIndexNumber<optional>
0

clearGroups()

Clears all groups.

clone() → {t3d.Geometry}

Creates a clone of this Geometry.
Returns:
Type: 
t3d.Geometry

computeBoundingBox()

Computes bounding box of the geometry, updating t3d.Geometry#boundingBox. Bounding boxes aren't computed by default. They need to be explicitly computed.

computeBoundingSphere()

Computes bounding sphere of the geometry, updating t3d.Geometry#boundingSphere. Bounding spheres aren't computed by default. They need to be explicitly computed.

copy(source) → {t3d.Geometry}

Copies another Geometry to this Geometry.
Parameters:
NameTypeDescription
sourcet3d.GeometryThe geometry to be copied.
Returns:
Type: 
t3d.Geometry

dispatchEvent(event)

Fire an event.
Parameters:
NameTypeDescription
eventObjectThe event that gets fired.

dispose()

Disposes the object from memory. You need to call this when you want the BufferGeometry removed while the application is running.

getAttribute(name) → {t3d.Attribute}

Returns the attribute with the specified name.
Parameters:
NameTypeDescription
nameString
Returns:
Type: 
t3d.Attribute

removeAttribute(name)

Removes the attribute with the specified name.
Parameters:
NameTypeDescription
nameString

removeEventListener(type, listener, thisObjectopt)

Removes a listener from an event type.
Parameters:
NameTypeAttributesDefaultDescription
typeStringThe type of the listener that gets removed.
listenerfunctionThe listener function that gets removed.
thisObjectObject<optional>
thisthisObject - The Object of calling listener method.

setIndex(index)

Set the t3d.Geometry#index buffer.
Parameters:
NameTypeDescription
indexArray | t3d.Attribute | Null