Various org.lwjgl.vector bugs found by cfmdobbie fixed

This commit is contained in:
Elias Naur 2003-08-30 14:25:10 +00:00
parent ba3acc79b9
commit bdfd1735c5
10 changed files with 85 additions and 197 deletions

View File

@ -330,25 +330,22 @@ public class Matrix3f extends Matrix implements Serializable {
* @return the transposed matrix
*/
public Matrix3f transpose(Matrix3f dest) {
if (dest == null)
if (dest == null) {
dest = new Matrix3f();
if (this != dest) {
m00 = dest.m00;
m01 = dest.m10;
m02 = dest.m20;
m10 = dest.m01;
m11 = dest.m11;
m12 = dest.m21;
m20 = dest.m02;
m21 = dest.m12;
m22 = dest.m22;
} else
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;
return this;
}
}
/**

View File

@ -635,28 +635,29 @@ public class Matrix4f extends Matrix implements Serializable {
* @return the transposed matrix
*/
public Matrix4f transpose(Matrix4f dest) {
if (this != dest) {
m00 = dest.m00;
m01 = dest.m10;
m02 = dest.m20;
m03 = dest.m30;
m10 = dest.m01;
m11 = dest.m11;
m12 = dest.m21;
m13 = dest.m31;
m20 = dest.m02;
m21 = dest.m12;
m22 = dest.m22;
m23 = dest.m32;
m30 = dest.m03;
m31 = dest.m13;
m32 = dest.m23;
m33 = dest.m33;
} else
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 dest;
return this;
}
}
/**

View File

@ -82,7 +82,7 @@ public abstract class Vector implements Serializable {
* Normalise this vector
* @return this
*/
public final Vector normalize() {
public final Vector normalise() {
float len = length();
if (len != 0.0f) {
float l = 1.0f / len;

View File

@ -241,4 +241,17 @@ public class Vector2f extends Vector implements Serializable {
return this;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer sb = new StringBuffer(64);
sb.append("Vector2f[");
sb.append(x);
sb.append(", ");
sb.append(y);
sb.append(']');
return sb.toString();
}
}

View File

@ -1,16 +1,4 @@
SUBDIRS = common linux
lib_LTLIBRARIES = liblwjgl.la
#liblwjgl_la_LDFLAGS = \
# -release $(LT_RELEASE) \
# -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
liblwjgl_la_SOURCES = \
dummy.cpp
liblwjgl_la_CPPFLAGS = -D_DEBUG
liblwjgl_la_LIBADD = \
common/libcommon.la \
linux/liblinux.la
liblwjgl_la_DEPENDENCIES = \
common/libcommon.la \
linux/liblinux.la
liblwjgl_LDADD

View File

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

View File

@ -1,15 +1,8 @@
#SUBDIRS = callbacks
noinst_LTLIBRARIES = libcommon.la
libcommon_la_SOURCES = $(COMMON)
libcommon_la_CPPFLAGS = -D_DEBUG
#libcommon_la_LIBADD = \
# callbacks/libcallbacks.la
#libcommon_la_DEPENDENCIES = \
# callbacks/libcallbacks.la
COMMON = \
extal.cpp \
extal.h \

View File

@ -1,67 +0,0 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the `X11' library (-lX11). */
#undef HAVE_LIBX11
/* Define to 1 if you have the `Xext' library (-lXext). */
#undef HAVE_LIBXEXT
/* Define to 1 if you have the `Xxf86vm' library (-lXxf86vm). */
#undef HAVE_LIBXXF86VM
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

View File

@ -1,76 +1,42 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(dummy.cpp)
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
dnl These should be changed =)
LWJGL_MAJOR_VERSION=0
LWJGL_MINOR_VERSION=0
LWJGL_MICRO_VERSION=0
LWJGL_INTERFACE_AGE=1
LWJGL_BINARY_AGE=1
LWJGL_VERSION=$LWJGL_MAJOR_VERSION.$LWJGL_MINOR_VERSION.$LWJGL_MICRO_VERSION
AC_PREREQ(2.57)
AC_INIT
AM_INIT_AUTOMAKE(LWJGL, 0.7)
AC_CONFIG_SRCDIR([autogen.sh])
AC_SUBST(LWJGL_MAJOR_VERSION)
AC_SUBST(LWJGL_MINOR_VERSION)
AC_SUBST(LWJGL_MICRO_VERSION)
AC_SUBST(LWJGL_INTERFACE_AGE)
AC_SUBST(LWJGL_BINARY_AGE)
AC_SUBST(LWJGL_VERSION)
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
# libtool versioning
LT_RELEASE=$LWJGL_MAJOR_VERSION.$LWJGL_MINOR_VERSION
LT_CURRENT=`expr $LWJGL_MICRO_VERSION - $LWJGL_INTERFACE_AGE`
LT_REVISION=$LWJGL_INTERFACE_AGE
LT_AGE=`expr $LWJGL_BINARY_AGE - $LWJGL_INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_CONFIG_AUX_DIR(admin)
#AC_CONFIG_SRCDIR(common/org_lwjgl_opengl_CoreGL.cpp)
AM_INIT_AUTOMAKE(lwjgl, $LWJGL_VERSION)
AM_CONFIG_HEADER(config.h)
dnl Checks for programs.
dnl AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_CPP
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_REQUIRE_CPP
AC_MSG_CHECKING(for JAVA_HOME)
if test "x$JAVA_HOME" = x; then
AC_MSG_ERROR([*** Please set the JAVA_HOME environment variable ])
else
AC_MSG_RESULT($JAVA_HOME)
JAVA_HOME="$JAVA_HOME"
CPPFLAGS="$CPPFLAGS -D_DEBUG -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
CFLAGS="$CFLAGS -D_DEBUG -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
fi
# Checks for libraries.
dnl Checks for libraries.
LIBS='-L/usr/X11R6/lib'
# Checks for header files.
AC_PATH_X
dnl Replace `main' with a function in -lX11:
AC_CHECK_LIB(X11, main,, AC_MSG_ERROR(X11 is required))
dnl Replace `main' with a function in -lXext:
AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required))
dnl Replace `main' with a function in -lXxf86vm:
AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required))
dnl Replace `main' with a function in -tpthread:
AC_CHECK_LIB(pthread, main,, AC_MSG_ERROR(pthread is required))
AC_HEADER_STDC
AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/time.h])
dnl Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
dnl Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gettimeofday memset strchr strstr])
dnl Checks for library functions.
AC_OUTPUT([Makefile common/Makefile linux/Makefile])
AC_CONFIG_FILES([Makefile
common/Makefile
linux/Makefile])
AC_OUTPUT

View File

@ -1,4 +0,0 @@
/* This is needed for automake, so that it can build an empty archive */
int pointless_symbol_so_the_archive_doesnt_look_empty;