Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
MikkTSpace Class Reference

#include <MikktspaceWrap.h>

Public Member Functions

 MikkTSpace (const CModelDefPtr &m, std::vector< float > &v, bool gpuSkinning)
 
void Generate ()
 

Static Private Member Functions

static int GetNumFaces (const SMikkTSpaceContext *pContext)
 
static int GetNumVerticesOfFace (const SMikkTSpaceContext *pContext, const int iFace)
 
static MikkTSpaceGetUserDataFromContext (const SMikkTSpaceContext *pContext)
 
static SModelVertex GetVertex (const SMikkTSpaceContext *pContext, const int iFace, const int iVert)
 
static void GetPosition (const SMikkTSpaceContext *pContext, float *fvPosOut, const int iFace, const int iVert)
 
static void GetNormal (const SMikkTSpaceContext *pContext, float *fvNormOut, const int iFace, const int iVert)
 
static void GetTexCoord (const SMikkTSpaceContext *pContext, float *fvTexcOut, const int iFace, const int iVert)
 
static void SetTSpace (const SMikkTSpaceContext *pContext, const float *fvTangent, const float *fvBiTangent, const float fMagS, const float fMagT, const tbool bIsOrientationPreserving, const int iFace, const int iVert)
 This function is used to return tangent space results to the application. More...
 

Private Attributes

SMikkTSpaceInterface m_Interface
 
SMikkTSpaceContext m_Context
 
const CModelDefPtrm_Model
 
std::vector< float > & m_NewVertices
 
bool m_GpuSkinning
 

Constructor & Destructor Documentation

◆ MikkTSpace()

MikkTSpace::MikkTSpace ( const CModelDefPtr m,
std::vector< float > &  v,
bool  gpuSkinning 
)

Member Function Documentation

◆ Generate()

void MikkTSpace::Generate ( )

◆ GetNormal()

void MikkTSpace::GetNormal ( const SMikkTSpaceContext *  pContext,
float *  fvNormOut,
const int  iFace,
const int  iVert 
)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
[out]fvNormOutiVert - The array containing the normal.
[in]iFace- Number in the range { 0, 1, ..., getNumFaces() - 1 }.
[in]iVert- Number in the range { 0, 1, 2 } for triangles and { 0, 1, 2, 3 } for quads.

◆ GetNumFaces()

int MikkTSpace::GetNumFaces ( const SMikkTSpaceContext *  pContext)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
Returns
- the number of faces (triangles/quads) on the mesh to be processed.

◆ GetNumVerticesOfFace()

int MikkTSpace::GetNumVerticesOfFace ( const SMikkTSpaceContext *  pContext,
const int  iFace 
)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
[in]iFace- Number in the range { 0, 1, ..., getNumFaces() - 1 }.
Returns
- the number of faces (triangles/quads) on the mesh to be processed.

◆ GetPosition()

void MikkTSpace::GetPosition ( const SMikkTSpaceContext *  pContext,
float *  fvPosOut,
const int  iFace,
const int  iVert 
)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
[out]fvPosOut- The array containing the face.
[in]iFace- Number in the range { 0, 1, ..., getNumFaces() - 1 }.
[in]iVert- Number in the range { 0, 1, 2 } for triangles and { 0, 1, 2, 3 } for quads.

◆ GetTexCoord()

void MikkTSpace::GetTexCoord ( const SMikkTSpaceContext *  pContext,
float *  fvTexcOut,
const int  iFace,
const int  iVert 
)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
[out]fvTexcOutiVert - Array containing the UV.
[in]iFace- Number in the range { 0, 1, ..., getNumFaces() - 1 }.
[in]iVert- Number in the range { 0, 1, 2 } for triangles and { 0, 1, 2, 3 } for quads.

◆ GetUserDataFromContext()

MikkTSpace * MikkTSpace::GetUserDataFromContext ( const SMikkTSpaceContext *  pContext)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
Returns
- The MikkTSpace.

◆ GetVertex()

SModelVertex MikkTSpace::GetVertex ( const SMikkTSpaceContext *  pContext,
const int  iFace,
const int  iVert 
)
staticprivate
Parameters
[in]pContext- Pointer to the MikkTSpace context.
[in]iFace- Number in the range { 0, 1, ..., getNumFaces() - 1 }.
[in]iVert- Number in the range { 0, 1, 2 } for triangles and { 0, 1, 2, 3 } for quads.
Returns
- The MikkTSpace.

◆ SetTSpace()

void MikkTSpace::SetTSpace ( const SMikkTSpaceContext *  pContext,
const float *  fvTangent,
const float *  fvBiTangent,
const float  fMagS,
const float  fMagT,
const tbool  bIsOrientationPreserving,
const int  iFace,
const int  iVert 
)
staticprivate

This function is used to return tangent space results to the application.

For normal maps it is sufficient to use the following simplified version of the bitangent which is generated at pixel/vertex level. fSign = bIsOrientationPreserving ? 1.0f : (-1.0f); bitangent = fSign * cross(vN, tangent);

Parameters
[in]pContext- Pointer to the MikkTSpace context.
[in]fvTangent- fvTangent - The tangent vector.
[in]fvBiTangent- The "real" bitangent vector. Not be perpendicular to fvTangent. However, both are perpendicular to the vertex normal.
[in]fMagS- magniture of the fvTangent vector.
[in]fMagT- magniture of the fvBiTangent vector.
[in]bIsOrientationPreserving- Whether the orientation should be preserved.
[in]iFace- Number in the range {0,1,2} for triangles and {0,1,2,3} for quads.
[in]iVert- Array containing the position vector of the face.

Member Data Documentation

◆ m_Context

SMikkTSpaceContext MikkTSpace::m_Context
private

◆ m_GpuSkinning

bool MikkTSpace::m_GpuSkinning
private

◆ m_Interface

SMikkTSpaceInterface MikkTSpace::m_Interface
private

◆ m_Model

const CModelDefPtr& MikkTSpace::m_Model
private

◆ m_NewVertices

std::vector<float>& MikkTSpace::m_NewVertices
private

The documentation for this class was generated from the following files: