CurveBuilder

Back to documentation index.

### new CurveBuilder()

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

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

Methods

### CurveBuilder#attribute(curve, semantic, [semanticIndex], [size])

Sets the parametric curve used to generate vertex attribute values.

Parameters

Return Value

This object. (Type: CurveBuilder)

### CurveBuilder#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: CurveBuilder)

### CurveBuilder#constantAttribute(constantValue, semantic, [semanticIndex])

Sets a value for an attribute semantic that will be the same for all future vertices generated by the “evalCurve” method.

Parameters

Return Value

This object. (Type: CurveBuilder)

Examples

This example sets the color to use for future vertices to be generated for the curve.

// Set color to red
curve.constantAttribute([1,0,0],"COLOR");

### CurveBuilder#constantColor(color, [semanticIndex])

Sets a value for a color attribute that will be the same for all future vertices generated by the “evalCurve” method.

Parameters

Return Value

This object. (Type: CurveBuilder)

Examples

This example sets the color to use for future vertices to be generated for the curve.

// Set color to red
curve.constantColor("red");

### (static) CurveBuilder.curveToBuffer(curve, [mode], [n], [u1], [u2])

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

Parameters

Return Value

The generated mesh buffer. (Type: MeshBuffer)

### CurveBuilder#evalCurve([mode], [n], [u1], [u2])

Generates the vertex attributes of the parametric curves.

Parameters

Return Value

This object. (Type: CurveBuilder)

### CurveBuilder#position(curve, [size])

Sets the parametric curve used to generate vertex positions.

Parameters

Return Value

This object. (Type: CurveBuilder)

### CurveBuilder#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 CurveBuilder.curveEval method.

Return Value

The generated mesh buffer. (Type: MeshBuffer)

Back to documentation index.