From 0c7caf4a7525e3950e53a67efcbf5997d540233f Mon Sep 17 00:00:00 2001 From: ganovelli Date: Thu, 30 Jun 2005 10:17:04 +0000 Subject: [PATCH] added draw plane --- wrap/gl/space.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/wrap/gl/space.h b/wrap/gl/space.h index 012743be..5d229152 100644 --- a/wrap/gl/space.h +++ b/wrap/gl/space.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2005/05/05 12:28:13 cignoni +added glboxwire + Revision 1.4 2004/07/07 23:30:28 cignoni Added box3 drawing functions @@ -45,6 +48,7 @@ First working version! // Please note that this file assume that you have already included your // gl-extension wrapping utility, and that therefore all the extension symbol are already defined. +#include #include #include #include @@ -202,6 +206,40 @@ inline void glBoxClip(const Box3 & b) glPopAttrib(); }; + template + inline void glPlane3( Plane3 p, Point3 c, T size ) { + Point3 w = p.Direction(); + Point3 u,v,c1; + GetUV(w,u,v); + + c1 = p.Projection(c); + + u.Normalize(); + w.Normalize(); + v.Normalize(); + + Matrix44 m; + *(Point3*)&m[0][0] = *(Point3*)&u[0];m[0][3]=0; + *(Point3*)&m[1][0] = *(Point3*)&w[0];m[1][3]=0; + *(Point3*)&m[2][0] = *(Point3*)&v[0];m[2][3]=0; + *(Point3*)&m[3][0] = *(Point3*)&c1[0];m[3][3]=1; + + vcg::Transpose(m); + glPushMatrix(); + glMultMatrix(m); + + glBegin(GL_QUADS); + glNormal(Point3(0,1,0)); + glVertex(Point3(-size,0,-size)); + glVertex(Point3(size ,0,-size)); + glVertex(Point3(size ,0, size)); + glVertex(Point3(-size,0, size)); + glEnd(); + + + glPopMatrix(); + } + }//namespace #endif