proj home

Files   Classes   Functions   Hierarchy  

buttonpanel01.cpp

Go to the documentation of this file.
00001 #include <buttonpanel01.h>
00002 
00003 buttonpanel01::buttonpanel01(zprmouse* zm_)
00004   : zm(zm_)
00005 {
00006   radiussphere=0.025;
00007   centerdelta=0.03;
00008 
00009   point2<double> center = point2<double>(0.9,0.2);
00010 
00011   for (uint i=0; i<4; ++i)
00012     pos[i]=center;
00013   pos[0].y += centerdelta;
00014   pos[1].x += centerdelta;
00015   pos[2].y -= centerdelta;
00016   pos[3].x -= centerdelta;
00017 
00018   for (uint i=0; i<4; ++i)
00019     color[i] = point3<uint>(239,151,255);
00020 }
00021 
00022 void buttonpanel01::update()
00023 {
00024   assert(zm);
00025   if (zm==0)
00026     return;
00027 
00028   for (uint i=0; i<4; ++i)
00029   {
00030     posw[i] = zm->world(pos[i]);
00031     posw[i].z += -1.0;
00032 //    posw[i].z -= zm->zz.zFar;
00033 //    posw[i].z *= 0.5;
00034 cout << "posw[" << i << "]=" << posw[i] << endl;
00035   }
00036 
00037   point3<double> diff = posw[0] - posw[2];
00038   double radius2 = diff.dot();
00039   radiusworld = sqrt(radius2) * radiussphere * 0.5 / centerdelta;
00040 }
00041 
00042 void buttonpanel01::draw()
00043 {
00044   update();
00045 
00046   glPushAttrib(GL_CURRENT_BIT);
00047 
00048   for (uint i=0; i<4; ++i)
00049   {
00050     glColor3ui(color[i].x,color[i].y,color[i].z);
00051 
00052     glPushMatrix();
00053     glTranslated(posw[i].x,posw[i].y,posw[i].z);
00054     glutSolidSphere(radiusworld,35,35);
00055     glPopMatrix();
00056   }
00057 
00058   glPopAttrib();
00059 }
00060 

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