Show / Hide Table of Contents

    Class GeometryConstructor

    Utility class which guides the construction of meshes Provides helper methods to register vertices and create faces of different shapes

    Inheritance
    Object
    GeometryConstructor
    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
    List<Vector3>

    Triangles

    The triangles/faces of the geometry object

    Declaration
    public List<int> Triangles { get; }
    Property Value
    Type Description
    List<Int32>

    UVCoords

    Manually set UV coords

    Declaration
    public List<Vector2> UVCoords { get; }
    Property Value
    Type Description
    List<Vector2>

    Vertices

    The vertices of the geometry object

    Declaration
    public List<Vector3> Vertices { get; }
    Property Value
    Type Description
    List<Vector3>

    Methods

    AddQuad(Int32, Int32, Int32, Int32, Boolean)

    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
    Int32 v0

    Index of vertex 1

    Int32 v1

    Index of vertex 2

    Int32 v2

    Index of vertex 3

    Int32 v3

    Index of vertex 4

    Boolean flipNormals

    If set to true, the quad will face the other way

    AddTriangle(Int32, Int32, Int32, Boolean)

    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
    Int32 v0

    Index of vertex 1

    Int32 v1

    Index of vertex 2

    Int32 v2

    Index of vertex 3

    Boolean flipNormal

    If set to true, the triangle will face the other way

    AddTriangleFan(Int32, Int32[], Boolean)

    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
    Int32 poleVertex

    The pole vertex which is connected to all other vertices of the fan

    Int32[] otherVertices

    The vertices which span the fan

    Boolean flipNormals

    If set to true, the triangle fan will face the other way

    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
    Int32

    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
    Int32

    Returns the index of the created vertex

    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
    Int32

    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
    Int32

    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

    Back to top i5 Toolkit Documentation