summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2005-04-22 21:51:02 +0200
committerneoraider <devnull@localhost>2005-04-22 21:51:02 +0200
commit16dca7381bb37a7304fa29d553a73a068e2fe431 (patch)
treeb055db6b6444f2cfc7f882e5c93dc1df02d35b44
parentf3df7ef89aa15aed2e4d68e2b414d31aef57f976 (diff)
downloadlibzoom-16dca7381bb37a7304fa29d553a73a068e2fe431.tar
libzoom-16dca7381bb37a7304fa29d553a73a068e2fe431.zip
Libneofx von Libzoom abgespalten
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in81
-rw-r--r--collision.c116
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure79
-rw-r--r--configure.in3
-rw-r--r--level.c2
-rw-r--r--math.c165
-rw-r--r--player.c4
-rw-r--r--render.c2
-rw-r--r--zoom/collision.h11
-rw-r--r--zoom/init.h4
-rw-r--r--zoom/level.h4
-rw-r--r--zoom/math.h21
-rw-r--r--zoom/player.h4
-rw-r--r--zoom/render.h4
-rw-r--r--zoom/texture.h4
-rw-r--r--zoom/types.h28
18 files changed, 105 insertions, 434 deletions
diff --git a/Makefile.am b/Makefile.am
index b5e7641..b47b9fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
lib_LTLIBRARIES = libzoom.la
-libzoom_la_SOURCES = collision.c init.c level.c math.c player.c render.c texture.c
+libzoom_la_SOURCES = init.c level.c player.c render.c texture.c
libzoom_la_CFLAGS = @GL_CFLAGS@ @GLU_CFLAGS@
libzoom_la_LIBADD = @GL_LIBS@ @GLU_LIBS@
-nobase_include_HEADERS = zoom/types.h zoom/collision.h zoom/init.h zoom/level.h zoom/math.h zoom/player.h zoom/render.h zoom/texture.h
+nobase_include_HEADERS = zoom/types.h zoom/init.h zoom/level.h zoom/player.h zoom/render.h zoom/texture.h
diff --git a/Makefile.in b/Makefile.in
index ff2cef1..e628b78 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -141,10 +141,10 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
lib_LTLIBRARIES = libzoom.la
-libzoom_la_SOURCES = collision.c init.c level.c math.c player.c render.c texture.c
+libzoom_la_SOURCES = init.c level.c player.c render.c texture.c
libzoom_la_CFLAGS = @GL_CFLAGS@ @GLU_CFLAGS@
libzoom_la_LIBADD = @GL_LIBS@ @GLU_LIBS@
-nobase_include_HEADERS = zoom/types.h zoom/collision.h zoom/init.h zoom/level.h zoom/math.h zoom/player.h zoom/render.h zoom/texture.h
+nobase_include_HEADERS = zoom/types.h zoom/init.h zoom/level.h zoom/player.h zoom/render.h zoom/texture.h
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -154,18 +154,15 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libzoom_la_LDFLAGS =
libzoom_la_DEPENDENCIES =
-am_libzoom_la_OBJECTS = libzoom_la-collision.lo libzoom_la-init.lo \
- libzoom_la-level.lo libzoom_la-math.lo libzoom_la-player.lo \
- libzoom_la-render.lo libzoom_la-texture.lo
+am_libzoom_la_OBJECTS = libzoom_la-init.lo libzoom_la-level.lo \
+ libzoom_la-player.lo libzoom_la-render.lo libzoom_la-texture.lo
libzoom_la_OBJECTS = $(am_libzoom_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libzoom_la-collision.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/libzoom_la-init.Plo \
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libzoom_la-init.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/libzoom_la-level.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/libzoom_la-math.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/libzoom_la-player.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/libzoom_la-render.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/libzoom_la-texture.Plo
@@ -261,10 +258,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-collision.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-level.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-math.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-player.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-render.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzoom_la-texture.Plo@am__quote@
@@ -302,39 +297,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
-libzoom_la-collision.o: collision.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-collision.o -MD -MP -MF "$(DEPDIR)/libzoom_la-collision.Tpo" \
-@am__fastdepCC_TRUE@ -c -o libzoom_la-collision.o `test -f 'collision.c' || echo '$(srcdir)/'`collision.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzoom_la-collision.Tpo" "$(DEPDIR)/libzoom_la-collision.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libzoom_la-collision.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='collision.c' object='libzoom_la-collision.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libzoom_la-collision.Po' tmpdepfile='$(DEPDIR)/libzoom_la-collision.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-collision.o `test -f 'collision.c' || echo '$(srcdir)/'`collision.c
-
-libzoom_la-collision.obj: collision.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-collision.obj -MD -MP -MF "$(DEPDIR)/libzoom_la-collision.Tpo" \
-@am__fastdepCC_TRUE@ -c -o libzoom_la-collision.obj `if test -f 'collision.c'; then $(CYGPATH_W) 'collision.c'; else $(CYGPATH_W) '$(srcdir)/collision.c'; fi`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzoom_la-collision.Tpo" "$(DEPDIR)/libzoom_la-collision.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libzoom_la-collision.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='collision.c' object='libzoom_la-collision.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libzoom_la-collision.Po' tmpdepfile='$(DEPDIR)/libzoom_la-collision.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-collision.obj `if test -f 'collision.c'; then $(CYGPATH_W) 'collision.c'; else $(CYGPATH_W) '$(srcdir)/collision.c'; fi`
-
-libzoom_la-collision.lo: collision.c
-@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-collision.lo -MD -MP -MF "$(DEPDIR)/libzoom_la-collision.Tpo" \
-@am__fastdepCC_TRUE@ -c -o libzoom_la-collision.lo `test -f 'collision.c' || echo '$(srcdir)/'`collision.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzoom_la-collision.Tpo" "$(DEPDIR)/libzoom_la-collision.Plo"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libzoom_la-collision.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='collision.c' object='libzoom_la-collision.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libzoom_la-collision.Plo' tmpdepfile='$(DEPDIR)/libzoom_la-collision.TPlo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-collision.lo `test -f 'collision.c' || echo '$(srcdir)/'`collision.c
-
libzoom_la-init.o: init.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-init.o -MD -MP -MF "$(DEPDIR)/libzoom_la-init.Tpo" \
@am__fastdepCC_TRUE@ -c -o libzoom_la-init.o `test -f 'init.c' || echo '$(srcdir)/'`init.c; \
@@ -401,39 +363,6 @@ libzoom_la-level.lo: level.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-level.lo `test -f 'level.c' || echo '$(srcdir)/'`level.c
-libzoom_la-math.o: math.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-math.o -MD -MP -MF "$(DEPDIR)/libzoom_la-math.Tpo" \
-@am__fastdepCC_TRUE@ -c -o libzoom_la-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzoom_la-math.Tpo" "$(DEPDIR)/libzoom_la-math.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libzoom_la-math.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='math.c' object='libzoom_la-math.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libzoom_la-math.Po' tmpdepfile='$(DEPDIR)/libzoom_la-math.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c
-
-libzoom_la-math.obj: math.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-math.obj -MD -MP -MF "$(DEPDIR)/libzoom_la-math.Tpo" \
-@am__fastdepCC_TRUE@ -c -o libzoom_la-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzoom_la-math.Tpo" "$(DEPDIR)/libzoom_la-math.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libzoom_la-math.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='math.c' object='libzoom_la-math.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libzoom_la-math.Po' tmpdepfile='$(DEPDIR)/libzoom_la-math.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi`
-
-libzoom_la-math.lo: math.c
-@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-math.lo -MD -MP -MF "$(DEPDIR)/libzoom_la-math.Tpo" \
-@am__fastdepCC_TRUE@ -c -o libzoom_la-math.lo `test -f 'math.c' || echo '$(srcdir)/'`math.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzoom_la-math.Tpo" "$(DEPDIR)/libzoom_la-math.Plo"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libzoom_la-math.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='math.c' object='libzoom_la-math.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libzoom_la-math.Plo' tmpdepfile='$(DEPDIR)/libzoom_la-math.TPlo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -c -o libzoom_la-math.lo `test -f 'math.c' || echo '$(srcdir)/'`math.c
-
libzoom_la-player.o: player.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzoom_la_CFLAGS) $(CFLAGS) -MT libzoom_la-player.o -MD -MP -MF "$(DEPDIR)/libzoom_la-player.Tpo" \
@am__fastdepCC_TRUE@ -c -o libzoom_la-player.o `test -f 'player.c' || echo '$(srcdir)/'`player.c; \
diff --git a/collision.c b/collision.c
deleted file mode 100644
index 8417df6..0000000
--- a/collision.c
+++ /dev/null
@@ -1,116 +0,0 @@
-#include <zoom/collision.h>
-#include <zoom/math.h>
-
-static VERTEX TriangleCollisionPoint(TRIANGLE, VERTEX);
-static VERTEX LineCollisionPoint(VERTEX, VERTEX, VERTEX);
-
-int CollisionPointTriangle(VERTEX p, TRIANGLE t) {
- VECTOR v1, v2;
- TRIANGLE triangle = t;
-
- if(VectorDot(VectorSub(p, triangle.vertices[0]), triangle.normal) > 0.0) return 0;
-
- v1 = VectorCross(VectorSub(triangle.vertices[2], triangle.vertices[1]), VectorSub(p, triangle.vertices[1]));
- v2 = VectorCross(VectorSub(triangle.vertices[2], triangle.vertices[1]), VectorSub(triangle.vertices[0], triangle.vertices[1]));
- if(VectorDot(v1, v2) < 0.0) return 0;
-
- v1 = VectorCross(VectorSub(triangle.vertices[2], triangle.vertices[0]), VectorSub(p, triangle.vertices[0]));
- v2 = VectorCross(VectorSub(triangle.vertices[2], triangle.vertices[0]), VectorSub(triangle.vertices[1], triangle.vertices[0]));
- if(VectorDot(v1, v2) < 0.0) return 0;
-
- v1 = VectorCross(VectorSub(triangle.vertices[1], triangle.vertices[0]), VectorSub(p, triangle.vertices[0]));
- v2 = VectorCross(VectorSub(triangle.vertices[1], triangle.vertices[0]), VectorSub(triangle.vertices[2], triangle.vertices[0]));
- if(VectorDot(v1, v2) < 0.0) return 0;
-
- return 1;
-}
-
-int CollisionRayTriangle(VERTEX p, VECTOR vec, TRIANGLE t, float* f) {
- VECTOR pvec, tvec, qvec, edge1, edge2;
- float det, u, v, invDet;
-
- edge1 = VectorSub(t.vertices[1], t.vertices[0]);
- edge2 = VectorSub(t.vertices[2], t.vertices[0]);
-
- pvec = VectorCross(vec, edge2);
-
- det = VectorDot(edge1, pvec);
-
- if(det < 0.0001) return 0;
-
- tvec = VectorSub(p, t.vertices[0]);
- u = VectorDot(tvec, pvec);
- if(u < 0.0 || u > det) return 0;
-
- qvec = VectorCross(tvec, edge1);
- v = VectorDot(vec, qvec);
- if(v < 0.0 || u+v > det) return 0;
-
- if(f) {
- *f = VectorDot(edge2, qvec);
- invDet = 1.0 / det;
- *f *= invDet;
- }
-
- return 1;
-}
-
-static VERTEX LineCollisionPoint(VERTEX v1, VERTEX v2, VERTEX p) {
- VECTOR c;
- VECTOR V;
- float d;
- float t;
-
- c = VectorSub(p, v1);
- V = VectorSub(v2, v1);
- d = VectorLengthSq(V);
- t = VectorDot(V, c);
-
- if(t < 0) return v1;
- if(t > d) return v2;
-
- return VectorAdd(v1, VectorMul(V, t/d));
-}
-
-static VERTEX TriangleCollisionPoint(TRIANGLE t, VERTEX p) {
- VERTEX v1, v2, v3;
-
- v1 = LineCollisionPoint(t.vertices[0], t.vertices[1], p);
- v2 = LineCollisionPoint(t.vertices[1], t.vertices[2], p);
- v3 = LineCollisionPoint(t.vertices[2], t.vertices[0], p);
-
- if(VectorLengthSq(VectorSub(v1, p)) < VectorLengthSq(VectorSub(v2, p)) &&
- VectorLengthSq(VectorSub(v1, p)) < VectorLengthSq(VectorSub(v3, p))) return v1;
- if(VectorLengthSq(VectorSub(v2, p)) < VectorLengthSq(VectorSub(v3, p))) return v2;
- return v3;
-}
-
-int CollisionSphereTriangle(VERTEX p, float r, TRIANGLE t) {
- float f;
- VERTEX v;
-
- /*if(CollisionRayTriangle(VectorAdd(p, VectorMul(VectorNeg(t.normal), r)), m, t, &f)) {*/
- if(CollisionRayTriangle(p, VectorNeg(t.normal), t, &f)) {
- if(f < r) return 1;
- return 0;
- }
-
- v = TriangleCollisionPoint(t, p);
- if(VectorLengthSq(VectorSub(p, v)) < r*r) return 1;
- return 0;
-}
-
-int CollisionMovingSphereTriangle(VERTEX p, float r, VECTOR m, float l, TRIANGLE t) {
- float f;
- VERTEX v;
-
- if(CollisionRayTriangle(VectorAdd(p, VectorMul(VectorNeg(t.normal), r)), m, t, &f)) {
- if(f < l) return 1;
- return 0;
- }
-
- v = TriangleCollisionPoint(t, p);
- v = LineCollisionPoint(v, VectorSub(v, VectorMul(m, l)), p);
- if(VectorLengthSq(VectorSub(p, v)) < r*r) return 1;
- return 0;
-}
diff --git a/config.h.in b/config.h.in
index dc77e9a..c520dc9 100644
--- a/config.h.in
+++ b/config.h.in
@@ -9,6 +9,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `neofx' library (-lneofx). */
+#undef HAVE_LIBNEOFX
+
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
diff --git a/configure b/configure
index dbcc84d..be14ca0 100755
--- a/configure
+++ b/configure
@@ -20150,8 +20150,83 @@ echo "$as_me: error: OpenGL Utility Library not found" >&2;}
{ (exit 1); exit 1; }; }
fi
-#CFLAGS="$CFLAGS $GL_CFLAGS $GLU_CFLAGS"
-#LIBS="$LIBS $GL_LIBS $GLU_LIBS"
+
+echo "$as_me:$LINENO: checking for MatrixMul in -lneofx" >&5
+echo $ECHO_N "checking for MatrixMul in -lneofx... $ECHO_C" >&6
+if test "${ac_cv_lib_neofx_MatrixMul+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lneofx $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char MatrixMul ();
+int
+main ()
+{
+MatrixMul ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_neofx_MatrixMul=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_neofx_MatrixMul=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_neofx_MatrixMul" >&5
+echo "${ECHO_T}$ac_cv_lib_neofx_MatrixMul" >&6
+if test $ac_cv_lib_neofx_MatrixMul = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBNEOFX 1
+_ACEOF
+
+ LIBS="-lneofx $LIBS"
+
+else
+ { { echo "$as_me:$LINENO: error: NeoFX Library not found" >&5
+echo "$as_me: error: NeoFX Library not found" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
# Checks for header files.
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
diff --git a/configure.in b/configure.in
index 0fbb214..e481a1d 100644
--- a/configure.in
+++ b/configure.in
@@ -24,8 +24,7 @@ if test x$no_gl = xyes; then
AC_MSG_ERROR([OpenGL Utility Library not found])
fi
-#CFLAGS="$CFLAGS $GL_CFLAGS $GLU_CFLAGS"
-#LIBS="$LIBS $GL_LIBS $GLU_LIBS"
+AC_CHECK_LIB(neofx, MatrixMul, , AC_MSG_ERROR([NeoFX Library not found]))
# Checks for header files.
AC_HEADER_STDC
diff --git a/level.c b/level.c
index 9f40f38..d884341 100644
--- a/level.c
+++ b/level.c
@@ -4,7 +4,7 @@
#include <zoom/types.h>
#include <zoom/level.h>
#include <zoom/texture.h>
-#include <zoom/math.h>
+#include <neofx/math.h>
extern GLuint sphere;
extern GLuint meditex_blue;
diff --git a/math.c b/math.c
deleted file mode 100644
index a725ebc..0000000
--- a/math.c
+++ /dev/null
@@ -1,165 +0,0 @@
-#include <math.h>
-#include <zoom/math.h>
-#include <zoom/types.h>
-
-float VectorDot(VECTOR v1, VECTOR v2) {
- return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
-}
-
-VECTOR VectorCross(VECTOR v1, VECTOR v2) {
- VECTOR vec;
-
- vec.x = v1.y * v2.z - v1.z * v2.y;
- vec.y = v1.z * v2.x - v1.x * v2.z;
- vec.z = v1.x * v2.y - v1.y * v2.x;
-
- return vec;
-}
-
-VECTOR VectorSub(VECTOR v1, VECTOR v2) {
- VECTOR vec;
-
- vec.x = v1.x - v2.x;
- vec.y = v1.y - v2.y;
- vec.z = v1.z - v2.z;
-
- return vec;
-}
-
-VECTOR VectorAdd(VECTOR v1, VECTOR v2) {
- VECTOR vec;
-
- vec.x = v1.x + v2.x;
- vec.y = v1.y + v2.y;
- vec.z = v1.z + v2.z;
-
- return vec;
-}
-
-VECTOR VectorMul(VECTOR v, float f) {
- v.x *= f;
- v.y *= f;
- v.z *= f;
-
- return v;
-}
-
-VECTOR VectorNormalize(VECTOR v) {
- float f = sqrt(v.x*v.x + v.y*v.y + v.z*v.z);
-
- v.x /= f;
- v.y /= f;
- v.z /= f;
-
- return v;
-}
-
-VECTOR VectorNeg(VECTOR v) {
- v.x = -v.x;
- v.y = -v.y;
- v.z = -v.z;
-
- return v;
-}
-
-float VectorLength(VECTOR v) {
- return sqrt(v.x*v.x + v.y*v.y + v.z*v.z);
-}
-
-float VectorLengthSq(VECTOR v) {
- return (v.x*v.x + v.y*v.y + v.z*v.z);
-}
-
-int VectorEqual(VECTOR v1, VECTOR v2) {
- if(v1.x == v2.x && v1.y == v2.y && v1.z == v2.z) return 1;
- return 0;
-}
-
-MATRIX MatrixIdentity() {
- MATRIX m = {
- 1.0, 0.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0
- };
- return m;
-}
-
-MATRIX MatrixMul(MATRIX m1, MATRIX m2) {
- MATRIX m = {
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0
- };
- short i, j, k;
-
- for(i = 0; i < 4; i++)
- for(j = 0; j < 4; j++)
- for(k = 0; k < 4; k++)
- m.m[i][j] += m1.m[i][k] * m2.m[k][j];
-
- return m;
-}
-
-MATRIX VectorMatrix(VERTEX p1, VECTOR v1, VERTEX p2, VECTOR v2) {
- MATRIX translate;
- MATRIX rotate;
- VECTOR axis;
- float s, c;
-
- axis = VectorCross(v1, v2);
- s = VectorLength(axis);
- c = VectorDot(v1, v2);
- if(s) axis = VectorMul(axis, 1/s);
-
- rotate.m[0][0] = (axis.x * axis.x) * (1.0 - c) + c;
- rotate.m[0][1] = (axis.x * axis.y) * (1.0 - c) - (axis.z * s);
- rotate.m[0][2] = (axis.x * axis.z) * (1.0 - c) + (axis.y * s);
- rotate.m[0][3] = 0.0;
-
- rotate.m[1][0] = (axis.y * axis.x) * (1.0 - c) + (axis.z * s);
- rotate.m[1][1] = (axis.y * axis.y) * (1.0 - c) + c;
- rotate.m[1][2] = (axis.y * axis.z) * (1.0 - c) - (axis.x * s);
- rotate.m[1][3] = 0.0;
-
- rotate.m[2][0] = (axis.z * axis.x) * (1.0 - c) - (axis.y * s);
- rotate.m[2][1] = (axis.z * axis.y) * (1.0 - c) + (axis.x * s);
- rotate.m[2][2] = (axis.z * axis.z) * (1.0 - c) + c;
- rotate.m[2][3] = 0.0;
-
- rotate.m[3][0] = 0.0;
- rotate.m[3][1] = 0.0;
- rotate.m[3][2] = 0.0;
- rotate.m[3][3] = 1.0;
-
- translate = MatrixIdentity();
-
- translate.m[3][0] = p1.x;
- translate.m[3][1] = p1.y;
- translate.m[3][2] = p1.z;
-
- rotate = MatrixMul(rotate, translate);
-
- translate.m[3][0] = -p2.x;
- translate.m[3][1] = -p2.y;
- translate.m[3][2] = -p2.z;
-
- return MatrixMul(translate, rotate);
-}
-
-VECTOR VectorMatrixMul(VECTOR v, MATRIX m) {
- VECTOR r;
- float w;
-
- r.x = v.x*m.m[0][0] + v.y*m.m[1][0] + v.z*m.m[2][0] + m.m[3][0];
- r.y = v.x*m.m[0][1] + v.y*m.m[1][1] + v.z*m.m[2][1] + m.m[3][1];
- r.z = v.x*m.m[0][2] + v.y*m.m[1][2] + v.z*m.m[2][2] + m.m[3][2];
- w = v.x*m.m[0][3] + v.y*m.m[1][3] + v.z*m.m[2][3] + m.m[3][3];
-
- r.x /= w;
- r.y /= w;
- r.z /= w;
-
- return r;
-}
diff --git a/player.c b/player.c
index f8195c0..9f4d531 100644
--- a/player.c
+++ b/player.c
@@ -2,8 +2,8 @@
#include <math.h>
#include <zoom/player.h>
#include <zoom/level.h>
-#include <zoom/collision.h>
-#include <zoom/math.h>
+#include <neofx/collision.h>
+#include <neofx/math.h>
int input = 0;
int falling = 0;
diff --git a/render.c b/render.c
index 7296055..5816090 100644
--- a/render.c
+++ b/render.c
@@ -3,7 +3,7 @@
#include <zoom/render.h>
#include <zoom/player.h>
#include <zoom/level.h>
-#include <zoom/math.h>
+#include <neofx/math.h>
extern PLAYER player;
extern LEVEL level;
diff --git a/zoom/collision.h b/zoom/collision.h
deleted file mode 100644
index 6d35079..0000000
--- a/zoom/collision.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef GAME_COLLISION_H
-#define GAME_COLLISION_H
-
-#include "types.h"
-
-int CollisionPointTriangle(VERTEX, TRIANGLE);
-int CollisionRayTriangle(VERTEX, VECTOR, TRIANGLE, float*);
-int CollisionSphereTriangle(VERTEX, float,TRIANGLE);
-int CollisionMovingSphereTriangle(VERTEX, float, VECTOR, float, TRIANGLE);
-
-#endif
diff --git a/zoom/init.h b/zoom/init.h
index 482102d..ceeffbe 100644
--- a/zoom/init.h
+++ b/zoom/init.h
@@ -1,5 +1,5 @@
-#ifndef GAME_INIT_H
-#define GAME_INIT_H
+#ifndef ZOOM_INIT_H
+#define ZOOM_INIT_H
int InitGame();
void UninitGame();
diff --git a/zoom/level.h b/zoom/level.h
index 50911b0..223afe1 100644
--- a/zoom/level.h
+++ b/zoom/level.h
@@ -1,5 +1,5 @@
-#ifndef GAME_LEVEL_H
-#define GAME_LEVEL_H
+#ifndef ZOOM_LEVEL_H
+#define ZOOM_LEVEL_H
#include <GL/gl.h>
#include "types.h"
diff --git a/zoom/math.h b/zoom/math.h
deleted file mode 100644
index 5644e60..0000000
--- a/zoom/math.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef GAME_MATH_H
-#define GAME_MATH_H
-
-#include "types.h"
-
-float VectorDot(VECTOR, VECTOR);
-VECTOR VectorCross(VECTOR, VECTOR);
-VECTOR VectorSub(VECTOR, VECTOR);
-VECTOR VectorAdd(VECTOR, VECTOR);
-VECTOR VectorMul(VECTOR, float);
-VECTOR VectorNormalize(VECTOR);
-VECTOR VectorNeg(VECTOR);
-float VectorLength(VECTOR);
-float VectorLengthSq(VECTOR);
-int VectorEqual(VECTOR, VECTOR);
-MATRIX MatrixMul(MATRIX, MATRIX);
-MATRIX MatrixIdentity();
-MATRIX VectorMatrix(VERTEX, VECTOR, VERTEX, VECTOR);
-VECTOR VectorMatrixMul(VECTOR, MATRIX);
-
-#endif
diff --git a/zoom/player.h b/zoom/player.h
index 200edcc..06c0e28 100644
--- a/zoom/player.h
+++ b/zoom/player.h
@@ -1,5 +1,5 @@
-#ifndef GAME_PLAYER_H
-#define GAME_PLAYER_H
+#ifndef ZOOM_PLAYER_H
+#define ZOOM_PLAYER_H
#include "types.h"
diff --git a/zoom/render.h b/zoom/render.h
index d114ddd..606d6eb 100644
--- a/zoom/render.h
+++ b/zoom/render.h
@@ -1,5 +1,5 @@
-#ifndef GAME_RENDER_H
-#define GAME_RENDER_H
+#ifndef ZOOM_RENDER_H
+#define ZOOM_RENDER_H
void Render();
diff --git a/zoom/texture.h b/zoom/texture.h
index c40f2f6..23540d7 100644
--- a/zoom/texture.h
+++ b/zoom/texture.h
@@ -1,5 +1,5 @@
-#ifndef GAME_TEXTURE_H
-#define GAME_TEXTURE_H
+#ifndef ZOOM_TEXTURE_H
+#define ZOOM_TEXTURE_H
typedef struct _TEXLIST {
char name[30];
diff --git a/zoom/types.h b/zoom/types.h
index 1fce68b..51dc259 100644
--- a/zoom/types.h
+++ b/zoom/types.h
@@ -1,7 +1,7 @@
-#ifndef GAME_TYPES_H
-#define GAME_TYPES_H
+#ifndef ZOOM_TYPES_H
+#define ZOOM_TYPES_H
-#include <GL/gl.h>
+#include <neofx/types.h>
#define TRIANGLE_UNKNOWN 0
#define TRIANGLE_WALL 1
@@ -22,28 +22,6 @@
#define STATE_CLOSING 4
#pragma pack(push, 2)
-typedef union _MATRIX {
- float m[4][4];
- float f[16];
-} MATRIX;
-
-typedef struct _VECTOR_VERTEX {
- float x, y, z;
-} VECTOR, VERTEX;
-
-typedef struct _TEXCOORDS {
- float s, t;
-} TEXCOORDS;
-
-typedef struct _TRIANGLE {
- unsigned char type;
- unsigned char visible;
- VERTEX vertices[3];
- VECTOR normal;
- int texture;
- TEXCOORDS texcoords[3];
-} TRIANGLE;
-
typedef struct _OBJECT {
unsigned char type;
unsigned char visible;