#include <algorithm>
#include <cmath>
-#include <msp/core/except.h>
+#include "error.h"
#include "matrix.h"
using namespace std;
double Matrix::operator[](unsigned i) const
{
if(i>=16)
- throw InvalidParameterValue("Matrix element index out of range");
+ throw out_of_range("Matrix::operator[]");
return matrix[i];
}
Matrix Matrix::ortho(double l, double r, double b, double t, double n, double f)
{
if(l==r || b==t || n==f)
- throw InvalidParameterValue("Orthogonal projection can't have zero dimension");
+ throw invalid_argument("Matrix::ortho");
Matrix result;
result.matrix[0] = 2/(r-l);
Matrix Matrix::frustum(double l, double r, double b, double t, double n, double f)
{
if(l==r || b==t || n<=0 || f<=n)
- throw InvalidParameterValue("Invalid frustum parameters");
+ throw invalid_argument("Matrix::frustum");
Matrix result;
result.matrix[0] = 2*n/(r-l);
void MatrixStack::pop()
{
if(matrices.size()==1)
- throw InvalidState("Can't pop the last matrix");
+ throw stack_underflow("MatrixStack::pop()");
matrices.pop_back();
update();
else if(m==PROJECTION)
active_stack = &MatrixStack::projection();
else
- throw InvalidParameterValue("Texture matrices are not supported");
+ throw invalid_argument("matrix_mode");
}
void load_identity()