MATH: Move the math classes to their own math/ dir and Math namespace.

This commit is contained in:
Giulio Camuffo 2011-09-10 17:46:07 +02:00
parent e9267cfec5
commit 0083c8619c
42 changed files with 353 additions and 346 deletions

View file

@ -174,11 +174,11 @@ void GfxOpenGL::setupCamera(float fov, float nclip, float fclip, float roll) {
glRotatef(roll, 0, 0, -1);
}
void GfxOpenGL::positionCamera(Graphics::Vector3d pos, Graphics::Vector3d interest) {
Graphics::Vector3d up_vec(0, 0, 1);
void GfxOpenGL::positionCamera(Math::Vector3d pos, Math::Vector3d interest) {
Math::Vector3d up_vec(0, 0, 1);
if (pos.x() == interest.x() && pos.y() == interest.y())
up_vec = Graphics::Vector3d(0, 1, 0);
up_vec = Math::Vector3d(0, 1, 0);
gluLookAt(pos.x(), pos.y(), pos.z(), interest.x(), interest.y(), interest.z(), up_vec.x(), up_vec.y(), up_vec.z());
}
@ -195,7 +195,7 @@ bool GfxOpenGL::isHardwareAccelerated() {
return true;
}
static void glShadowProjection(Graphics::Vector3d light, Graphics::Vector3d plane, Graphics::Vector3d normal, bool dontNegate) {
static void glShadowProjection(Math::Vector3d light, Math::Vector3d plane, Math::Vector3d normal, bool dontNegate) {
// Based on GPL shadow projection example by
// (c) 2002-2003 Phaetos <phaetos@gaffga.de>
float d, c;
@ -260,7 +260,7 @@ void GfxOpenGL::getBoundingBoxPos(const Mesh *model, int *x1, int *y1, int *x2,
GLdouble winX, winY, winZ;
for (int i = 0; i < model->_numFaces; i++) {
Graphics::Vector3d v;
Math::Vector3d v;
float* pVertices;
for (int j = 0; j < model->_faces[i]._numVertices; j++) {
@ -315,7 +315,7 @@ void GfxOpenGL::getBoundingBoxPos(const Mesh *model, int *x1, int *y1, int *x2,
*y2 = (int)bottom;
}
void GfxOpenGL::startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll) {
void GfxOpenGL::startActorDraw(Math::Vector3d pos, float scale, float yaw, float pitch, float roll) {
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
@ -480,7 +480,7 @@ void GfxOpenGL::drawSprite(const Sprite *sprite) {
glPopMatrix();
}
void GfxOpenGL::translateViewpointStart(Graphics::Vector3d pos, float pitch, float yaw, float roll) {
void GfxOpenGL::translateViewpointStart(Math::Vector3d pos, float pitch, float yaw, float roll) {
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
@ -495,7 +495,7 @@ void GfxOpenGL::translateViewpointFinish() {
}
void GfxOpenGL::drawHierachyNode(const ModelNode *node, int *x1, int *y1, int *x2, int *y2) {
Graphics::Vector3d animPos = node->_pos + node->_animPos;
Math::Vector3d animPos = node->_pos + node->_animPos;
float animPitch = node->_pitch + node->_animPitch;
float animYaw = node->_yaw + node->_animYaw;
float animRoll = node->_roll + node->_animRoll;