Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "gl_globals.h"
#include "gfxlib.h"
#include "gfx/vec.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include "gfx/matrix.h"
#include "vs_globals.h"
#include "gl_matrix.h"
Go to the source code of this file.
Macros | |
#define | M(row, col) m[col*4+row] |
#define | M(row, col) i[col*4+row] |
#define | M(row, col) m[col*4+row] |
#define | M(row, col) view.r[col*3+row] |
Functions | |
void | getInverseProjection (float *&inv) |
float | GFXGetXInvPerspective () |
Screen to eye. More... | |
float | GFXGetYInvPerspective () |
void | MatrixToDoubles (double t[], const Matrix &m) |
void | ViewToModel () |
static void | IdentityFloat (float id[]) |
void | MultFloatMatrix (float dest[], const float m1[], const Matrix &m2) |
static void | RotateFloatMatrix (float dest[], const float m1[], const Matrix &m2) |
void | ConstructAndLoadProjection () |
void | GFXTranslateView (const QVector &a) |
void | GFXTranslateModel (const QVector &a) |
void | GFXTranslateProjection (const Vector &a) |
Translates the current "mode" matrix by a given vector. More... | |
void | GFXMultMatrixModel (const Matrix &matrix) |
Multipliex the current "mode" matrix by a given matrix. More... | |
void | GFXLoadMatrixView (const Matrix &matrix) |
void | GFXLoadMatrixModel (const Matrix &matrix) |
loads a given matrix to the current "mode" More... | |
void | GFXLoadMatrixProjection (const float matrix[16]) |
void | GFXViewPort (int minx, int miny, int maxx, int maxy) |
Sets the final translation to screen coordinates, Also adjusts range of clearing. More... | |
void | GFXCenterCamera (bool Enter) |
void | GFXRestoreHudMode () |
void | GFXHudMode (const bool Enter) |
void | GFXLoadIdentity (const MATRIXMODE mode) |
Loads the identity matrix for the given mode. More... | |
void | GFXGetMatrixView (Matrix &matrix) |
void | GFXGetMatrixModel (Matrix &matrix) |
retrieves the matrix for a given mode. More... | |
static void | gl_Frustum (float left, float right, float bottom, float top, float nearval, float farval) |
void | GFXFrustum (float *m, float *i, float left, float right, float bottom, float top, float nearval, float farval) |
Given matrices, calculates the matrix and inverse matrix of a projection matrix to go from screen to 3-space coordinates. More... | |
void | GFXPerspective (float fov, float aspect, float znear, float zfar, float cockpit_offset) |
Sets the Projection matrix to have fov and aspect as follows (fov is field of view in radians, aspect is width/height znear and zfar are clip planes. More... | |
void | GFXParallel (float left, float right, float bottom, float top, float nearval, float farval) |
Sets the Projection matrix to a parallel view with given paramters. More... | |
static void | LookAtHelper (float eyex, float eyey, float eyez, double centerx, double centery, double centerz, float upx, float upy, float upz) |
void | GFXLookAt (Vector eye, QVector center, Vector up) |
Sets the VIEW matrix to look from center in direction of eye with up vector up. More... | |
#define M | ( | row, | |
col | |||
) | m[col*4+row] |
#define M | ( | row, | |
col | |||
) | i[col*4+row] |
#define M | ( | row, | |
col | |||
) | m[col*4+row] |
#define M | ( | row, | |
col | |||
) | view.r[col*3+row] |
void ConstructAndLoadProjection | ( | ) |
Definition at line 157 of file gl_matrix.cpp.
References GFXMatrices::projection, RotateFloatMatrix(), and GFXMatrices::view.
Referenced by GFXLoadIdentity(), GFXLoadMatrixProjection(), GFXLoadMatrixView(), GFXPerspective(), and GFXTranslateProjection().
void getInverseProjection | ( | float *& | inv) |
Definition at line 46 of file gl_matrix.cpp.
References GFXMatrices::invprojection.
void GFXCenterCamera | ( | bool | Enter) |
Definition at line 224 of file gl_matrix.cpp.
References GFXLoadIdentity(), MODEL, Matrix::p, QVector, and GFXMatrices::view.
Referenced by Background::Draw(), and Mesh::DrawNow().
void GFXFrustum | ( | float * | m, |
float * | i, | ||
float | left, | ||
float | right, | ||
float | bottom, | ||
float | top, | ||
float | nearval, | ||
float | farval | ||
) |
void GFXGetMatrixModel | ( | Matrix & | matrix) |
retrieves the matrix for a given mode.
Definition at line 292 of file gl_matrix.cpp.
References CopyMatrix(), and GFXMatrices::model.
Referenced by LocationSelect::Draw(), and GFXUploadLightState().
void GFXGetMatrixView | ( | Matrix & | matrix) |
Definition at line 288 of file gl_matrix.cpp.
References CopyMatrix(), and GFXMatrices::view.
Referenced by LocationSelect::Draw(), and Camera::GetView().
float GFXGetXInvPerspective | ( | ) |
Screen to eye.
Definition at line 51 of file gl_matrix.cpp.
References GFXMatrices::invprojection.
float GFXGetYInvPerspective | ( | ) |
Definition at line 56 of file gl_matrix.cpp.
References GFXMatrices::invprojection.
void GFXHudMode | ( | const bool | Enter) |
Hud Mode saves the current matrices and sets projection and view matrices to identity. Caution: use of other matrix functions in HudMode could alter state.
Definition at line 246 of file gl_matrix.cpp.
void GFXLoadIdentity | ( | const MATRIXMODE | mode) |
Loads the identity matrix for the given mode.
Definition at line 263 of file gl_matrix.cpp.
References ConstructAndLoadProjection(), GFX_SCALE, Identity(), IdentityFloat(), GFXMatrices::model, MODEL, Matrix::p, GFXMatrices::projection, PROJECTION, GFXMatrices::view, VIEW, and ViewToModel().
void GFXLoadMatrixModel | ( | const Matrix & | matrix) |
loads a given matrix to the current "mode"
Definition at line 207 of file gl_matrix.cpp.
References CopyMatrix(), GFXMatrices::model, and ViewToModel().
Referenced by bootstrap_draw(), Bolt::Draw(), Background::Draw(), Atmosphere::Draw(), Animation::DrawNow(), Mesh::DrawNow(), GFXUploadLightState(), Box::ProcessDrawQueue(), Logo::ProcessDrawQueue(), Beam::ProcessDrawQueue(), and QuadTree::Render().
void GFXLoadMatrixProjection | ( | const float | matrix[16]) |
Definition at line 213 of file gl_matrix.cpp.
References ConstructAndLoadProjection(), VsnetOSS::memcpy(), and GFXMatrices::projection.
Referenced by GFXParallel().
void GFXLoadMatrixView | ( | const Matrix & | matrix) |
Definition at line 200 of file gl_matrix.cpp.
References ConstructAndLoadProjection(), CopyMatrix(), GFXMatrices::view, and ViewToModel().
Referenced by GFXLookAt().
Sets the VIEW matrix to look from center in direction of eye with up vector up.
Definition at line 495 of file gl_matrix.cpp.
References GFXLoadMatrixView(), LookAtHelper(), and GFXMatrices::view.
Referenced by Camera::UpdateGFX(), and Camera::UpdateGLCenter().
void GFXMultMatrixModel | ( | const Matrix & | matrix) |
Multipliex the current "mode" matrix by a given matrix.
Definition at line 189 of file gl_matrix.cpp.
References CopyMatrix(), GFXMatrices::model, MultMatrix(), and ViewToModel().
Referenced by LocationSelect::Draw().
Sets the Projection matrix to a parallel view with given paramters.
Definition at line 376 of file gl_matrix.cpp.
References GFXGetFrustumVars(), GFXLoadMatrixProjection(), M, GFXMatrices::projection, x, y, and z.
Sets the Projection matrix to have fov and aspect as follows (fov is field of view in radians, aspect is width/height znear and zfar are clip planes.
Definition at line 356 of file gl_matrix.cpp.
References ConstructAndLoadProjection(), GFX_SCALE, gl_Frustum(), and M_PI.
void GFXRestoreHudMode | ( | ) |
Definition at line 238 of file gl_matrix.cpp.
void GFXTranslateModel | ( | const QVector & | a) |
Definition at line 175 of file gl_matrix.cpp.
References GFXMatrices::model, Matrix::p, TransformNormal(), and ViewToModel().
Referenced by Stars::Draw(), and ParticleTrail::DrawAndUpdate().
void GFXTranslateProjection | ( | const Vector & | a) |
Translates the current "mode" matrix by a given vector.
Definition at line 181 of file gl_matrix.cpp.
References ConstructAndLoadProjection(), and GFXMatrices::projection.
void GFXTranslateView | ( | const QVector & | a) |
Definition at line 165 of file gl_matrix.cpp.
References Matrix::p, TransformNormal(), GFXMatrices::view, and ViewToModel().
|
static |
Definition at line 297 of file gl_matrix.cpp.
References GFXFrustum(), GFXGetFrustumVars(), GFXMatrices::invprojection, and GFXMatrices::projection.
Referenced by GFXPerspective().
|
static |
Definition at line 105 of file gl_matrix.cpp.
Referenced by GFXLoadIdentity().
|
static |
Definition at line 408 of file gl_matrix.cpp.
References M, Matrix::p, GFXMatrices::view, x, y, and z.
Referenced by GFXLookAt().
void MatrixToDoubles | ( | double | t[], |
const Matrix & | m | ||
) |
Definition at line 134 of file gl_matrix.cpp.
References Matrix::r.
Referenced by ConstructAndLoadProjection().
|
inline |
Definition at line 81 of file gl_matrix.cpp.
References GFX_SCALE, GFXMatrices::model, Matrix::p, Matrix::r, and GFXMatrices::view.
Referenced by GFXLoadIdentity(), GFXLoadMatrixModel(), GFXLoadMatrixView(), GFXMultMatrixModel(), GFXTranslateModel(), and GFXTranslateView().