Class GeometryConstructor
Utility class which guides the construction of meshes Provides helper methods to register vertices and create faces of different shapes
Inheritance
Namespace: i5.Toolkit.Core.ProceduralGeometry
Assembly: cs.temp.dll.dll
Syntax
public class GeometryConstructor
Constructors
GeometryConstructor()
Creates the geometry constructor to buid the mesh data You can only add geometry, not remove it
Declaration
public GeometryConstructor()
Properties
Name
The name of the produced mesh
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Normals
Manually set normals
Declaration
public List<Vector3> Normals { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><Vector3> |
Triangles
The triangles/faces of the geometry object
Declaration
public List<int> Triangles { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><int> |
UVCoords
Manually set UV coords
Declaration
public List<Vector2> UVCoords { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><Vector2> |
Vertices
The vertices of the geometry object
Declaration
public List<Vector3> Vertices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><Vector3> |
Methods
AddQuad(int, int, int, int, bool)
Adds a quad to the geometry (by adding two triangles) List the four vertices in clockwise order as seen from the outside The diagonal will be created between the first and third vertex The indices must exist in the geometry, i.e. they first need to be added using AddVertex()
Declaration
public void AddQuad(int v0, int v1, int v2, int v3, bool flipNormals = false)
Parameters
Type | Name | Description |
---|---|---|
int | v0 | Index of vertex 1 |
int | v1 | Index of vertex 2 |
int | v2 | Index of vertex 3 |
int | v3 | Index of vertex 4 |
bool | flipNormals | If set to true, the quad will face the other way |
AddTriangle(int, int, int, bool)
Adds a triangle to the geometry List the three vertices in clockwise order as seen from the outside The indices must exist in the geometry, i.e. they first need to be added using AddVertex()
Declaration
public void AddTriangle(int v0, int v1, int v2, bool flipNormal = false)
Parameters
Type | Name | Description |
---|---|---|
int | v0 | Index of vertex 1 |
int | v1 | Index of vertex 2 |
int | v2 | Index of vertex 3 |
bool | flipNormal | If set to true, the triangle will face the other way |
AddTriangleFan(int, int[], bool)
Adds a fan of triangles to the geometry List the otherVertices clockwise The indices must exist in the geometry, i.e. they first need to be added using AddVertex()
Declaration
public void AddTriangleFan(int poleVertex, int[] otherVertices, bool flipNormals = false)
Parameters
Type | Name | Description |
---|---|---|
int | poleVertex | The pole vertex which is connected to all other vertices of the fan |
int[] | otherVertices | The vertices which span the fan |
bool | flipNormals | If set to true, the triangle fan will face the other way |
AddVertex(Vector3, Vector2, Vector3)
Adds a disconnected vertex to the geometry with the given coordinates, UV coordinates and normal vector
Declaration
public int AddVertex(Vector3 coordinates, Vector2 uvCoordinates, Vector3 normalVector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | coordinates | The 3D coordinates of the vertex |
Vector2 | uvCoordinates | The texture UV coordinates of the vertex |
Vector3 | normalVector | The normal vector of the vertex |
Returns
Type | Description |
---|---|
int | Returns the index of the created vertex |
AddVertex(Vector3, Vector2)
Adds a disconnected vertex to the geometry with the given coordinates and UV coordinates
Declaration
public int AddVertex(Vector3 coordinates, Vector2 uvCoordinates)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | coordinates | The 3D coordinates of the vertex |
Vector2 | uvCoordinates | The texture UV coordinates of the vertex |
Returns
Type | Description |
---|---|
int | Returns the index of the created vertex |
AddVertex(Vector3, Vector3)
Adds a disconnected vertex to the geometry with a given normal vector The normal vector is only used if a normal vector is supplied for every vertex
Declaration
public int AddVertex(Vector3 coordinates, Vector3 normalVector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | coordinates | The coordinates of the vertex |
Vector3 | normalVector | The normal vector which should be used |
Returns
Type | Description |
---|---|
int | The index of the created vertex |
AddVertex(Vector3)
Adds a disconnected, unnamed vertex to the geometry
Declaration
public int AddVertex(Vector3 coordinates)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | coordinates | The coordinates of the vertex |
Returns
Type | Description |
---|---|
int | The index of the created vertex |
ConstructMesh()
Builds a mesh from the constructed geometry data
Declaration
public Mesh ConstructMesh()
Returns
Type | Description |
---|---|
Mesh | The constructed mesh which is described by these geometry data |