From 2997aeeea512437e8b8f61bef4cb329756888695 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 30 Nov 2012 22:29:21 +0200 Subject: [PATCH] Remove deprecated matrix APIs --- source/matrix.cpp | 70 ------------------------------------------- source/matrix.h | 32 -------------------- source/projection.cpp | 47 ----------------------------- source/projection.h | 49 ------------------------------ source/transform.h | 1 - 5 files changed, 199 deletions(-) delete mode 100644 source/projection.cpp delete mode 100644 source/projection.h delete mode 100644 source/transform.h diff --git a/source/matrix.cpp b/source/matrix.cpp index b7f76bc7..6ff3b603 100644 --- a/source/matrix.cpp +++ b/source/matrix.cpp @@ -358,75 +358,5 @@ MatrixStack &MatrixStack::projection() 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 diff --git a/source/matrix.h b/source/matrix.h index 5444b8b4..6aae6df0 100644 --- a/source/matrix.h +++ b/source/matrix.h @@ -107,38 +107,6 @@ public: 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 diff --git a/source/projection.cpp b/source/projection.cpp deleted file mode 100644 index dd573da4..00000000 --- a/source/projection.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#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 diff --git a/source/projection.h b/source/projection.h deleted file mode 100644 index 1ad78493..00000000 --- a/source/projection.h +++ /dev/null @@ -1,49 +0,0 @@ -#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 diff --git a/source/transform.h b/source/transform.h deleted file mode 100644 index 24a274b8..00000000 --- a/source/transform.h +++ /dev/null @@ -1 +0,0 @@ -#include "matrix.h" -- 2.45.2