Skip to content
Snippets Groups Projects
Commit b726b0bd authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

opt to shade plane in bbox
parent eb3174c6
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ void Draw_Vector(int Type, int Fill, ...@@ -94,7 +94,7 @@ void Draw_Vector(int Type, int Fill,
int light); int light);
void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin,
double xmax, double ymax, double zmax, double xmax, double ymax, double zmax,
double a, double b, double c, double d); double a, double b, double c, double d, int shade=0);
void Draw_SmallAxes(void); void Draw_SmallAxes(void);
void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256],
double bbox[6]); double bbox[6]);
......
// $Id: Entity.cpp,v 1.62 2006-01-06 00:34:24 geuzaine Exp $ // $Id: Entity.cpp,v 1.63 2006-01-20 00:29:59 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -399,11 +399,11 @@ void Draw_Vector(int Type, int Fill, ...@@ -399,11 +399,11 @@ void Draw_Vector(int Type, int Fill,
class point{ class point{
public: public:
double x, y, z; double x, y, z;
bool valid; bool valid;
point() : x(0.), y(0.), z(0.), valid(false) {;}; point() : x(0.), y(0.), z(0.), valid(false) {;};
point(double xi, double yi, double zi) : point(double xi, double yi, double zi) :
x(xi), y(yi), z(zi), valid(true) {;}; x(xi), y(yi), z(zi), valid(true) {;};
}; };
class plane{ class plane{
...@@ -439,7 +439,8 @@ public: ...@@ -439,7 +439,8 @@ public:
void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin,
double xmax, double ymax, double zmax, double xmax, double ymax, double zmax,
double a, double b, double c, double d) double a, double b, double c, double d,
int shade)
{ {
plane pl(a, b, c, d); plane pl(a, b, c, d);
...@@ -480,6 +481,9 @@ void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, ...@@ -480,6 +481,9 @@ void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin,
n[2] *= ll * CTX.pixel_equiv_x / CTX.s[2]; n[2] *= ll * CTX.pixel_equiv_x / CTX.s[2];
double length = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); double length = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
int n_shade = 0;
point p_shade[24];
for(int i = 0; i < 6; i++){ for(int i = 0; i < 6; i++){
int nb = 0; int nb = 0;
point p[4]; point p[4];
...@@ -498,9 +502,31 @@ void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, ...@@ -498,9 +502,31 @@ void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin,
Draw_3DArrow(CTX.arrow_rel_head_radius, Draw_3DArrow(CTX.arrow_rel_head_radius,
CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius,
p[j].x, p[j].y, p[j].z, n[0], n[1], n[2], length, 1); p[j].x, p[j].y, p[j].z, n[0], n[1], n[2], length, 1);
if(shade){
p_shade[n_shade].x = p[j].x;
p_shade[n_shade].y = p[j].y;
p_shade[n_shade].z = p[j].z;
n_shade++;
}
} }
} }
} }
if(shade){
// disable two-side lighting beacuse polygon can overlap itself
GLboolean twoside;
glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &twoside);
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
glEnable(GL_LIGHTING);
glBegin(GL_POLYGON);
glNormal3d(n[0], n[1], n[2]);
for(int j = 0; j < n_shade; j++){
glVertex3d(p_shade[j].x, p_shade[j].y, p_shade[j].z);
}
glEnd();
glDisable(GL_LIGHTING);
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, twoside);
}
} }
void Draw_SmallAxes() void Draw_SmallAxes()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment