diff options
Diffstat (limited to 'src/Data')
-rw-r--r-- | src/Data/Makefile.am | 1 | ||||
-rw-r--r-- | src/Data/Makefile.in | 81 | ||||
-rw-r--r-- | src/Data/Vector.cpp | 13 | ||||
-rw-r--r-- | src/Data/Vector.h | 7 |
4 files changed, 32 insertions, 70 deletions
diff --git a/src/Data/Makefile.am b/src/Data/Makefile.am index 3719262..b4e9beb 100644 --- a/src/Data/Makefile.am +++ b/src/Data/Makefile.am @@ -1,4 +1,3 @@ noinst_LTLIBRARIES = libdata.la libdata_la_SOURCES = Info.cpp Gate.cpp Level.cpp Room.cpp Texture.cpp Triangle.cpp Vector.cpp Vertex.cpp -libdata_la_CPPFLAGS = $(libxml_CFLAGS)
\ No newline at end of file diff --git a/src/Data/Makefile.in b/src/Data/Makefile.in index 2e1f63f..6ab63ac 100644 --- a/src/Data/Makefile.in +++ b/src/Data/Makefile.in @@ -43,10 +43,8 @@ CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdata_la_LIBADD = -am_libdata_la_OBJECTS = libdata_la-Info.lo libdata_la-Gate.lo \ - libdata_la-Level.lo libdata_la-Room.lo libdata_la-Texture.lo \ - libdata_la-Triangle.lo libdata_la-Vector.lo \ - libdata_la-Vertex.lo +am_libdata_la_OBJECTS = Info.lo Gate.lo Level.lo Room.lo Texture.lo \ + Triangle.lo Vector.lo Vertex.lo libdata_la_OBJECTS = $(am_libdata_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -84,6 +82,7 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -109,6 +108,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -181,7 +181,6 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdata.la libdata_la_SOURCES = Info.cpp Gate.cpp Level.cpp Room.cpp Texture.cpp Triangle.cpp Vector.cpp Vertex.cpp -libdata_la_CPPFLAGS = $(libxml_CFLAGS) all: all-am .SUFFIXES: @@ -233,14 +232,14 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Gate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Level.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Room.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Texture.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Triangle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Vector.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdata_la-Vertex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Info.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Level.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Room.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triangle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vertex.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -263,62 +262,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< -libdata_la-Info.lo: Info.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Info.lo -MD -MP -MF $(DEPDIR)/libdata_la-Info.Tpo -c -o libdata_la-Info.lo `test -f 'Info.cpp' || echo '$(srcdir)/'`Info.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Info.Tpo $(DEPDIR)/libdata_la-Info.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Info.cpp' object='libdata_la-Info.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Info.lo `test -f 'Info.cpp' || echo '$(srcdir)/'`Info.cpp - -libdata_la-Gate.lo: Gate.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Gate.lo -MD -MP -MF $(DEPDIR)/libdata_la-Gate.Tpo -c -o libdata_la-Gate.lo `test -f 'Gate.cpp' || echo '$(srcdir)/'`Gate.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Gate.Tpo $(DEPDIR)/libdata_la-Gate.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Gate.cpp' object='libdata_la-Gate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Gate.lo `test -f 'Gate.cpp' || echo '$(srcdir)/'`Gate.cpp - -libdata_la-Level.lo: Level.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Level.lo -MD -MP -MF $(DEPDIR)/libdata_la-Level.Tpo -c -o libdata_la-Level.lo `test -f 'Level.cpp' || echo '$(srcdir)/'`Level.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Level.Tpo $(DEPDIR)/libdata_la-Level.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Level.cpp' object='libdata_la-Level.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Level.lo `test -f 'Level.cpp' || echo '$(srcdir)/'`Level.cpp - -libdata_la-Room.lo: Room.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Room.lo -MD -MP -MF $(DEPDIR)/libdata_la-Room.Tpo -c -o libdata_la-Room.lo `test -f 'Room.cpp' || echo '$(srcdir)/'`Room.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Room.Tpo $(DEPDIR)/libdata_la-Room.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Room.cpp' object='libdata_la-Room.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Room.lo `test -f 'Room.cpp' || echo '$(srcdir)/'`Room.cpp - -libdata_la-Texture.lo: Texture.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Texture.lo -MD -MP -MF $(DEPDIR)/libdata_la-Texture.Tpo -c -o libdata_la-Texture.lo `test -f 'Texture.cpp' || echo '$(srcdir)/'`Texture.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Texture.Tpo $(DEPDIR)/libdata_la-Texture.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Texture.cpp' object='libdata_la-Texture.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Texture.lo `test -f 'Texture.cpp' || echo '$(srcdir)/'`Texture.cpp - -libdata_la-Triangle.lo: Triangle.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Triangle.lo -MD -MP -MF $(DEPDIR)/libdata_la-Triangle.Tpo -c -o libdata_la-Triangle.lo `test -f 'Triangle.cpp' || echo '$(srcdir)/'`Triangle.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Triangle.Tpo $(DEPDIR)/libdata_la-Triangle.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Triangle.cpp' object='libdata_la-Triangle.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Triangle.lo `test -f 'Triangle.cpp' || echo '$(srcdir)/'`Triangle.cpp - -libdata_la-Vector.lo: Vector.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Vector.lo -MD -MP -MF $(DEPDIR)/libdata_la-Vector.Tpo -c -o libdata_la-Vector.lo `test -f 'Vector.cpp' || echo '$(srcdir)/'`Vector.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Vector.Tpo $(DEPDIR)/libdata_la-Vector.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Vector.cpp' object='libdata_la-Vector.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Vector.lo `test -f 'Vector.cpp' || echo '$(srcdir)/'`Vector.cpp - -libdata_la-Vertex.lo: Vertex.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdata_la-Vertex.lo -MD -MP -MF $(DEPDIR)/libdata_la-Vertex.Tpo -c -o libdata_la-Vertex.lo `test -f 'Vertex.cpp' || echo '$(srcdir)/'`Vertex.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libdata_la-Vertex.Tpo $(DEPDIR)/libdata_la-Vertex.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Vertex.cpp' object='libdata_la-Vertex.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdata_la-Vertex.lo `test -f 'Vertex.cpp' || echo '$(srcdir)/'`Vertex.cpp - mostlyclean-libtool: -rm -f *.lo diff --git a/src/Data/Vector.cpp b/src/Data/Vector.cpp index ad17447..8677fd1 100644 --- a/src/Data/Vector.cpp +++ b/src/Data/Vector.cpp @@ -39,6 +39,10 @@ Vector Vector::operator-(const Vector &v) const { return Vector(x - v.x, y - v.y, z - v.z); } +float Vector::operator*(const Vector &v) const { + return (x*v.x + y*v.y + z*v.z); +} + Vector Vector::operator*(float f) const { return Vector(x*f, y*f, z*f); } @@ -47,6 +51,10 @@ Vector Vector::operator/(float f) const { return Vector(x/f, y/f, z/f); } +Vector Vector::operator%(const Vector &v) const { + return Vector(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x); +} + Vector& Vector::operator+=(const Vector &v) { x += v.x; y += v.y; @@ -79,5 +87,10 @@ Vector& Vector::operator/=(float f) { return *this; } +Vector& Vector::operator%=(const Vector &v) { + *this = *this % v; + return *this; +} + } } diff --git a/src/Data/Vector.h b/src/Data/Vector.h index 5d9fd1e..cfac1c0 100644 --- a/src/Data/Vector.h +++ b/src/Data/Vector.h @@ -50,13 +50,20 @@ class Vector { Vector operator+(const Vector &v) const; Vector operator-(const Vector &v) const; + float operator*(const Vector &v) const; + Vector operator*(float f) const; Vector operator/(float f) const; + Vector operator%(const Vector &v) const; + Vector& operator+=(const Vector &v); Vector& operator-=(const Vector &v); + Vector& operator*=(float f); Vector& operator/=(float f); + + Vector& operator%=(const Vector &v); }; } |