Static extension with additional helpers for ceramic.Mesh

Static methods

@:value({ floatsPerVertex : -1 })staticcreateQuad(mesh:Mesh, width:Float, height:Float, floatsPerVertex:Int = -1):Void

Generate vertices, indices and uvs on the given mesh to make it form a quad

Parameters:

mesh

The mesh to work with

width

With of the quad to form

height

Height of the quad to form

floatsPerVertex

(optional) Number of floats per vertex Set to 2 for regular quad, 6 for quads with dark color, must be 2 or higher. If not provided, will resolve the value from mesh.customFloatAttributesSize

staticsetDarkColor(mesh:Mesh, darkColor:Color):Void

Assign a dark color to the given mesh. The mesh is expected to have 6 floats per vertex and 4 last vertices will be used for color values.

Parameters:

mesh

The mesh to work with

darkColor

The dark color to assign

staticsetDarkAlphaColor(mesh:Mesh, darkAlphaColor:AlphaColor):Void

Assign a dark color (with alpha included) to the given mesh. The mesh is expected to have 6 floats per vertex and 4 last vertices will be used for color values.

Parameters:

mesh

The mesh to work with

darkColor

The dark color to assign

staticcreateArc(mesh:Mesh, radius:Float, angle:Float, thickness:Float, sides:Int, borderPosition:BorderPosition):Void

Generate vertices and indices to draw arc, pie, ring or disc geometry

Parameters:

mesh

The mesh to work with

radius

Radius of the arc

angle

Angle (from 0 to 360). 360 will make it draw a full circle/ring

thickness

Thickness of the arc. If same value as radius and borderPosition is INSIDE, will draw a pie.

sides

Number of sides. Higher is smoother but needs more vertices

borderPosition

Position of the drawn border

@:value({ attrLength : 0, staggerY : 0, staggerX : 0 })staticcreateVerticesGrid(mesh:Mesh, columns:Int, rows:Int, width:Float, height:Float, staggerX:Float = 0, staggerY:Float = 0, attrLength:Int = 0, ?attrValues:Array<Float>):Void

Create vertices to form a grid with the given options

Parameters:

mesh

The mesh to work with

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

@:value({ mirrorFlip : false, mirrorY : false, mirrorX : false })staticcreateIndicesGrid(mesh:Mesh, columns:Int, rows:Int, mirrorX:Bool = false, mirrorY:Bool = false, mirrorFlip:Bool = false):Void

Create indices to form a grid with the given options

Parameters:

mesh

The mesh to work with

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 mirrorX and mirrorY

staticcreateUVsGrid(mesh:Mesh, columns:Int, rows:Int):Void

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:

mesh

The mesh to work with

columns

The number of columns in the grid

rows

The number of rows in the grid