return ms;
}
-
-// Deprecated stuff
-
-MatrixStack *active_stack = &MatrixStack::modelview();
-
-void matrix_mode(MatrixMode m)
-{
- if(m==MODELVIEW)
- active_stack = &MatrixStack::modelview();
- else if(m==PROJECTION)
- active_stack = &MatrixStack::projection();
- else
- throw invalid_argument("matrix_mode");
-}
-
-void load_identity()
-{
- *active_stack = Matrix();
-}
-
-void load_matrix(const float *matrix)
-{
- *active_stack = Matrix(matrix);
-}
-
-void load_matrix(const double *matrix)
-{
- *active_stack = Matrix(matrix);
-}
-
-void mult_matrix(const float *matrix)
-{
- *active_stack *= Matrix(matrix);
-}
-
-void mult_matrix(const double *matrix)
-{
- *active_stack *= Matrix(matrix);
-}
-
-void push_matrix()
-{
- active_stack->push();
-}
-
-void pop_matrix()
-{
- active_stack->pop();
-}
-
-void translate(float x, float y, float z)
-{
- *active_stack *= Matrix::translation(x, y, z);
-}
-
-void rotate(float a, float x, float y, float z)
-{
- *active_stack *= Matrix::rotation_deg(a, x, y, z);
-}
-
-void scale(float x, float y, float z)
-{
- *active_stack *= Matrix::scaling(x, y, z);
-}
-
-void scale_uniform(float s)
-{
- *active_stack *= Matrix::scaling(s);
-}
-
} // namespace GL
} // namespace Msp
static MatrixStack &projection();
};
-
-/* The stuff below is deprecated and preserved (for now) only for compatibility
-with existing applications */
-
-enum MatrixMode
-{
- MODELVIEW = GL_MODELVIEW,
- PROJECTION = GL_PROJECTION,
- TEXTURE = GL_TEXTURE
-};
-
-void matrix_mode(MatrixMode);
-void load_identity();
-void load_matrix(const float *);
-void load_matrix(const double *);
-void mult_matrix(const float *);
-void mult_matrix(const double *);
-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
-#include <cmath>
-#include "matrix.h"
-#include "projection.h"
-
-namespace Msp {
-namespace GL {
-
-extern MatrixStack *active_stack;
-
-void ortho(double left, double right, double bottom, double top, double nearr, double farr)
-{
- *active_stack *= Matrix::ortho(left, right, bottom, top, nearr, farr);
-}
-
-void ortho_centered(double width, double height)
-{
- ortho(-width/2, width/2, -height/2, height/2, 0, 1);
-}
-
-void ortho_bottomleft(double width, double height)
-{
- ortho(0, width, 0, height, 0, 1);
-}
-
-void ortho_topleft(double width, double height)
-{
- ortho(0, width, height, 0, 0, 1);
-}
-
-void frustum(double left, double right, double bottom, double top, double nearr, double farr)
-{
- *active_stack *= Matrix::frustum(left, right, bottom, top, nearr, farr);
-}
-
-void frustum_centered(double width, double height, double nearr, double farr)
-{
- frustum(-width/2, width/2, -height/2, height/2, nearr, farr);
-}
-
-void perspective(double fov_y, double aspect, double nearr, double farr)
-{
- double hh = tan(fov_y*M_PI/360)*nearr;
- frustum(-hh*aspect, hh*aspect, -hh, hh, nearr, farr);
-}
-
-} // namespace GL
-} // namespace Msp
+++ /dev/null
-#ifndef MSP_GL_PROJECTION_H_
-#define MSP_GL_PROJECTION_H_
-
-namespace Msp {
-namespace GL {
-
-// Everything in this header is deprecated - use the classes in matrix.h instead
-
-/**
-Sets up an orthogonal projection.
-*/
-void ortho(double, double, double, double, double, double);
-
-/**
-Sets up an orthogonal projection, with origin at the center of the screen.
-*/
-void ortho_centered(double, double);
-
-/**
-Sets up an orthogonal projection, with origin at the bottom left corner of the
-screen.
-*/
-void ortho_bottomleft(double, double);
-
-/**
-Sets up an orthogonal projection, with origin at the top left corner of the
-screen. The Y coordinate is reversed and grows downwards.
-*/
-void ortho_topleft(double, double);
-
-/**
-Sets up a perspective projection.
-*/
-void frustum(double, double, double, double, double, double);
-
-/**
-Sets up a perspective projection, with origin at the center of the screen.
-*/
-void frustum_centered(double width, double height, double near, double far);
-
-/**
-Sets up a centered perspective projection in a simple way.
-*/
-void perspective(double fov_y, double aspect, double near, double far);
-
-} // namespace GL
-} // namespace Msp
-
-#endif
+++ /dev/null
-#include "matrix.h"