本文整理汇总了C++中VertexList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexList::front方法的具体用法?C++ VertexList::front怎么用?C++ VertexList::front使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexList
的用法示例。
在下文中一共展示了VertexList::front方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: streamSubmesh
//bool MeshXMLExporter::streamSubmesh(std::ostream &of, IGameNode *node, std::string &mtlName) {
bool MeshXMLExporter::streamSubmesh(std::ostream &of, IGameObject *obj, std::string &mtlName) {
//IGameObject* obj = node->GetIGameObject();
if (obj->GetIGameType() != IGameMesh::IGAME_MESH)
return false;
// InitializeData() is important -- it performs all of the WSM/time eval for us; no face data without it
// obj->InitializeData();
IGameMesh* mesh = (IGameMesh*) obj;
int vertCount = mesh->GetNumberOfVerts();
int faceCount = mesh->GetNumberOfFaces();
Tab<int> matIds = mesh->GetActiveMatIDs();
Tab<DWORD> smGrpIds = mesh->GetActiveSmgrps();
Tab<int> texMaps = mesh->GetActiveMapChannelNum();
of << "\t\t<submesh ";
if (mtlName.length() > 0)
of << "material=\"" << mtlName << "\" ";
of << "usesharedvertices=\"false\" use32bitindexes=\"";
of << (vertCount > 65535);
of << "\">" << std::endl;
// *************** Export Face List ***************
of << "\t\t\t<faces count=\"" << faceCount << "\">" << std::endl;
//std::vector<UVVert
// iterate the face list, putting vertices in the list for this submesh
VertexList vertexList;
for (int i=0; i<faceCount; i++) {
of << "\t\t\t\t<face";
FaceEx* face = mesh->GetFace(i);
// do this for each vertex on the face
for (int vi=0; vi<3; vi++) {
Point3 p = mesh->GetVertex(face->vert[vi]);
Vertex v(p.x, p.y, p.z);
if (m_config.getExportVertexColours()) {
Point3 c = mesh->GetColorVertex(face->vert[vi]);
float a = mesh->GetAlphaVertex(face->vert[vi]);
v.setColour(c.x, c.y, c.z, a);
}
Point3 n = mesh->GetNormal(face, vi);
v.setNormal(n.x, n.y, n.z);
// get each set of texcoords for this vertex
for (int ch=0; ch < texMaps.Count(); ch++) {
Point3 tv;
DWORD indices[3];
if (mesh->GetMapFaceIndex(texMaps[ch], i, indices))
tv = mesh->GetMapVertex(texMaps[ch], indices[vi]);
else
tv = mesh->GetMapVertex(texMaps[ch], face->vert[vi]);
v.addTexCoord(texMaps[ch], tv.x, tv.y, tv.z);
}
int actualVertexIndex = vertexList.add(v);
of << " v" << vi + 1 << "=\"" << actualVertexIndex << "\"";
}
of << " />" << std::endl;
}
of << "\t\t\t</faces>" << std::endl;
// *************** End Export Face List ***************
// *************** Export Geometry ***************
of << "\t\t\t<geometry vertexcount=\"" << vertexList.size() << "\">" << std::endl;
// *************** Export Vertex Buffer ***************
bool exportNormals = true;
of << std::boolalpha;
of << "\t\t\t\t<vertexbuffer positions=\"true\" normals=\"" << exportNormals << "\" colours_diffuse=\"" << m_config.getExportVertexColours() << "\" texture_coords=\"" << texMaps.Count() << "\"";
for (int i=0; i<texMaps.Count(); i++)
of << " texture_coords_dimensions_" << i << "=\"2\"";
of << ">" << std::endl;
int numVerts = vertexList.size();
for (int i=0; i < numVerts; i++)
{
const Vertex& v = vertexList.front();
//.........这里部分代码省略.........