mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-06 15:04:41 +00:00
removing parts of Math
removing examples removed small doc
This commit is contained in:
parent
f14e76ab8f
commit
cb23db8c47
42 changed files with 0 additions and 3021 deletions
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint leftSourceAddress,
|
||||
jint leftSourceStride,
|
||||
jint leftElements,
|
||||
jint leftSourceWidth,
|
||||
jint leftSourceHeight,
|
||||
jboolean transposeLeftSource,
|
||||
jint rightSourceAddress,
|
||||
jint rightSourceStride,
|
||||
jint rightElements,
|
||||
jint rightSourceWidth,
|
||||
jint rightSourceHeight,
|
||||
jboolean transposeRightSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
MatrixSrc left (leftSourceAddress, leftSourceStride,
|
||||
leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource);
|
||||
MatrixSrc right (rightSourceAddress, leftSourceStride,
|
||||
rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
left.width, left.height, left.elements * right.elements, transposeDest);
|
||||
|
||||
dest.configureBuffer(left, right);
|
||||
|
||||
float * leftMatrix, * rightMatrix, * destMatrix;
|
||||
|
||||
left.rewind();
|
||||
for (int i = 0; i < left.elements; i++)
|
||||
{
|
||||
leftMatrix = left.nextMatrix();
|
||||
|
||||
right.rewind();
|
||||
for (int j = 0; j < right.elements; j++)
|
||||
{
|
||||
rightMatrix = right.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
int k = dest.width * dest.height;
|
||||
while (k--)
|
||||
destMatrix[k] = leftMatrix[k] + rightMatrix[k];
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint leftSourceAddress,
|
||||
jint leftSourceStride,
|
||||
jint leftElements,
|
||||
jint leftSourceWidth,
|
||||
jint leftSourceHeight,
|
||||
jboolean transposeLeftSource,
|
||||
jint rightSourceAddress,
|
||||
jint rightSourceStride,
|
||||
jint rightElements,
|
||||
jint rightSourceWidth,
|
||||
jint rightSourceHeight,
|
||||
jboolean transposeRightSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
MatrixSrc left (leftSourceAddress, leftSourceStride,
|
||||
leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource);
|
||||
MatrixSrc right (rightSourceAddress, leftSourceStride,
|
||||
rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
left.width, left.height, left.elements * right.elements, transposeDest);
|
||||
|
||||
float * leftMatrix, * rightMatrix, * destMatrix;
|
||||
|
||||
left.rewind();
|
||||
for (int i = 0; i < leftElements; i++)
|
||||
{
|
||||
leftMatrix = left.nextMatrix();
|
||||
right.rewind();
|
||||
|
||||
for (int j = 0; j < rightElements; j++)
|
||||
{
|
||||
rightMatrix = right.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
int k = dest.width * dest.height;
|
||||
while (k--)
|
||||
destMatrix[k] = leftMatrix[k] + rightMatrix[k];
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
#include <string.h>
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpCopy_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
if (transposeSource == transposeDest)
|
||||
{
|
||||
transposeSource = false;
|
||||
transposeDest = false;
|
||||
}
|
||||
|
||||
MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest);
|
||||
|
||||
dest.configureBuffer(source);
|
||||
|
||||
float * srcMatrix, * destMatrix;
|
||||
int matrixByteCount = source.width*source.height*sizeof(jfloat);
|
||||
|
||||
for (int i = 0; i < source.elements; i++)
|
||||
{
|
||||
srcMatrix = source.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
// just do a straight memory copy
|
||||
memcpy(destMatrix, srcMatrix, matrixByteCount);
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpCopy_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpCopy_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
// remove any unnecessary copying
|
||||
if (transposeSource == transposeDest)
|
||||
{
|
||||
transposeSource = false;
|
||||
transposeDest = false;
|
||||
}
|
||||
|
||||
MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest);
|
||||
|
||||
float * srcMatrix, * destMatrix;
|
||||
int matrixByteCount = source.width*source.height*sizeof(jfloat);
|
||||
|
||||
for (int i = 0; i < source.elements; i++)
|
||||
{
|
||||
srcMatrix = source.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
// just do a straight memory copy
|
||||
memcpy(destMatrix, srcMatrix, matrixByteCount);
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpCopy_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
#ifdef _DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
static float * temp_matrix = 0;
|
||||
static int temp_matrix_size = 0;
|
||||
|
||||
if (transposeSource == transposeDest)
|
||||
{
|
||||
transposeSource = JNI_FALSE;
|
||||
transposeDest = JNI_FALSE;
|
||||
}
|
||||
|
||||
|
||||
// We are under the assumption that sourceWidth == sourceHeight and the matrix
|
||||
// defined within is invertable
|
||||
|
||||
MatrixSrc source (sourceAddress, sourceStride,
|
||||
sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
source.width, source.height, source.elements, transposeDest);
|
||||
|
||||
dest.configureBuffer(source);
|
||||
|
||||
float * srcMatrix, * destMatrix;
|
||||
|
||||
int temp_side = source.width-1;
|
||||
|
||||
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();
|
||||
|
||||
// calculate the determinant
|
||||
float det = determinant(srcMatrix, source.width);
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("Matrix Determinant: %f\n", det);
|
||||
printf("Matrix Determinant - 1 = %f\n", det -1);
|
||||
#endif
|
||||
|
||||
float sign;
|
||||
|
||||
for (int col = 0; col < source.width; col++)
|
||||
{
|
||||
/*
|
||||
Maintain sign:
|
||||
|
||||
+ - + - ...
|
||||
- + - + ..
|
||||
+ - + - ..
|
||||
- + - + ..
|
||||
: : : : \
|
||||
*/
|
||||
|
||||
sign = (col & 1) ? -1.0f : 1.0f;
|
||||
|
||||
for (int row = 0; row < source.height; row++)
|
||||
{
|
||||
// get the sub matrix
|
||||
subMatrix(srcMatrix, source.width, temp_matrix, col, row);
|
||||
|
||||
// transpose the result
|
||||
destMatrix[col + row * source.height]
|
||||
= (sign / det) * determinant(temp_matrix, temp_side);
|
||||
|
||||
// swap signs
|
||||
sign *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* Win32 math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
|
||||
static float * temp_matrix = 0;
|
||||
static int temp_matrix_size = 0;
|
||||
|
||||
if (transposeSource == transposeDest)
|
||||
{
|
||||
transposeSource = JNI_FALSE;
|
||||
transposeDest = JNI_FALSE;
|
||||
}
|
||||
|
||||
// We are under the assumption that sourceWidth == sourceHeight and the matrix
|
||||
// defined within is invertable
|
||||
|
||||
MatrixSrc source (sourceAddress, sourceStride,
|
||||
sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
source.width, source.height, source.elements, transposeDest);
|
||||
|
||||
float * srcMatrix, * destMatrix;
|
||||
|
||||
int temp_side = source.width-1;
|
||||
|
||||
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();
|
||||
|
||||
// calculate the determinant
|
||||
float det = determinant(srcMatrix, source.width);
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("Matrix Determinant: %f\n", det);
|
||||
printf("Matrix Determinant - 1: %f\n", det-1);
|
||||
#endif
|
||||
|
||||
float sign;
|
||||
|
||||
for (int col = 0; col < source.width; col++)
|
||||
{
|
||||
/*
|
||||
Maintain sign:
|
||||
|
||||
+ - + - ...
|
||||
- + - + ..
|
||||
+ - + - ..
|
||||
- + - + ..
|
||||
: : : : \
|
||||
*/
|
||||
|
||||
sign = (col & 1) ? -1.0f : 1.0f;
|
||||
|
||||
for (int row = 0; row < source.height; row++)
|
||||
{
|
||||
// get the sub matrix
|
||||
subMatrix(srcMatrix, source.width, temp_matrix, col, row);
|
||||
|
||||
// transpose the result
|
||||
destMatrix[col + row * source.height]
|
||||
= (sign / det) * determinant(temp_matrix, temp_side);
|
||||
|
||||
// swap signs
|
||||
sign *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
dest.writeComplete();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
#include <cstring>
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpMultiply_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint leftSourceAddress,
|
||||
jint leftSourceStride,
|
||||
jint leftElements,
|
||||
jint leftSourceWidth,
|
||||
jint leftSourceHeight,
|
||||
jboolean transposeLeftSource,
|
||||
jint rightSourceAddress,
|
||||
jint rightSourceStride,
|
||||
jint rightElements,
|
||||
jint rightSourceWidth,
|
||||
jint rightSourceHeight,
|
||||
jboolean transposeRightSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
if (transposeLeftSource && transposeRightSource)
|
||||
{
|
||||
transposeLeftSource = false;
|
||||
transposeRightSource = false;
|
||||
transposeDest = !transposeDest;
|
||||
}
|
||||
|
||||
|
||||
MatrixSrc left (leftSourceAddress, leftSourceStride,
|
||||
leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource);
|
||||
MatrixSrc right (rightSourceAddress, leftSourceStride,
|
||||
rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
right.width, left.height, left.elements * right.elements, transposeDest);
|
||||
|
||||
dest.configureBuffer(left, right);
|
||||
|
||||
float * leftMatrix, * rightMatrix, * destMatrix;
|
||||
|
||||
// check out discussions envolving ordering
|
||||
|
||||
|
||||
left.rewind();
|
||||
for (int i = 0; i < left.elements; i++)
|
||||
{
|
||||
leftMatrix = left.nextMatrix();
|
||||
|
||||
right.rewind();
|
||||
for (int j = 0; j < right.elements; j++)
|
||||
{
|
||||
rightMatrix = right.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
// zero the elements of the destination matrix
|
||||
for (int d = 0; d < dest.width * dest.height; d++)
|
||||
destMatrix[d] = 0;
|
||||
|
||||
// loop through each column of the right matrix
|
||||
int rightCell = 0;
|
||||
for (int rightCol = 0; rightCol < right.width; rightCol++)
|
||||
{
|
||||
// [RxC] * [RxC]
|
||||
// dest has same height as left
|
||||
// dest has same width as right
|
||||
|
||||
int leftCell = 0;
|
||||
for (int leftCol = 0; leftCol < left.width; leftCol++)
|
||||
{
|
||||
for (int leftRow = 0; leftRow < left.height; leftRow++)
|
||||
{
|
||||
destMatrix[leftRow] += rightMatrix[rightCell] * leftMatrix[leftCell++];
|
||||
}
|
||||
rightCell ++ ;
|
||||
}
|
||||
|
||||
//rightMatrix = &rightMatrix[right.height];
|
||||
destMatrix = &destMatrix[dest.height];
|
||||
|
||||
}
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpMultiply_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* Win32 math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
#include <cstring>
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpMultiply_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint leftSourceAddress,
|
||||
jint leftSourceStride,
|
||||
jint leftElements,
|
||||
jint leftSourceWidth,
|
||||
jint leftSourceHeight,
|
||||
jboolean transposeLeftSource,
|
||||
jint rightSourceAddress,
|
||||
jint rightSourceStride,
|
||||
jint rightElements,
|
||||
jint rightSourceWidth,
|
||||
jint rightSourceHeight,
|
||||
jboolean transposeRightSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
if (transposeLeftSource && transposeRightSource)
|
||||
{
|
||||
transposeLeftSource = false;
|
||||
transposeRightSource = false;
|
||||
transposeDest = !transposeDest;
|
||||
}
|
||||
|
||||
|
||||
MatrixSrc left (leftSourceAddress, leftSourceStride,
|
||||
leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource);
|
||||
MatrixSrc right (rightSourceAddress, leftSourceStride,
|
||||
rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
right.width, left.height, left.elements * right.elements, transposeDest);
|
||||
|
||||
float * leftMatrix, * rightMatrix, * destMatrix;
|
||||
|
||||
// check out discussions envolving ordering
|
||||
|
||||
|
||||
left.rewind();
|
||||
for (int i = 0; i < left.elements; i++)
|
||||
{
|
||||
leftMatrix = left.nextMatrix();
|
||||
|
||||
right.rewind();
|
||||
for (int j = 0; j < right.elements; j++)
|
||||
{
|
||||
rightMatrix = right.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
// zero the elements of the destination matrix
|
||||
for (int d = 0; d < dest.width * dest.height; d++)
|
||||
destMatrix[d] = 0;
|
||||
|
||||
// loop through each column of the right matrix
|
||||
int rightCell = 0;
|
||||
for (int rightCol = 0; rightCol < right.width; rightCol++)
|
||||
{
|
||||
// [RxC] * [RxC]
|
||||
// dest has same height as left
|
||||
// dest has same width as right
|
||||
|
||||
int leftCell = 0;
|
||||
for (int leftCol = 0; leftCol < left.width; leftCol++)
|
||||
{
|
||||
for (int leftRow = 0; leftRow < left.height; leftRow++)
|
||||
{
|
||||
destMatrix[leftRow] += rightMatrix[rightCell] * leftMatrix[leftCell++];
|
||||
}
|
||||
rightCell ++ ;
|
||||
}
|
||||
|
||||
//rightMatrix = &rightMatrix[right.height];
|
||||
destMatrix = &destMatrix[dest.height];
|
||||
|
||||
}
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpMultiply_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNegate_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride, source.width, source.height, numElements, transposeDest);
|
||||
|
||||
dest.configureBuffer(source);
|
||||
|
||||
int * srcMatrix, * destMatrix;
|
||||
|
||||
for (int i = 0; i < source.elements; i++)
|
||||
{
|
||||
srcMatrix = (int *) source.nextMatrix();
|
||||
destMatrix = (int *) dest.nextMatrix();
|
||||
|
||||
// we can cheat and use the less expensive xor
|
||||
// to switch the sign bit of the float
|
||||
// single precision format 1 - sign 8 - exponent (excess 127) 23 - mantisa
|
||||
|
||||
int j = source.width*source.height;
|
||||
while (j--)
|
||||
destMatrix[j] = srcMatrix[j] ^ 0x80000000;
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNegate_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNegate_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride, source.width, source.height, numElements, transposeDest);
|
||||
|
||||
int * srcMatrix, * destMatrix;
|
||||
|
||||
for (int i = 0; i < source.elements; i++)
|
||||
{
|
||||
srcMatrix = (int *) source.nextMatrix();
|
||||
destMatrix = (int *) dest.nextMatrix();
|
||||
|
||||
// we can cheat and use the less expensive xor
|
||||
// to switch the sign bit of the float
|
||||
// single precision format 1 - sign 8 - exponent (excess 127) 23 - mantisa
|
||||
|
||||
int j = source.width*source.height;
|
||||
while (j--)
|
||||
destMatrix[j] = srcMatrix[j] ^ 0x80000000;
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNegate_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
#include <cmath>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNormalise_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest);
|
||||
|
||||
dest.configureBuffer(source);
|
||||
|
||||
float * srcMatrix, * destMatrix;
|
||||
float magnitude, magnitude_squared;
|
||||
|
||||
int i, j, matrixFloatCount = source.width * source.height;
|
||||
|
||||
for (i = 0; i < source.elements; i++)
|
||||
{
|
||||
magnitude_squared = 0;
|
||||
srcMatrix = source.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
j = matrixFloatCount;
|
||||
while (j--)
|
||||
magnitude_squared += srcMatrix[j] * srcMatrix[j];
|
||||
|
||||
magnitude = (float) sqrt((double) magnitude_squared);
|
||||
|
||||
j = matrixFloatCount;
|
||||
while (j--)
|
||||
destMatrix[j] = srcMatrix[j] / magnitude;
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNormalise_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
#include <cmath>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNormalise_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint sourceAddress,
|
||||
jint sourceStride,
|
||||
jint numElements,
|
||||
jint sourceWidth,
|
||||
jint sourceHeight,
|
||||
jboolean transposeSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
MatrixSrc source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource);
|
||||
MatrixDst dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest);
|
||||
|
||||
float * srcMatrix, * destMatrix;
|
||||
float magnitude, magnitude_squared;
|
||||
|
||||
int i, j, matrixFloatCount = source.width * source.height;
|
||||
|
||||
for (i = 0; i < source.elements; i++)
|
||||
{
|
||||
magnitude_squared = 0;
|
||||
srcMatrix = source.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
j = matrixFloatCount;
|
||||
while (j--)
|
||||
magnitude_squared += srcMatrix[j] * srcMatrix[j];
|
||||
|
||||
magnitude = (float) sqrt((double) magnitude_squared);
|
||||
|
||||
j = matrixFloatCount;
|
||||
while (j--)
|
||||
destMatrix[j] = srcMatrix[j] / magnitude;
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNormalise_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpSubtract_00024MatrixOpDirect_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint leftSourceAddress,
|
||||
jint leftSourceStride,
|
||||
jint leftElements,
|
||||
jint leftSourceWidth,
|
||||
jint leftSourceHeight,
|
||||
jboolean transposeLeftSource,
|
||||
jint rightSourceAddress,
|
||||
jint rightSourceStride,
|
||||
jint rightElements,
|
||||
jint rightSourceWidth,
|
||||
jint rightSourceHeight,
|
||||
jboolean transposeRightSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
if (transposeLeftSource && transposeRightSource)
|
||||
{
|
||||
transposeLeftSource = false;
|
||||
transposeRightSource = false;
|
||||
transposeDest = !transposeDest;
|
||||
}
|
||||
|
||||
MatrixSrc left (leftSourceAddress, leftSourceStride,
|
||||
leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource);
|
||||
MatrixSrc right (rightSourceAddress, leftSourceStride,
|
||||
rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
left.width, left.height, left.elements * right.elements, transposeDest);
|
||||
|
||||
dest.configureBuffer(left, right);
|
||||
|
||||
float * leftMatrix, * rightMatrix, * destMatrix;
|
||||
|
||||
left.rewind();
|
||||
for (int i = 0; i < left.elements; i++)
|
||||
{
|
||||
leftMatrix = left.nextMatrix();
|
||||
|
||||
right.rewind();
|
||||
for (int j = 0; j < right.elements; j++)
|
||||
{
|
||||
rightMatrix = right.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
int k = dest.width * dest.height;
|
||||
while (k--)
|
||||
destMatrix[k] = leftMatrix[k] - rightMatrix[k];
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect
|
||||
#define _Included_org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpSubtract_00024MatrixOpDirect_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* math library.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.h"
|
||||
#include "MatrixOpCommon.h"
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpSubtract_00024MatrixOpSafe_execute
|
||||
(
|
||||
JNIEnv * env,
|
||||
jobject obj,
|
||||
jint leftSourceAddress,
|
||||
jint leftSourceStride,
|
||||
jint leftElements,
|
||||
jint leftSourceWidth,
|
||||
jint leftSourceHeight,
|
||||
jboolean transposeLeftSource,
|
||||
jint rightSourceAddress,
|
||||
jint rightSourceStride,
|
||||
jint rightElements,
|
||||
jint rightSourceWidth,
|
||||
jint rightSourceHeight,
|
||||
jboolean transposeRightSource,
|
||||
jint destAddress,
|
||||
jint destStride,
|
||||
jboolean transposeDest
|
||||
)
|
||||
{
|
||||
if (transposeLeftSource && transposeRightSource)
|
||||
{
|
||||
transposeLeftSource = false;
|
||||
transposeRightSource = false;
|
||||
transposeDest = !transposeDest;
|
||||
}
|
||||
|
||||
MatrixSrc left (leftSourceAddress, leftSourceStride,
|
||||
leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource);
|
||||
MatrixSrc right (rightSourceAddress, leftSourceStride,
|
||||
rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource);
|
||||
MatrixDst dest (destAddress, destStride,
|
||||
left.width, left.height, left.elements * right.elements, transposeDest);
|
||||
|
||||
float * leftMatrix, * rightMatrix, * destMatrix;
|
||||
|
||||
left.rewind();
|
||||
for (int i = 0; i < left.elements; i++)
|
||||
{
|
||||
leftMatrix = left.nextMatrix();
|
||||
|
||||
right.rewind();
|
||||
for (int j = 0; j < right.elements; j++)
|
||||
{
|
||||
rightMatrix = right.nextMatrix();
|
||||
destMatrix = dest.nextMatrix();
|
||||
|
||||
int k = dest.width * dest.height;
|
||||
while (k--)
|
||||
destMatrix[k] = leftMatrix[k] - rightMatrix[k];
|
||||
|
||||
dest.writeComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe */
|
||||
|
||||
#ifndef _Included_org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe
|
||||
#define _Included_org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe
|
||||
* Method: execute
|
||||
* Signature: (IIIIIZIIIIIZIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpSubtract_00024MatrixOpSafe_execute
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue