Class CommonGeometry
Represents a concrete implementation of IGeometry that holds vertex and face data within a CommonGeometryGroup. Multiple CommonGeometry instances can exist within a single group, each referencing a shared vertex pool.
Implements
Inherited Members
Namespace: TriLibCore.Geometries
Assembly: TriLibCore.dll
Syntax
public class CommonGeometry : IGeometry
Constructors
CommonGeometry()
Declaration
public CommonGeometry()
Properties
GeometryGroup
Gets or sets the parent geometry group that contains this geometry.
Declaration
public CommonGeometryGroup GeometryGroup { get; set; }
Property Value
| Type | Description |
|---|---|
| CommonGeometryGroup |
Index
Gets or sets the index of this geometry within its parent geometry group.
Declaration
public int Index { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
IsQuad
Gets or sets a value indicating whether this geometry should be processed as quads. If false, the geometry is typically handled as triangles.
Declaration
public bool IsQuad { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MaterialIndex
Gets or sets the index of the material assigned to this geometry.
Declaration
public int MaterialIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
OriginalIndex
Gets or sets the original geometry index within the parent geometry group. If this geometry was duplicated, this field preserves the initial index.
Declaration
public int OriginalIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
VertexDataIndices
Gets or sets the list of indices into the shared vertex data managed by CommonGeometryGroup. These indices map this geometry's faces to the group's vertex pool.
Declaration
public List<int> VertexDataIndices { get; set; }
Property Value
| Type | Description |
|---|---|
| List<int> |
Methods
AddVertex(AssetLoaderContext, int, Vector3, Vector3, Vector4, Color, Vector2, Vector2, Vector2, Vector2, BoneWeight)
Adds a new vertex (with position, normal, tangent, color, UVs, and bone weighting) to the parent geometry group's vertex pool and records the resulting index in VertexDataIndices if this geometry is not a point cloud.
Declaration
public void AddVertex(AssetLoaderContext assetLoaderContext, int originalVertexIndex, Vector3 position, Vector3 normal = null, Vector4 tangent = null, Color color = null, Vector2 uv0 = null, Vector2 uv1 = null, Vector2 uv2 = null, Vector2 uv3 = null, BoneWeight boneWeight = null)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The context containing model loading data and settings. |
| int | originalVertexIndex | The source vertex index from the loaded model. |
| Vector3 | position | The vertex position. |
| Vector3 | normal | The vertex normal. |
| Vector4 | tangent | The vertex tangent. |
| Color | color | The vertex color. |
| Vector2 | uv0 | The first set of UV coordinates. |
| Vector2 | uv1 | The second set of UV coordinates. |
| Vector2 | uv2 | The third set of UV coordinates. |
| Vector2 | uv3 | The fourth set of UV coordinates. |
| BoneWeight | boneWeight | The bone weight data, if applicable. |
Setup(CommonGeometryGroup, int, bool, bool, bool)
Configures this geometry with the specified parent group, material index, face mode (quads or triangles), blend shape usage, and point cloud status. If the geometry is not a point cloud, this method also pre-allocates a list for storing vertex indices.
Declaration
public void Setup(CommonGeometryGroup geometryGroup, int materialIndex, bool isQuad, bool hasBlendShapes, bool isPointCloud)
Parameters
| Type | Name | Description |
|---|---|---|
| CommonGeometryGroup | geometryGroup | The parent geometry group. |
| int | materialIndex | The material index for this geometry. |
| bool | isQuad | Indicates if this geometry uses quadrilateral faces. |
| bool | hasBlendShapes | Indicates if this geometry uses blend shapes. |
| bool | isPointCloud | Indicates if this geometry is a point cloud. |