本文整理汇总了C++中LTMatrix::Apply3x3方法的典型用法代码示例。如果您正苦于以下问题:C++ LTMatrix::Apply3x3方法的具体用法?C++ LTMatrix::Apply3x3怎么用?C++ LTMatrix::Apply3x3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LTMatrix
的用法示例。
在下文中一共展示了LTMatrix::Apply3x3方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WrapTexture
// Wrap the textures, starting at a poly index
void CRVTrackerTextureWrap::WrapTexture(CTWPolyInfo *pPoly, const CVector &vWrapDir, CTextExtents &cExtents) const
{
// Mark this poly as wrapped
pPoly->m_bTouched = TRUE;
CTexturedPlane& Texture = pPoly->m_pPoly->GetTexture(GetCurrTexture());
// Get the texture space
LTVector vWrapO = Texture.GetO();
LTVector vWrapP = Texture.GetP();
LTVector vWrapQ = Texture.GetQ();
// Get the texture offset projections
float fWrapOdotP = vWrapO.Dot(vWrapP);
float fWrapOdotQ = vWrapO.Dot(vWrapQ);
// Update the texturing extents
for (uint32 nExtentLoop = 0; nExtentLoop < pPoly->m_aEdges.GetSize(); ++nExtentLoop)
{
LTVector vEdgePt = pPoly->m_aEdges[nExtentLoop]->m_aPt[0];
float fCurU = vWrapP.Dot(vEdgePt) - fWrapOdotP;
float fCurV = vWrapQ.Dot(vEdgePt) - fWrapOdotQ;
cExtents.m_fMinU = LTMIN(fCurU, cExtents.m_fMinU);
cExtents.m_fMaxU = LTMAX(fCurU, cExtents.m_fMaxU);
cExtents.m_fMinV = LTMIN(fCurV, cExtents.m_fMinV);
cExtents.m_fMaxV = LTMAX(fCurV, cExtents.m_fMaxV);
}
CMoArray<uint32> aNeighbors;
CMoArray<float> aDots;
// Insert the neighbors into a list in dot-product order
for (uint32 nNeighborLoop = 0; nNeighborLoop < pPoly->m_aNeighbors.GetSize(); ++nNeighborLoop)
{
CTWPolyInfo *pNeighbor = pPoly->m_aNeighbors[nNeighborLoop];
// Skip edges that don't have a neighbor
if (!pNeighbor)
continue;
// Skip neighbors that are already wrapped
if (pNeighbor->m_bTouched)
continue;
// Get our dot product
float fCurDot = vWrapDir.Dot(pPoly->m_aEdges[nNeighborLoop]->m_Plane.m_Normal);
if ((m_bRestrictWalkDir) && (fCurDot < 0.707f))
continue;
// Mark this neighbor as touched (to avoid later polygons pushing it onto the stack)
pNeighbor->m_bTouched = TRUE;
// Insert it into the list
for (uint32 nInsertLoop = 0; nInsertLoop < aNeighbors.GetSize(); ++nInsertLoop)
{
if (fCurDot > aDots[nInsertLoop])
break;
}
aDots.Insert(nInsertLoop, fCurDot);
aNeighbors.Insert(nInsertLoop, nNeighborLoop);
}
// Recurse through its neighbors
for (uint32 nWrapLoop = 0; nWrapLoop < aNeighbors.GetSize(); ++nWrapLoop)
{
CTWPolyInfo *pNeighbor = pPoly->m_aNeighbors[aNeighbors[nWrapLoop]];
CTWEdgeInfo *pEdge = pPoly->m_aEdges[aNeighbors[nWrapLoop]];
//////////////////////////////////////////////////////////////////////////////
// Wrap this neighbor
// Create a matrix representing the basis of the polygon in relation to this edge
LTMatrix mPolyBasis;
mPolyBasis.SetTranslation(0.0f, 0.0f, 0.0f);
mPolyBasis.SetBasisVectors(&pEdge->m_vDir, &pPoly->m_pPoly->m_Plane.m_Normal, &pEdge->m_Plane.m_Normal);
// Create a new basis for the neighbor polygon
LTMatrix mNeighborBasis;
LTVector vNeighborForward;
vNeighborForward = pNeighbor->m_pPoly->m_Plane.m_Normal.Cross(pEdge->m_vDir);
// Just to be sure..
vNeighborForward.Norm();
mNeighborBasis.SetTranslation(0.0f, 0.0f, 0.0f);
mNeighborBasis.SetBasisVectors(&pEdge->m_vDir, &pNeighbor->m_pPoly->m_Plane.m_Normal, &vNeighborForward);
// Create a rotation matrix from here to there
LTMatrix mRotation;
mRotation = mNeighborBasis * ~mPolyBasis;
// Rotate the various vectors
LTVector vNewP;
LTVector vNewQ;
LTVector vNewDir;
mRotation.Apply3x3(vWrapP, vNewP);
mRotation.Apply3x3(vWrapQ, vNewQ);
//.........这里部分代码省略.........