| Package | alternativa.engine3d.resources |
| Class | public class Geometry |
| Inheritance | Geometry Resource Object |
| Property | Defined By | ||
|---|---|---|---|
| indices : Vector.<uint>
Indexes of vertices for specifying of triangles of surface. | Geometry | ||
| isUploaded : Boolean [override] [read-only]
Check for existence of resource in video memory. | Geometry | ||
| numTriangles : int [read-only]
Number of triangles, that are contained in geometry. | Geometry | ||
| numVertexStreams : int [read-only]
Number of vertex-streams. | Geometry | ||
| numVertices : int
Number of vertices of geometry. | Geometry | ||
| Method | Defined By | ||
|---|---|---|---|
Geometry(numVertices:int = 0)
Creates a new instance. | Geometry | ||
addVertexStream(attributes:Array):int
Adds a stream for set of parameters, that can be updated independently of the other sets of parameters. | Geometry | ||
calculateNormals():void
Calculation of vertex normals. | Geometry | ||
calculateTangents(uvChannel:int):void
Calculation of tangents and bi-normals. | Geometry | ||
dispose():void [override]
Removes this resource from Context3D to which it was uploaded. | Geometry | ||
findVertexStreamByAttribute(attribute:uint):int
Returns index of stream, that contains needed attribute. | Geometry | ||
getAttributeOffset(attribute:uint):int
Offset of attribute at stream, with which this attribute is stored. | Geometry | ||
getAttributeValues(attribute:uint):Vector.<Number> | Geometry | ||
getVertexStreamAttributes(index:int):Array
returns mapping of stream by index. | Geometry | ||
hasAttribute(attribute:uint):Boolean
Check the existence of attribute in all streams. | Geometry | ||
setAttributeValues(attribute:uint, values:Vector.<Number>):void
Sets value for attribute. | Geometry | ||
updateIndexBufferInContextFromByteArray(data:ByteArray, byteArrayOffset:int, startOffset:int, count:int):void
Updates values of index-buffer in video memory. | Geometry | ||
updateIndexBufferInContextFromVector(data:Vector.<uint>, startOffset:int, count:int):void
Updates values of index-buffer in video memory. | Geometry | ||
updateVertexBufferInContextFromByteArray(index:int, data:ByteArray, byteArrayOffset:int, startVertex:int, numVertices:int):void
Updates values of vertex-buffer in video memory. | Geometry | ||
updateVertexBufferInContextFromVector(index:int, data:Vector.<Number>, startVertex:int, numVertices:int):void
Updates values of vertex-buffer in video memory. | Geometry | ||
upload(context3D:Context3D):void [override]
Uploads resource into given Context3D. | Geometry | ||
| indices | property |
indices:Vector.<uint>
Indexes of vertices for specifying of triangles of surface.
Example of specifying of surface, that consists of two triangles: Vector.<uint>([vertex_id_1,vertex_id_2,vertex_id_3,vertex_id_4,vertex_id_5,vertex_id_6]);.
public function get indices():Vector.<uint> public function set indices(value:Vector.<uint>):void| isUploaded | property |
isUploaded:Boolean [read-only] [override] Check for existence of resource in video memory.
public function get isUploaded():Boolean| numTriangles | property |
numTriangles:int [read-only] Number of triangles, that are contained in geometry.
public function get numTriangles():int| numVertexStreams | property |
numVertexStreams:int [read-only] Number of vertex-streams.
public function get numVertexStreams():int| numVertices | property |
numVertices:intNumber of vertices of geometry.
public function get numVertices():int public function set numVertices(value:int):void| Geometry | () | Constructor |
public function Geometry(numVertices:int = 0)Creates a new instance.
ParametersnumVertices:int (default = 0) — Number of vertices.
|
| addVertexStream | () | method |
public function addVertexStream(attributes:Array):intAdds a stream for set of parameters, that can be updated independently of the other sets of parameters.
Parameters
attributes:Array — List of parameters. Types of parameters are get from VertexAttributes.
|
int — Index of stream, that has been created.
|
| calculateNormals | () | method |
public function calculateNormals():voidCalculation of vertex normals.
| calculateTangents | () | method |
public function calculateTangents(uvChannel:int):voidCalculation of tangents and bi-normals. Normals of geometry must be calculated.
Parameters
uvChannel:int |
| dispose | () | method |
override public function dispose():void
Removes this resource from Context3D to which it was uploaded.
| findVertexStreamByAttribute | () | method |
public function findVertexStreamByAttribute(attribute:uint):intReturns index of stream, that contains needed attribute.
Parameters
attribute:uint |
int — -1 if attribute is not found.
|
| getAttributeOffset | () | method |
public function getAttributeOffset(attribute:uint):int
Offset of attribute at stream, with which this attribute is stored. You can find index of stream using findVertexStreamByAttribute.
Parameters
attribute:uint — Type of attribute. List of types of attributes placed at VertexAttributes.
|
int — Offset.
|
See also
| getAttributeValues | () | method |
public function getAttributeValues(attribute:uint):Vector.<Number>Parameters
attribute:uint |
Vector.<Number> |
| getVertexStreamAttributes | () | method |
public function getVertexStreamAttributes(index:int):Arrayreturns mapping of stream by index.
Parameters
index:int — index of stream.
|
Array — mapping.
|
| hasAttribute | () | method |
public function hasAttribute(attribute:uint):BooleanCheck the existence of attribute in all streams.
Parameters
attribute:uint — Attribute, that is checked.
|
Boolean —
|
| intersectRay | () | method |
alternativa3d function intersectRay(origin:Vector3D, direction:Vector3D, indexBegin:uint, numTriangles:uint):RayIntersectionDataParameters
origin:Vector3D | |
direction:Vector3D | |
indexBegin:uint | |
numTriangles:uint |
RayIntersectionData |
| setAttributeValues | () | method |
public function setAttributeValues(attribute:uint, values:Vector.<Number>):voidSets value for attribute. If buffer has not been initialized, then it initialized with zeros automatically.
Parameters
attribute:uint | |
values:Vector.<Number> |
| updateIndexBufferInContextFromByteArray | () | method |
public function updateIndexBufferInContextFromByteArray(data:ByteArray, byteArrayOffset:int, startOffset:int, count:int):voidUpdates values of index-buffer in video memory.
Parameters
data:ByteArray — Data
| |
byteArrayOffset:int — Offset
| |
startOffset:int — Number of updated values.
| |
count:int |
| updateIndexBufferInContextFromVector | () | method |
public function updateIndexBufferInContextFromVector(data:Vector.<uint>, startOffset:int, count:int):voidUpdates values of index-buffer in video memory.
Parameters
data:Vector.<uint> — List of values.
| |
startOffset:int — Offset.
| |
count:int — Count of updated values.
|
| updateVertexBufferInContextFromByteArray | () | method |
public function updateVertexBufferInContextFromByteArray(index:int, data:ByteArray, byteArrayOffset:int, startVertex:int, numVertices:int):voidUpdates values of vertex-buffer in video memory.
Parameters
index:int — Data
| |
data:ByteArray — Offset.
| |
byteArrayOffset:int — Number of updated values.
| |
startVertex:int | |
numVertices:int |
| updateVertexBufferInContextFromVector | () | method |
public function updateVertexBufferInContextFromVector(index:int, data:Vector.<Number>, startVertex:int, numVertices:int):voidUpdates values of vertex-buffer in video memory.
Parameters
index:int — List of values.
| |
data:Vector.<Number> — Offset.
| |
startVertex:int — Number of updated values.
| |
numVertices:int |
| upload | () | method |
override public function upload(context3D:Context3D):void
Uploads resource into given Context3D.
Parameters
context3D:Context3D — Context3D to which resource will uploaded.
|
var attributes:Array = new Array();
attributes[0] = VertexAttributes.POSITION;
attributes[1] = VertexAttributes.POSITION;
attributes[2] = VertexAttributes.POSITION;
attributes[3] = VertexAttributes.TEXCOORDS[0];
attributes[4] = VertexAttributes.TEXCOORDS[0];
var geometry = new Geometry();
geometry.addVertexStream(attributes);
geometry.numVertices = 3;
geometry.setAttributeValues(VertexAttributes.POSITION, new <Number>[x1,y1,z1,x2,y2,z2,x3,y3,z3]);
geometry.setAttributeValues(VertexAttributes.TEXCOORDS[0], new <Number>[u1,v1,u2,v2,u3,v3]);
geometry.indices = Vector.<uint>([0,1,2]);
getAttributeValues by parameter name, e.g.:
geometry.getAttributeValues(VertexAttributes.POSITION)
returns vector from coordinates: <Number>[x1,y1,z1,x2,y2,z2,x3,y3,z3].