Package | flash.display3D |
Class | public final class IndexBuffer3D |
Inheritance | IndexBuffer3D Object |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 11, AIR 3 |
Each value in an index buffer is an index into the current vertex buffer. A sequence of three values defines a triangle. You can upload the index list either from a Vector array or a ByteArray. (Once uploaded, the data in the original array is no longer referenced; changing or discarding the source array does not change the triangle list.)
An index is a 16-bit unsigned integer. The maximum allowable index value is 65535 (0xffff).
Render the triangles defined in an index buffer using the Context3D drawTriangles()
method. To draw a triangle defined in the index buffer, the rendering context looks up the data for
each triangle point in the vertex buffer at the specified index and passes that data as an input to the
vertex shader program. The vertex buffer to use for an input is specified by the most recent call
to the Context3D setVertexBufferAt()
method.
You cannot create an IndexBuffer3D object directly; use the
Context3D createIndexBuffer()
method instead.
To free the render context resources associated with an index buffer, call the object's dispose()
method.
Related API Elements
flash.display.Context3D.drawTriangles()
Method | Defined By | ||
---|---|---|---|
Frees all resources associated with this object. | IndexBuffer3D | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Uploads a set of triangle indices to the rendering context from a byte array. | IndexBuffer3D | ||
Uploads a set of triangle indices to the rendering context from a vector array. | IndexBuffer3D | ||
Returns the primitive value of the specified object. | Object |
dispose | () | method |
public function dispose():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 11, AIR 3 |
Frees all resources associated with this object. After disposing an index buffer, calling upload() and rendering using this object will fail.
uploadFromByteArray | () | method |
public function uploadFromByteArray(data:ByteArray, byteArrayOffset:int, startOffset:int, count:int):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 11, AIR 3 |
Uploads a set of triangle indices to the rendering context from a byte array.
Parameters
data:ByteArray — a ByteArray containing index data. Each index is represented by 16-bits (two bytes) in the array.
The number of bytes in data must be at least byteArrayOffset plus two times count .
The ByteArray object must use the little endian format.
| |
byteArrayOffset:int — offset, in bytes, into the data ByteArray from where to start reading.
| |
startOffset:int — The index in this IndexBuffer3D object of the first index to be loaded in this IndexBuffer3D object.
A value for startIndex not equal to zero may be used to load a subregion of the index data.
| |
count:int — The number of indices represented by data .
|
Throws
TypeError — when data is null.
| |
RangeError — when any of count , byteArrayOffset ,
or startOffset is less than 0,
or if byteArrayOffset is greater than or equal to the length of data ,
or if two times count plus byteArrayOffset is greater than the
length of data .
|
uploadFromVector | () | method |
public function uploadFromVector(data:Vector.<uint>, startOffset:int, count:int):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 11, AIR 3 |
Uploads a set of triangle indices to the rendering context from a vector array.
Parameters
data:Vector.<uint> — a vector of vertex indices. Only the low 16 bits of each index value are used.
The length of the vector must be greater than or equal to count .
| |
startOffset:int — The index in this IndexBuffer3D object of the first index to be loaded.
A value for startOffset not equal to zero can be used to load a subregion of the index data.
| |
count:int — The number of indices in data .
|
Throws
TypeError — when data is null .
| |
RangeError — when count is less than 0 or greater than the length of data .
|
renderContext
, is an instance of the Context3D class.
var triangles:Vector.<uint> = Vector.<uint>( [ 0, 1, 2, 0, 3, 4 ] ); var indexList:IndexBuffer3D = renderContext.createIndexBuffer( triangles.length ); indexList.uploadFromVector( triangles, 0, triangles.length );
Mon Nov 28 2011, 06:48 AM -08:00