Libraries.Game.Graphics.MeshBuilder Documentation

Inherits from: Libraries.Language.Object

Variables Table

VariablesDescription
integer POINTSThe 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 vertices.
integer LINESThe LINES value is one of the possible primitive type values. The Mesh will form lines using pairs of vertices.
integer TRIANGLESThe TRIANGLES value is one of the possible primitive type values. The Mesh will form triangles from triplets of vertices.

Actions Documentation

AddIndex(integer value)

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

Parameters

  • integer value

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 thrown.

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 thrown.

Parameters

  • integer index1
  • integer index2

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 thrown.

Parameters

  • number x1
  • number y1
  • number z1
  • number x2
  • number y2
  • number z2

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 thrown.

Parameters

AddLine(Libraries.Compute.Vector3 point1, Libraries.Compute.Vector3 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 thrown.

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 MeshBuilder.

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 thrown.

Parameters

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 thrown.

Parameters

  • integer index1
  • integer index2
  • integer index3

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 thrown.

Parameters

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 thrown.

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 vertex.

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 returned.

Parameters

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 error.

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 TRIANGLES.

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)

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)

BuildBox(number width, number height, number depth)

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

Parameters

  • number width
  • number height
  • number depth

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 depth.

Parameters

  • number x
  • number y
  • number z
  • number width
  • number height
  • number depth

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 edges.

Parameters

  • number width
  • number height
  • number depth
  • integer divisions

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

  • number width
  • number height
  • number depth
  • integer divisions
  • number angleFrom
  • number angleTo
  • boolean close

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

  • number width
  • number height
  • number depth
  • integer divisions
  • number angleFrom
  • number angleTo

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 construction.

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 construction.

Parameters

  • 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

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 construction.

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 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 construction.

Parameters

  • 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

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 construction.

Parameters

  • number width
  • number height
  • number innerWidth
  • number innerHeight
  • integer divisions
  • number centerX
  • number centerY
  • number centerZ
  • number normalX
  • number normalY
  • number normalZ

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 construction.

Parameters

  • number width
  • number height
  • integer divisions
  • number centerX
  • number centerY
  • number centerZ
  • number normalX
  • number normalY
  • number normalZ
  • number angleFrom
  • number angleTo

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 construction.

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 construction.

Parameters

  • 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

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 construction.

Parameters

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 construction.

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 construction.

Parameters

  • 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

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 construction.

Parameters

  • number width
  • number height
  • integer divisions
  • number centerX
  • number centerY
  • number centerZ
  • number normalX
  • number normalY
  • number normalZ

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

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 depth.

Parameters

  • number x
  • number y
  • number z
  • number width
  • number depth
  • boolean doubleSided

BuildPlane(number width, number depth, boolean doubleSided)

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

Parameters

  • number width
  • number depth
  • boolean doubleSided

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 error.

Parameters

  • integer corner00
  • integer corner10
  • integer corner11
  • integer corner01

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 thrown.

Parameters

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 thrown.

Parameters

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 construction.

Parameters

  • number width
  • number height
  • number depth
  • integer divisionsU
  • integer divisionsV
  • number angleUFrom
  • number angleUTo
  • number angleVFrom
  • number angleVTo

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

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

Parameters

  • number width
  • number height
  • number depth
  • integer divisionsU
  • integer divisionsV

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.

Parameters

Return

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

Example

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

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 transform.

End()

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

Return

Libraries.Game.Graphics.Mesh:

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 indices.

Parameters

  • integer numIndices

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 Mesh.

Parameters

  • integer numRectangles

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 Mesh.

Parameters

  • integer numTriangles

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 storing.

Parameters

  • integer numVertices

Equals(Libraries.Language.Object object)

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

Parameters

Return

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

Example

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

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 undefined.

Return

Libraries.Game.Graphics.VertexAttributes:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

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 error.

Return

Libraries.Containers.Array:

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 Mesh.

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 undefined.

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 TRIANGLES.

Return

integer:

GetVertexSize()

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

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 using.

Return

Libraries.Compute.Matrix4:

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 thrown.

Return

Libraries.Containers.Array:

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 vertices.

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 transformations.

Parameters

  • text id
  • integer type

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 construction.

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) component.

Parameters

  • number red
  • number green
  • number blue
  • number alpha

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 Mesh.

Parameters

  • number u1
  • number v1
  • number u2
  • number v2

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 Mesh.

Parameters

SetVertexTransform(Libraries.Compute.Matrix4 transform)

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

Parameters

SetVertexTransformationEnabled(boolean enabled)

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

Parameters

  • boolean enabled