Commit 4f6fece4 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Update

parent b2643988
......@@ -60,10 +60,11 @@ void mat_translate(float *matrix, float dx, float dy, float dz)
void mat_rotate(float *matrix, float x, float y, float z, float angle)
{
float s, c, m;
normalize(&x, &y, &z);
float s = sinf(angle);
float c = cosf(angle);
float m = 1 - c;
s = sinf(angle);
c = cosf(angle);
m = 1 - c;
matrix[0] = m * x * x + c;
matrix[1] = m * x * y - z * s;
matrix[2] = m * z * x + y * s;
......@@ -88,8 +89,9 @@ void mat_vec_multiply(float *vector, float *a, float *b)
float result[4];
for (i = 0; i < 4; i++)
{
int j;
float total = 0;
for (int j = 0; j < 4; j++)
for (j = 0; j < 4; j++)
{
int p = j * 4 + i;
int q = j;
......@@ -104,14 +106,19 @@ void mat_vec_multiply(float *vector, float *a, float *b)
void mat_multiply(float *matrix, float *a, float *b)
{
int c;
float result[16];
for (int c = 0; c < 4; c++)
for (c = 0; c < 4; c++)
{
for (int r = 0; r < 4; r++) {
int r;
for (r = 0; r < 4; r++)
{
int i;
int index = c * 4 + r;
float total = 0;
for (int i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
int p = i * 4 + r;
int q = c * 4 + i;
total += a[p] * b[q];
......@@ -126,9 +133,10 @@ void mat_multiply(float *matrix, float *a, float *b)
void mat_apply(float *data, float *matrix, int count, int offset, int stride)
{
int i;
float vec[4] = {0, 0, 0, 1};
for (int i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
float *d = data + offset + stride * i;
vec[0] = *(d++); vec[1] = *(d++); vec[2] = *(d++);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment