Home › Page › UghTriangle

UghTriangle

UghTriangle is a helper class used chiefly by UghSprite to construct meshes.  It can be useful outside of UghSprite to aid in constructing custom meshes.

Variables
name type description
points Vector3[] The points of the triangle
uvs Vector2[] The uvs of the triangle
Constructors
name type description
UghTriangle Creates a new UghTriangle from parameters
Functions
name type description
AddToMeshList void Adds this triangle to the class mesh list
MakeQuad UghTriangle[] Makes and returns a new quad (composed of UghTriangles)

_

Using UghTriangle in Script

public void AddToMeshList(ref Vector3[] vertList, ref int[] triList, ref Vector2[] uvList)

This function aids in constructing a mesh by filling data in to the supplied arrays.  The supplied arrays will be expanded (as needed) to include the vertices of the UghTriangle instance.

static public UghTriangle[] MakeQuad(Vector3 topLeft, Vector2 topLeftUV, Vector3 bottomRight, Vector2 bottomRightUV)

Given top-left and bottom-right coordinates, this static function will output an array of UghTriangles that form a rectangle.  The coordinates are in Unity units.