Constructor
@:value({ _material : null })new(width:Float, height:Float, depth:Float, ?_material:FoxMaterial, ?usage:Int)
Methods
Inherited Variables
Defined by FoxMesh
@:value(0x88E4)bufferUsage:Int = 0x88E4
The buffer usage pattern for optimization purposes.
Note: This will be applied on the next call to setArrays().
@:value(3)vertexPerFace:Int = 3
By default, this mesh will use 3 vertices per face (a triangle), but you can change it to 4 (quads) or 2 (lines).
This will affect how the mesh is processed when drawing.
Note: To apply it correctly, call setArrays() directly afterwards.
Note 2: This currently needs to be implemented.
Inherited Methods
Defined by FoxMesh
setBuffer(type:FoxMeshBufferType, data:Array<Float>):Void
Writes buffer data on the GPU
Parameters:
type | The buffer to write to |
|---|---|
data | The data array |
setBufferRaw(type:FoxMeshBufferType, data:ArrayBufferView):Void
Writes buffer data on the GPU using an existing ArrayBufferView.
This method runs faster than setBuffer
@:value({ offset : 0 })updateBuffer(type:FoxMeshBufferType, data:Array<Float>, offset:Int = 0):Void
Updates buffer data on the GPU
Use this to set portions of it or are updating data constantly.
Tip: Make sure the buffer is set to GL.DYNAMIC_DRAW on its usage.
Parameters:
type | The buffer to update |
|---|---|
data | The data array |
offset | The index of the buffer where to start writing |
@:value({ offset : 0 })updateIndexBuffer(data:Array<Int>, offset:Int = 0):Void
Same as updateBuffer() but exclusive to the Index buffer
@:value({ offset : 0 })updateBufferRaw(type:FoxMeshBufferType, data:ArrayBufferView, offset:Int = 0):Void
Same as updateBuffer() and updateIndexBuffer(), but there's no data copying to a typed array,
instead, you provide it.
This method is faster than the other ones, but needs more setup.
setArrays(?vertices:Array<Float>, ?uvtData:Array<Float>, ?indices:Array<Int>, ?material_:FoxMaterial, ?normals:Array<Float>, ?colors:Array<Float>, ?weights:Array<Float>, ?influences:Array<Int>):Void
Creates buffers and uploads data to the GPU.