diff options
Diffstat (limited to 'src/Data')
-rw-r--r-- | src/Data/Level.cpp | 28 | ||||
-rw-r--r-- | src/Data/Level.h | 40 | ||||
-rw-r--r-- | src/Data/Makefile.am | 5 | ||||
-rw-r--r-- | src/Data/Makefile.in | 54 | ||||
-rw-r--r-- | src/Data/Room.cpp | 28 | ||||
-rw-r--r-- | src/Data/Room.h | 40 | ||||
-rw-r--r-- | src/Data/TexCoords.h | 37 | ||||
-rw-r--r-- | src/Data/Triangle.h | 57 |
8 files changed, 279 insertions, 10 deletions
diff --git a/src/Data/Level.cpp b/src/Data/Level.cpp new file mode 100644 index 0000000..4da62ea --- /dev/null +++ b/src/Data/Level.cpp @@ -0,0 +1,28 @@ +/* + * Level.cpp + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Level.h" + +namespace ZoomEdit { +namespace Data { + + + +} +} diff --git a/src/Data/Level.h b/src/Data/Level.h new file mode 100644 index 0000000..4a9481a --- /dev/null +++ b/src/Data/Level.h @@ -0,0 +1,40 @@ +/* + * Level.h + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ZOOMEDIT_DATA_LEVEL_H_ +#define ZOOMEDIT_DATA_LEVEL_H_ + +#include "Room.h" +#include <list> + +namespace ZoomEdit { +namespace Data { + +class Level { + private: + std::list<Room> rooms; + + public: + Level() {} +}; + +} +} + +#endif /*ZOOMEDIT_DATA_LEVEL_H_*/ diff --git a/src/Data/Makefile.am b/src/Data/Makefile.am index 51afca5..f4712df 100644 --- a/src/Data/Makefile.am +++ b/src/Data/Makefile.am @@ -1,3 +1,4 @@ -noinst_LTLIBRARIES = libdata.la +noinst_LTLIBRARIES = libdata.la -libdata_la_SOURCES = Triangle.cpp Vector.cpp Vertex.cpp
\ No newline at end of file +libdata_la_SOURCES = Level.cpp Room.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 bcc5af8..19de33c 100644 --- a/src/Data/Makefile.in +++ b/src/Data/Makefile.in @@ -43,7 +43,9 @@ CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdata_la_LIBADD = -am_libdata_la_OBJECTS = Triangle.lo Vector.lo Vertex.lo +am_libdata_la_OBJECTS = libdata_la-Level.lo libdata_la-Room.lo \ + libdata_la-Triangle.lo libdata_la-Vector.lo \ + libdata_la-Vertex.lo libdata_la_OBJECTS = $(am_libdata_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -81,6 +83,7 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -106,6 +109,7 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -158,6 +162,8 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +libxml_CFLAGS = @libxml_CFLAGS@ +libxml_LIBS = @libxml_LIBS@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -175,7 +181,8 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdata.la -libdata_la_SOURCES = Triangle.cpp Vector.cpp Vertex.cpp +libdata_la_SOURCES = Level.cpp Room.cpp Triangle.cpp Vector.cpp Vertex.cpp +libdata_la_CPPFLAGS = $(libxml_CFLAGS) all: all-am .SUFFIXES: @@ -227,9 +234,11 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@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@ +@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-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@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -252,6 +261,41 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< +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-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/Room.cpp b/src/Data/Room.cpp new file mode 100644 index 0000000..58a7c31 --- /dev/null +++ b/src/Data/Room.cpp @@ -0,0 +1,28 @@ +/* + * Room.cpp + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Room.h" + +namespace ZoomEdit { +namespace Data { + + + +} +} diff --git a/src/Data/Room.h b/src/Data/Room.h new file mode 100644 index 0000000..3d7ddbd --- /dev/null +++ b/src/Data/Room.h @@ -0,0 +1,40 @@ +/* + * Room.h + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ZOOMEDIT_DATA_ROOM_H_ +#define ZOOMEDIT_DATA_ROOM_H_ + +#include "Triangle.h" +#include <list> + +namespace ZoomEdit { +namespace Data { + +class Room { + private: + std::list<Triangle> triangles; + + public: + Room() {} +}; + +} +} + +#endif /*ZOOMEDIT_DATA_ROOM_H_*/ diff --git a/src/Data/TexCoords.h b/src/Data/TexCoords.h new file mode 100644 index 0000000..caf98a1 --- /dev/null +++ b/src/Data/TexCoords.h @@ -0,0 +1,37 @@ +/* + * TexCoords.h + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ZOOMEDIT_DATA_TEXCOORDS_H_ +#define ZOOMEDIT_DATA_TEXCOORDS_H_ + +namespace ZoomEdit { +namespace Data { + +class TexCoords { + private: + float s, t, r, q; + + public: + TexCoords(float s0 = 0, float t0 = 0, float r0 = 0, float q0 = 0) : s(s0), t(t0), r(r0), q(q0) {} +}; + +} +} + +#endif /*ZOOMEDIT_DATA_TEXCOORDS_H_*/ diff --git a/src/Data/Triangle.h b/src/Data/Triangle.h index 03e0fa4..e3e6130 100644 --- a/src/Data/Triangle.h +++ b/src/Data/Triangle.h @@ -21,17 +21,68 @@ #define ZOOMEDIT_DATA_TRIANGLE_H_ #include "Vertex.h" +#include "TexCoords.h" namespace ZoomEdit { namespace Data { class Triangle { private: - Vertex a, b, c; - Vector na, nb, nc; + Vertex vertices[3]; + Vector normals[3]; + TexCoords texCoords[3]; + bool visible; public: - Triangle(Vertex a0, Vertex b0, Vertex c0) : a(a0), b(b0), c(c0) {} + Triangle(bool vis = true) : visible(vis) {} + + Triangle(Vertex v0, Vertex v1, Vertex v2, bool vis = true) : visible(vis) { + vertices[0] = v0; vertices[1] = v1; vertices[2] = v2; + } + + Triangle(Vertex v[3], bool vis = true) : visible(vis) { + vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2]; + } + + Triangle(Vertex v[3], Vector n[3], bool vis = true) : visible(vis) { + vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2]; + normals[0] = n[0]; normals[1] = n[1]; normals[2] = n[2]; + } + + Triangle(Vertex v[3], TexCoords t[3], bool vis = true) : visible(vis) { + vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2]; + texCoords[0] = t[0]; texCoords[1] = t[1]; texCoords[2] = t[2]; + } + + Triangle(Vertex v[3], Vector n[3], TexCoords t[3], bool vis = true) : visible(vis) { + vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2]; + normals[0] = n[0]; normals[1] = n[1]; normals[2] = n[2]; + texCoords[0] = t[0]; texCoords[1] = t[1]; texCoords[2] = t[2]; + } + + Vertex& getVertex(unsigned int i) {return vertices[i%3];} + const Vertex& getVertex(unsigned int i) const {return vertices[i%3];} + void setVertex(unsigned int i, Vertex v) {vertices[i%3] = v;} + void setVertices(Vertex v[3]) { + vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2]; + } + + Vector& getNormal(unsigned int i) {return normals[i%3];} + const Vector& getNormal(unsigned int i) const {return normals[i%3];} + void setNormal(unsigned int i, Vector n) {normals[i%3] = n;} + void setNormals(Vector n[3]) { + normals[0] = n[0]; normals[1] = n[1]; normals[2] = n[2]; + } + + TexCoords& getTexCoords(unsigned int i) {return texCoords[i%3];} + const TexCoords& getTexCoords(unsigned int i) const {return texCoords[i%3];} + void getTexCoords(unsigned int i, TexCoords t) {texCoords[i%3] = t;} + void getTexCoords(TexCoords t[3]) { + texCoords[0] = t[0]; texCoords[1] = t[1]; texCoords[2] = t[2]; + } + + bool isVisible() {return visible;} + void setVisible(bool vis) {visible = vis;} }; } |