Updated some code

This commit is contained in:
Ray
2016-06-07 23:44:53 +02:00
parent 5631f822bd
commit ee795150fa
8 changed files with 290 additions and 146 deletions

View File

@@ -151,7 +151,6 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top,
RMDEF Matrix MatrixPerspective(double fovy, double aspect, double near, double far); // Returns perspective projection matrix
RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far); // Returns orthographic projection matrix
RMDEF Matrix MatrixLookAt(Vector3 position, Vector3 target, Vector3 up); // Returns camera look-at matrix (view matrix)
RMDEF void PrintMatrix(Matrix m); // Print matrix utility
//------------------------------------------------------------------------------------
// Functions Declaration to work with Quaternions
@@ -178,9 +177,7 @@ RMDEF void QuaternionTransform(Quaternion *q, Matrix mat); // Transfo
#if defined(RAYMATH_IMPLEMENTATION) || defined(RAYMATH_EXTERN_INLINE)
#include <stdio.h> // Used only on PrintMatrix()
#include <math.h> // Standard math libary: sin(), cos(), tan()...
#include <stdlib.h> // Used for abs()
#include <math.h> // Required for: sinf(), cosf(), tan(), fabs()
//----------------------------------------------------------------------------------
// Module Functions Definition - Vector3 math
@@ -342,15 +339,14 @@ RMDEF Vector3 VectorReflect(Vector3 vector, Vector3 normal)
return result;
}
// Transforms a Vector3 with a given Matrix
// Transforms a Vector3 by a given Matrix
// TODO: Review math (matrix transpose required?)
RMDEF void VectorTransform(Vector3 *v, Matrix mat)
{
float x = v->x;
float y = v->y;
float z = v->z;
//MatrixTranspose(&mat);
v->x = mat.m0*x + mat.m4*y + mat.m8*z + mat.m12;
v->y = mat.m1*x + mat.m5*y + mat.m9*z + mat.m13;
v->z = mat.m2*x + mat.m6*y + mat.m10*z + mat.m14;
@@ -871,17 +867,6 @@ RMDEF Matrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up)
return result;
}
// Print matrix utility (for debug)
RMDEF void PrintMatrix(Matrix m)
{
printf("----------------------\n");
printf("%2.2f %2.2f %2.2f %2.2f\n", m.m0, m.m4, m.m8, m.m12);
printf("%2.2f %2.2f %2.2f %2.2f\n", m.m1, m.m5, m.m9, m.m13);
printf("%2.2f %2.2f %2.2f %2.2f\n", m.m2, m.m6, m.m10, m.m14);
printf("%2.2f %2.2f %2.2f %2.2f\n", m.m3, m.m7, m.m11, m.m15);
printf("----------------------\n");
}
//----------------------------------------------------------------------------------
// Module Functions Definition - Quaternion math
//----------------------------------------------------------------------------------