Menu - Top - Home - Donate to Me

H3DU.SurfaceBuilder

Back to documentation index.

H3DU.SurfaceBuilder()

An evaluator of surface evaluator objects for generating vertex attributes for a surface.

For more information, see the Parametric Curves and Parametric Surfaces tutorial.

Methods

H3DU.SurfaceBuilder#attribute(surface, semantic, [semanticIndex], [size])

Sets the parametric surface used to generate vertex attribute values.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

Example

The following example sets the surface function for texture coordinates to a linear evaluator. Thus, coordinates passed to the evalSurface method will be interpolated as direct texture coordinates.

surface.attribute({"evaluate":function(u,v) {
"use strict"; return [u,v] }},H3DU.Semantic.TEXCOORD);

H3DU.SurfaceBuilder#clearVertices()

Clears the arrays of attribute values (such as positions and normals) and vertex indices generated so far. The attributes themselves will remain.

Return Value

This object. (Type: H3DU.SurfaceBuilder)

H3DU.SurfaceBuilder#evalSurface([mode], [un], [vn], [u1], [u2], [v1], [v2])

Generates the vertex attributes of the parametric surfaces.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

H3DU.SurfaceBuilder#position(surface, [size])

Sets the parametric surface used to generate vertex positions.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

H3DU.SurfaceBuilder#positionNormal(surface, [size])

Sets the parametric surface used to generate vertex positions and normals.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

H3DU.SurfaceBuilder#positionNormalTexCoord(surface, [size])

Sets the parametric surface used to generate vertex positions and normals, and sets a surface evaluator that generates texture coordinates ranging from (0,1) along the U and V axes of the surface.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

H3DU.SurfaceBuilder#positionTexCoord(surface, [size])

Sets the parametric surface used to generate vertex positions, and sets a surface evaluator that generates texture coordinates ranging from (0,1) along the U and V axes of the surface.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

(static) H3DU.SurfaceBuilder.surfaceToBuffer(surface, [mode], [un], [vn], [u1], [u2], [v1], [v2])

Convenience method for creating a mesh buffer from a parametric surface. The mesh buffer will contain positions, vertex normals, and texture coordinates that cover the given surface.

Parameters

Return Value

The generated mesh buffer. (Type: H3DU.MeshBuffer)

H3DU.SurfaceBuilder#texCoord(surface, [size])

Sets the parametric surface used to generate texture coordinates.

Parameters

Return Value

This object. (Type: H3DU.SurfaceBuilder)

H3DU.SurfaceBuilder#toMeshBuffer()

Generates a mesh buffer containing the vertex attributes generated so far. The mesh buffer's primitive type will equal the last type passed to the "mode" parameter in the H3DU.SurfaceBuilder.surfaceEval method.

Return Value

The generated mesh buffer. (Type: H3DU.MeshBuffer)

Back to documentation index.