H3DU.ShapeGroup

Back to documentation index.

new H3DU.ShapeGroup()

Represents a grouping of shapes. This object can hold both Shape objects and other ShapeGroup objects.

Members

Methods

H3DU.ShapeGroup#shapes

Deprecated: Use the ShapeGroup#shapeCount, ShapeGroup#getShape, and ShapeGroup#setShape methods instead.

List of shapes contained in this group. This property should only be used to access properties and call methods on each shape, and not to add, remove or replace shapes directly.

H3DU.ShapeGroup#addShape(shape)

Adds a 3D shape to this shape group, at the end of the list of shapes. Its reference, not a copy, will be stored in the list of shapes.

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#copy()

Makes a copy of this shape group and the objects contained in it. The copied object will will have its own version of the transform and visibility flag, and any objects contained in this one will be copied using their copy() method. The copied shape group won't have a parent.

Return Value

A copy of this shape group. (Type: ShapeGroup)

H3DU.ShapeGroup#getBounds()

Finds a bounding box that holds all vertices in this shape group. The bounding box is not guaranteed to be the tightest, and the box will be in world space coordinates.

Return Value

An array of six numbers describing an axis-aligned bounding box that fits all vertices in the shape group. The first three numbers are the smallest-valued X, Y, and Z coordinates, and the last three are the largest-valued X, Y, and Z coordinates. If the shape group has no vertices, returns the array [Inf, Inf, Inf, -Inf, -Inf, -Inf]. (Type: Array.<number>)

H3DU.ShapeGroup#getMatrix()

Gets a copy of the transformation needed to transform this shape group's coordinates to world coordinates.

Return Value

A 4x4 matrix. (Type: Transform)

H3DU.ShapeGroup#getShape(index)

Gets the shape or shape group located in this shape group at the given index.

Parameters

Return Value

The shape or shape group located in this shape group at the given index, or null if none is found there. (Type: Shape | ShapeGroup)

H3DU.ShapeGroup#getTransform()

Gets a reference to the transform used by this shape group object.

Return Value

Return value. (Type: Transform)

H3DU.ShapeGroup#getVisible()

Gets whether this shape group will be drawn on rendering.

Return Value

value True if this shape group will be visible; otherwise, false. (Type: boolean)

H3DU.ShapeGroup#primitiveCount()

Gets the number of primitives (triangles, lines, and points) composed by all shapes in this shape group.

Return Value

Return value. (Type: number)

H3DU.ShapeGroup#removeShape(shape)

Removes all instances of a 3D shape from this shape group

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#setPosition(x, y, z)

Sets the relative position of the shapes in this group from their original position. See Transform#setPosition This method will modify this shape group's transform rather than the transform for each shape in the group.

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#setQuaternion(quat)

Sets this shape group's rotation in the form of a quaternion. See Transform#setQuaternion. This method will modify this shape group's transform rather than the transform for each shape in the group.

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#setScale(x, y, z)

Sets the scale of this shape group relative to its original size. See Transform#setScale. This method will modify this shape group's transform rather than the transform for each shape in the group.

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#setShape(index, shape)

Sets a shape or shape group at the given index in this shape group.

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#setTransform(transform)

Sets the transform used by this shape group to a copy of the given transform. Child shapes can set their own transforms, in which case the rendering process will multiply this shape group's transform with the child shape's transform as it renders the child shape.

Parameters

Return Value

Return value. (Type: Object)

H3DU.ShapeGroup#setVisible(value)

Sets whether this shape group will be drawn on rendering.

Parameters

Return Value

This object. (Type: ShapeGroup)

H3DU.ShapeGroup#shapeCount()

Returns the number of shapes and/or shape groups that are direct children of this shape group.

Return Value

Return value. (Type: number)

H3DU.ShapeGroup#vertexCount()

Gets the number of vertices composed by all shapes in this shape group.

Return Value

Return value. (Type: number)

Back to documentation index.