v2.37
 
IGrid Interface Reference

Represents a triangle grid. More...

Inheritance diagram for IGrid:

Public Member Functions

HRESULT GetNormal ([in] int index, [out, retval] FloatVector3D *pVector)
 Returns the normal vector by the given index.
 
HRESULT GetNormalComponents ([in] int index, [out] float *pX, [out] float *pY, [out] float *pZ)
 Returns the normal vector components by the given index.
 
HRESULT GetTextureCoordinate ([in] int index, [out, retval] FloatPoint2D *pPoint)
 Returns the texture coordinates by the given index.
 
HRESULT GetTextureCoordinateComponents ([in] int index, [out] float *pX, [out] float *pY)
 Returns the texture coordinates components by the given index.
 
HRESULT GetTriangle ([in] int index, [out, retval] Triangle *pTriangle)
 Returns the triangle by the given index.
 
HRESULT GetTriangleComponents ([in] int index, [out] unsigned int *pTriangleV0, [out] unsigned int *pTriangleV1, [out] unsigned int *pTriangleV2)
 Returns the triangle components by the given index.
 
HRESULT GetVertex ([in] int index, [out, retval] FloatPoint3D *pPoint)
 Returns the vertex by the given index.
 
HRESULT GetVertexComponents ([in] int index, [out] float *pX, [out] float *pY, [out] float *pZ)
 Returns the vertex components by the given index.
 

Properties

VARIANT_BOOL DoubleSided [get]
 Queries if the grid is double-sided.
 
int GridType [get]
 The grid type.
 
int NormalCount [get]
 The number of normals in the grid.
 
int TextureCoordinateCount [get]
 The number of texture coordinates in the grid.
 
int TriangleCount [get]
 The number of triangles in the grid.
 
int VertexCount [get]
 The number of vertices in the grid.
 

Detailed Description

Represents a triangle grid.

A grid is a subset of a mesh corresponding to a particular face of an exported object. This interface provides access to grid vertices and their normals and texture coordinates.

Most often, vertex, normal and texture coordinate vector counts are equal. It means that any vertex has a corresponding normal vector and a texture coordinate vector. But in some cases it is possible that a vertex has no normal vector and/or texture coordinate. (One such case when it might happen is when objects are imported into Renga from another CAD.) Therefore you should not assume the numbers of vertices, normal vectors and texture coordinates to be equal. For example:

Renga::IGridPtr grid = mesh->GetGrid(someIndex);
bool hasNormals = grid->GetNormalCount() == grid->GetVertexCount();
bool hasTexCoords = grid->GetTextureCoordinateCount() == grid->GetVertexCount();
for (int i = 0; i < grid->GetVertexCount(); i++)
{
Renga::Point3D vertex = grid->GetVertex(i);
if (hasNormals && hasTexCoords)
{
Renga::Vector3D normal = grid->GetNormal(i);
Renga::Point2D texCoord = grid->GetTextureCoordinate(i);
// do something with vertex, normal, texCoord
}
else
{
// do something with vertex only
}
}
See also
IMesh, IExportedObject3D, Point3D, Vector3D, Triangle, gridTypes

Member Function Documentation

◆ GetNormal()

HRESULT GetNormal ( [in] int index,
[out, retval] FloatVector3D * pVector )

Returns the normal vector by the given index.

Parameters
[in]indexIndex.
[out]pVectorThe requested normal vector.
See also
NormalCount

◆ GetNormalComponents()

HRESULT GetNormalComponents ( [in] int index,
[out] float * pX,
[out] float * pY,
[out] float * pZ )

Returns the normal vector components by the given index.

Parameters
[in]indexIndex.
[out]pXThe x component of the requested normal vector.
[out]pYThe y component of the requested normal vector.
[out]pZThe z component of the requested normal vector.
See also
NormalCount

◆ GetTextureCoordinate()

HRESULT GetTextureCoordinate ( [in] int index,
[out, retval] FloatPoint2D * pPoint )

Returns the texture coordinates by the given index.

Parameters
[in]indexIndex.
[out]pPointThe requested texture coordinate.
See also
TextureCoordinateCount

◆ GetTextureCoordinateComponents()

HRESULT GetTextureCoordinateComponents ( [in] int index,
[out] float * pX,
[out] float * pY )

Returns the texture coordinates components by the given index.

Parameters
[in]indexIndex.
[out]pXThe x component of the requested texture coordinate point.
[out]pYThe y component of the requested texture coordinate point.
See also
TextureCoordinateCount

◆ GetTriangle()

HRESULT GetTriangle ( [in] int index,
[out, retval] Triangle * pTriangle )

Returns the triangle by the given index.

Parameters
[in]indexIndex.
[out]pTriangleThe requested triangle.
See also
TriangleCount

◆ GetTriangleComponents()

HRESULT GetTriangleComponents ( [in] int index,
[out] unsigned int * pTriangleV0,
[out] unsigned int * pTriangleV1,
[out] unsigned int * pTriangleV2 )

Returns the triangle components by the given index.

Parameters
[in]indexIndex.
[out]pTriangleV0The first vertex index of the requested triangle.
[out]pTriangleV1The second vertex index of the requested triangle.
[out]pTriangleV2The third vertex index of the requested triangle.
See also
TriangleCount

◆ GetVertex()

HRESULT GetVertex ( [in] int index,
[out, retval] FloatPoint3D * pPoint )

Returns the vertex by the given index.

Parameters
[in]indexVertex index in the collection.
[out]pPointThe requested point with coordinates of the vertex.
See also
VertexCount

◆ GetVertexComponents()

HRESULT GetVertexComponents ( [in] int index,
[out] float * pX,
[out] float * pY,
[out] float * pZ )

Returns the vertex components by the given index.

Parameters
[in]indexVertex index in the collection.
[out]pXThe x component of the requested point with coordinates of the vertex.
[out]pYThe y component of the requested point with coordinates of the vertex.
[out]pZThe z component of the requested point with coordinates of the vertex.
See also
VertexCount

Property Documentation

◆ DoubleSided

VARIANT_BOOL DoubleSided
get

Queries if the grid is double-sided.

Orientation of the grid sides (i.e. which side is the inner one, and which is the outer) is the same as the orientation of the ExportedObject3D face it represents.

◆ GridType

int GridType
get

The grid type.

See also
Grid types

◆ NormalCount

int NormalCount
get

The number of normals in the grid.

See also
GetNormal()

◆ TextureCoordinateCount

int TextureCoordinateCount
get

The number of texture coordinates in the grid.

See also
GetTextureCoordinate()

◆ TriangleCount

int TriangleCount
get

The number of triangles in the grid.

See also
GetTriangle()

◆ VertexCount

int VertexCount
get

The number of vertices in the grid.

See also
GetVertex()