Question

If I populate a vertex-buffer by using the byte-array method:

//Example:
var ba:ByteArray = new ByteArray();

//Write vertex #0:
ba.writeFloat(-.5);
ba.writeFloat(-.5);
ba.writeUnsignedInt(0);
ba.writeUnsignedInt(0);

//Write vertex #1:
ba.writeFloat(.5);
ba.writeFloat(-.5);
ba.writeUnsignedInt(1);
ba.writeUnsignedInt(0);

//Write vertex #2:
ba.writeFloat(.5);
ba.writeFloat(.5);
ba.writeUnsignedInt(1);
ba.writeUnsignedInt(1);

//Write vertex #3:
ba.writeFloat(-.5);
ba.writeFloat(.5);
ba.writeUnsignedInt(0);
ba.writeUnsignedInt(1);

myVertexBuffer.uploadFromByteArray(ba, 0, 0, 4);

And then set the vertex-buffer attribute with the following format:

var format:String = Context3DVertexBufferFormat.BYTES_4;
context3D.setVertexBufferAt(0, myVertexBuffer, 0, format);

What is the range of values possible (0 to 255? 0.0 to 1.0? etc.) for the Vertex attribute's field (in this case, va0.x, va0.y, va0.z, va0.w)? Does it vary between which data-type is written to the ByteArray object (writeFloat vs. writeUnsignedInt)?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top