Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (code == KeyRight) {
- camera += vec3(step, 0.0f, 0.0f);
- for (int i = 0; i < mesh->numFaces; ++i) {
- // Get the indices into the vertices array for each vertex of the mesh
- int i1 = mesh->indices[i * 3 + 0];
- int i2 = mesh->indices[i * 3 + 1];
- int i3 = mesh->indices[i * 3 + 2];
- vec3 currentPoint1(
- mesh->vertices[i1 * 5 + 0],
- mesh->vertices[i1 * 5 + 1],
- mesh->vertices[i1 * 5 + 2]
- );
- vec3 currentPoint2(
- mesh->vertices[i2 * 5 + 0],
- mesh->vertices[i2 * 5 + 1],
- mesh->vertices[i2 * 5 + 2]
- );
- vec3 currentPoint3(
- mesh->vertices[i3 * 5 + 0],
- mesh->vertices[i3 * 5 + 1],
- mesh->vertices[i3 * 5 + 2]
- );
- // transform all 3 points of each vertex
- vec2 point1 = transformPoint(currentPoint1, camera, cam_rotation);
- mesh->vertices[i1 * 5 + 0] = point1.x();
- mesh->vertices[i1 * 5 + 1] = point1.y();
- vec2 point2 = transformPoint(currentPoint2, camera, cam_rotation);
- mesh->vertices[i2 * 5 + 0] = point2.x();
- mesh->vertices[i2 * 5 + 1] = point2.y();
- vec2 point3 = transformPoint(currentPoint3, camera, cam_rotation);
- mesh->vertices[i3 * 5 + 0] = point3.x();
- mesh->vertices[i3 * 5 + 1] = point3.y();
- } // for(i)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement