int main(int argc, char **argv) { GmshInitialize(argc, argv); GmshSetOption("Mesh", "Algorithm", 5.); GmshSetOption("General", "Terminal", 1.); GModel *m = new GModel(); m->readMSH("bunny.msh"); m->fillVertexArrays(); std::vector<GEntity*> entities; m->getEntities(entities); for(unsigned int i = 0; i < entities.size(); i++){ GEntity *ge = entities[i]; printf("coucou entite %d (dimension %d)\n", ge->tag(), ge->dim()); if(ge->va_triangles) printf(" j'ai un va de triangles: %d vertex\n", ge->va_triangles->getNumVertices()); if(ge->va_lines) printf(" j'ai un va de lignes: %d vertex\n", ge->va_lines->getNumVertices()); } delete m; GmshFinalize(); }
void drawContext::drawMesh() { if(!CTX::instance()->mesh.draw) return; // make sure to flag any model-dependent post-processing view as // changed if the underlying mesh has, before resetting the changed // flag if(CTX::instance()->mesh.changed){ for(unsigned int i = 0; i < GModel::list.size(); i++) for(unsigned int j = 0; j < PView::list.size(); j++) if(PView::list[j]->getData()->hasModel(GModel::list[i])) PView::list[j]->setChanged(true); } glPointSize((float)CTX::instance()->mesh.pointSize); gl2psPointSize((float)(CTX::instance()->mesh.pointSize * CTX::instance()->print.epsPointSizeFactor)); glLineWidth((float)CTX::instance()->mesh.lineWidth); gl2psLineWidth((float)(CTX::instance()->mesh.lineWidth * CTX::instance()->print.epsLineWidthFactor)); if(CTX::instance()->mesh.lightTwoSide) glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); else glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); if(!CTX::instance()->clipWholeElements){ for(int i = 0; i < 6; i++) if(CTX::instance()->mesh.clip & (1 << i)) glEnable((GLenum)(GL_CLIP_PLANE0 + i)); else glDisable((GLenum)(GL_CLIP_PLANE0 + i)); } for(unsigned int i = 0; i < GModel::list.size(); i++){ GModel *m = GModel::list[i]; m->fillVertexArrays(); if(m->getVisibility() && isVisible(m)){ int status = m->getMeshStatus(); if(status >= 0) std::for_each(m->firstVertex(), m->lastVertex(), drawMeshGVertex(this)); if(status >= 1) std::for_each(m->firstEdge(), m->lastEdge(), drawMeshGEdge(this)); if(status >= 2){ beginFakeTransparency(); std::for_each(m->firstFace(), m->lastFace(), drawMeshGFace(this)); endFakeTransparency(); } if(status >= 3) std::for_each(m->firstRegion(), m->lastRegion(), drawMeshGRegion(this)); } } CTX::instance()->mesh.changed = 0; for(int i = 0; i < 6; i++) glDisable((GLenum)(GL_CLIP_PLANE0 + i)); }