X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmatrix.cpp;h=6ff3b603002f3a43a59cee50f3a4d75508efdae2;hb=2997aeeea512437e8b8f61bef4cb329756888695;hp=549fe8b61578ecf94958e2650519aea7579a8e00;hpb=2e7f19b895424c3a77940e648639f8df2b395d0f;p=libs%2Fgl.git diff --git a/source/matrix.cpp b/source/matrix.cpp index 549fe8b6..6ff3b603 100644 --- a/source/matrix.cpp +++ b/source/matrix.cpp @@ -278,12 +278,14 @@ GLenum MatrixStack::current_mode = GL_MODELVIEW; MatrixStack::MatrixStack(GLenum m): mode(m) { + matrices.reserve(mode==GL_MODELVIEW ? 32 : 4); matrices.push_back(Matrix()); } MatrixStack::MatrixStack(): mode(0) { + matrices.reserve(32); matrices.push_back(Matrix()); } @@ -356,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