o3d.Buffer Class Reference
Inherits
o3d.NamedObject
List of all members.
Detailed Description
The Buffer object is a low level container for a flat list of
floating point or integer values. These are currently used to define
geometry.
Public Member Functions
Public Properties
Member Function Documentation
| boolean Buffer.allocateElements |
( |
number |
numElements |
) |
|
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 Buffer.createField |
( |
string |
fieldType |
|
|
|
|
number |
numComponents |
) |
|
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 Buffer.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.
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:
-
| Buffer.set |
( |
!o3d.RawData |
param1 |
|
|
|
|
number |
opt_param2 |
|
|
|
|
number |
opt_param3 |
) |
|
Sets the values in the buffer given a RawData object.
- Parameters:
-
| param1 |
contains data to assign to the Buffer data itself. |
| opt_param2 |
is a byte offset from the start of raw_data |
| opt_param3 |
is the byte length of the data to set |
Member Property Documentation
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.
Unique id of the object.
This id will be unique, even across multiple O3D clients in the same
page.
This property is read-only.
The fields currently set on the buffer.
This property is read-only.
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 Buffer.numElements
|
Number of elements in the buffer.
This property is read-only.
| number Buffer.totalComponents
|
The total components in all fields in this buffer.
This property is read-only.