本文整理汇总了C++中StdMat2::EnableMap方法的典型用法代码示例。如果您正苦于以下问题:C++ StdMat2::EnableMap方法的具体用法?C++ StdMat2::EnableMap怎么用?C++ StdMat2::EnableMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StdMat2
的用法示例。
在下文中一共展示了StdMat2::EnableMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createGroupHeaderNode
//.........这里部分代码省略.........
// 顶点坐标和UV
for (unsigned int i = 0; i < geosetData.vcount; ++i)
{
ModelVertex& vertexData = m_globalVertices[ verDataIndex[geosetData.vstart + i] ];
mesh.verts[i] = *(Point3*)(&vertexData.pos);
// UV坐标反转
mesh.tVerts[i].x = vertexData.texcoords.x;
mesh.tVerts[i].y = 1.0f - vertexData.texcoords.y;
}
// 三角形
for (unsigned int i = 0; i < triangeCount; ++i)
{
Face& face = mesh.faces[i];
face.setVerts(triData[geosetData.istart + i*3] - m_indexCount,
triData[geosetData.istart + i*3+1] - m_indexCount,
triData[geosetData.istart + i*3+2] - m_indexCount);
face.Show();
face.setEdgeVisFlags(EDGE_VIS, EDGE_VIS, EDGE_VIS);
TVFace& tface = mesh.tvFace[i];
tface.setTVerts(triData[geosetData.istart + i*3] - m_indexCount,
triData[geosetData.istart + i*3+1] - m_indexCount,
triData[geosetData.istart + i*3+2] - m_indexCount);
}
// 法线
mesh.SpecifyNormals();
MeshNormalSpec *specNorms = mesh.GetSpecifiedNormals();
if (specNorms)
{
specNorms->ClearAndFree();
specNorms->SetNumFaces(triangeCount);
specNorms->SetNumNormals(geosetData.vcount);
Point3* norms = specNorms->GetNormalArray();
for (unsigned int i = 0; i < geosetData.vcount; ++i)
{
ModelVertex& vertexData = m_globalVertices[ verDataIndex[geosetData.vstart + i] ];
norms[i] = *(Point3*)(&vertexData.normal);
}
MeshNormalFace* pFaces = specNorms->GetFaceArray();
for (unsigned int i = 0; i < triangeCount; ++i)
{
pFaces[i].SpecifyNormalID(0, triData[geosetData.istart + i*3] - m_indexCount);
pFaces[i].SpecifyNormalID(1, triData[geosetData.istart + i*3+1] - m_indexCount);
pFaces[i].SpecifyNormalID(2, triData[geosetData.istart + i*3+2] - m_indexCount);
}
specNorms->SetAllExplicit(true);
specNorms->CheckNormals();
}
// 删除重复的和无效的面
mesh.RemoveDegenerateFaces();
mesh.RemoveIllegalFaces();
//realINode->BackCull(FALSE); // 取消背面裁减 双面绘制与取消背面裁减一起设置
realINode->EvalWorldState(0);
// 索引值修正
m_indexCount += geosetData.vcount;
}
// 加载材质
unsigned short* texLookupData = (unsigned short*)(m_m2FileData + m_modelHeader->ofsTexLookup);
ModelTextureDef* texUnitDefData = (ModelTextureDef*)(m_m2FileData + m_modelHeader->ofsTextures);
ModelTexUnit* texUnitData = (ModelTexUnit*)(m_m2FileData + m_modelView->ofsTex);
for (unsigned int i = 0; i < m_modelView->nTex; ++i)
{
ModelTexUnit& texUnit = texUnitData[i];
unsigned short textureID = texLookupData[texUnit.textureid];
ModelTextureDef& texDef = texUnitDefData[textureID];
string textureName;
if (texDef.type == 0)
textureName = (LPCSTR)(m_m2FileData + texDef.nameOfs);
else
textureName = getReplacableTexture(texDef.type);
StdMat2* material = m_materialList[texUnit.op];
if (!material)
material = createMaterial();
// 根据混合属性决定加在第几层
material->SetSubTexmap(ID_DI, createTexture(textureName.c_str()));
material->EnableMap(ID_DI, TRUE);
//material->SetTwoSided(TRUE); // 双面 设置了此标志的才打开
m_maxInterface->GetMaterialLibrary().Add(material);
m_geosetNodeList[texUnit.op]->SetMtl(material);
}
m_maxInterface->RedrawViews(m_maxInterface->GetTime());
}