diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp index 57fa7c1d92329cbe5ff80c848b913d7580d86e30..a017aece624102a8b8616020035a838a9f72aba2 100644 --- a/Graphics/Draw.cpp +++ b/Graphics/Draw.cpp @@ -1,4 +1,4 @@ -// $Id: Draw.cpp,v 1.53 2004-05-18 17:00:37 geuzaine Exp $ +// $Id: Draw.cpp,v 1.54 2004-05-28 21:06:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -169,7 +169,7 @@ void InitRenderModel(void) glShadeModel(GL_SMOOTH); float specular[4] = {CTX.shine, CTX.shine, CTX.shine, 1.0}; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); - glEnable(GL_NORMALIZE); + glEnable(GL_RESCALE_NORMAL); glEnable(GL_COLOR_MATERIAL); // disable lighting by default (we enable it for each particular // case in the drawing routines) diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index 2b775a96ca40f8220d1b289307426f917de936dc..a91a6c5d7cf124e2b48ae49e5059b1856b858c93 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.39 2004-05-13 18:01:36 geuzaine Exp $ +// $Id: Entity.cpp,v 1.40 2004-05-28 21:06:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -145,7 +145,7 @@ void Draw_Triangle(double *x, double *y, double *z, double *n, nn[0] = y1y0 * z2z0 - z1z0 * y2y0; nn[1] = z1z0 * x2x0 - x1x0 * z2z0; nn[2] = x1x0 * y2y0 - y1y0 * x2x0; - //norme(nn); not necessary if GL_NORMALIZE is enabled + norme(nn); glNormal3dv(nn); } else diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index 8abb9e4c9019b7c4ca18cecc68b173bc5af5cd35..e09027d067ed017929d461e073a6159fd0c9c7ff 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.87 2004-05-28 19:22:12 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.88 2004-05-28 21:06:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -229,32 +229,27 @@ void Draw_Mesh_Surface(void *a, void *b) if(!(s->Visible & VIS_MESH)) return; - if(Tree_Nbr(s->Simplexes)){ - - if(CTX.mesh.vertex_arrays && !CTX.threads_lock){ - CTX.threads_lock = 1; - if(CTX.mesh.changed){ - printf("generate vertex array\n"); - if(s->vertexArray) delete s->vertexArray; - s->vertexArray = new triangleVertexArray(Tree_Nbr(s->Simplexes)); - theVertexArray = s->vertexArray; - fillTheVertexArray = 1; - useTheVertexArray = 1; - Tree_Action(s->Simplexes, Draw_Mesh_Triangle); - fillTheVertexArray = 0; - } - CTX.threads_lock = 0; - } - else{ - useTheVertexArray = 0; + if(CTX.mesh.vertex_arrays && Tree_Nbr(s->Simplexes) && !CTX.threads_lock){ + CTX.threads_lock = 1; + if(CTX.mesh.changed){ + printf("generate vertex array\n"); + if(s->vertexArray) delete s->vertexArray; + s->vertexArray = new triangleVertexArray(Tree_Nbr(s->Simplexes)); + theVertexArray = s->vertexArray; + fillTheVertexArray = 1; + useTheVertexArray = 1; + Tree_Action(s->Simplexes, Draw_Mesh_Triangle); + fillTheVertexArray = 0; } - if(s->vertexArray && useTheVertexArray) Draw_Mesh_Triangle_Array(s->vertexArray); + CTX.threads_lock = 0; + } - if(!useTheVertexArray || CTX.mesh.dual || - CTX.mesh.surfaces_num || CTX.mesh.normals) - Tree_Action(s->Simplexes, Draw_Mesh_Triangle); + fillTheVertexArray = 0; // just to make sure... + if(!useTheVertexArray || CTX.mesh.dual || + CTX.mesh.surfaces_num || CTX.mesh.normals){ + Tree_Action(s->Simplexes, Draw_Mesh_Triangle); } Tree_Action(s->Quadrangles, Draw_Mesh_Quadrangle); @@ -428,6 +423,7 @@ void _normal3points(double x0, double y0, double z0, n[0] = y1y0 * z2z0 - z1z0 * y2y0; n[1] = z1z0 * x2x0 - x1x0 * z2z0; n[2] = x1x0 * y2y0 - y1y0 * x2x0; + norme(n); glNormal3dv(n); } @@ -619,7 +615,6 @@ void Draw_Mesh_Triangle(void *a, void *b) } if(CTX.mesh.normals) { - norme(n); glColor4ubv((GLubyte *) & CTX.color.mesh.normals); n[0] *= CTX.mesh.normals * CTX.pixel_equiv_x / CTX.s[0]; n[1] *= CTX.mesh.normals * CTX.pixel_equiv_x / CTX.s[1]; @@ -642,7 +637,7 @@ void Draw_Mesh_Triangle_Array(triangleVertexArray *va) glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); - + if(CTX.mesh.surfaces_faces){ if(CTX.mesh.surfaces_edges) glEnable(GL_POLYGON_OFFSET_FILL); @@ -788,7 +783,6 @@ void Draw_Mesh_Quadrangle(void *a, void *b) } if(CTX.mesh.normals) { - norme(n); glColor4ubv((GLubyte *) & CTX.color.mesh.normals); n[0] *= CTX.mesh.normals * CTX.pixel_equiv_x / CTX.s[0]; n[1] *= CTX.mesh.normals * CTX.pixel_equiv_x / CTX.s[1]; diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index 7d9a0b53caa705540a0650d6ad395cdcf54e5843..01aeef997b2e97412958854292910cd141daff69 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.28 2004-04-27 00:11:55 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.29 2004-05-28 21:06:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -434,9 +434,9 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, norms[3 * i + 2] = nn[2]; } } - //norme(norms); not necessary since GL_NORMALIZE is enabled - //norme(&norms[3]); - //norme(&norms[6]); + norme(&norms[0]); + norme(&norms[3]); + norme(&norms[6]); glNormal3dv(norms); }