00001 #ifndef _COLOR_CUBE_ 00002 #define _COLOR_CUBE_ 00003 00004 #include "LifeVariables.h" 00005 #include "ArcBall.h" 00006 00007 using namespace std; 00008 00010 static GLfloat colors[8][3] = { 00011 {0.0,0.0,0.0}, 00012 {1.0,0.0,0.0}, 00013 {1.0,1.0,0.0}, 00014 {0.0,1.0,0.0}, 00015 {0.0,0.0,1.0}, 00016 {1.0,0.0,1.0}, 00017 {1.0,1.0,1.0}, 00018 {0.0,1.0,1.0} 00019 }; 00020 00021 00024 static Matrix4fT finalTransformation = { 00025 1.0f, 0.0f, 0.0f, 0.0f, 00026 0.0f, 1.0f, 0.0f, 0.0f, 00027 0.0f, 0.0f, 1.0f, 0.0f, 00028 0.0f, 0.0f, 0.0f, 1.0f 00029 }; 00030 00031 00034 static Matrix3fT lastRotation = { 00035 1.0f, 0.0f, 0.0f, 00036 0.0f, 1.0f, 0.0f, 00037 0.0f, 0.0f, 1.0f 00038 }; 00039 00040 00043 static Matrix3fT currentRotation = { 00044 1.0f, 0.0f, 0.0f, 00045 0.0f, 1.0f, 0.0f, 00046 0.0f, 0.0f, 1.0f 00047 }; 00048 00049 00050 class ColorCube: public ArcBall_t { 00051 00052 private: 00054 void polygon(int a, int b, int c , int d); 00055 00057 void colorcube(); 00058 00060 float selectedColor[3]; 00061 00063 Point2fT mousePosition; 00064 00065 public: 00072 ColorCube(int width, int height); 00073 00077 void onMouseDown(int x, int y); 00078 00080 float* getColor(); 00081 00083 void onMouseUp(int x, int y); 00084 00087 void onMouseDrag(int x, int y); 00088 00090 void render(); 00091 }; 00092 00093 #endif