Synced math operations with win32

This commit is contained in:
Elias Naur 2002-11-25 00:09:47 +00:00
parent 2530b45005
commit c8139a4ea2
4 changed files with 25 additions and 7 deletions

View File

@ -64,7 +64,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDire
jboolean transposeDest
)
{
if (transposeSource == transposeDest)
static float * temp_matrix = 0;
static int temp_matrix_size = 0;
if (transposeSource == transposeDest)
{
transposeSource = JNI_FALSE;
transposeDest = JNI_FALSE;
@ -84,7 +87,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDire
float * srcMatrix, * destMatrix;
int temp_side = source.width-1;
float temp_matrix [temp_side*temp_side];
if (temp_matrix_size < temp_side) {
if (temp_matrix)
delete[] temp_matrix;
temp_matrix = new float[temp_side * temp_side];
temp_matrix_size = temp_side;
}
for (int i = 0; i < source.elements; i++)
{

View File

@ -67,7 +67,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe
)
{
if (transposeSource == transposeDest)
static float * temp_matrix = 0;
static int temp_matrix_size = 0;
if (transposeSource == transposeDest)
{
transposeSource = JNI_FALSE;
transposeDest = JNI_FALSE;
@ -84,9 +87,15 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe
float * srcMatrix, * destMatrix;
int temp_side = source.width-1;
float temp_matrix [temp_side*temp_side];
for (int i = 0; i < source.elements; i++)
if (temp_matrix_size < temp_side) {
if (temp_matrix)
delete[] temp_matrix;
temp_matrix = new float[temp_side * temp_side];
temp_matrix_size = temp_side;
}
for (int i = 0; i < source.elements; i++)
{
srcMatrix = source.nextMatrix();
destMatrix = dest.nextMatrix();

View File

@ -43,7 +43,7 @@
#include "MatrixOpCommon.h"
#include <cmath>
using namespace std;
//using namespace std;
/*
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect

View File

@ -43,7 +43,7 @@
#include "MatrixOpCommon.h"
#include <cmath>
using namespace std;
//using namespace std;
/*
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe