More vector fixes by cfmdobbie

This commit is contained in:
Elias Naur 2003-09-01 12:45:47 +00:00
parent bdfd1735c5
commit 1333673bb5
6 changed files with 129 additions and 44 deletions

View File

@ -330,22 +330,27 @@ public class Matrix3f extends Matrix implements Serializable {
* @return the transposed matrix
*/
public Matrix3f transpose(Matrix3f dest) {
if (dest == null) {
dest = new Matrix3f();
dest.m00 = m00;
dest.m01 = m10;
dest.m02 = m20;
dest.m10 = m01;
dest.m11 = m11;
dest.m12 = m21;
dest.m20 = m02;
dest.m21 = m12;
dest.m22 = m22;
return dest;
} else {
transpose();
return this;
}
if (dest == null) {
// New matrix needed to store transpose
dest = new Matrix3f();
}
if (this == dest) {
// Destination and source are the same! Run the in-place
// transpose instead as the copy transpose will be destructive.
transpose();
} else {
// Destination differs from source. Perform copy transpose
dest.m00 = m00;
dest.m01 = m10;
dest.m02 = m20;
dest.m10 = m01;
dest.m11 = m11;
dest.m12 = m21;
dest.m20 = m02;
dest.m21 = m12;
dest.m22 = m22;
}
return dest;
}
/**

View File

@ -635,30 +635,35 @@ public class Matrix4f extends Matrix implements Serializable {
* @return the transposed matrix
*/
public Matrix4f transpose(Matrix4f dest) {
if (dest == null) {
dest = new Matrix4f();
dest.m00 = m00;
dest.m01 = m10;
dest.m02 = m20;
dest.m03 = m30;
dest.m10 = m01;
dest.m11 = m11;
dest.m12 = m21;
dest.m13 = m31;
dest.m20 = m02;
dest.m21 = m12;
dest.m22 = m22;
dest.m23 = m32;
dest.m30 = m03;
dest.m31 = m13;
dest.m32 = m23;
dest.m33 = m33;
return dest;
} else {
transpose();
return this;
}
}
if (dest == null) {
// New matrix needed to store transpose
dest = new Matrix4f();
}
if (this == dest) {
// Destination and source are the same! Run the in-place
// transpose instead as the copy transpose will be destructive.
transpose();
} else {
// Destination differs from source. Perform copy transpose
dest.m00 = m00;
dest.m01 = m10;
dest.m02 = m20;
dest.m03 = m30;
dest.m10 = m01;
dest.m11 = m11;
dest.m12 = m21;
dest.m13 = m31;
dest.m20 = m02;
dest.m21 = m12;
dest.m22 = m22;
dest.m23 = m32;
dest.m30 = m03;
dest.m31 = m13;
dest.m32 = m23;
dest.m33 = m33;
}
return dest;
}
/**
* @return the determinant of the matrix

View File

@ -1,4 +1,3 @@
SUBDIRS = common linux
lib_LTLIBRARIES = liblwjgl.la
liblwjgl_LDADD

66
src/native/acinclude.m4 Normal file
View File

@ -0,0 +1,66 @@
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_jni_include_dirs.html
dnl
AC_DEFUN(AC_JNI_INCLUDE_DIR,[
JNI_INCLUDE_DIRS=""
test "x$JAVAC" = x && JAVAC=javac
AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no)
test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path])
_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
case "$host_os" in
darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
_JINC="$_JTOPDIR/Headers";;
*) _JINC="$_JTOPDIR/include";;
esac
if test -f "$_JINC/jni.h"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
else
_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
if test -f "$_JTOPDIR/include/jni.h"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
else
AC_MSG_ERROR([cannot find java include files])
fi
fi
# get the likely subdirectories for system specific java includes
case "$host_os" in
bsdi*) _JNI_INC_SUBDIRS="bsdos";;
linux*) _JNI_INC_SUBDIRS="linux genunix";;
osf*) _JNI_INC_SUBDIRS="alpha";;
solaris*) _JNI_INC_SUBDIRS="solaris";;
*) _JNI_INC_SUBDIRS="genunix";;
esac
# add any subdirectories that are present
for JINCSUBDIR in $_JNI_INC_SUBDIRS
do
if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
fi
done
])
# _ACJNI_FOLLOW_SYMLINKS <path>
# Follows symbolic links on <path>,
# finally setting variable _ACJNI_FOLLOWED
# --------------------
AC_DEFUN(_ACJNI_FOLLOW_SYMLINKS,[
# find the include directory relative to the javac executable
_cur="$1"
while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
AC_MSG_CHECKING(symlink for $_cur)
_slink=`ls -ld "$_cur" | sed 's/.* -> //'`
case "$_slink" in
/*) _cur="$_slink";;
# 'X' avoids triggering unwanted echo options.
*) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";;
esac
AC_MSG_RESULT($_cur)
done
_ACJNI_FOLLOWED="$_cur"
])# _ACJNI

View File

@ -2,7 +2,8 @@
#WANT_AUTOMAKE_1_5=1
#autoheader linux
libtoolize --force
aclocal
automake --foreign --include-deps --add-missing --copy
autoheader
libtoolize --force
autoconf
automake --foreign --include-deps --add-missing --copy

View File

@ -5,6 +5,7 @@ AC_PREREQ(2.57)
AC_INIT
AM_INIT_AUTOMAKE(LWJGL, 0.7)
AC_CONFIG_SRCDIR([autogen.sh])
AM_CONFIG_HEADER([config.h])
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
@ -24,7 +25,15 @@ AC_PROG_LIBTOOL
# Checks for header files.
AC_PATH_X
AC_HEADER_STDC
AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/time.h])
AC_JNI_INCLUDE_DIR
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
do
CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
done
AC_CHECK_HEADER([stddef.h stdlib.h string.h sys/time.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL