## Libraries.Game.Graphics.MeshBuilder Documentation

*Inherits from: *Libraries.Language.Object

## Summary

### Variable Summary Table

Variables | Description |
---|---|

integer TRIANGLES | The TRIANGLES value is one of the possible primitive type values. The Mesh will form triangles from triplets of vertice |

integer POINTS | The POINTS value is one of the possible primitive type values. It is used to indicate that each vertex of the Mesh should be considered an individual point, separate from the other vertice |

integer LINES | The LINES value is one of the possible primitive type values. The Mesh will form lines using pairs of vertice |

### Actions Summary Table

## Actions Documentation

### AddIndex(integer value)

This action will add a new index to the indices of the Mesh under constructio

#### Parameters

### AddLine(Libraries.Game.Graphics.VertexSchematic point1, Libraries.Game.Graphics.VertexSchematic point2)

This action will add two new vertices to the current Mesh under construction, and then create a line between them. This is only valid if the primitive type being used is LINES - otherwise, an error will be throw

#### Parameters

### AddLine(integer index1, integer index2)

This action will create a new line between the two given indices in the Mesh under construction. This is only valid if the primitive type being used is LINES - otherwise, an error will be throw

#### Parameters

### AddLine(number x1, number y1, number z1, number x2, number y2, number z2)

This action will add two new vertices to the current Mesh under construction, and then create a line between them. This is only valid if the primitive type being used is LINES - otherwise, an error will be throw

#### Parameters

### AddLine(Libraries.Compute.Vector3 point1, Libraries.Game.Graphics.Color color1, Libraries.Compute.Vector3 point2, Libraries.Game.Graphics.Color color2)

This action will add two new vertices to the current Mesh under construction, and then create a line between them. This is only valid if the primitive type being used is LINES - otherwise, an error will be throw

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Game.Graphics.Color
- Libraries.Compute.Vector3
- Libraries.Game.Graphics.Color

### AddLine(Libraries.Compute.Vector3 point1, Libraries.Compute.Vector3 point2)

#### Parameters

### AddMesh(Libraries.Containers.Array<number> vertices, Libraries.Containers.Array<integer> indices)

This action will add the given vertex and index arrays to the geometry of the Mesh currently under construction by the MeshBuilde

#### Parameters

### AddTriangle(Libraries.Game.Graphics.VertexSchematic point1, Libraries.Game.Graphics.VertexSchematic point2, Libraries.Game.Graphics.VertexSchematic point3)

This action will add three new vertices to the Mesh under construction, and create a triangle between them. The primitive type used must be POINTS, LINES, or TRIANGLES. Otherwise, an error will be throw

#### Parameters

- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic

### AddTriangle(integer index1, integer index2, integer index3)

This action will create a new triangle between the three given indices in the Mesh under construction. This is only valid if the primitive type being used is either POINTS, LINES, or TRIANGLES. Otherwise, an error will be throw

#### Parameters

### AddTriangle(Libraries.Compute.Vector3 point1, Libraries.Game.Graphics.Color color1, Libraries.Compute.Vector3 point2, Libraries.Game.Graphics.Color color2, Libraries.Compute.Vector3 point3, Libraries.Game.Graphics.Color color3)

This action will add three new vertices to the Mesh under construction, and create a triangle between them. The primitive type used must be POINTS, LINES, or TRIANGLES. Otherwise, an error will be throw

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Game.Graphics.Color
- Libraries.Compute.Vector3
- Libraries.Game.Graphics.Color
- Libraries.Compute.Vector3
- Libraries.Game.Graphics.Color

### AddTriangle(Libraries.Compute.Vector3 point1, Libraries.Compute.Vector3 point2, Libraries.Compute.Vector3 point3)

This action will add three new vertices to the Mesh under construction, and create a triangle between them. The primitive type used must be POINTS, LINES, or TRIANGLES. Otherwise, an error will be throw

#### Parameters

### AddVertex(Libraries.Game.Graphics.VertexSchematic schematic)

This action will add the vertex described by the given VertexSchematic to the Mesh currently under construction. This action will return the index of the newly added verte

#### Parameters

#### Return

integer:

### AddVertex(Libraries.Compute.Vector3 pos, Libraries.Compute.Vector3 norm, Libraries.Game.Graphics.Color col, Libraries.Compute.Vector2 uv)

This action will create a new vertex and add it to the Mesh currently under construction. The index of the newly created vertex will be returne

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Game.Graphics.Color
- Libraries.Compute.Vector2

#### Return

integer:

### Begin(Libraries.Game.Graphics.VertexAttributes vAttributes)

This action informs the MeshBuilder to begin constructing a new mesh. If a mesh is already in construction, this will throw an erro

#### Parameters

### Begin(Libraries.Game.Graphics.VertexAttributes vAttributes, integer type)

This action informs the MeshBuilder to begin constructing a new mesh. If a mesh is already in construction, this will throw an error. The VertexAttributes must contain at least a Position attribute, and can also contain Normal, Binormal, Tangent, ColorUnpacked, ColorPacked, or TextureCoordinates attributes. The type should be one of the primitive type constants in the MeshBuilder: POINTS, LINES, or TRIANGLE

#### Parameters

### BuildBox(Libraries.Compute.Vector3 corner000, Libraries.Compute.Vector3 corner010, Libraries.Compute.Vector3 corner100, Libraries.Compute.Vector3 corner110, Libraries.Compute.Vector3 corner001, Libraries.Compute.Vector3 corner011, Libraries.Compute.Vector3 corner101, Libraries.Compute.Vector3 corner111)

This action will create a box using the 8 provided vertice

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3

### BuildBox(Libraries.Game.Graphics.VertexSchematic corner000, Libraries.Game.Graphics.VertexSchematic corner010, Libraries.Game.Graphics.VertexSchematic corner100, Libraries.Game.Graphics.VertexSchematic corner110, Libraries.Game.Graphics.VertexSchematic corner001, Libraries.Game.Graphics.VertexSchematic corner011, Libraries.Game.Graphics.VertexSchematic corner101, Libraries.Game.Graphics.VertexSchematic corner111)

This action will create a box using the 8 provided vertice

#### Parameters

- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic

### BuildBox(number width, number height, number depth)

This action will build a box with the given width, height, and dept

#### Parameters

### BuildBox(number x, number y, number z, number width, number height, number depth)

This action will build a box at the provided coordinates with the given width, height, and dept

#### Parameters

### BuildCylinder(number width, number height, number depth, integer divisions)

This action will build a cylinder shape with the given width, height, and depth. The curve of the cylinder will be made using the provided number of divisions to approximate the curve using straight edge

#### Parameters

### BuildCylinder(number width, number height, number depth, integer divisions, number angleFrom, number angleTo, boolean close)

