# class
GeometryData
GeometryData represents a geometric structure consisting of point data (Vertices) and topological data (Triangles). GeometryData may represent a whole geometric object, but can also be used by streaming data filters, and in this way, only represents a part of the object. Different fields in the Vertices and Triangles fields data objects will contain point data and topological data. The standard naming convention used in the filters/renderers are as follows: (Case sensitive naming, other fields may also be present) 'Coords' Positional coordinates of a vertex, expressed with a 3-component real field (XYZ). 'TexCoords0' - 'TexCoords255' Texture coordinates of a vertex, expressed with a 2 components real field. By convention, the existing fields must be sequential, and must start with 'TexCoord0'. 'Normals' Normal vector for the vertex, expressed with a 3-component real field, a normalized (XYZ) vector. 'VertexIds' The id of the current vertex in the primitive. This field is present even if the vertex data is directly specified in the primitive data, to specify topology. The field is of type rid. 'MaterialIds' The material of the primitive. The field is of type rid. The 'Coords' and 'VertexIds' fields always exist in the object, but the other fields are optional. Also, there can exist user fields.
# Properties
Property | Description |
---|---|
Name | The name of the GeometryData object. (Inherited from Object) |
TriangleCount | The number of triangles in the geometry. The number of corners is always set to (TriangleCount*3), so there is no specific method to set the number of corners. |
VertexCount | The number of vertices in the geometry. |
# Methods
Method | Description |
---|---|
AddBaseTypeCustomField | Adds an empty custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields. |
AddBaseTypeUserCornerField | Adds an empty user-specified corner field. |
AddBaseTypeUserTriangleField | Adds an empty user-specified triangle field. |
AddBaseTypeUserVertexField | Adds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields. |
AddBoneWeights | Adds the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute) |
AddColors | The vertex colors in the input channel from the corners the geometry. The valid id range of the channel parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: 'Color0'-'Color255' which is stored as attribute per corner) |
AddCustomField | Adds a custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields. |
AddGroupIds | Adds the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute) |
AddMaterialIds | Adds the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute) |
AddNamedColors | Adds a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute) |
AddNamedTexCoords | Adds a named TexCoords field in the corners. (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute) |
AddNormals | Adds the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute) |
AddObserver | Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object) |
AddTangents | Adds Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute) |
AddTexCoords | Adds a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute) |
AddTriangles | AddTriangles increases the triangle count by the specified value. |
AddUserCornerField | Adds a user-specified corner field. To be able to add a field, it must have a name that does not conflict with the existing corner fields. |
AddUserTriangleField | Adds a user-specified triangle field. To be able to add a field, it must have a name that does not conflict with the existing triangle fields. |
AddUserVertexField | Adds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields. |
AddVertexLocks | Adds the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute) |
AddVertexWeights | Adds the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute) |
AddVertices | Increases the vertex count by the specified value. |
AppendGeometry | Appends the geometry data to this geometry. This geometry will contain all triangles and vertices of both geometries. The VertexIds that are copied from the source are remapped to point at the vertices, which are appended to the end of the current vertices. Any field in the appended geometry that does not exist in this geometry will be added, with the tuples that are added set to 0. The method will fail if the source geometry has identically named fields, but with different tuple sizes or base types. |
CalculateExtents | Calculate the extents by checking the coordinates of all vertices in the geometry. Set only_triangles to true to test only vertices that are indexed by a triangle. This is a slower test, and the bounding box may not encompass all vertices' positions. the new extents are found by calling GetInf() and GetSup() afterwards. |
ChangeWinding | Change winding. |
CleanupInvalidTriangles | Finds triangles that contain the same vertex more than once, and invalidates them, ie. sets all the vertex id references to -1. These triangles can be culled using Compact(). |
CleanupNanValues | Finds all Nan (1.#IND, 1.#INF etc) values in the real/float/double arrays in the GeometryData, and sets them to 0.0 just to make sure all numbers in the GeometryData are legit. Should not be needed if all the data loaded into the GeometryData object is ok to begin with. |
Compact | Removes invalid triangles and vertices not referenced by any triangle. If any vertices are removed, the triangles will be remapped to the new compacted vertex field. |
ConvertHandedness | Converts the handedness of the triangle winding, coords, normals and texture coordinates of the geometry from left-handed to right-handed coordinate systems and vice versa. Simplygon generally uses right-handed coordinates, so this conversion needs to be done before processing any left-handed geometry. |
CopyCombine3Corners | Combines three corners via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3. |
CopyCombine3Triangles | Combines the fields of three triangles via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3. |
CopyCombine3Vertices | Combines the fields of three vertices via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3. |
CopyCombineCorners | Combines the fields of two corners by linear interpolation into the destination corner. |
CopyCombineTriangles | Combines the fields of two triangles by linear interpolation into the destination triangle. |
CopyCombineVertices | Combines the fields of two vertices by linear interpolation into the destination vertex. |
CopyCorner | Copies all fields in the specified corner in the source geometry to the destination corner in this geometry . |
CopyTriangle | Copies all fields in the specified triangle in the source geometry to the destination triangle in this geometry. |
CopyVertex | Copies all fields in the specified vertex in the source geometry to the destination vertex in this geometry. |
CreateAABB | Returns an axis aligned bounding box GeometryData of this geometry. |
DeepCopy | Copies the field setup and data from another object into this object. To only copy the setup, set copy_data to false. |
DetectEdgeNeighbours | Detect triangle edge neighbors. Neighbor ids are stored in the "SgEdgeNeighbours" Corner field. |
ExpandVertices | Expands the Vertices field data so that there exists one vertex for each of the three corners of each triangle in the geometry. The vertices will be organized identical to the Corners field. The triangles will be remapped to use the new vertices correctly. Expanding the vertex field is required to be able to extract a range of the geometry, and to be able to stream it. Note! This will lead to increased memory requirement, as vertex data is not shared among neighboring triangles. It also removes the connectivity information of the triangles, and effectively detaches all triangles from one another. This call may replace fields in the Vertices field data. Re-query any previously cached field pointer after the call. All user fields are copied as well. |
ExtentsContainCoords | Tests if the extents of the geometry fully contain all vertex coordinates. Note! ExtentsContainCoords() checks all vertices in the geometry, regardless to whether the vertex is referenced by any triangle. Use Compact() to remove any non-referenced vertex before calling ExtentsContainCoords. |
ExtractRange | Extracts a range of triangles with their vertices from the geometry. ExpandVertices() must first be called for the extraction to succeed. ExtractGeometry() can be used to stream geometries in chunks. If writing to a stream, the extracted geometry is guaranteed to have the same setup as the original. Any previous data in the destination will be deleted. |
ExtractTriangles | Extracts specified triangles from the geometry. The destination geometry will contain the triangles and vertices. The vertices in the destination will be expanded so that there exists one vertex for each of the three corners of each triangle in the geometry. |
FindEdgeIdsFromVertexPairs | Each tuple in the "vertex_pairs" array contains the start-vertex and end-vertex of a half-edge in the geometry. If a half-edge is found from a tuple in the "vertex_pairs" array, the edge-id of that half-edge will be stored in the edge_ids array. Do note: the half-edges are directed, so if you want all half-edges that contains 2 vertices, you need to add the tuple twice. |
FindNamedColorsIndex | Returns the level index of the colors field with the name returns -1 if not found. |
FindNamedTexCoordsIndex | Returns the level index of the texcoord field with the name returns -1 if not found. |
GetBitangents | Gets a Bitangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute) |
GetBoneIds | The BoneIds fields in the vertices. (Field name: "BoneIds", Tuple size: varying , Stored as: Vertex attribute) |
GetBoneWeights | The BoneWeights field in the vertices. (Field name: "BoneWeights", Tuple size: varying , Stored as: Vertex attribute) |
GetClass | Get the name of the GeometryData class. (Inherited from Object) |
GetColors | Gets a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute) |
GetCoords | The Coords field in the vertices. (Field name: "Coords", Tuple size: 3 , Stored as: Vertex attribute) |
GetCorners | Retrieves the IFieldData object that contains the corner fields. |
GetCustomField | Gets a custom field. |
GetGroupIds | The GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute) |
GetInf | The inferior (minimum) extent of the geometry. |
GetMaterialIds | The MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute) |
GetNamedColors | Gets a Color field, using the alternative name instead of the index. |
GetNamedTexCoords | Gets a TexCoords field, using the alternative name instead of the index. |
GetNormals | The Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute) |
GetSup | The superior (maximum) extent of the geometry. |
GetTangents | Gets a Tangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Tangents0" - "Tangents255", Tuple size: 3 , Stored as: Corner attribute) |
GetTexCoords | Gets a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute). |
GetTriangles | Retrieves the IFieldData object that contains the triangle fields. |
GetUserCornerField | Gets a user-specified corner field. |
GetUserTriangleField | Gets a user-specified triangle field. |
GetUserVertexField | Gets a user-specified vertex field. |
GetVertexIds | The VertexIds field in the corners. |
GetVertexLocks | The VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute) |
GetVertexWeights | The VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute) |
GetVertices | Retrieves the IFieldData object that contains the vertex fields. |
IsA | Returns true if GeometryData is a or is a descendant of the class named as the type parameter. (Inherited from Object) |
IsNull | Returns true if the GeometryData object is invalid. (Inherited from Object) |
IsSameObjectAs | Returns true if the GeometryData object is valid. (Inherited from Object) |
NewCopy | Creates another geometry data object with the same field setup. To also copy the data to the new object, set copy_data to true. |
NewPackedCopy | Creates a "packed" PackedGeometryData object, where all fields in the Corner field data object is moved to the vertex field data object. Please note that the vertex field data object will be enlarged to accommodate for data in a vertex shared by multiple triangles, where the corner data differs between the triangles. The method will fail if a Corner field is named the same as an existing Vertices field, please make sure to remove any such field before calling the method. |
NonNull | Returns true if the GeometryData object is valid. (Inherited from Object) |
PrintInfo | Prints the content/info of the GeometryData object to the log. (Inherited from Object) |
RemoveBoneWeights | Removes the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute) |
RemoveColors | Removes a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute) |
RemoveCustomField | Removes a custom field. |
RemoveGroupIds | Removes the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute) |
RemoveMaterialIds | Removes the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute) |
RemoveNamedColors | Removes a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute) |
RemoveNamedTexCoords | Removes a named TexCoords field in the corners. 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute) |
RemoveNormals | Removes the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute) |
RemoveObserver | Removes a previously added observer object. (Inherited from Object) |
RemoveTangents | Removes Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute) |
RemoveTexCoords | Removes a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute) |
RemoveUserCornerField | Removes a user-specified corner field. |
RemoveUserTriangleField | Removes a user-specified triangle field. |
RemoveUserVertexField | Removes a user-specified vertex field. |
RemoveVertexLocks | Removes the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute) |
RemoveVertexWeights | Removes the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute) |
SetInf | The inferior (minimum) extent of the geometry. |
SetSup | The superior (maximum) extent of the geometry. |
Transform | Transforms the geometry using the supplied matrix transformation. The fields that are modified are the Coords field of Vertices, as well as the Normals and all Tangent and Bi-tangent fields of the Corners. |
Weld | Welds all vertices in the geometry that are closer than the welding threshold. Non-referenced vertices will not be removed, only the vertex indices will be remapped. Call Compact() to clean up the geometry and free up memory. |
# Static methods
Method | Description |
---|---|
IsClassA | Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object) |
SafeCast | SafeCast makes sure the input object is of a class that can be cast into spGeometryData, and if this is the case, returns the object cast into spGeometryData. (Inherited from Object) |
# Properties details
# Name
The name of the GeometryData object. (Inherited from Object)
# TriangleCount
The number of triangles in the geometry. The number of corners is always set to (TriangleCount*3), so there is no specific method to set the number of corners.
# VertexCount
The number of vertices in the geometry.
# Methods details
# AddBaseTypeCustomField
Adds an empty custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields.
# Syntax
spValueArray AddBaseTypeCustomField( Simplygon::EBaseTypes base_type , const char * name , unsigned int tuple_size ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
EBaseTypes | base_type | The base_type of the new custom field, data types are listed in BaseTypes. | ||
const char * | name | The name of the new custom field. | ||
unsigned int | tuple_size | The tuple size of the new custom field, defaults to 1 if not specified. |
# Return value
Type: ValueArray
# AddBaseTypeUserCornerField
Adds an empty user-specified corner field.
# Syntax
spValueArray AddBaseTypeUserCornerField( Simplygon::EBaseTypes base_type , const char * name , unsigned int tuple_size ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
EBaseTypes | base_type | Specifies the base type of the new corner field, data types are listed in BaseTypes. | ||
const char * | name | The name of the field to add. | ||
unsigned int | tuple_size | The tuple size of the new field, defaults to 1 if not specified. |
# Return value
Type: ValueArray
# AddBaseTypeUserTriangleField
Adds an empty user-specified triangle field.
# Syntax
spValueArray AddBaseTypeUserTriangleField( Simplygon::EBaseTypes base_type , const char * name , unsigned int tuple_size ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
EBaseTypes | base_type | The base_type of the new user triangle field, data types are listed in BaseTypes. | ||
const char * | name | The name of the triangle field to add to the GeometryData object. | ||
unsigned int | tuple_size | The tuple size of the new field, deafaults to 1 if not specified. |
# Return value
Type: ValueArray
# AddBaseTypeUserVertexField
Adds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields.
# Syntax
spValueArray AddBaseTypeUserVertexField( Simplygon::EBaseTypes base_type , const char * name , unsigned int tuple_size ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
EBaseTypes | base_type | The BaseType of the new user field, data types are listed in BaseTypes. | ||
const char * | name | The name of the new user field. | ||
unsigned int | tuple_size | The tuple size of the new user field, defaults to 1 if not specified. |
# Return value
Type: ValueArray
# AddBoneWeights
Adds the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute)
# AddColors
The vertex colors in the input channel from the corners the geometry. The valid id range of the channel parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: 'Color0'-'Color255' which is stored as attribute per corner)
# AddCustomField
Adds a custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields.
# Syntax
void AddCustomField( const spValueArray & field ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
ValueArray | field | The custom field to add to the GeometryData object. |
# AddGroupIds
Adds the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)
# AddMaterialIds
Adds the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)
# AddNamedColors
Adds a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
# AddNamedTexCoords
Adds a named TexCoords field in the corners. (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
# AddNormals
Adds the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)
# AddObserver
Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
# AddTangents
Adds Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)
# AddTexCoords
Adds a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
# AddTriangles
AddTriangles increases the triangle count by the specified value.
# AddUserCornerField
Adds a user-specified corner field. To be able to add a field, it must have a name that does not conflict with the existing corner fields.
# Syntax
void AddUserCornerField( const spValueArray & field ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
ValueArray | field | The field to add into the GeometryData object. |
# AddUserTriangleField
Adds a user-specified triangle field. To be able to add a field, it must have a name that does not conflict with the existing triangle fields.
# Syntax
void AddUserTriangleField( const spValueArray & field ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
ValueArray | field | The triangle field to add to the GeometryData object. |
# AddUserVertexField
Adds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields.
# Syntax
void AddUserVertexField( const spValueArray & field ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
ValueArray | field | The field to add to this GeometryData object. |
# AddVertexLocks
Adds the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)
# AddVertexWeights
Adds the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)
# AddVertices
Increases the vertex count by the specified value.
# AppendGeometry
Appends the geometry data to this geometry. This geometry will contain all triangles and vertices of both geometries. The VertexIds that are copied from the source are remapped to point at the vertices, which are appended to the end of the current vertices. Any field in the appended geometry that does not exist in this geometry will be added, with the tuples that are added set to 0. The method will fail if the source geometry has identically named fields, but with different tuple sizes or base types.
# Syntax
void AppendGeometry( const spGeometryData & source ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The source geometry that will be appended to this geometry. the contents of source will not be modified. |
# CalculateExtents
Calculate the extents by checking the coordinates of all vertices in the geometry. Set only_triangles to true to test only vertices that are indexed by a triangle. This is a slower test, and the bounding box may not encompass all vertices' positions. the new extents are found by calling GetInf() and GetSup() afterwards.
# ChangeWinding
Change winding.
# CleanupInvalidTriangles
Finds triangles that contain the same vertex more than once, and invalidates them, ie. sets all the vertex id references to -1. These triangles can be culled using Compact().
# CleanupNanValues
Finds all Nan (1.#IND, 1.#INF etc) values in the real/float/double arrays in the GeometryData, and sets them to 0.0 just to make sure all numbers in the GeometryData are legit. Should not be needed if all the data loaded into the GeometryData object is ok to begin with.
# Compact
Removes invalid triangles and vertices not referenced by any triangle. If any vertices are removed, the triangles will be remapped to the new compacted vertex field.
# ConvertHandedness
Converts the handedness of the triangle winding, coords, normals and texture coordinates of the geometry from left-handed to right-handed coordinate systems and vice versa. Simplygon generally uses right-handed coordinates, so this conversion needs to be done before processing any left-handed geometry.
# CopyCombine3Corners
Combines three corners via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.
# Syntax
void CopyCombine3Corners( const spGeometryData & source , rid dest_id , rid src_id_1 , rid src_id_2 , rid src_id_3 , real alpha_1 , real alpha_2 ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to combine from. | ||
rid | dest_id | The corner id to replace in this GeometryData object. | ||
rid | src_id_1 | The first corner id to combine from. | ||
rid | src_id_2 | The second corner id to combine from. | ||
rid | src_id_3 | The third corner id to combine from. | ||
real | alpha_1 | The first interpolation value. | ||
real | alpha_2 | The second interpolation value. |
# CopyCombine3Triangles
Combines the fields of three triangles via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.
# Syntax
void CopyCombine3Triangles( const spGeometryData & source , rid dest_id , rid src_id_1 , rid src_id_2 , rid src_id_3 , real alpha_1 , real alpha_2 ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to combine from. | ||
rid | dest_id | The triangle id to replace in this GeometryData object. | ||
rid | src_id_1 | The first triangle id to combine from. | ||
rid | src_id_2 | The second triangle id to combine from. | ||
rid | src_id_3 | The third triangle id to combine from. | ||
real | alpha_1 | The first interpolation value. | ||
real | alpha_2 | The second interpolation value. |
# CopyCombine3Vertices
Combines the fields of three vertices via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.
# Syntax
void CopyCombine3Vertices( const spGeometryData & source , rid dest_id , rid src_id_1 , rid src_id_2 , rid src_id_3 , real alpha_1 , real alpha_2 ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to combine from. | ||
rid | dest_id | The vertex id to replace in this GeometryData object. | ||
rid | src_id_1 | The first vertex id to combine from. | ||
rid | src_id_2 | The second vertex id to combine from. | ||
rid | src_id_3 | The third vertex id to combine from. | ||
real | alpha_1 | The first interpolation value. | ||
real | alpha_2 | The first interpolation value. |
# CopyCombineCorners
Combines the fields of two corners by linear interpolation into the destination corner.
# Syntax
void CopyCombineCorners( const spGeometryData & source , rid dest_id , rid src_id_1 , rid src_id_2 , real alpha ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to combine from. | ||
rid | dest_id | The corner id to replace in this GeometryData object. | ||
rid | src_id_1 | The first corner id to combine from. | ||
rid | src_id_2 | The second corner id to combine from. | ||
real | alpha | The interpolation value between 0 and 1. |
# CopyCombineTriangles
Combines the fields of two triangles by linear interpolation into the destination triangle.
# Syntax
void CopyCombineTriangles( const spGeometryData & source , rid dest_id , rid src_id_1 , rid src_id_2 , real alpha ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to combine from. | ||
rid | dest_id | The triangle id to replace in this GeometryData object. | ||
rid | src_id_1 | The first triangle id to combine from. | ||
rid | src_id_2 | The second triangle id to combine from. | ||
real | alpha | The interpolation value between 0 and 1. |
# CopyCombineVertices
Combines the fields of two vertices by linear interpolation into the destination vertex.
# Syntax
void CopyCombineVertices( const spGeometryData & source , rid dest_id , rid src_id_1 , rid src_id_2 , real alpha ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to combine from. | ||
rid | dest_id | The vertex id to replace in this GeometryData object. | ||
rid | src_id_1 | The first vertex id to combine from. | ||
rid | src_id_2 | The second vertex id to combine from. | ||
real | alpha | The interpolation value between 0 and 1. |
# CopyCorner
Copies all fields in the specified corner in the source geometry to the destination corner in this geometry .
# Syntax
void CopyCorner( const spGeometryData & source , rid dest_id , rid src_id ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to copy from. | ||
rid | dest_id | The vertex id to replace in this GeometryData object. | ||
rid | src_id | The id of the vertex to copy. |
# CopyTriangle
Copies all fields in the specified triangle in the source geometry to the destination triangle in this geometry.
# Syntax
void CopyTriangle( const spGeometryData & source , rid dest_id , rid src_id ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to copy from. | ||
rid | dest_id | The triangle id to replace in this GeometryData object. | ||
rid | src_id | The id of the triangle to copy. |
# CopyVertex
Copies all fields in the specified vertex in the source geometry to the destination vertex in this geometry.
# Syntax
void CopyVertex( const spGeometryData & source , rid dest_id , rid src_id ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to copy from. | ||
rid | dest_id | The vertex id to replace in this GeometryData object. | ||
rid | src_id | The id of the vertex to copy. |
# CreateAABB
Returns an axis aligned bounding box GeometryData of this geometry.
# Syntax
spGeometryData CreateAABB() const;
# Parameters
CreateAABB takes no parameters.
# Return value
Type: GeometryData
# DeepCopy
Copies the field setup and data from another object into this object. To only copy the setup, set copy_data to false.
# Syntax
void DeepCopy( const spGeometryData & source , bool copy_data ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | source | The GeometryData object to copy from. | ||
bool | copy_data | If true, copies the data along with the GeometryData properties. |
# DetectEdgeNeighbours
Detect triangle edge neighbors. Neighbor ids are stored in the "SgEdgeNeighbours" Corner field.
# ExpandVertices
Expands the Vertices field data so that there exists one vertex for each of the three corners of each triangle in the geometry. The vertices will be organized identical to the Corners field. The triangles will be remapped to use the new vertices correctly. Expanding the vertex field is required to be able to extract a range of the geometry, and to be able to stream it. Note! This will lead to increased memory requirement, as vertex data is not shared among neighboring triangles. It also removes the connectivity information of the triangles, and effectively detaches all triangles from one another. This call may replace fields in the Vertices field data. Re-query any previously cached field pointer after the call. All user fields are copied as well.
# ExtentsContainCoords
Tests if the extents of the geometry fully contain all vertex coordinates. Note! ExtentsContainCoords() checks all vertices in the geometry, regardless to whether the vertex is referenced by any triangle. Use Compact() to remove any non-referenced vertex before calling ExtentsContainCoords.
# ExtractRange
Extracts a range of triangles with their vertices from the geometry. ExpandVertices() must first be called for the extraction to succeed. ExtractGeometry() can be used to stream geometries in chunks. If writing to a stream, the extracted geometry is guaranteed to have the same setup as the original. Any previous data in the destination will be deleted.
# Syntax
void ExtractRange( const spGeometryData & dest , rid start_tri_id , unsigned int count ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | dest | The GeometryData object that is written to. | ||
rid | start_tri_id | The first triangle to be extracted. | ||
unsigned int | count | The number of triangles to extract. |
# ExtractTriangles
Extracts specified triangles from the geometry. The destination geometry will contain the triangles and vertices. The vertices in the destination will be expanded so that there exists one vertex for each of the three corners of each triangle in the geometry.
# Syntax
void ExtractTriangles( const spGeometryData & dest , const spRidArray & triangle_ids ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
GeometryData | dest | The GeometryData object that is written to. | ||
RidArray | triangle_ids | The list of triangles indices to extract. |
# FindEdgeIdsFromVertexPairs
Each tuple in the "vertex_pairs" array contains the start-vertex and end-vertex of a half-edge in the geometry. If a half-edge is found from a tuple in the "vertex_pairs" array, the edge-id of that half-edge will be stored in the edge_ids array. Do note: the half-edges are directed, so if you want all half-edges that contains 2 vertices, you need to add the tuple twice.
# Syntax
void FindEdgeIdsFromVertexPairs( const spRidArray & vertex_pairs , const spRidArray & edge_ids ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
RidArray | vertex_pairs | An array with tuplesize 2, which contains start and end-vertex of the edges you want to find. | ||
RidArray | edge_ids | Will contain all edge-ids that were found from the vertex-pairs. The function will replace all previous data in this array. |
# FindNamedColorsIndex
Returns the level index of the colors field with the name returns -1 if not found.
# FindNamedTexCoordsIndex
Returns the level index of the texcoord field with the name returns -1 if not found.
# GetBitangents
Gets a Bitangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)
# GetBoneIds
The BoneIds fields in the vertices. (Field name: "BoneIds", Tuple size: varying , Stored as: Vertex attribute)
# GetBoneWeights
The BoneWeights field in the vertices. (Field name: "BoneWeights", Tuple size: varying , Stored as: Vertex attribute)
# GetClass
Get the name of the GeometryData class. (Inherited from Object)
# GetColors
Gets a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
# GetCoords
The Coords field in the vertices. (Field name: "Coords", Tuple size: 3 , Stored as: Vertex attribute)
# GetCorners
Retrieves the IFieldData object that contains the corner fields.
# GetCustomField
Gets a custom field.
# Syntax
spValueArray GetCustomField( const char * name ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
const char * | name | The name of the custom field to get from the GeometryData object. |
# Return value
Type: ValueArray
# GetGroupIds
The GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)
# GetInf
The inferior (minimum) extent of the geometry.
# GetMaterialIds
The MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)
# GetNamedColors
Gets a Color field, using the alternative name instead of the index.
# GetNamedTexCoords
Gets a TexCoords field, using the alternative name instead of the index.
# GetNormals
The Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)
# GetSup
The superior (maximum) extent of the geometry.
# GetTangents
Gets a Tangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Tangents0" - "Tangents255", Tuple size: 3 , Stored as: Corner attribute)
# GetTexCoords
Gets a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute).
# GetTriangles
Retrieves the IFieldData object that contains the triangle fields.
# GetUserCornerField
Gets a user-specified corner field.
# Syntax
spValueArray GetUserCornerField( const char * name ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
const char * | name | The name of the field to get. |
# Return value
Type: ValueArray
# GetUserTriangleField
Gets a user-specified triangle field.
# Syntax
spValueArray GetUserTriangleField( const char * name ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
const char * | name | The name of the triangle field to get from the GeometryData object. |
# Return value
Type: ValueArray
# GetUserVertexField
Gets a user-specified vertex field.
# Syntax
spValueArray GetUserVertexField( const char * name ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
const char * | name | The name of the user vertex field to be fetched from the GeometryData object. |
# Return value
Type: ValueArray
# GetVertexIds
The VertexIds field in the corners.
# GetVertexLocks
The VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)
# GetVertexWeights
The VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)
# GetVertices
Retrieves the IFieldData object that contains the vertex fields.
# IsA
Returns true if GeometryData is a or is a descendant of the class named as the type parameter. (Inherited from Object)
# IsNull
Returns true if the GeometryData object is invalid. (Inherited from Object)
# IsSameObjectAs
Returns true if the GeometryData object is valid. (Inherited from Object)
# NewCopy
Creates another geometry data object with the same field setup. To also copy the data to the new object, set copy_data to true.
# Syntax
spGeometryData NewCopy( bool copy_data ) const;
# Parameters
Type | Name | Min | Max | Description |
---|---|---|---|---|
bool | copy_data | If true, copies the data along with the GeometryData properties. |
# Return value
Type: GeometryData
# NewPackedCopy
Creates a "packed" PackedGeometryData object, where all fields in the Corner field data object is moved to the vertex field data object. Please note that the vertex field data object will be enlarged to accommodate for data in a vertex shared by multiple triangles, where the corner data differs between the triangles. The method will fail if a Corner field is named the same as an existing Vertices field, please make sure to remove any such field before calling the method.
# Syntax
spPackedGeometryData NewPackedCopy() const;
# Parameters
NewPackedCopy takes no parameters.
# Return value
Type: PackedGeometryData
# NonNull
Returns true if the GeometryData object is valid. (Inherited from Object)
# PrintInfo
Prints the content/info of the GeometryData object to the log. (Inherited from Object)
# RemoveBoneWeights
Removes the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute)
# RemoveColors
Removes a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
# RemoveCustomField
Removes a custom field.
# RemoveGroupIds
Removes the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)
# RemoveMaterialIds
Removes the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)
# RemoveNamedColors
Removes a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
# RemoveNamedTexCoords
Removes a named TexCoords field in the corners. 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
# RemoveNormals
Removes the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)
# RemoveObserver
Removes a previously added observer object. (Inherited from Object)
# RemoveTangents
Removes Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)
# RemoveTexCoords
Removes a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
# RemoveUserCornerField
Removes a user-specified corner field.
# RemoveUserTriangleField
Removes a user-specified triangle field.
# RemoveUserVertexField
Removes a user-specified vertex field.
# RemoveVertexLocks
Removes the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)
# RemoveVertexWeights
Removes the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)
# SetInf
The inferior (minimum) extent of the geometry.
# SetSup
The superior (maximum) extent of the geometry.
# Transform
Transforms the geometry using the supplied matrix transformation. The fields that are modified are the Coords field of Vertices, as well as the Normals and all Tangent and Bi-tangent fields of the Corners.
# Weld
Welds all vertices in the geometry that are closer than the welding threshold. Non-referenced vertices will not be removed, only the vertex indices will be remapped. Call Compact() to clean up the geometry and free up memory.
# Static methods details
# IsClassA
Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
# SafeCast
SafeCast makes sure the input object is of a class that can be cast into spGeometryData, and if this is the case, returns the object cast into spGeometryData. (Inherited from Object)