diff --git a/Geo/GEntity.cpp b/Geo/GEntity.cpp index 72abc9a55dd5041068d622354f37c39c43711a8f..113911b13a087ae1b6c36279bced7b22f3d06d4b 100644 --- a/Geo/GEntity.cpp +++ b/Geo/GEntity.cpp @@ -5,7 +5,7 @@ extern Context_T CTX; GEntity::GEntity(GModel *m, int t) - : _model(m), _tag(t), _visible(true), _flag(0), meshRep(0) + : _model(m), _tag(t), _visible(true), _selection(0), meshRep(0) { _color = CTX.PACK_COLOR(0, 0, 255, 0); } diff --git a/Geo/GEntity.h b/Geo/GEntity.h index 5e57a77ca5f5c1621e5ebaa11c869fc970ac1abd..f38b986fc1c7d08d1779e74cf25e9b92cc089546 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -45,8 +45,8 @@ class GEntity { // The tag (the number) of this entity int _tag; - // The visibility and the general purpose flag - char _visible, _flag; + // The visibility and the selection flag + char _visible, _selection; // The color of the entity (ignored if set to transparent blue) unsigned int _color; @@ -166,11 +166,11 @@ class GEntity { // Set the visibility flag virtual void setVisibility(char val, bool recursive=false){ _visible = val; } - // Get the multi-purpose flag - virtual char getFlag(){ return _flag; } + // Get the selection flag + virtual char getSelection(){ return _selection; } - // Set the multi-purpose flag - virtual void setFlag(char val){ _flag = val; } + // Set the selection flag + virtual void setSelection(char val){ _selection = val; } // Get the color virtual unsigned int getColor(){ return _color; } diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 09521bc4c68c2cd41f0f11489a74ebba35265843..8c26197b336b8c279aa63267442efc87856b17a5 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.114 2006-08-15 21:22:12 geuzaine Exp $ +// $Id: Geom.cpp,v 1.115 2006-08-17 14:09:37 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -41,7 +41,7 @@ class drawGVertex { glPushName(v->tag()); } - if(v->getFlag() > 0) { + if(v->getSelection()) { glPointSize(CTX.geom.point_sel_size); gl2psPointSize(CTX.geom.point_sel_size * CTX.print.eps_point_size_factor); glColor4ubv((GLubyte *) & CTX.color.geom.point_sel); @@ -54,7 +54,7 @@ class drawGVertex { if(CTX.geom.points) { if(CTX.geom.point_type > 0) { - if(v->getFlag() > 0) + if(v->getSelection()) Draw_Sphere(CTX.geom.point_sel_size, v->x(), v->y(), v->z(), CTX.geom.light); else @@ -98,7 +98,7 @@ class drawGEdge { glPushName(e->tag()); } - if(e->getFlag() > 0) { + if(e->getSelection()) { glLineWidth(CTX.geom.line_sel_width); gl2psLineWidth(CTX.geom.line_sel_width * CTX.print.eps_line_width_factor); glColor4ubv((GLubyte *) & CTX.color.geom.line_sel); @@ -124,7 +124,7 @@ class drawGEdge { double x[2] = {p1.x(), p2.x()}; double y[2] = {p1.y(), p2.y()}; double z[2] = {p1.z(), p2.z()}; - Draw_Cylinder(e->getFlag() > 0 ? CTX.geom.line_sel_width : + Draw_Cylinder(e->getSelection() ? CTX.geom.line_sel_width : CTX.geom.line_width, x, y, z, CTX.geom.light); } } @@ -327,7 +327,7 @@ public : glPushName(f->tag()); } - if(f->getFlag() > 0) { + if(f->getSelection()) { glLineWidth(CTX.geom.line_sel_width / 2.); gl2psLineWidth(CTX.geom.line_sel_width / 2. * CTX.print.eps_line_width_factor); @@ -364,7 +364,7 @@ class drawGRegion { glPushName(r->tag()); } - if(r->getFlag() > 0) + if(r->getSelection()) glColor4ubv((GLubyte *) & CTX.color.geom.volume_sel); else glColor4ubv((GLubyte *) & CTX.color.geom.volume); @@ -461,7 +461,7 @@ void Draw_Geom() void HighlightEntity(GEntity *e, int permanent) { if(permanent) - e->setFlag(2); + e->setSelection(1); else Msg(STATUS2N, "%s", e->getInfoString().c_str()); } @@ -497,7 +497,7 @@ void HighlightEntityNum(int v, int c, int s, int r, int permanent) void ZeroHighlightEntity(GEntity *e) { - e->setFlag(-2); + e->setSelection(0); } void ZeroHighlightEntity(GVertex *v, GEdge *c, GFace *s, GRegion *r) diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index 30df83886aabe27626fd5db452f07c3a5f73e722..2ade192c4f9fa9a4d57277c9b672e2569110e352 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.174 2006-08-17 03:22:22 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.175 2006-08-17 14:09:38 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -58,7 +58,7 @@ static unsigned int getColorByElement(MElement *ele) static unsigned int getColorByEntity(GEntity *e) { - if(e->getFlag() > 0){ // selection + if(e->getSelection()){ // selection switch(e->dim()){ case 0: return CTX.color.geom.point_sel; case 1: return CTX.color.geom.line_sel; @@ -367,7 +367,7 @@ static void addEdgesInArrays(GEntity *e) for(MRep::eriter it = m->firstEdgeRep(); it != m->lastEdgeRep(); ++it){ MVertex *v[2] = {it->first.first, it->first.second}; MElement *ele = it->second; - SVector3 n = ele->getFace(0).normal(); + SVector3 n = ele->getFaceRep(0).normal(); unsigned int color = getColorByElement(ele); for(int i = 0; i < 2; i++){ if(e->dim() == 2 && CTX.mesh.smooth_normals) @@ -452,7 +452,8 @@ static void drawArrays(GEntity *e, VertexArray *va, GLint type, bool useNormalAr glDisableClientState(GL_COLOR_ARRAY); glColor4ubv((GLubyte *) & color); } - else if(CTX.mesh.color_carousel == 0 || CTX.mesh.color_carousel == 3){ + else if(!e->getSelection() && (CTX.mesh.color_carousel == 0 || + CTX.mesh.color_carousel == 3)){ glEnableClientState(GL_COLOR_ARRAY); } else{