本文整理汇总了C++中GMatrix::ExtractMatrix3方法的典型用法代码示例。如果您正苦于以下问题:C++ GMatrix::ExtractMatrix3方法的具体用法?C++ GMatrix::ExtractMatrix3怎么用?C++ GMatrix::ExtractMatrix3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMatrix
的用法示例。
在下文中一共展示了GMatrix::ExtractMatrix3方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Inverse
// [HACK] Wow, "GMatrix::Inverse()" appears to be buggy...
GMatrix PLTools::Inverse(const GMatrix &mMatrix)
{
Matrix3 mMatrix3 = mMatrix.ExtractMatrix3();
mMatrix3.Invert();
return mMatrix3;
}
示例2: DumpModel
//----------------------------------------------------------------------------------
bool DumpModel(IGameMesh *gM, m_model *pModel, IGameNode *pGameNode)
{
IGameSkin *skin = NULL;
if (gM->InitializeData()) // prepare game data
{
GMatrix ObjectTM = pGameNode->GetObjectTM(ExporterMAX::GetExporter()->GetStaticFrame());
Matrix3 world_to_obj = Inverse(ObjectTM.ExtractMatrix3());
AffineParts PRS;
decomp_affine(ObjectTM.ExtractMatrix3(), &PRS);
//Matrix xform;
//
//xform.set_rot(Quaternion(-PRS.q.x, -PRS.q.z, PRS.q.y, PRS.q.w));
//xform.set_translation(Vector(-PRS.t.x, PRS.t.z, PRS.t.y));
const int numMod = gM->GetNumModifiers();
if (numMod > 0)
{
for (int i = 0; i < numMod; i++) // check for skin modifier
{
IGameModifier * pM = gM->GetIGameModifier(i);
if (pM->IsSkin()) {
skin = (IGameSkin*)pM; // skin modifier
}
}
}
mesh_opt *m_opt;
TriMapType tri_map;
MatFaceMapType matface_map; // int <-> material
unsigned int max_face_idx = 0;
unsigned int FaceNum = Helper_GetNumberOfFaces(gM, FaceNum, max_face_idx);
for (size_t i = 0; i < FaceNum; ++i)
{
Helper_ProcessFace(gM, i, PRS, world_to_obj, matface_map, tri_map, max_face_idx);
}
Helper_ComputeNormals(gM, matface_map);
for (size_t IndexAdd = 0; IndexAdd < tri_map.size(); ++IndexAdd)
{
pModel->meshes.push_back(new m_mesh());
}
int count = 0;
TriMapIt it = tri_map.begin();
while (it != tri_map.end())
{
m_mesh &msh = *pModel->meshes[count];
msh.num_faces = (*it).second->size() / 3;
msh.material_id = (*it).first;
msh.faces_idx = new unsigned int[msh.num_faces * 3];
for (size_t i = 0; i < msh.num_faces * 3; i+=3)
{
int Idx0 = (*it).second->front();
(*it).second->pop_front();
int Idx1 = (*it).second->front();
(*it).second->pop_front();
int Idx2 = (*it).second->front();
(*it).second->pop_front();
msh.faces_idx[i+0] = Idx2;
msh.faces_idx[i+1] = Idx1;
msh.faces_idx[i+2] = Idx0;
}
MatFaceMapIt it_mapfacemap = matface_map.find((*it).first);
assert(it_mapfacemap != matface_map.end());
m_opt = (*it_mapfacemap).second;
msh.skin = skin ? true : false;
msh.num_vertices = m_opt->face_map.size();
msh.vertices = new Vector[msh.num_vertices];
msh.normals = new Vector[msh.num_vertices];
msh.colors = new Vector4f[msh.num_vertices];
msh.weights = skin ? new Vector4f[msh.num_vertices] : NULL;
msh.bone_idxs = skin ? new unsigned int[msh.num_vertices * 4] : NULL;
unsigned int texdim = 0;
bool * faceidx_cache = new bool[msh.num_vertices];
memset(faceidx_cache, 0, msh.num_vertices * sizeof(bool));
bool alloc_texture = false;
for (size_t i = 0; i < msh.num_faces * 3; ++i)
//.........这里部分代码省略.........