This action will build a cylinder shape with the given width, height, and depth. The curve of the cylinder will be made using the provided number of divisions to form straight edges from the starting angle to the ending angle (in degrees). If the provided boolean is true, the cylinder will be closed (the ends will be capped). Otherwise, the cylinder will be open (the ends will not be capped

#### Parameters

### BuildCylinder(number width, number height, number depth, integer divisions, number angleFrom, number angleTo)

This action will build a cylinder shape with the given width, height, and depth. The curve of the cylinder will be made using the provided number of divisions to form straight edges from the starting angle to the ending angle (in degrees

#### Parameters

### BuildEllipse(number width, number height, integer divisions, Libraries.Compute.Vector3 center, Libraries.Compute.Vector3 normal, number angleFrom, number angleTo)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, number innerWidth, number innerHeight, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ, number angleFrom, number angleTo)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, integer divisions, Libraries.Compute.Vector3 center, Libraries.Compute.Vector3 normal, Libraries.Compute.Vector3 tangent, Libraries.Compute.Vector3 binormal)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3

### BuildEllipse(number width, number height, number innerWidth, number innerHeight, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ, number tangentX, number tangentY, number tangentZ, number binormalX, number binormalY, number binormalZ, number angleFrom, number angleTo)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, number innerWidth, number innerHeight, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ, number angleFrom, number angleTo)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, number innerWidth, number innerHeight, integer divisions, Libraries.Compute.Vector3 center, Libraries.Compute.Vector3 normal)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ, number tangentX, number tangentY, number tangentZ, number binormalX, number binormalY, number binormalZ, number angleFrom, number angleTo)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, integer divisions, Libraries.Compute.Vector3 center, Libraries.Compute.Vector3 normal, Libraries.Compute.Vector3 tangent, Libraries.Compute.Vector3 binormal, number angleFrom, number angleTo)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3

### BuildEllipse(number width, number height, integer divisions, Libraries.Compute.Vector3 center, Libraries.Compute.Vector3 normal)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ, number tangentX, number tangentY, number tangentZ, number binormalX, number binormalY, number binormalZ)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildEllipse(number width, number height, integer divisions, number centerX, number centerY, number centerZ, number normalX, number normalY, number normalZ)

This action will add an ellipse to the geometry of the mesh that is under constructio

#### Parameters

### BuildPlane(Libraries.Game.Graphics.VertexSchematic corner00, Libraries.Game.Graphics.VertexSchematic corner01, Libraries.Game.Graphics.VertexSchematic corner10, Libraries.Game.Graphics.VertexSchematic corner11, boolean doubleSided)

This action will create a box using the 8 provided vertice

#### Parameters

- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic

### BuildPlane(number x, number y, number z, number width, number depth, boolean doubleSided)

This action will build a box with the given width, height, and dept

#### Parameters

### BuildPlane(number width, number depth, boolean doubleSided)

This action will build a box at the provided coordinates with the given width, height, and dept

#### Parameters

### BuildRectangle(integer corner00, integer corner10, integer corner11, integer corner01)

This action will add a new Rectangle to the Mesh under construction, using the given indices to form the rectangle. The supported primitive types are POINTS, LINES, and TRIANGLES - any other primitive type will throw an erro

#### Parameters

### BuildRectangle(Libraries.Game.Graphics.VertexSchematic corner00, Libraries.Game.Graphics.VertexSchematic corner10, Libraries.Game.Graphics.VertexSchematic corner11, Libraries.Game.Graphics.VertexSchematic corner01)

This action will add four new vertices to the Mesh under construction, and form a rectangle between them. The primitive type used must be POINTS, LINES, or TRIANGLES - otherwise, an error will be throw

#### Parameters

- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic
- Libraries.Game.Graphics.VertexSchematic

### BuildRectangle(Libraries.Compute.Vector3 corner00, Libraries.Compute.Vector3 corner10, Libraries.Compute.Vector3 corner11, Libraries.Compute.Vector3 corner01, Libraries.Compute.Vector3 normal)

This action will add four new vertices to the Mesh under construction, and form a rectangle between them. The primitive type used must be POINTS, LINES, or TRIANGLES - otherwise, an error will be throw

#### Parameters

- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3

### BuildSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, number angleUFrom, number angleUTo, number angleVFrom, number angleVTo)

This action will add a sphere to the geometry of the mesh under constructio

#### Parameters

### BuildSphere(number width, number height, number depth, integer divisionsU, integer divisionsV)

This action will add a sphere to the geometry of the mesh under constructio

#### Parameters

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

**Example Code**

```
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle
```

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

integer: The Compare result, Smaller, Equal, or Larger.

### Empty()

Empties the data being built up until now, including the vertices, indices, and all parts. Must be called between Begin() and End() to have any effect. This effectively discards all work done since the initial Begin(), but will not reset state such as UV region, color, or vertex transfor

### End()

This action will finish construction of the current Mesh, and then return i

#### Return

### EnsureIndices(integer numIndices)

This action will ensure that the current Mesh under construction will support all of its current indices, plus the given number of additional indice

#### Parameters

### EnsureRectangleIndices(integer numRectangles)

This action will guarantee that the Mesh under construction will have the proper number of indices to form the given number of rectangles, based on what primitive type has already been set for the Mes

#### Parameters

### EnsureTriangleIndices(integer numTriangles)

This action will guarantee that the Mesh under construction will have the proper number of indices to form the given number of triangles, based on what primitive type has already been set for the Mes

#### Parameters

### EnsureVertices(integer numVertices)

This action will ensure that the current Mesh under construction will have enough room to store the given number of vertices, in addition to what it is currently storin

#### Parameters

### Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

**Example Code**

```
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(
```

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

boolean: True if the hash codes are equal and false if they are not equal.

### GetAttributes()

This action will return the attributes that were given for the current Mesh under construction. If there isn't a Mesh currently being built, this will be undefine

#### Return

Libraries.Game.Graphics.VertexAttributes:

### GetHashCode()

This action gets the hash code for an object.

**Example Code**

```
Object o
integer hash = o:GetHashCode
```

#### Return

integer: The integer hash code of the object.

### GetIndices()

This action will return a copy of the indices that have been built so far. This action is only valid between calls to Begin() and End() - otherwise, this action will throw an erro

#### Return

### GetIndicesCount()

This action will return the number of indices that has been built so far in the Mesh currently under construction. This is only valid between calls to Begin() and End(

#### Return

integer:

### GetLastIndex()

This action will return what the last index used was during the construction of a Mes

#### Return

integer:

### GetMeshPart()

This action will return the MeshPart currently under construction by the MeshBuilder. If there isn't a MeshPart under construction, then this will be undefine

#### Return

Libraries.Game.Graphics.ModelData.MeshPart:

### GetPrimitiveType()

This action will return the primitive type being used to define the geometry of the current Mesh under construction. The primitive type is an integer value that represents an OpenGL constant, such as TRIANGLE

#### Return

integer:

### GetVertexSize()

This action will return the amount of number components that makes up each verte

#### Return

integer:

### GetVertexTransform()

This action will return a new Matrix4 object containing a copy of the vertex transformation matrix that the current Mesh being built is usin

#### Return

### GetVertices()

This action will return a copy of all of the vertices built so far. This action must be called between Begin() and End() - otherwise, an error will be throw

#### Return

### GetVerticesCount()

This action returns the number of vertices that have been built so far for the current Mesh under construction. This will only return a valid result if used between calls to Begin() and End(

#### Return

number:

### IsVertexTransformationEnabled()

This action will return whether or not the Mesh under construction is currently using a Matrix4 to transform its vertice

#### Return

boolean:

### NewPart(text id, integer type)

This action will start constructing a new MeshPart for the Mesh. The new MeshPart will still not be usable until End() is called. This will reset any current color and vertex transformation

#### Parameters

#### Return

Libraries.Game.Graphics.ModelData.MeshPart:

### SetColor(Libraries.Game.Graphics.Color newColor)

This action will set the color value of the vertices that are created during Mesh constructio

#### Parameters

### SetColor(number red, number green, number blue, number alpha)

This action will set the color value of the vertices that are created during Mesh construction. The color is made of a red, green, blue, and alpha (or transparency) componen

#### Parameters

### SetUVRange(number u1, number v1, number u2, number v2)

This action will set the UV range that will be applied to the vertices of the Mesh under construction. The UV values are used to determine how a texture should be mapped onto the Mes

#### Parameters

### SetUVRange(Libraries.Game.Graphics.TextureRegion region)

This action will set the UV range that will be applied to the vertices of the Mesh under construction. The UV values are used to determine how a texture should be mapped onto the Mes

#### Parameters

### SetVertexTransform(Libraries.Compute.Matrix4 transform)

This action will set the transformation matrix for the vertices of the Mesh that is under constructio

#### Parameters

### SetVertexTransformationEnabled(boolean enabled)

This action will set the MeshBuilder to allow for vertex transformation using a Matrix4 objec