| 1 | /**************************************************************************** |
| 2 | * VCGLib o o * |
| 3 | * Visual and Computer Graphics Library o o * |
| 4 | * _ O _ * |
| 5 | * Copyright(C) 2004 \/)\/ * |
| 6 | * Visual Computing Lab /\/| * |
| 7 | * ISTI - Italian National Research Council | * |
| 8 | * \ * |
| 9 | * All rights reserved. * |
| 10 | * * |
| 11 | * This program is free software; you can redistribute it and/or modify * |
| 12 | * it under the terms of the GNU General Public License as published by * |
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
| 14 | * (at your option) any later version. * |
| 15 | * * |
| 16 | * This program is distributed in the hope that it will be useful, * |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * |
| 20 | * for more details. * |
| 21 | * * |
| 22 | ****************************************************************************/ |
| 23 | /**************************************************************************** |
| 24 | History |
| 25 | |
| 26 | $Log: space.h,v $ |
| 27 | Revision 1.11 2007/08/17 07:00:00 cignoni |
| 28 | added a missing typename |
| 29 | |
| 30 | Revision 1.10 2007/07/31 12:21:50 ganovelli |
| 31 | added gltetra, added normal gltriangle |
| 32 | |
| 33 | Revision 1.9 2007/05/08 18:55:38 ganovelli |
| 34 | glTriangle added |
| 35 | |
| 36 | Revision 1.8 2007/01/18 01:26:23 cignoni |
| 37 | Added cast for mac compiling |
| 38 | |
| 39 | Revision 1.7 2005/10/13 08:32:26 cignoni |
| 40 | Added glscale(scalar) and corrected bug in glscale(point2) |
| 41 | |
| 42 | Revision 1.6 2005/06/30 10:17:04 ganovelli |
| 43 | added draw plane |
| 44 | |
| 45 | Revision 1.5 2005/05/05 12:28:13 cignoni |
| 46 | added glboxwire |
| 47 | |
| 48 | Revision 1.4 2004/07/07 23:30:28 cignoni |
| 49 | Added box3 drawing functions |
| 50 | |
| 51 | Revision 1.3 2004/05/26 15:13:01 cignoni |
| 52 | Removed inclusion of gl extension stuff and added glcolor stuff |
| 53 | |
| 54 | Revision 1.2 2004/05/13 23:44:47 ponchio |
| 55 | <GL/GL.h> --> <GL/gl.h> |
| 56 | |
| 57 | Revision 1.1 2004/04/05 11:56:14 cignoni |
| 58 | First working version! |
| 59 | |
| 60 | |
| 61 | ****************************************************************************/ |
| 62 | |
| 63 | #ifndef VCG_GL_SPACE_H |
| 64 | #define VCG_GL_SPACE_Hcxx . . $ `vcg/wrap/gl/space.h:64:9`! |
| 65 | |
| 66 | // Please note that this file assume that you have already included your |
| 67 | // gl-extension wrapping utility, and that therefore all the extension symbol are already defined. |
| 68 | |
| 69 | #include <vcg/space/triangle3.h>cxx . . $ `<file>/vcg/vcg/space/triangle3.h`/ |
| 70 | #include <vcg/space/plane3.h>cxx . . $ `<file>/vcg/vcg/space/plane3.h`/ |
| 71 | #include <vcg/space/point2.h>cxx . . $ `<file>/vcg/vcg/space/point2.h`/ |
| 72 | #include <vcg/space/point3.h>cxx . . $ `<file>/vcg/vcg/space/point3.h`/ |
| 73 | #include <vcg/space/color4.h>cxx . . $ `<file>/vcg/vcg/space/color4.h`/ |
| 74 | #include <vcg/space/box2.h>cxx . . $ `<file>/vcg/vcg/space/box2.h`/ |
| 75 | #include <vcg/space/box3.h>cxx . . $ `<file>/vcg/vcg/space/box3.h`/ |
| 76 | |
| 77 | namespace vcgcxx . . $ vcg/ { |
| 78 | |
| 79 | inline void glScalecxx . . $ vcg/glScale(733da83e8cfbc73e).(float const & p){ glScalef(p,p,p);} |
| 80 | inline void glScalecxx . . $ vcg/glScale(f371dfa6ad81844c).(double const & p){ glScaled(p,p,p);} |
| 81 | |
| 82 | inline void glVertexcxx . . $ vcg/glVertex(52e90b362caf7495).(Point2cxx . . $ vcg/Point2#<int> const & p) { glVertex2iv((const GLint*)p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 83 | inline void glVertexcxx . . $ vcg/glVertex(c9c0ef37d4d6dcf6).(Point2cxx . . $ vcg/Point2#<short> const & p) { glVertex2sv(p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 84 | inline void glVertexcxx . . $ vcg/glVertex(3beb5203910ab48e).(Point2cxx . . $ vcg/Point2#<float> const & p) { glVertex2fv(p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 85 | inline void glVertexcxx . . $ vcg/glVertex(cb742e945e273a49).(Point2cxx . . $ vcg/Point2#<double> const & p){ glVertex2dv(p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 86 | inline void glTexCoordcxx . . $ vcg/glTexCoord(52e90b362caf7495).(Point2cxx . . $ vcg/Point2#<int> const & p) { glTexCoord2iv((const GLint*)p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 87 | inline void glTexCoordcxx . . $ vcg/glTexCoord(c9c0ef37d4d6dcf6).(Point2cxx . . $ vcg/Point2#<short> const & p) { glTexCoord2sv(p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 88 | inline void glTexCoordcxx . . $ vcg/glTexCoord(3beb5203910ab48e).(Point2cxx . . $ vcg/Point2#<float> const & p) { glTexCoord2fv(p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 89 | inline void glTexCoordcxx . . $ vcg/glTexCoord(cb742e945e273a49).(Point2cxx . . $ vcg/Point2#<double> const & p){ glTexCoord2dv(p.Vcxx . . $ vcg/Point2#V(1016ee5406d91ab9).());} |
| 90 | inline void glTranslatecxx . . $ vcg/glTranslate(3beb5203910ab48e).(Point2cxx . . $ vcg/Point2#<float> const & p) { glTranslatef(p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).1],0);} |
| 91 | inline void glTranslatecxx . . $ vcg/glTranslate(cb742e945e273a49).(Point2cxx . . $ vcg/Point2#<double> const & p){ glTranslated(p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).1],0);} |
| 92 | inline void glScalecxx . . $ vcg/glScale(3beb5203910ab48e).(Point2cxx . . $ vcg/Point2#<float> const & p) { glScalef(p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).1],1.0);} |
| 93 | inline void glScalecxx . . $ vcg/glScale(cb742e945e273a49).(Point2cxx . . $ vcg/Point2#<double> const & p){ glScaled(p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point2#`operator[]`(e2681f9bb6b2f357).1],1.0);} |
| 94 | |
| 95 | inline void glVertexcxx . . $ vcg/glVertex(7cb38864cae69c99).(Point3cxx . . $ vcg/Point3#<int> const & p) { glVertex3iv((const GLint*)p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 96 | inline void glVertexcxx . . $ vcg/glVertex(4fb481df99182dd6).(Point3cxx . . $ vcg/Point3#<short> const & p) { glVertex3sv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 97 | inline void glVertexcxx . . $ vcg/glVertex(fc87840241e07ad6).(Point3cxx . . $ vcg/Point3#<float> const & p) { glVertex3fv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 98 | inline void glVertexcxx . . $ vcg/glVertex(2f0e3e2d7d7b5edb).(Point3cxx . . $ vcg/Point3#<double> const & p){ glVertex3dv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 99 | inline void glNormalcxx . . $ vcg/glNormal(7cb38864cae69c99).(Point3cxx . . $ vcg/Point3#<int> const & p) { glNormal3iv((const GLint*)p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 100 | inline void glNormalcxx . . $ vcg/glNormal(4fb481df99182dd6).(Point3cxx . . $ vcg/Point3#<short> const & p) { glNormal3sv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 101 | inline void glNormalcxx . . $ vcg/glNormal(fc87840241e07ad6).(Point3cxx . . $ vcg/Point3#<float> const & p) { glNormal3fv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 102 | inline void glNormalcxx . . $ vcg/glNormal(2f0e3e2d7d7b5edb).(Point3cxx . . $ vcg/Point3#<double> const & p){ glNormal3dv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 103 | inline void glTexCoordcxx . . $ vcg/glTexCoord(7cb38864cae69c99).(Point3cxx . . $ vcg/Point3#<int> const & p) { glTexCoord3iv((const GLint*)p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 104 | inline void glTexCoordcxx . . $ vcg/glTexCoord(4fb481df99182dd6).(Point3cxx . . $ vcg/Point3#<short> const & p) { glTexCoord3sv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 105 | inline void glTexCoordcxx . . $ vcg/glTexCoord(fc87840241e07ad6).(Point3cxx . . $ vcg/Point3#<float> const & p) { glTexCoord3fv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 106 | inline void glTexCoordcxx . . $ vcg/glTexCoord(2f0e3e2d7d7b5edb).(Point3cxx . . $ vcg/Point3#<double> const & p){ glTexCoord3dv(p.Vcxx . . $ vcg/Point3#V(1016ee5406d91ab9).());} |
| 107 | inline void glTranslatecxx . . $ vcg/glTranslate(fc87840241e07ad6).(Point3cxx . . $ vcg/Point3#<float> const & p) { glTranslatef(p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).1],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).2]);} |
| 108 | inline void glTranslatecxx . . $ vcg/glTranslate(2f0e3e2d7d7b5edb).(Point3cxx . . $ vcg/Point3#<double> const & p){ glTranslated(p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).1],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).2]);} |
| 109 | inline void glScalecxx . . $ vcg/glScale(fc87840241e07ad6).(Point3cxx . . $ vcg/Point3#<float> const & p) { glScalef(p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).1],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).2]);} |
| 110 | inline void glScalecxx . . $ vcg/glScale(2f0e3e2d7d7b5edb).(Point3cxx . . $ vcg/Point3#<double> const & p){ glScaled(p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).0],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).1],p[cxx . . $ vcg/Point3#`operator[]`(e2681f9bb6b2f357).2]);} |
| 111 | |
| 112 | inline void glColorcxx . . $ vcg/glColor(57713e9b429ea9ae).(Color4bcxx . . $ vcg/Color4b# const & c) { glColor4ubv(c.Vcxx . . $ vcg/Point4#V(1016ee5406d91ab9).());} |
| 113 | inline void glClearColorcxx . . $ vcg/glClearColor(57713e9b429ea9ae).(Color4bcxx . . $ vcg/Color4b# const &c) { ::glClearColor(float(c[cxx . . $ vcg/Point4#`operator[]`(e2681f9bb6b2f357).0])/255.0f,float(c[cxx . . $ vcg/Point4#`operator[]`(e2681f9bb6b2f357).1])/255.0f,float(c[cxx . . $ vcg/Point4#`operator[]`(e2681f9bb6b2f357).2])/255.0f,1.0f);} |
| 114 | inline void glLightcxx . . $ vcg/glLight(acf571a42747124b).(GLenum light, GLenum pname, Color4bcxx . . $ vcg/Color4b# const & c) { |
| 115 | static float cf[4]; |
| 116 | cf[0]=float(cf[0]/255.0); cf[1]=float(c[cxx . . $ vcg/Point4#`operator[]`(e2681f9bb6b2f357).1]/255.0); cf[2]=float(c[cxx . . $ vcg/Point4#`operator[]`(e2681f9bb6b2f357).2]/255.0); cf[3]=float(c[cxx . . $ vcg/Point4#`operator[]`(e2681f9bb6b2f357).3]/255.0); |
| 117 | glLightfv(light,pname,cf); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | template <class T> |
| 122 | inline void glBoxWirecxx . . $ vcg/glBoxWire(eaa79bd5c611aae6).(Box3cxx . . $ vcg/Box3#<T> const & b) |
| 123 | { |
| 124 | glPushAttrib(GL_ENABLE_BITcxx . . $ `<external>/18396878532286971346/glew.h:713:9`!); |
| 125 | glDisable(GL_LIGHTINGcxx . . $ `<external>/18396878532286971346/glew.h:449:9`!); |
| 126 | glBegin(GL_LINE_STRIPcxx . . $ `<external>/18396878532286971346/glew.h:339:9`!); |
| 127 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 128 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 129 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 130 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 131 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 132 | glEnd(); |
| 133 | glBegin(GL_LINE_STRIPcxx . . $ `<external>/18396878532286971346/glew.h:339:9`!); |
| 134 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 135 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 136 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 137 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 138 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 139 | glEnd(); |
| 140 | glBegin(GL_LINEScxx . . $ `<external>/18396878532286971346/glew.h:335:9`!); |
| 141 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 142 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 143 | |
| 144 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 145 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.mincxx . . $ vcg/Box3#min.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 146 | |
| 147 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 148 | glVertex3f((float)b.maxcxx . . $ vcg/Box3#max.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 149 | |
| 150 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.mincxx . . $ vcg/Box3#min.[2]); |
| 151 | glVertex3f((float)b.mincxx . . $ vcg/Box3#min.[0],(float)b.maxcxx . . $ vcg/Box3#max.[1],(float)b.maxcxx . . $ vcg/Box3#max.[2]); |
| 152 | glEnd(); |
| 153 | glPopAttrib(); |
| 154 | }; |
| 155 | template <class T> |
| 156 | /// Funzione di utilita' per la visualizzazione in OpenGL (flat shaded) |
| 157 | inline void glBoxFlatcxx . . $ vcg/glBoxFlat(eaa79bd5c611aae6).(Box3cxx . . $ vcg/Box3#<T> const & b) |
| 158 | { |
| 159 | glPushAttrib(GL_SHADE_MODELcxx . . $ `<external>/18396878532286971346/glew.h:453:9`!); |
| 160 | glShadeModel(GL_FLATcxx . . $ `<external>/18396878532286971346/glew.h:702:9`!); |
| 161 | glBegin(GL_QUAD_STRIPcxx . . $ `<external>/18396878532286971346/glew.h:345:9`!); |
| 162 | glNormal3f(.0f,.0f,1.0f); |
| 163 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 164 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.mincxx . . $ vcg/Box3#min.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 165 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 166 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.mincxx . . $ vcg/Box3#min.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 167 | glNormal3f(1.0f,.0f,.0f); |
| 168 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 169 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.mincxx . . $ vcg/Box3#min.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 170 | glNormal3f(.0f,.0f,-1.0f); |
| 171 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 172 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.mincxx . . $ vcg/Box3#min.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 173 | glNormal3f(-1.0f,.0f,.0f); |
| 174 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 175 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.mincxx . . $ vcg/Box3#min.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 176 | glEnd(); |
| 177 | |
| 178 | glBegin(GL_QUADScxx . . $ `<external>/18396878532286971346/glew.h:344:9`!); |
| 179 | glNormal3f(.0f,1.0f,.0f); |
| 180 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 181 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 182 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 183 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.maxcxx . . $ vcg/Box3#max.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 184 | |
| 185 | glNormal3f(.0f,-1.0f,.0f); |
| 186 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.mincxx . . $ vcg/Box3#min.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 187 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.mincxx . . $ vcg/Box3#min.[1], b.mincxx . . $ vcg/Box3#min.[2]); |
| 188 | glVertex3f(b.maxcxx . . $ vcg/Box3#max.[0], b.mincxx . . $ vcg/Box3#min.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 189 | glVertex3f(b.mincxx . . $ vcg/Box3#min.[0], b.mincxx . . $ vcg/Box3#min.[1], b.maxcxx . . $ vcg/Box3#max.[2]); |
| 190 | glEnd(); |
| 191 | glPopAttrib(); |
| 192 | }; |
| 193 | |
| 194 | |
| 195 | template <class T> |
| 196 | /// Setta i sei clip planes di opengl a far vedere solo l'interno del box |
| 197 | inline void glBoxClipcxx . . $ vcg/glBoxClip(eaa79bd5c611aae6).(const Box3cxx . . $ vcg/Box3#<T> & b) |
| 198 | { |
| 199 | double eq[4]; |
| 200 | eq[0]= 1; eq[1]= 0; eq[2]= 0; eq[3]=(double)-cxx . . $ vcg/operator-(15359579ba43381e).b.mincxx . . $ vcg/Box3#min.[0]; |
| 201 | glClipPlane(GL_CLIP_PLANE0cxx . . $ `<external>/18396878532286971346/glew.h:758:9`!,eq); |
| 202 | eq[0]=-1; eq[1]= 0; eq[2]= 0; eq[3]=(double) b.maxcxx . . $ vcg/Box3#max.[0]; |
| 203 | glClipPlane(GL_CLIP_PLANE1cxx . . $ `<external>/18396878532286971346/glew.h:759:9`!,eq); |
| 204 | |
| 205 | eq[0]= 0; eq[1]= 1; eq[2]= 0; eq[3]=(double)-cxx . . $ vcg/operator-(15359579ba43381e).b.mincxx . . $ vcg/Box3#min.[1]; |
| 206 | glClipPlane(GL_CLIP_PLANE2cxx . . $ `<external>/18396878532286971346/glew.h:760:9`!,eq); |
| 207 | eq[0]= 0; eq[1]=-1; eq[2]= 0; eq[3]=(double) b.maxcxx . . $ vcg/Box3#max.[1]; |
| 208 | glClipPlane(GL_CLIP_PLANE3cxx . . $ `<external>/18396878532286971346/glew.h:761:9`!,eq); |
| 209 | |
| 210 | |
| 211 | eq[0]= 0; eq[1]= 0; eq[2]= 1; eq[3]=(double)-cxx . . $ vcg/operator-(15359579ba43381e).b.mincxx . . $ vcg/Box3#min.[2]; |
| 212 | glClipPlane(GL_CLIP_PLANE4cxx . . $ `<external>/18396878532286971346/glew.h:762:9`!,eq); |
| 213 | eq[0]= 0; eq[1]= 0; eq[2]=-1; eq[3]=(double) b.maxcxx . . $ vcg/Box3#max.[2]; |
| 214 | glClipPlane(GL_CLIP_PLANE5cxx . . $ `<external>/18396878532286971346/glew.h:763:9`!,eq); |
| 215 | } |
| 216 | template <class T> |
| 217 | inline void glBoxWirecxx . . $ vcg/glBoxWire(2e53a9e903471798).(const Box2cxx . . $ vcg/Box2#<T> & b) |
| 218 | { |
| 219 | glPushAttrib(GL_ENABLE_BITcxx . . $ `<external>/18396878532286971346/glew.h:713:9`!); |
| 220 | glDisable(GL_LIGHTINGcxx . . $ `<external>/18396878532286971346/glew.h:449:9`!); |
| 221 | glBegin(GL_LINE_LOOPcxx . . $ `<external>/18396878532286971346/glew.h:336:9`!); |
| 222 | |
| 223 | glVertex2f((float)b.mincxx . . $ vcg/Box2#min.[0],(float)b.mincxx . . $ vcg/Box2#min.[1]); |
| 224 | glVertex2f((float)b.maxcxx . . $ vcg/Box2#max.[0],(float)b.mincxx . . $ vcg/Box2#min.[1]); |
| 225 | glVertex2f((float)b.maxcxx . . $ vcg/Box2#max.[0],(float)b.maxcxx . . $ vcg/Box2#max.[1]); |
| 226 | glVertex2f((float)b.mincxx . . $ vcg/Box2#min.[0],(float)b.maxcxx . . $ vcg/Box2#max.[1]); |
| 227 | glEnd(); |
| 228 | |
| 229 | glPopAttrib(); |
| 230 | }; |
| 231 | template <class T> |
| 232 | inline void glPlane3cxx . . $ vcg/glPlane3(12f517b37a5fce22).( Plane3cxx . . $ vcg/Plane3#<T> p, Point3cxx . . $ vcg/Point3#<T> c, T size ) { |
| 233 | Point3cxx . . $ vcg/Point3#<T> w = p.Directioncxx . . $ vcg/Plane3#Direction(61080bd0aaebf357).(); |
| 234 | Point3cxx . . $ vcg/Point3#<T> u,v,c1; |
| 235 | GetUVcxx . . $ vcg/GetUV(e9567458d6da989).<T>(w,u,v); |
| 236 | |
| 237 | c1 = p.Projectioncxx . . $ vcg/Plane3#Projection(7198c4a0a81b097f).(c); |
| 238 | |
| 239 | u.Normalizecxx . . $ vcg/Point3#Normalize(f55c2490dff4ff58).(); |
| 240 | w.Normalizecxx . . $ vcg/Point3#Normalize(f55c2490dff4ff58).(); |
| 241 | v.Normalizecxx . . $ vcg/Point3#Normalize(f55c2490dff4ff58).(); |
| 242 | |
| 243 | Matrix44cxx . . $ vcg/Matrix44#<T> m; |
| 244 | *(Point3cxx . . $ vcg/Point3#<T>*)&m[0][0] = *(Point3cxx . . $ vcg/Point3#<T>*)&u[0];m[0][3]=0; |
| 245 | *(Point3cxx . . $ vcg/Point3#<T>*)&m[1][0] = *(Point3cxx . . $ vcg/Point3#<T>*)&w[0];m[1][3]=0; |
| 246 | *(Point3cxx . . $ vcg/Point3#<T>*)&m[2][0] = *(Point3cxx . . $ vcg/Point3#<T>*)&v[0];m[2][3]=0; |
| 247 | *(Point3cxx . . $ vcg/Point3#<T>*)&m[3][0] = *(Point3cxx . . $ vcg/Point3#<T>*)&c1[0];m[3][3]=1; |
| 248 | |
| 249 | vcgcxx . . $ vcg/::Transposecxx . . $ vcg/Transpose(24a89560d95dde74).(m); |
| 250 | glPushMatrix(); |
| 251 | glMultMatrixcxx . . $ vcg/glMultMatrix(93674a9c63b6404).(m); |
| 252 | |
| 253 | glBegin(GL_QUADScxx . . $ `<external>/18396878532286971346/glew.h:344:9`!); |
| 254 | glNormalcxx . . $ vcg/glNormal(2f0e3e2d7d7b5edb).(Point3cxx . . $ vcg/Point3#<T>(0,1,0)); |
| 255 | glVertexcxx . . $ vcg/glVertex(3beb5203910ab48e).(Point3cxx . . $ vcg/Point3#<T>(-cxx . . $ vcg/operator-(15359579ba43381e).size,0,-cxx . . $ vcg/operator-(15359579ba43381e).size)); |
| 256 | glVertexcxx . . $ vcg/glVertex(7cb38864cae69c99).(Point3cxx . . $ vcg/Point3#<T>(size ,0,-cxx . . $ vcg/operator-(15359579ba43381e).size)); |
| 257 | glVertexcxx . . $ vcg/glVertex(fc87840241e07ad6).(Point3cxx . . $ vcg/Point3#<T>(size ,0, size)); |
| 258 | glVertexcxx . . $ vcg/glVertex(4fb481df99182dd6).(Point3cxx . . $ vcg/Point3#<T>(-cxx . . $ vcg/operator-(15359579ba43381e).size,0, size)); |
| 259 | glEnd(); |
| 260 | |
| 261 | |
| 262 | glPopMatrix(); |
| 263 | } |
| 264 | |
| 265 | |
| 266 | template <class TriangleType> |
| 267 | inline void glTriangle3cxx . . $ vcg/glTriangle3(8e935d9c2e576e3a).( TriangleType & c ) { |
| 268 | vcgcxx . . $ vcg/::Point3cxx . . $ vcg/Point3#<typename TriangleType::ScalarType> n = vcgcxx . . $ vcg/::Normalcxx . . $ vcg/Normal(130a2fb1da154a82).(c); |
| 269 | glBegin(GL_TRIANGLEScxx . . $ `<external>/18396878532286971346/glew.h:341:9`!); |
| 270 | glNormalcxx . . $ vcg/glNormal(fc87840241e07ad6).(n); |
| 271 | glVertexcxx . . $ vcg/glVertex(4fb481df99182dd6).(c.P(0)); |
| 272 | glVertexcxx . . $ vcg/glVertex(4fb481df99182dd6).(c.P(1)); |
| 273 | glVertexcxx . . $ vcg/glVertex(4fb481df99182dd6).(c.P(2)); |
| 274 | glEnd(); |
| 275 | } |
| 276 | |
| 277 | template <class TetraType> |
| 278 | inline void glTetra3cxx . . $ vcg/glTetra3(8e935d9c2e576e3a).( TetraType & c ) { |
| 279 | glTriangle3cxx . . $ vcg/glTriangle3(8e935d9c2e576e3a).(Triangle3cxx . . $ vcg/Triangle3#<typename TetraType::ScalarType>(c.P(0),c.P(1),c.P(2))); |
| 280 | glTriangle3cxx . . $ vcg/glTriangle3(8e935d9c2e576e3a).(Triangle3cxx . . $ vcg/Triangle3#<typename TetraType::ScalarType>(c.P(1),c.P(3),c.P(2))); |
| 281 | glTriangle3cxx . . $ vcg/glTriangle3(8e935d9c2e576e3a).(Triangle3cxx . . $ vcg/Triangle3#<typename TetraType::ScalarType>(c.P(0),c.P(2),c.P(3))); |
| 282 | glTriangle3cxx . . $ vcg/glTriangle3(8e935d9c2e576e3a).(Triangle3cxx . . $ vcg/Triangle3#<typename TetraType::ScalarType>(c.P(1),c.P(0),c.P(3))); |
| 283 | } |
| 284 | |
| 285 | }//namespace |
| 286 | #endif |