From 9c54bdbf458e3c9433d237ae71cf47c4ec47d852 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Wed, 17 Jun 2009 16:52:59 -0700 Subject: Implement default programs and implement defaults and parents for imports. --- libs/rs/rsMatrix.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'libs/rs/rsMatrix.cpp') diff --git a/libs/rs/rsMatrix.cpp b/libs/rs/rsMatrix.cpp index e68d5ac..258b836 100644 --- a/libs/rs/rsMatrix.cpp +++ b/libs/rs/rsMatrix.cpp @@ -136,4 +136,26 @@ void Matrix::loadMultiply(const Matrix *lhs, const Matrix *rhs) } } +void Matrix::loadOrtho(float l, float r, float b, float t, float n, float f) { + loadIdentity(); + m[0] = 2 / (r - l); + m[5] = 2 / (t - b); + m[10]= -2 / (f - n); + m[12]= -(r + l) / (r - l); + m[13]= -(t + b) / (t - b); + m[14]= -(f + n) / (f - n); +} + +void Matrix::loadFrustum(float l, float r, float b, float t, float n, float f) { + loadIdentity(); + m[0] = 2 * n / (r - l); + m[5] = 2 * n / (t - b); + m[8] = (r + l) / (r - l); + m[9] = (t + b) / (t - b); + m[10]= -(f + n) / (f - n); + m[11]= -1; + m[14]= -2*f*n / (f - n); + m[15]= 0; +} + -- cgit v1.1