proj home

Files   Classes   Functions   Hierarchy  

test01obj.h

Go to the documentation of this file.
00001 #ifndef TEST01OBJ_H
00002 #define TEST01OBJ_H
00003 
00004 #include <menu01.h>
00005 #include <zpr.h>
00006 
00007 
00008 typedef void pftessinit(d3tess & );
00009 
00010 
00011 template< typename P, typename PD >
00012 class test01obj : public myglutgui
00013 {
00014 public:
00015 
00016   zpr zz;
00017 
00018   menu01< test01obj<P,PD> > menu;
00019 
00020   gobjContainer xGraphics;
00021 
00022   d3tess * mesh;
00023   d3tessdraw *meshdraw;
00024   d3clipping *clip;
00025 
00026   d2partitiondraw< PD > * hdraw;
00027 
00028   test01obj
00029   (
00030     pftessinit tessinit, 
00031     P * cp,
00032     int & argc, 
00033     char** & argv,
00034     uintc mode,
00035     uintc x,
00036     uintc y,
00037     string const & title
00038   )
00039     : myglutgui(argc,argv,mode,x,y,title), menu(*this)
00040   {
00041     set();
00042 
00043     xGraphics.set();
00044 
00045     unsigned int N(1000);
00046     mesh = new d3tess(N);
00047     assert(tessinit!=0);
00048     (*tessinit)(*mesh);
00049 
00050     meshdraw = new d3tessdraw(*mesh);
00051     meshdraw->graphicsDeffered.v[d3tessdraw::multicolor]->isdrawn = true;
00052     meshdraw->graphicsDeffered.v[d3tessdraw::points]->isdrawn = true;
00053     meshdraw->graphicsDeffered.v[d3tessdraw::simplexes]->isdrawn = true;
00054     meshdraw->meshupdate();
00055 
00056     xGraphics.push_back(new gobjglPushMatrix());
00057     xGraphics.push_back(& menu.meshAoffset);
00058 
00059     xGraphics.push_back(meshdraw);
00060 
00061     xGraphics.push_back(new gobjglPopMatrix());
00062 
00063     clip = new d3clipping(*mesh,*cp);
00064     clip->zero = 1.0e-10;
00065 
00066     hdraw = new d2partitiondraw<PD>(*new PD(*cp));
00067     xGraphics.push_back(hdraw);
00068 //cout << SHOW(xGraphics.vg.size()) << endl;
00069   }
00070 
00071   void keyboard(unsigned char key, int x, int y)
00072     { menu.read(key); }
00073 
00074   void display()
00075   {
00076     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00077 
00078     menu.draw();
00079 
00080     xGraphics.draw();
00081 
00082     glerrordisplay();
00083     glutSwapBuffers();
00084   }
00085 
00086   void eval()
00087   {
00088     OpenGLinitialisation();
00089   
00090     glEnable(GL_DEPTH_TEST);
00091     glEnable(GL_CULL_FACE);
00092 
00093     xGraphics.set();
00094 
00095     glMatrixMode(GL_MODELVIEW);
00096     glLoadIdentity();
00097     gluLookAt
00098     (
00099       3.0,0.0,6.0,  // Eye
00100       3.0,0.0,0.0,  // Center
00101       0.0,1.0,0.0   // Up
00102     );
00103 
00104     zz.update();
00105 
00106 
00107     glutPostRedisplay();
00108   }
00109 
00110 };
00111 
00112 
00113 
00114 #endif
00115 
00116 
00117 

Generated on Fri Mar 4 00:49:26 2011 for Chelton Evans Source by  doxygen 1.5.8