Static methods
staticcreateVerticesGrid(?vertices:Array<Float>, columns:Int, rows:Int, width:Float, height:Float, staggerX:Float = 0, staggerY:Float = 0, attrLength:Int = 0, ?attrValues:Array<Float>):Array<Float>
Create vertices to form a grid with the given options
Parameters:
vertices | (optional) The existing vertices. If provided, will be used as result instead of creating a new array |
---|---|
columns | The number of columns in the grid |
rows | The number of rows in the grid |
width | The total width of the grid |
height | The total height of the grid |
staggerX | (optional, default 0) A stagger value to offset rows by this value |
staggerY | (optional, default 0) A stagger value to offset columns by this value |
attrLength | (optional, default 0) The number of attribute values per vertex |
attrValues | (optional) The attributes buffer that will be added to vertex data |
Returns:
The generated vertices
staticcreateIndicesGrid(?indices:Array<Int>, columns:Int, rows:Int, mirrorX:Bool = false, mirrorY:Bool = false, mirrorFlip:Bool = false):Array<Int>
Create indices to form a grid with the given options
Parameters:
indices | (optional) The existing indices. If provided, will be used as result instead of creating a new array |
---|---|
columns | The number of columns in the grid |
rows | The number of rows in the grid |
mirrorX | (optional, default false) Mirror triangles horizontally in odd columns |
mirrorY | (optional, default false) Mirror triangles vertically in odd rows |
mirrorFlip | (optional, default false) Invert the mirroring described by |
Returns:
The generated indices
staticcreateUVsGrid(?uvs:Array<Float>, columns:Int, rows:Int):Array<Float>
Create uvs to match a grid with the given options. The uvs will be distributed linearly across the mesh so that when displaying a texture it would be stretched to the grid.
Parameters:
uvs | (optional) The existing uvs. If provided, will be used as result instead of creating a new array |
---|---|
columns | The number of columns in the grid |
rows | The number of rows in the grid |
Returns:
The generated uvs