Javier Aravena avatar Javier Aravena committed dd63e83

Ahora se muestra un cubo.

Comments (0)

Files changed (2)

 FakeCube::FakeCube()
 {
     float initial_points[][3] = {
-        {320.f, 120.f, 0.f},
-        {480.f, 100.f, 0.f},
-        {480.f, 400.f, 0.f},
-        {320.f, 360.f, 0.f}
+        {347.f, 225.f, 0.f},
+        {343.f, 560.f, 0.f},
+        {613.f, 451.f, 0.f},
+        {652.f, 145.f, 0.f},
+        {161.f, 106.f, 0.f},
+        {175.f, 397.f, 0.f},
+        {440.f, 55.f, 0.f}
     };
 
-    for(int i=0; i<4; ++i) {
-        for(int j=0; j<3; ++j) {
+    for(unsigned int i=0; i<point_count; ++i) {
+        for(unsigned int j=0; j<3; ++j) {
             points[i][j] = initial_points[i][j];
         }
     }
     switch(event.Type) {
         case sf::Event::MouseButtonPressed:
             if(event.MouseButton.Button == sf::Mouse::Left) {
-                for(unsigned int i=0; i < pointsLimit; ++i) {
+                for(unsigned int i=0; i < point_count; ++i) {
                     if(abs(event.MouseButton.X - points[i][0]) < dragTolerance &&
                             abs(event.MouseButton.Y - points[i][1]) < dragTolerance) {
                         draggingPoint = i;
         glVertex3f(points[0][0], points[0][1], points[0][2]);
         glVertex3f(points[1][0], points[1][1], points[1][2]);
         glVertex3f(points[2][0], points[2][1], points[2][2]);
-        glVertex3f(points[3][0], points[3][1], points[4][2]);
+        glVertex3f(points[3][0], points[3][1], points[3][2]);
+    glEnd();
+
+    glBegin(GL_QUADS);
+        glColor3f(1.0f, 1.0f, 1.0f);
+        glVertex3f(points[0][0], points[0][1], points[0][2]);
+        glVertex3f(points[1][0], points[1][1], points[1][2]);
+        glVertex3f(points[5][0], points[5][1], points[5][2]);
+        glVertex3f(points[4][0], points[4][1], points[4][2]);
+    glEnd();
+
+    glBegin(GL_QUADS);
+        glColor3f(1.0f, 1.0f, 1.0f);
+        glVertex3f(points[0][0], points[0][1], points[0][2]);
+        glVertex3f(points[3][0], points[3][1], points[3][2]);
+        glVertex3f(points[6][0], points[6][1], points[6][2]);
+        glVertex3f(points[4][0], points[4][1], points[4][2]);
     glEnd();
 }
 
 
 class FakeCube {
     private:
-        static const unsigned int pointsLimit = 4;
-        float points[pointsLimit][3];
+        static const unsigned int point_count = 7;
+        float points[point_count][3];
         int draggingPoint;
     public: //TODO: Estas cosas deberían estar definidas en clases virtuales (aka interfases)
         bool OnEvent(sf::Event & Event);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.