summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a9d4c74..7ead051 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -215,9 +215,14 @@ Redisplay(void)
* the world-space origin at a distance of 15 units.
*/
const GLUmat4 vp(projection_matrix * gluTranslate(0.0, 0.0, -15.0));
+ transformations[0] = vp * rotate_y_axis(orbit_angle);
- for (unsigned i = 0; i < ARRAY_SIZE(transformations); i++) {
- transformations[i] = vp;
+ const GLUmat4 translate_up = gluTranslate(0.0f, 2.0f, 0.0f);
+ const GLUmat4 rotate_hinge = gluTranslate(0.0f, -1.0f, 1.0f) * rotate_x_axis(hinge_angle) * gluTranslate(0.0f, 1.0f, -1.0f);
+ const GLUmat4 cube_trans = translate_up * rotate_hinge;
+
+ for (unsigned i = 1; i < ARRAY_SIZE(transformations); i++) {
+ transformations[i] = transformations[i - 1] * cube_trans;
}