Menu - Top - Home - Donate to Me

H3DU.Batch3D

Back to documentation index.

H3DU.Batch3D()

A Batch3D represents a so-called "scene graph". It holds 3D objects which will be drawn to the screen, as well as the camera's projection, the camera's position, and light sources to illuminate the 3D scene.

Parameters

Methods

H3DU.Batch3D#addShape(shape)

Adds a 3D shape to this batch of shapes, at the end of the list of shapes. Its reference, not a copy, will be stored in the 3D scene's list of shapes. Its parent will be set to no parent.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

(static) H3DU.Batch3D.forFilter(scene, fbo, shader)

Creates a batch whose purpose is to render the contents of a frame buffer using a particular shader. This is often used to apply a graphics filter to that frame buffer's contents. See the Graphics Filters tutorial.

Parameters

Return Value

The created batch. (Type: H3DU.Batch3D)

H3DU.Batch3D#getLights()

Gets the light sources used by this batch.

Return Value

Return value. (Type: H3DU.Lights)

H3DU.Batch3D#getProjectionMatrix()

Gets the current projection matrix for this batch of shapes.

Return Value

A 4x4 matrix used as the current projection matrix. (Type: Array.<number>)

H3DU.Batch3D#getProjectionViewMatrix()

Gets the current projection matrix multiplied by the current view matrix for this batch of shapes.

Return Value

A 4x4 matrix used as the current projection-view matrix. (Type: Array.<number>)

H3DU.Batch3D#getShape(index)

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

Parameters

Return Value

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

H3DU.Batch3D#getViewMatrix()

Gets the current view matrix for this batch of shapes.

Return Value

Return value. (Type: Array.<number>)

H3DU.Batch3D#ortho2DAspect(l, r, b, t)

Uses a 2D orthographic projection for this batch. It will be adjusted to the scene's aspect ratio each time this batch is rendered.

The near and far clipping planes will be set to -1 and 1, respectively.

If the view rectangle's aspect ratio doesn't match the desired aspect ratio, the view rectangle will be centered on the 3D scene's viewport or otherwise moved and scaled so as to keep the entire view rectangle visible without stretching or squishing it.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#orthoAspect(l, r, b, t, e, f)

Uses an orthographic projection for this batch. It will be adjusted to the scene's aspect ratio each time this batch is rendered.

In this projection, the left clipping plane is parallel to the right clipping plane and the top to the bottom.

If the view rectangle's aspect ratio doesn't match the desired aspect ratio, the view rectangle will be centered on the 3D scene's viewport or otherwise moved and scaled so as to keep the entire view rectangle visible without stretching or squishing it.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#perspectiveAspect(fov, near, far)

Uses a perspective projection for this batch. It will be adjusted to the scene's aspect ratio each time this batch is rendered.

For considerations when choosing the "near" and "far" parameters, see H3DU.Math.mat4perspective.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#primitiveCount()

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

Return Value

Return value. (Type: number)

H3DU.Batch3D#removeShape(shape)

Removes all instances of a 3D shape from this batch of shapes.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#setLookAt(eye, [center], [up])

Sets this batch's view matrix to represent a camera view. This method takes a camera's position (eye), and the point the camera is viewing (center).

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#setProjectionMatrix(mat)

Sets the projection matrix for this batch.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#setShape(index, shape)

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

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#setViewMatrix(mat)

Sets the current view matrix for this batch of shapes.

Parameters

Return Value

This object. (Type: H3DU.Batch3D)

H3DU.Batch3D#shapeCount()

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

Return Value

Return value. (Type: number)

H3DU.Batch3D#vertexCount()

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

Return Value

Return value. (Type: number)

Back to documentation index.