Table Of Contents

Previous topic

21.47. The SoundManager Object

Next topic

21.49. The TextureEffects Object

This Page

21.48. The Surface Object

A Surface object is a JavaScript object that represents one of the surfaces of a Geometry. It defines part or all of the the geometry to draw and provides the indexing information required to draw it. The data is stored using either indexBuffer and numIndices or first and numVertices.:

if (surface.indexBuffer)
{
    drawParameters.indexBuffer = surface.indexBuffer;
    drawParameters.count = surface.numIndices;
}
else
{
    drawParameters.firstIndex = surface.first;
    drawParameters.count = surface.numVertices;
}

21.48.1. Properties

21.48.1.1. primitive

Summary

The primitive type the surface.

Syntax

var primitive = surface.primitive;

21.48.1.2. indexBuffer

Summary

The IndexBuffer for the surface.

This may be undefined.

If it is defined then numIndices is also defined.

Syntax

var indexBuffer = surface.indexBuffer;

21.48.1.3. numIndices

Summary

When indexBuffer is defined this is the number of indicies in the buffer to use.

This may be undefined.

Syntax

var numIndices = surface.numIndices;

21.48.1.4. first

Summary

When indexBuffer is not defined this is the first index of the first vertex in the Geometry’s vertexBuffer to start from.

This may be undefined.

If it is defined then numVertices is also defined.

Syntax

var first = surface.first;

21.48.1.5. numVertices

Summary

When indexBuffer is not defined this is the number of vertices to process.

This may be undefined.

Syntax

var numVertices = surface.numVertices;

21.48.1.6. vertexData

Summary

A native array of vertexData that can be use to create or update a VertexBuffer.

See Scene.load.

This may be undefined.

Syntax

var vertexData = surface.vertexData;

21.48.1.7. indexData

Summary

A native array of indexData that can be use to create or update a IndexBuffer.

See Scene.load.

This may be undefined.

Syntax

var indexData = surface.indexData;