Class PrimitiveModelBuilder
Represents a builder for primitive models.
Inherited Members
Namespace: Evergine.Components.Primitives
Assembly: Evergine.Components.dll
Syntax
public class PrimitiveModelBuilder
Properties
VerticesCount
Gets the vertices count.
Declaration
public int VerticesCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
AddIndex(int)
Adds a new index to the primitive model.
Declaration
public void AddIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index. |
Remarks
This should only be called during the initialization process, before InitializePrimitive.
AddVertex(Vector3, Vector3)
Adds a new vertex to the primitive model.
Declaration
public void AddVertex(Vector3 position, Vector3 normal)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position. |
| Vector3 | normal | The normal. |
Remarks
This should only be called during the initialization process, before InitializePrimitive.
AddVertex(Vector3, Vector3, Vector2)
Adds a new vertex to the primitive model.
Declaration
public void AddVertex(Vector3 position, Vector3 normal, Vector2 texcoord)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position. |
| Vector3 | normal | The normal. |
| Vector2 | texcoord | The texture coordinate. |
Remarks
This should only be called during the initialization process, before InitializePrimitive.
AddVertex(Vector3, Vector3, Vector3, Vector2)
Adds a new vertex to the primitive model.
Declaration
public void AddVertex(Vector3 position, Vector3 normal, Vector3 tangent, Vector2 texcoord)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position. |
| Vector3 | normal | The normal. |
| Vector3 | tangent | The tangent. |
| Vector2 | texcoord | The texture coordinate. |
Remarks
This should only be called during the initialization process, before InitializePrimitive.
AddVertex(Vector3, Vector3, Vector3, Vector2, Color)
Adds a new vertex to the primitive model.
Declaration
public void AddVertex(Vector3 position, Vector3 normal, Vector3 tangent, Vector2 texcoord, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position. |
| Vector3 | normal | The normal. |
| Vector3 | tangent | The tangent. |
| Vector2 | texcoord | The texture coordinate. |
| Color | color | The color. |
Remarks
This should only be called during the initialization process, before InitializePrimitive.
CalculateTangentSpace()
Calculate tangent space of the geometry.
Declaration
public void CalculateTangentSpace()
Clear()
Clears the internal structure.
Declaration
public void Clear()
CreateMesh(GraphicsContext)
Gets the Mesh by vertex and index information.
Declaration
public Mesh CreateMesh(GraphicsContext graphicsContext)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsContext | graphicsContext | The GraphicsContext used for mesh buffers generation. |
Returns
| Type | Description |
|---|---|
| Mesh | Mesh instance. |
GetSphericalTexCoord(Vector3)
Gets the spherical texture coordinates.
Declaration
public Vector2 GetSphericalTexCoord(Vector3 normal)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | normal | The normal. |
Returns
| Type | Description |
|---|---|
| Vector2 | Spherical coordinates. |
SetCapacity(int, int)
Prepares the internal structure with the specified size for indices and vertices.
Declaration
public void SetCapacity(int indicesCount, int vertexCount)
Parameters
| Type | Name | Description |
|---|---|---|
| int | indicesCount | The maximum indices count. |
| int | vertexCount | The maximum vertex count. |