glPopMatrix();
}
+void translate(float x, float y, float z)
+{
+ glTranslatef(x, y, z);
+}
+
+void rotate(float a, float x, float y, float z)
+{
+ glRotatef(a, x, y, z);
+}
+
+void scale(float x, float y, float z)
+{
+ glScalef(x, y, z);
+}
+
+void scale_uniform(float s)
+{
+ scale(s, s, s);
+}
+
} // namespace GL
} // namespace Msp
void push_matrix();
void pop_matrix();
+/// RAII object - pushes matrix when constructed and pops when destroyed
+struct PushMatrix
+{
+ PushMatrix() { push_matrix(); }
+ ~PushMatrix() { pop_matrix(); }
+};
+
+void translate(float, float, float);
+void rotate(float, float, float, float);
+void scale(float, float, float);
+void scale_uniform(float);
+
} // namespace GL
} // namespace Msp
+++ /dev/null
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include "gl.h"
-#include "transform.h"
-
-namespace Msp {
-namespace GL {
-
-void translate(float x, float y, float z)
-{
- glTranslatef(x, y, z);
-}
-
-void rotate(float a, float x, float y, float z)
-{
- glRotatef(a, x, y, z);
-}
-
-void scale(float x, float y, float z)
-{
- glScalef(x, y, z);
-}
-
-void scale_uniform(float s)
-{
- scale(s, s, s);
-}
-
-} // namespace GL
-} // namespace Msp
Distributed under the LGPL
*/
-#ifndef MSP_GL_TRANSFORM_H_
-#define MSP_GL_TRANSFORM_H_
-
-namespace Msp {
-namespace GL {
-
-void translate(float, float, float);
-void rotate(float, float, float, float);
-void scale(float, float, float);
-void scale_uniform(float);
-
-} // namespace GL
-} // namespace Msp
-
-#endif
+#include "matrix.h"