Class Geometry
Stores three dimensional, polygonal geometry and provides methods for manipulation. To actually render the geometry in the engine, convert Geometry to Mesh objects.
Inheritance
Inherited Members
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class Geometry
Constructors
Geometry()
Initializes a new instance of the Geometry class.
Declaration
public Geometry()
Properties
Faces
Gets and sets the faces.
Declaration
public IList<Face> Faces { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<Face> | The faces. |
HasNormals
Gets a value indicating whether this instance has normals.
Declaration
public bool HasNormals { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
HasTexCoords
Gets a value indicating whether this instance has texture coordinates.
Declaration
public bool HasTexCoords { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Normals
Gets and sets the normals.
Declaration
public IList<double3> Normals { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<double3> | The normals. |
TexCoords
Gets and sets the texture coordinates.
Declaration
public IList<double2> TexCoords { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<double2> | The texture coordinates. |
Vertices
The list of vertices (3D positions).
Declaration
public IList<double3> Vertices { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<double3> | The vertices. |
Methods
AddFace(Int32[], Int32[], Int32[])
Adds the face.
Declaration
public int AddFace(int[] vertInx, int[] texCoordInx, int[] normalInx)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | vertInx | The vert inx. |
System.Int32[] | texCoordInx | The tex coord inx. |
System.Int32[] | normalInx | The normal inx. |
Returns
Type | Description |
---|---|
System.Int32 | The face count as integer value. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | vertInx |
System.ArgumentException | "Vertex index out of range: vertInx[i]" or "Number of texture coordinate indices must match number of vertex indices" or "Texture coordinate index out of range: texCoordInx[i]" or "Number of normal indices must match number of vertex indices" or "Normal index out of range: normalInx[i]" |
AddNormal(double3)
Adds the normal.
Declaration
public int AddNormal(double3 normal)
Parameters
Type | Name | Description |
---|---|---|
double3 | normal | The normal. |
Returns
Type | Description |
---|---|
System.Int32 | The count of Normals. |
AddTexCoord(double2)
Adds the texture coordinates.
Declaration
public int AddTexCoord(double2 uv)
Parameters
Type | Name | Description |
---|---|---|
double2 | uv | Texture coordinate |
Returns
Type | Description |
---|---|
System.Int32 | The count of TexCoords. |
AddVertex(double3)
Adds a vertex.
Declaration
public int AddVertex(double3 v)
Parameters
Type | Name | Description |
---|---|---|
double3 | v | A 3D vector. |
Returns
Type | Description |
---|---|
System.Int32 | The current vertex count. |
CalcFaceNormal(Face)
Calculates the normal vector for a given face.
Declaration
public double3 CalcFaceNormal(Face f)
Parameters
Type | Name | Description |
---|---|---|
Face | f | The face to calculate the normal for. |
Returns
Type | Description |
---|---|
double3 | The normal vector for the face. |
Exceptions
Type | Condition |
---|---|
System.Exception | The face doesn't consist of 3 or more vertices. |
CreateNormals(Double)
Creates normals for the entire geometry based on a given smoothing angle.
Declaration
public void CreateNormals(double smoothingAngle)
Parameters
Type | Name | Description |
---|---|---|
System.Double | smoothingAngle | The smoothing angle. |
GetAllFacesContainingVertex(Int32, out IList<Int32>)
Gets all faces containing a certain vertex.
Declaration
public IList<int> GetAllFacesContainingVertex(int iV, out IList<int> vertInFace)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iV | The index of the vertex. |
System.Collections.Generic.IList<System.Int32> | vertInFace | Out parameter: A list of indices of the vertex in each respective face. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Int32> | A list of indices containing the vertex. |
ToMesh()
Converts the whole geometry to a Mesh.
Declaration
public Mesh ToMesh()
Returns
Type | Description |
---|---|
Mesh | An equivalent instance of Mesh. |