My favorites | English | Sign in

o3d.IndexBuffer Class Reference

Inherits o3d.Buffer

List of all members.


Detailed Description

IndexBuffer is a buffer object used for storing geometry index data (e.g. triangle indices).

Public Member Functions

boolean  allocateElements(numElements) o3d.Buffer
o3d.Field  createField(fieldType, numComponents) o3d.Buffer
boolean  isAClassName(className) o3d.ObjectBase
removeField(field) o3d.Buffer
boolean  set(values) o3d.IndexBuffer
setAt(startIndex, values) o3d.IndexBuffer

Public Properties

string className o3d.ObjectBase
number clientId o3d.ObjectBase
!Array.<!o3d.Field> fields o3d.Buffer
string name o3d.NamedObject
number numElements o3d.Buffer
number totalComponents o3d.Buffer

Member Function Documentation

boolean IndexBuffer.allocateElements ( number numElements ) [inherited from o3d.Buffer]

Allocates memory for the data to be stored in the buffer based on the types of fields set on the buffer.

Parameters:
numElements Number of elements to allocate..
Returns:
boolean.True if operation was successful.
o3d.Field IndexBuffer.createField ( string fieldType
number numComponents ) [inherited from o3d.Buffer]

Defines a field on this buffer. Note: Creating a field after having allocated the buffer is an expensive operation as the data currently in the buffer has to be shuffled around to make room for the new field.

Parameters:
fieldType type of data in the field. Valid types are "FloatField", "UInt32Field", "UByteNField".
numComponents number of components in the field.
Returns:
o3d.Field.The created field.
boolean IndexBuffer.isAClassName ( string className ) [inherited from o3d.ObjectBase]

Takes the name of a class as an argument, and returns true if this object is either an instance of that class or derives from that class.

var t = pack.createObject('o3d.Transform');
t.isAClassName('o3d.Transform');    // true
t.isAClassName('o3d.ParamObject');  // true
t.isAClassName('o3d.Shape');        // false
Parameters:
className Name of class to check for.
Returns:
boolean.true if this object is a or is derived from the given class name.
IndexBuffer.removeField ( !o3d.Field field ) [inherited from o3d.Buffer]

Removes a field from this buffer. Note: Removing a field after having allocated the buffer is an expensive operation as the data currently in the buffer has to be shuffled around to remove the old field.

Parameters:
field field to remove.
boolean IndexBuffer.set ( !Array.<number> values )

Sets the values of the data stored in the buffer.

Parameters:
values Values to be stored in the buffer.
Returns:
boolean.True if operation was successful.
IndexBuffer.setAt ( number startIndex
!Array.<number> values )

Sets the values of the data stored in the buffer. The buffer must have already been created either through buffer.set or buffer.allocateElements.

Parameters:
startIndex index of first value to set.
values Values to be stored in the buffer starting at index.

Member Property Documentation

string IndexBuffer.className [inherited from o3d.ObjectBase]

The concrete class name for an object derived from ObjectBase. If you want to know if an object is of a certain type you should use objectBase.isAClassName

var t = pack.createObject('o3d.Transform');
t.className == 'o3d.Transform';  // true
This property is read-only.
number IndexBuffer.clientId [inherited from o3d.ObjectBase]

Unique id of the object. This id will be unique, even across multiple O3D clients in the same page. This property is read-only.

!Array.<!o3d.Field> IndexBuffer.fields [inherited from o3d.Buffer]

The fields currently set on the buffer. This property is read-only.

string IndexBuffer.name [inherited from o3d.NamedObject]

The object's name. Setting this has no meaning to O3D, but is useful for debugging and for the functions Client.getObjects, Pack.getObject, RenderNode.getRenderNodesByNameInTree and RenderNode.getTransformsByNameInTree which search for objects by name.

number IndexBuffer.numElements [inherited from o3d.Buffer]

Number of elements in the buffer. This property is read-only.

number IndexBuffer.totalComponents [inherited from o3d.Buffer]

The total components in all fields in this buffer. This property is read-only.