Advertisement
bekovski

keyright

Nov 12th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. if (code == KeyRight) {
  2.             camera += vec3(step, 0.0f, 0.0f);
  3.  
  4.             for (int i = 0; i < mesh->numFaces; ++i) {
  5.                 // Get the indices into the vertices array for each vertex of the mesh
  6.                 int i1 = mesh->indices[i * 3 + 0];
  7.                 int i2 = mesh->indices[i * 3 + 1];
  8.                 int i3 = mesh->indices[i * 3 + 2];
  9.  
  10.                 vec3 currentPoint1(
  11.                     mesh->vertices[i1 * 5 + 0],
  12.                     mesh->vertices[i1 * 5 + 1],
  13.                     mesh->vertices[i1 * 5 + 2]
  14.                 );
  15.  
  16.                 vec3 currentPoint2(
  17.                     mesh->vertices[i2 * 5 + 0],
  18.                     mesh->vertices[i2 * 5 + 1],
  19.                     mesh->vertices[i2 * 5 + 2]
  20.                 );
  21.  
  22.                 vec3 currentPoint3(
  23.                     mesh->vertices[i3 * 5 + 0],
  24.                     mesh->vertices[i3 * 5 + 1],
  25.                     mesh->vertices[i3 * 5 + 2]
  26.                 );
  27.  
  28.                 // transform all 3 points of each vertex
  29.                 vec2 point1 = transformPoint(currentPoint1, camera, cam_rotation);
  30.                 mesh->vertices[i1 * 5 + 0] = point1.x();
  31.                 mesh->vertices[i1 * 5 + 1] = point1.y();
  32.  
  33.                 vec2 point2 = transformPoint(currentPoint2, camera, cam_rotation);
  34.                 mesh->vertices[i2 * 5 + 0] = point2.x();
  35.                 mesh->vertices[i2 * 5 + 1] = point2.y();
  36.  
  37.                 vec2 point3 = transformPoint(currentPoint3, camera, cam_rotation);
  38.                 mesh->vertices[i3 * 5 + 0] = point3.x();
  39.                 mesh->vertices[i3 * 5 + 1] = point3.y();
  40.             } // for(i)
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement