diff --git a/Graphics/Draw.h b/Graphics/Draw.h index 6f5021e3e105e3a12f9d170feb55cc7eb50d4b62..bd307676b55060bba88cca8a1fefba5f9fef05c9 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -100,6 +100,8 @@ void Draw_Vector(int Type, int Fill, double relHeadRadius, double relStemLength, double relStemRadius, double x, double y, double z, double dx, double dy, double dz, int light); +void Draw_Box(double xmin, double ymin, double zmin, + double xmax, double ymax, double zmax); void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, double a, double b, double c, double d, int shade=0); diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index cdbd5c3ad59d675bcb306a46c44b50b0916fc447..72cf992d3e5587658c29de5c7f50896b6a216a1e 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.67 2006-08-15 03:43:38 geuzaine Exp $ +// $Id: Entity.cpp,v 1.68 2006-08-15 04:15:19 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -454,6 +454,33 @@ public: }; }; +void Draw_Box(double xmin, double ymin, double zmin, + double xmax, double ymax, double zmax) +{ + glBegin(GL_LINE_LOOP); + glVertex3d(xmin, ymin, zmin); + glVertex3d(xmax, ymin, zmin); + glVertex3d(xmax, ymax, zmin); + glVertex3d(xmin, ymax, zmin); + glEnd(); + glBegin(GL_LINE_LOOP); + glVertex3d(xmin, ymin, zmax); + glVertex3d(xmax, ymin, zmax); + glVertex3d(xmax, ymax, zmax); + glVertex3d(xmin, ymax, zmax); + glEnd(); + glBegin(GL_LINES); + glVertex3d(xmin, ymin, zmin); + glVertex3d(xmin, ymin, zmax); + glVertex3d(xmax, ymin, zmin); + glVertex3d(xmax, ymin, zmax); + glVertex3d(xmax, ymax, zmin); + glVertex3d(xmax, ymax, zmax); + glVertex3d(xmin, ymax, zmin); + glVertex3d(xmin, ymax, zmax); + glEnd(); +} + void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, double a, double b, double c, double d, diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index a71ad144f8fa9d24a2938ebbba3bb4627a17a9aa..f3015a3a1a4f690b6bf0e63793b4d81b7ef16359 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.112 2006-08-15 02:17:25 geuzaine Exp $ +// $Id: Geom.cpp,v 1.113 2006-08-15 04:15:19 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -419,6 +419,60 @@ void Draw_Geom() for(int i = 0; i < 6; i++) glDisable((GLenum)(GL_CLIP_PLANE0 + i)); + + bool geometryExists = + GMODEL->numVertex() || GMODEL->numEdge() || GMODEL->numFace() || GMODEL->numRegion(); + + if(geometryExists && (CTX.draw_bbox || !CTX.mesh.draw)) { + glColor4ubv((GLubyte *) & CTX.color.fg); + glLineWidth(CTX.line_width); + gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); + + Draw_Box(CTX.min[0], CTX.min[1], CTX.min[2], + CTX.max[0], CTX.max[1], CTX.max[2]); + + char label[256]; + double offset = 0.3 * CTX.gl_fontsize * CTX.pixel_equiv_x; + glRasterPos3d(CTX.min[0] + offset / CTX.s[0], + CTX.min[1] + offset / CTX.s[0], + CTX.min[2] + offset / CTX.s[0]); + sprintf(label, "(%g,%g,%g)", CTX.min[0], CTX.min[1], CTX.min[2]); + Draw_String(label); + glRasterPos3d(CTX.max[0] + offset / CTX.s[0], + CTX.max[1] + offset / CTX.s[0], + CTX.max[2] + offset / CTX.s[0]); + sprintf(label, "(%g,%g,%g)", CTX.max[0], CTX.max[1], CTX.max[2]); + Draw_String(label); + + glColor3d(1.,0.,0.); + for(int i = 0; i < 6; i++) + if(CTX.clip[i] & 1 || CTX.clip[i] & 2) + Draw_PlaneInBoundingBox(CTX.min[0], CTX.min[1], CTX.min[2], + CTX.max[0], CTX.max[1], CTX.max[2], + CTX.clip_plane[i][0], CTX.clip_plane[i][1], + CTX.clip_plane[i][2], CTX.clip_plane[i][3]); + if(CTX.mesh.use_cut_plane) + Draw_PlaneInBoundingBox(CTX.min[0], CTX.min[1], CTX.min[2], + CTX.max[0], CTX.max[1], CTX.max[2], + CTX.mesh.cut_planea, CTX.mesh.cut_planeb, + CTX.mesh.cut_planec, CTX.mesh.cut_planed); + } + + if(CTX.axes){ + glColor4ubv((GLubyte *) & CTX.color.axes); + glLineWidth(CTX.line_width); + gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); + if(!CTX.axes_auto_position){ + Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, + CTX.axes_position); + } + else if(geometryExists){ + double bb[6] = {CTX.min[0], CTX.max[0], + CTX.min[1], CTX.max[1], + CTX.min[2], CTX.max[2]}; + Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, bb); + } + } } void HighlightEntity(GEntity *e, int permanent) diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index 5c0b4cee43ed9d3ab11ea6c50aab8f197d7ebaca..0017b4f18b4ca8be56981277ab9e279f7326b357 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.162 2006-08-15 03:43:38 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.163 2006-08-15 04:15:19 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -341,6 +341,28 @@ class drawMeshGFace { drawNormals(f, f->quadrangles); } + if(CTX.mesh.points_per_element){ + // TODO + } + + if(CTX.mesh.dual) { + /* TODO + glColor4ubv((GLubyte *) & CTX.color.fg); + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0x0F0F); + gl2psEnable(GL2PS_LINE_STIPPLE); + glBegin(GL_LINES); + for(int i = 0; i < 3; i++) { + int j = i ? (i - 1) : 2; + glVertex3d(Xc, Yc, Zc); + glVertex3d((X[i] + X[j]) / 2., (Y[i] + Y[j]) / 2., (Z[i] + Z[j]) / 2.); + } + glEnd(); + glDisable(GL_LINE_STIPPLE); + gl2psDisable(GL2PS_LINE_STIPPLE); + */ + } + if(CTX.render_mode == GMSH_SELECT) { glPopName(); glPopName(); diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 2860da72fe9463e11ff90f8d298360347e047f8d..ebdecb7b95e0d24f9c24debc3f1b23925bc71568 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.110 2006-08-12 21:31:24 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.111 2006-08-15 04:15:19 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -327,6 +327,7 @@ int MergeProblem(char *name, int warn_if_missing) } SetBoundingBox(); + CTX.mesh.changed = 1; Msg(STATUS2, "Read '%s'", name); fclose(fp); return status;