Class CommonGeometryGroup
Represents a TriLib Geometry Group. A Geometry Group contains child Geometries.
Inherited Members
Namespace: TriLibCore.Geometries
Assembly: TriLibCore.dll
Syntax
public class CommonGeometryGroup : IGeometryGroup, IObject
Constructors
CommonGeometryGroup()
Declaration
public CommonGeometryGroup()
Fields
TempColor
Declaration
public Color TempColor
Field Value
| Type | Description |
|---|---|
| Color |
TempNormal
Declaration
public Vector3 TempNormal
Field Value
| Type | Description |
|---|---|
| Vector3 |
TempPosition
Declaration
public Vector3 TempPosition
Field Value
| Type | Description |
|---|---|
| Vector3 |
TempTangent
Declaration
public Vector4 TempTangent
Field Value
| Type | Description |
|---|---|
| Vector4 |
TempUV1
Declaration
public Vector2 TempUV1
Field Value
| Type | Description |
|---|---|
| Vector2 |
TempUV2
Declaration
public Vector2 TempUV2
Field Value
| Type | Description |
|---|---|
| Vector2 |
TempUV3
Declaration
public Vector2 TempUV3
Field Value
| Type | Description |
|---|---|
| Vector2 |
TempUV4
Declaration
public Vector2 TempUV4
Field Value
| Type | Description |
|---|---|
| Vector2 |
TempVertexIndex
Declaration
public int TempVertexIndex
Field Value
| Type | Description |
|---|---|
| int |
Properties
BlendShapeKeys
Gets/Sets the Blend-Shape keys in this group.
Declaration
public List<IBlendShapeKey> BlendShapeKeys { get; set; }
Property Value
| Type | Description |
|---|---|
| List<IBlendShapeKey> |
Colors
Gets or sets the color data for all vertices in this Geometry Group.
Declaration
public List<Color> Colors { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Color> |
GeometriesData
Gets/Sets the Geometries in this group.
Declaration
public Dictionary<int, IGeometry> GeometriesData { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<int, IGeometry> |
GeometryCapacity
Gets the maximum number of Geometries that can be stored in this Geometry Group.
Declaration
public int GeometryCapacity { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
HasColors
Gets or sets whether the Geometry Group contains vertex color data.
Declaration
public bool HasColors { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasInvalidNormals
Gets or sets whether the Geometry Group contains invalid normals.
Declaration
public bool HasInvalidNormals { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasNormals
Gets or sets whether the Geometry Group contains valid normals.
Declaration
public bool HasNormals { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasSkin
Gets or sets whether the Geometry Group has skinning information.
Declaration
public bool HasSkin { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasTangents
Gets or sets whether the Geometry Group contains tangent data.
Declaration
public bool HasTangents { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasUv1
Gets or sets whether the Geometry Group contains a first UV set (UV1).
Declaration
public bool HasUv1 { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasUv2
Gets or sets whether the Geometry Group contains a second UV set (UV2).
Declaration
public bool HasUv2 { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasUv3
Gets or sets whether the Geometry Group contains a third UV set (UV3).
Declaration
public bool HasUv3 { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HasUv4
Gets or sets whether the Geometry Group contains a fourth UV set (UV4).
Declaration
public bool HasUv4 { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Mesh
Gets or sets the final Unity Mesh generated by this Geometry Group.
Declaration
public Mesh Mesh { get; set; }
Property Value
| Type | Description |
|---|---|
| Mesh |
Name
Gets/Sets the Object name.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Normals
Gets or sets the normal data for all vertices in this Geometry Group.
Declaration
public List<Vector3> Normals { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector3> |
OriginalVertexIndices
Gets or sets the list that maps the current vertex indices to the original vertex indices.
Declaration
public List<int> OriginalVertexIndices { get; set; }
Property Value
| Type | Description |
|---|---|
| List<int> |
Pivot
Gets/Sets this Geometry Group local pivot position.
Declaration
public Vector3 Pivot { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Positions
Gets or sets the position data for all vertices in this Geometry Group.
Declaration
public List<Vector3> Positions { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector3> |
RawBoneWeights
Gets/Sets the Bone-Weights from this group.
Declaration
public Dictionary<int, List<BoneWeight1>> RawBoneWeights { get; set; }
Property Value
| Type | Description |
|---|---|
| Dictionary<int, List<BoneWeight1>> |
Tangents
Gets or sets the tangent data for all vertices in this Geometry Group.
Declaration
public List<Vector4> Tangents { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector4> |
UVs1
Gets or sets the first UV set (UV1) data for all vertices in this Geometry Group.
Declaration
public List<Vector2> UVs1 { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector2> |
UVs2
Gets or sets the second UV set (UV2) data for all vertices in this Geometry Group.
Declaration
public List<Vector2> UVs2 { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector2> |
UVs3
Gets or sets the third UV set (UV3) data for all vertices in this Geometry Group.
Declaration
public List<Vector2> UVs3 { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector2> |
UVs4
Gets or sets the fourth UV set (UV4) data for all vertices in this Geometry Group.
Declaration
public List<Vector2> UVs4 { get; set; }
Property Value
| Type | Description |
|---|---|
| List<Vector2> |
Used
Gets/Sets the flag indicating whether this object used somewhere.
Declaration
public bool Used { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
VerticesCapacity
Gets the maximum number of vertices that can be stored in this Geometry Group.
Declaration
public int VerticesCapacity { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
VerticesDataCount
Gets the total number of vertex data items in the Geometry Group.
Declaration
public int VerticesDataCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
AddBoneWeight(int, BoneWeight1)
Adds a new Bone Weight to this group.
Declaration
public void AddBoneWeight(int vertexIndex, BoneWeight1 boneWeight1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | vertexIndex | The original Vertex index. |
| BoneWeight1 | boneWeight1 | The Bone Weight data. |
AddVertex(AssetLoaderContext, int, Vector3, Vector3, Vector4, Color, Vector2, Vector2, Vector2, Vector2, BoneWeight)
Adds or gets an existing Vertex to/from this Geometry Group.
Declaration
public int AddVertex(AssetLoaderContext assetLoaderContext, int vertexIndex, Vector3 position, Vector3 normal, Vector4 tangent, Color color, Vector2 uv1, Vector2 uv2, Vector2 uv3, Vector2 uv4, BoneWeight boneWeight)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The Asset Loader Context reference, containing model loading data. |
| int | vertexIndex | The original Vertex index. |
| Vector3 | position | The position of the vertex. |
| Vector3 | normal | The normal of the vertex. |
| Vector4 | tangent | The tangent of the vertex. |
| Color | color | The color of the vertex. |
| Vector2 | uv1 | The first UV set (UV1) coordinate. |
| Vector2 | uv2 | The second UV set (UV2) coordinate. |
| Vector2 | uv3 | The third UV set (UV3) coordinate. |
| Vector2 | uv4 | The fourth UV set (UV4) coordinate. |
| BoneWeight | boneWeight | The BoneWeight data. |
Returns
| Type | Description |
|---|---|
| int | The final vertex index in the Geometry Group. |
Create(bool, bool, bool, bool, bool, bool, bool, bool)
Declaration
public static CommonGeometryGroup Create(bool hasNormal, bool hasTangent, bool hasColor, bool hasUV0, bool hasUV1, bool hasUV2, bool hasUV3, bool hasSkin)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | hasNormal | |
| bool | hasTangent | |
| bool | hasColor | |
| bool | hasUV0 | |
| bool | hasUV1 | |
| bool | hasUV2 | |
| bool | hasUV3 | |
| bool | hasSkin |
Returns
| Type | Description |
|---|---|
| CommonGeometryGroup |
GenerateMesh(AssetLoaderContext, GameObject, IModel)
Generates the final Unity Mesh.
Declaration
public IEnumerable GenerateMesh(AssetLoaderContext assetLoaderContext, GameObject meshGameObject, IModel meshModel)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The Asset Loader Context reference, containing model loading data. |
| GameObject | meshGameObject | The GameObject the Mesh will be attached to. |
| IModel | meshModel | The geometry model reference. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An IEnumerable for asynchronous or deferred Mesh construction. |
GetCenter()
Computes the centroid (center) of all vertices in this Geometry Group.
Declaration
public Vector3 GetCenter()
Returns
| Type | Description |
|---|---|
| Vector3 | The centroid of the vertex positions. |
GetGeometry<TGeometry>(AssetLoaderContext, int, bool, bool)
Gets a new or existing Geometry from this group.
Declaration
public virtual TGeometry GetGeometry<TGeometry>(AssetLoaderContext assetLoaderContext, int materialIndex, bool isQuad, bool hasBlendShapes) where TGeometry : class, IGeometry, new()
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The Asset Loader Context reference, containing model loading data. |
| int | materialIndex | The Geometry Material index. |
| bool | isQuad | Indicates if the Geometry contains quad data. |
| bool | hasBlendShapes | Indicates if the Geometry uses blend-shapes. |
Returns
| Type | Description |
|---|---|
| TGeometry | A new or existing Geometry. |
Type Parameters
| Name | Description |
|---|---|
| TGeometry | A class that implements IGeometry. |
Setup(AssetLoaderContext, int, int)
Configures this Geometry Group with capacity and context information.
Declaration
public virtual void Setup(AssetLoaderContext assetLoaderContext, int verticesCapacity, int geometriesCapacity)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The Asset Loader Context reference, containing model loading data. |
| int | verticesCapacity | The maximum number of vertices in this group. |
| int | geometriesCapacity | The maximum number of Geometries in this group. |
TransferToBlendShape(IGeometryGroup, IBlendShapeKey, IList<int>)
Transfers this Geometry Group data to a Blend Shape, referencing another base Geometry Group.
Declaration
public void TransferToBlendShape(IGeometryGroup baseGeometryGroup, IBlendShapeKey blendShapeKey, IList<int> originalVertexIndices)
Parameters
| Type | Name | Description |
|---|---|---|
| IGeometryGroup | baseGeometryGroup | The base Geometry Group to transfer from. |
| IBlendShapeKey | blendShapeKey | The blend shape key to apply the transfer. |
| IList<int> | originalVertexIndices | A list of original vertex indices used for mapping data. |