本文整理汇总了C++中SubMesh::GetVertex方法的典型用法代码示例。如果您正苦于以下问题:C++ SubMesh::GetVertex方法的具体用法?C++ SubMesh::GetVertex怎么用?C++ SubMesh::GetVertex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubMesh
的用法示例。
在下文中一共展示了SubMesh::GetVertex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeCurrent
void Andu::AnduGLWidget::newGLList( int listIdx, Caca::Mesh* pMesh,
GLenum renderType /*= GL_TRIANGLES*/,
map<int, vector<QColor> > *pVertexColorMap /*= 0*/,
map<int, vector<QColor> > *pPatchColorMap /*= 0*/)
{
makeCurrent();
// glNewList(2, GL_COMPILE);
// glutWireCube (1.0);
// glEndList();
printf("new gl list %d\n", listIdx);
glPushAttrib(GL_LIGHTING);
glPushAttrib(GL_LIGHT0);
glNewList(listIdx, GL_COMPILE);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
// glEnable (GL_BLEND);
Patch p;
MeshVertex v1,v2,v3;
//glColor4f(0,0.5,0.5,0.0);
GLfloat mat[] = { 0.5, 0.5, 0.5, 1.0 };
//glMaterialfv(GL_FRONT, GL_AMBIENT, mat);
for(int j = 0; j < pMesh->GetSubMeshCount(); j++) {
SubMesh* pSubMesh = pMesh->GetSubMesh(j);
const std::list<Patch>& patchList = pSubMesh->GetPatchList();
vector<QColor> *pPatchColorVec = 0;
if(pPatchColorMap) {
auto iter = pPatchColorMap->find(j);
if(iter != pPatchColorMap->end()) {
pPatchColorVec = &(iter->second);
}
}
vector<QColor> *pVertexColorVec = 0;
if(pVertexColorMap) {
auto iter = pVertexColorMap->find(j);
if(iter != pVertexColorMap->end()) {
pVertexColorVec = &(iter->second);
}
}
int patchIdx = 0;
for(std::list<Patch>::const_iterator i = patchList.begin();
i != patchList.end() ; i++)
{
MeshVertex v1 = pSubMesh->GetVertex(i->vertexIndexOne);
MeshVertex v2 = pSubMesh->GetVertex(i->vertexIndexTwo);
MeshVertex v3 = pSubMesh->GetVertex(i->vertexIndexThree);
glPushAttrib(GL_CURRENT_BIT);
glBegin(renderType);
QColor patchColor;
if(pPatchColorVec) {
patchColor = pPatchColorVec->at(patchIdx);
qglColor(patchColor);
}
if(!patchColor.isValid() && pVertexColorVec) {
qglColor(pVertexColorVec->at(i->vertexIndexOne));
}
glNormal3f(v1.normal.x,v1.normal.y,v1.normal.z);
glVertex3f(v1.pos.x,v1.pos.y,v1.pos.z);
if(!patchColor.isValid() && pVertexColorVec) {
qglColor(pVertexColorVec->at(i->vertexIndexThree));
}
glNormal3f(v3.normal.x,v3.normal.y,v3.normal.z);
glVertex3f(v3.pos.x,v3.pos.y,v3.pos.z);
if(!patchColor.isValid() && pVertexColorVec) {
qglColor(pVertexColorVec->at(i->vertexIndexTwo));
}
glNormal3f(v2.normal.x,v2.normal.y,v2.normal.z);
glVertex3f(v2.pos.x,v2.pos.y,v2.pos.z);
glEnd();
glPopAttrib();
patchIdx++;
}
}
glEndList();
glPopAttrib();
glPopAttrib();
//.........这里部分代码省略.........