Class: CubeGeometry

zen3d.CubeGeometry(widthopt, heightopt, depthopt, widthSegmentsopt, heightSegmentsopt, depthSegmentsopt)

CubeGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.

Constructor

new CubeGeometry(widthopt, heightopt, depthopt, widthSegmentsopt, heightSegmentsopt, depthSegmentsopt)

Parameters:
Name Type Attributes Default Description
width number <optional>
1 Width of the sides on the X axis.
height number <optional>
1 Height of the sides on the Y axis.
depth number <optional>
1 Depth of the sides on the Z axis.
widthSegments Integer <optional>
1 Number of segmented faces along the width of the sides.
heightSegments Integer <optional>
1 Number of segmented faces along the height of the sides.
depthSegments Integer <optional>
1 Number of segmented faces along the depth of the sides.
Source:

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 zen3d.Geometry#addAttribute and zen3d.Geometry#getAttribute to access attributes of this geometry.
Type:
  • Object
Overrides:
Source:

boundingBox :zen3d.Box3

Bounding box for the bufferGeometry, which can be calculated with zen3d.Geometry#computeBoundingBox.
Type:
Overrides:
Default Value:
  • zen3d.Box3()
Source:

boundingSphere :zen3d.Sphere

Bounding sphere for the bufferGeometry, which can be calculated with zen3d.Geometry#computeBoundingSphere.
Type:
Overrides:
Default Value:
  • zen3d.Sphere()
Source:

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 }
Type:
  • Array
Overrides:
Default Value:
  • []
Source:

index :zen3d.BufferAttribute|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:
Overrides:
Source:

morphAttributes :Object

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

uuid :string

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

version :Integer

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

Methods

addAttribute(name, attribute)

Adds an attribute to this geometry. Use this rather than the attributes property.
Parameters:
Name Type Description
name string
attribute zen3d.BufferAttribute | zen3d.InterleavedBufferAttribute
Overrides:
Source:

addEventListener(type, listener, thisObjectopt)

Adds a listener to an event type.
Parameters:
Name Type Attributes Default Description
type string The type of event to listen to.
listener function The function that gets called when the event is fired.
thisObject Object <optional>
this The Object of calling listener method.
Overrides:
Source:

addGroup(start, count, materialIndex)

Adds a group to this geometry; see the zen3d.Geometry#groups for details.
Parameters:
Name Type Description
start Integer
count Integer
materialIndex Integer
Overrides:
Source:

clearGroups()

Clears all groups.
Overrides:
Source:

clone() → {zen3d.Geometry}

Creates a clone of this Geometry.
Overrides:
Source:
Returns:
Type
zen3d.Geometry

computeBoundingBox()

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

computeBoundingSphere()

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

copy(source) → {zen3d.Geometry}

Copies another Geometry to this Geometry.
Parameters:
Name Type Description
source zen3d.Geometry The geometry to be copied.
Overrides:
Source:
Returns:
Type
zen3d.Geometry

dispatchEvent(event)

Fire an event type.
Parameters:
Name Type Description
event Object The event that gets fired.
Overrides:
Source:

dispose()

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

getAttribute() → {zen3d.BufferAttribute|zen3d.InterleavedBufferAttribute}

Returns the attribute with the specified name.
Overrides:
Source:
Returns:
Type
zen3d.BufferAttribute | zen3d.InterleavedBufferAttribute

removeAttribute()

Removes the attribute with the specified name.
Overrides:
Source:

removeEventListener(type, listener, thisObjectopt)

Removes a listener from an event type.
Parameters:
Name Type Attributes Default Description
type string The type of the listener that gets removed.
listener function The listener function that gets removed.
thisObject Object <optional>
this thisObject - The Object of calling listener method.
Overrides:
Source:

setIndex(index)

Set the zen3d.Geometry#index buffer.
Parameters:
Name Type Description
index Array | zen3d.BufferAttribute
Overrides:
Source: