Class MeshConstants
Inheritance
MeshConstants
Assembly: .dll
Syntax
public static class MeshConstants
Methods
AddManualBoundsToMesh(Mesh, Vector3, float, bool)
Adds some manual bounds to the mesh. Useful for shaders with vertex offsets.
Declaration
public static Mesh AddManualBoundsToMesh(Mesh mesh, Vector3 boundPivotWorldSpace, float boundRadius, bool flatZ = false)
Parameters
Type |
Name |
Description |
Mesh |
mesh |
The mesh to edit.
|
Vector3 |
boundPivotWorldSpace |
The pivot of the cubic bounds.
|
float |
boundRadius |
The radius of the cubic bounds.
|
bool |
flatZ |
|
Returns
getCustomIndependantQuadGrid(float, float, Vector2, int, int)
Declaration
public static Mesh getCustomIndependantQuadGrid(float length, float z, Vector2 pivot, int sizeX, int sizeY)
Parameters
Returns
getCustomIndependantQuadGrid_Normals(float, float, Vector2, int, int)
Declaration
public static Vector3[] getCustomIndependantQuadGrid_Normals(float length, float z, Vector2 pivot, int sizeX, int sizeY)
Parameters
Returns
Type |
Description |
Vector3[] |
|
getCustomIndependantQuadGrid_Triangles(float, float, Vector2, int, int)
Declaration
public static int[] getCustomIndependantQuadGrid_Triangles(float length, float z, Vector2 pivot, int sizeX, int sizeY)
Parameters
Returns
getCustomIndependantQuadGrid_UVs(float, float, Vector2, int, int)
Declaration
public static Vector2[] getCustomIndependantQuadGrid_UVs(float length, float z, Vector2 pivot, int sizeX, int sizeY)
Parameters
Returns
Type |
Description |
Vector2[] |
|
getCustomIndependantQuadGrid_Vertices(float, float, Vector2, int, int)
Declaration
public static Vector3[] getCustomIndependantQuadGrid_Vertices(float length, float z, Vector2 pivot, int sizeX, int sizeY)
Parameters
Returns
Type |
Description |
Vector3[] |
|
getDefaultMeshQuad()
Returns a copy the default mesh with length 1 and pivot (0.5, 0.5).
Declaration
public static Mesh getDefaultMeshQuad()
Returns
getDefaultMeshQuad(float)
Returns a default mesh with the given bound radius. Useful for shaders with vertex offsets.
Declaration
public static Mesh getDefaultMeshQuad(float boundRadius)
Parameters
Type |
Name |
Description |
float |
boundRadius |
The manually set bounds of the mesh.
|
Returns
getDefaultMeshQuad(float, float, Vector2)
Returns a copy the default mesh with definable length, z coordinate and pivot.
Declaration
public static Mesh getDefaultMeshQuad(float length, float z, Vector2 pivot)
Parameters
Type |
Name |
Description |
float |
length |
The length of a side.
|
float |
z |
z coordinate.
|
Vector2 |
pivot |
Pivot must be between (0,0) and (1,1).
|
Returns
getDefaultMeshQuad(Vector2)
Returns a copy the default mesh with definable pivot.
Declaration
public static Mesh getDefaultMeshQuad(Vector2 pivot)
Parameters
Type |
Name |
Description |
Vector2 |
pivot |
Pivot must be between (0,0) and (1,1).
|
Returns
getDefaultNormalsForQuad()
Returns the default normals for a quad. (Vector3.up x4).
Declaration
public static Vector3[] getDefaultNormalsForQuad()
Returns
Type |
Description |
Vector3[] |
|
getDefaultTrianglesForQuad()
Returns the default triangles fitting to the other methods in this class! (0, 2, 1, 1, 2, 3)
Declaration
public static int[] getDefaultTrianglesForQuad()
Returns
getDefaultTrianglesForQuadGrid(int)
Returns the default triangles for the quad grid starting from the bottom left for each row up to the top right.
Declaration
public static int[] getDefaultTrianglesForQuadGrid(int gridSize)
Parameters
Type |
Name |
Description |
int |
gridSize |
|
Returns
getDefaultUVMapForQuad()
Returns the default UV map for a texture. (0,0), (1,0), (0,1), (1,1).
Declaration
public static Vector2[] getDefaultUVMapForQuad()
Returns
Type |
Description |
Vector2[] |
|
getDefaultUVMapForQuadGrid(int)
Returns the default uv map that fits to the default vertices for the quad grid.
Declaration
public static Vector2[] getDefaultUVMapForQuadGrid(int gridSize)
Parameters
Type |
Name |
Description |
int |
gridSize |
|
Returns
Type |
Description |
Vector2[] |
|
getDefaultVerticesForQuad()
Returns the default Quad Vertices with length 1 and pivot (0.5,0.5).
Declaration
public static Vector3[] getDefaultVerticesForQuad()
Returns
Type |
Description |
Vector3[] |
|
getDefaultVerticesForQuad(float, float, Vector2)
Returns the default Quad Vertices with definable length, z coordinate and pivot. (0,0); (1,0); (0,1); (1,1) for length 1 and pivot (0,0). Pivot must be between (0,0) and (1,1).
Declaration
public static Vector3[] getDefaultVerticesForQuad(float length, float z, Vector2 pivot)
Parameters
Type |
Name |
Description |
float |
length |
The length of a side.
|
float |
z |
z coordinate.
|
Vector2 |
pivot |
Pivot must be between (0,0) and (1,1).
|
Returns
Type |
Description |
Vector3[] |
|
getDefaultVerticesForQuad(Vector2)
Returns the default Quad Vertices with length 1 and custom pivot.
Declaration
public static Vector3[] getDefaultVerticesForQuad(Vector2 pivot)
Parameters
Type |
Name |
Description |
Vector2 |
pivot |
|
Returns
Type |
Description |
Vector3[] |
|
getDefaultVerticesForQuadGrid(int, float, float, Vector2)
Returns the default Quad Grid Vertices with definable size, quad length, z coordinate and pivot in the lower left quad. (0,1); (1,1); (0,0); (1,0) for length 1 and pivot (0,0). Pivot must be between (0,0) and (1,1).
Declaration
public static Vector3[] getDefaultVerticesForQuadGrid(int gridSize, float length, float z, Vector2 pivot)
Parameters
Type |
Name |
Description |
int |
gridSize |
|
float |
length |
|
float |
z |
|
Vector2 |
pivot |
|
Returns
Type |
Description |
Vector3[] |
|
getVerticesForIndependantQuadGrid(int, float, float, Vector2, int)
Returns Quad Grid Vertices where each Quad does not share vertices with the next Quad. Has the option for multiple of the same vertices on top of each other (e.g. for blending multiple textures on top of each other). Includes definable size, quad length, z coordinate and pivot in the lower left quad. (0,1); (1,1); (0,0); (1,0) for length 1 and pivot (0,0). Pivot must be between (0,0) and (1,1).
Note: For example if we have amountOfQuadsOnTopOfEachOther=2: We draw the first Quad in the bottom left, then the same Quad again, then the next Quad to the right, then again this one, ...
Declaration
public static Vector3[] getVerticesForIndependantQuadGrid(int gridSize, float length, float z, Vector2 pivot, int amountOfQuadsOnTopOfEachOther)
Parameters
Type |
Name |
Description |
int |
gridSize |
|
float |
length |
|
float |
z |
|
Vector2 |
pivot |
|
int |
amountOfQuadsOnTopOfEachOther |
|
Returns
Type |
Description |
Vector3[] |
|
offsetMeshVertices(Mesh, Vector3)
Offsets the mesh's vertices by a certain vector.
Declaration
public static Mesh offsetMeshVertices(Mesh mesh, Vector3 offsetVector)
Parameters
Type |
Name |
Description |
Mesh |
mesh |
|
Vector3 |
offsetVector |
|
Returns
scaleMeshAroundPivot(Mesh, Vector3)
Scales a mesh around the pivot. From the scaleVector each coordinate is multiplied with the corresponding coordinates from the mesh vertices.
Declaration
public static Mesh scaleMeshAroundPivot(Mesh mesh, Vector3 scaleVector)
Parameters
Type |
Name |
Description |
Mesh |
mesh |
|
Vector3 |
scaleVector |
|
Returns