This repository was archived by the owner on Mar 11, 2018. It is now read-only.
forked from FallDownT/CS452-LAB4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathHelper.h
More file actions
40 lines (30 loc) · 1.35 KB
/
Copy pathMathHelper.h
File metadata and controls
40 lines (30 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef MATH_HELPER
#define MATH_HELPER
#include <GL/freeglut.h>
#include <math.h>
#include <stdio.h>
class MathHelper {
public:
// This is a column-order matrix multiply of matrices m1 and m2.
static void matrixMult4x4 (GLfloat* result, GLfloat* m1, GLfloat* m2);
static void matrixMult4x4Column (GLfloat* result, GLfloat* m1, GLfloat* m2);
// Makes an identity matrix
static void makeIdentity (GLfloat* result);
// Returns a matrix that translates by x, y and z amount
static void makeTranslate (GLfloat* result, GLfloat x, GLfloat y, GLfloat z);
// Updates result to include a translate
static void translateMatrixBy (GLfloat* result, GLfloat x, GLfloat y, GLfloat z);
// Returns matrices that rotate about the X, Y and Z axes by a rotation amount (radians)
static void makeRotateX (GLfloat* result, GLfloat rotation);
static void makeRotateY (GLfloat* result, GLfloat rotation);
static void makeRotateZ (GLfloat* result, GLfloat rotation);
// Returns a scaling matrix
static void makeScale (GLfloat* result, GLfloat x, GLfloat y, GLfloat z);
// Make a perspective camera
static void makePerspectiveMatrix (GLfloat* result, GLfloat fov, GLfloat aspect, GLfloat nearPlane, GLfloat farPlane);
// Copies the src matrix into the dest matrix
static void copyMatrix (GLfloat* src, GLfloat* dest);
static void print4x4Matrix(GLfloat* mat);
private:
};
#endif