From 84780a8c1d9801e6a2c9f14dd0c17f362ccf7a57 Mon Sep 17 00:00:00 2001 From: neoraider Date: Thu, 10 Apr 2008 18:36:05 +0000 Subject: zoomedit: * Mapped XML data structures to classes completely. --- src/Data/Gate.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ src/Data/Gate.h | 43 +++++++++++++++++++++++++++++++++++++++++++ src/Data/Info.cpp | 35 +++++++++++++++++++++++++++++++++++ src/Data/Info.h | 43 +++++++++++++++++++++++++++++++++++++++++++ src/Data/Level.cpp | 29 +++++++++++++++++++++++------ src/Data/Level.h | 11 +++++++++++ src/Data/Makefile.am | 2 +- src/Data/Makefile.in | 29 +++++++++++++++++++++++++++-- src/Data/Room.cpp | 4 +++- src/Data/Room.h | 4 +++- src/Data/Texture.cpp | 31 +++++++++++++++++++++++++++++++ src/Data/Texture.h | 41 +++++++++++++++++++++++++++++++++++++++++ src/Data/Triangle.cpp | 8 ++------ src/Data/Triangle.h | 4 +++- 14 files changed, 306 insertions(+), 18 deletions(-) create mode 100644 src/Data/Gate.cpp create mode 100644 src/Data/Gate.h create mode 100644 src/Data/Info.cpp create mode 100644 src/Data/Info.h create mode 100644 src/Data/Texture.cpp create mode 100644 src/Data/Texture.h diff --git a/src/Data/Gate.cpp b/src/Data/Gate.cpp new file mode 100644 index 0000000..5a6c63e --- /dev/null +++ b/src/Data/Gate.cpp @@ -0,0 +1,40 @@ +/* + * Gate.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * 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 . + */ + +#include "Gate.h" + +namespace ZoomEdit { +namespace Data { + +Gate::Gate(xmlpp::Element *node) : gateNode(node) { + xmlpp::Node::NodeList triangleList = node->get_children("triangle"); + + for(xmlpp::Node::NodeList::iterator t = triangleList.begin(); t != triangleList.end(); ++t) { + xmlpp::Element *tNode = dynamic_cast(*t); + + if(tNode) + triangles.push_front(Triangle(tNode)); + } + + room1 = node->get_attribute_value("room1"); + room2 = node->get_attribute_value("room2"); +} + +} +} diff --git a/src/Data/Gate.h b/src/Data/Gate.h new file mode 100644 index 0000000..9aa539a --- /dev/null +++ b/src/Data/Gate.h @@ -0,0 +1,43 @@ +/* + * Gate.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * 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 . + */ + +#ifndef ZOOMEDIT_DATA_GATE_H_ +#define ZOOMEDIT_DATA_GATE_H_ + +#include "Triangle.h" +#include + +namespace ZoomEdit { +namespace Data { + +class Gate { + private: + std::list triangles; + xmlpp::Element *gateNode; + + Glib::ustring room1, room2; + + public: + Gate(xmlpp::Element *node); +}; + +} +} + +#endif /*ZOOMEDIT_DATA_GATE_H_*/ diff --git a/src/Data/Info.cpp b/src/Data/Info.cpp new file mode 100644 index 0000000..bb384b6 --- /dev/null +++ b/src/Data/Info.cpp @@ -0,0 +1,35 @@ +/* + * Info.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * 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 . + */ + +#include "Info.h" +#include + +namespace ZoomEdit { +namespace Data { + +Info::Info(xmlpp::Element *node) { + nameNode = dynamic_cast(node->get_children("name").front()); + name = nameNode->get_child_text()->get_content(); + + descNode = dynamic_cast(node->get_children("desc").front()); + desc = descNode->get_child_text()->get_content(); +} + +} +} diff --git a/src/Data/Info.h b/src/Data/Info.h new file mode 100644 index 0000000..bc51855 --- /dev/null +++ b/src/Data/Info.h @@ -0,0 +1,43 @@ +/* + * Info.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * 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 . + */ + +#ifndef ZOOMEDIT_DATA_INFO_H_ +#define ZOOMEDIT_DATA_INFO_H_ + +#include + +namespace ZoomEdit { +namespace Data { + +class Info { + private: + xmlpp::Element *nameNode; + Glib::ustring name; + + xmlpp::Element *descNode; + Glib::ustring desc; + + public: + Info(xmlpp::Element *node); +}; + +} +} + +#endif /*ZOOMEDIT_DATA_INFO_H_*/ diff --git a/src/Data/Level.cpp b/src/Data/Level.cpp index e3c69fd..ff6f8fb 100644 --- a/src/Data/Level.cpp +++ b/src/Data/Level.cpp @@ -22,20 +22,37 @@ namespace ZoomEdit { namespace Data { -Level::Level(xmlpp::Element *levelNode) { +Level::Level(xmlpp::Element *levelNode) : info(dynamic_cast(levelNode->get_children("info").front())) { roomsNode = dynamic_cast(levelNode->get_children("rooms").front()); + gatesNode = dynamic_cast(levelNode->get_children("gates").front()); + texturesNode = dynamic_cast(levelNode->get_children("textures").front()); - if(!roomsNode) - return; + xmlpp::Node::NodeList nodeList = roomsNode->get_children("room"); - xmlpp::Node::NodeList roomList = roomsNode->get_children("room"); - - for(xmlpp::Node::NodeList::iterator room = roomList.begin(); room != roomList.end(); ++room) { + for(xmlpp::Node::NodeList::iterator room = nodeList.begin(); room != nodeList.end(); ++room) { xmlpp::Element *roomNode = dynamic_cast(*room); if(roomNode) rooms.push_front(Room(roomNode)); } + + nodeList = gatesNode->get_children("gate"); + + for(xmlpp::Node::NodeList::iterator gate = nodeList.begin(); gate != nodeList.end(); ++gate) { + xmlpp::Element *gateNode = dynamic_cast(*gate); + + if(gateNode) + gates.push_front(Gate(gateNode)); + } + + nodeList = texturesNode->get_children("texture"); + + for(xmlpp::Node::NodeList::iterator tex = nodeList.begin(); tex != nodeList.end(); ++tex) { + xmlpp::Element *texNode = dynamic_cast(*tex); + + if(texNode) + textures.push_front(Texture(texNode)); + } } } diff --git a/src/Data/Level.h b/src/Data/Level.h index 621263e..ab660a2 100644 --- a/src/Data/Level.h +++ b/src/Data/Level.h @@ -20,7 +20,10 @@ #ifndef ZOOMEDIT_DATA_LEVEL_H_ #define ZOOMEDIT_DATA_LEVEL_H_ +#include "Info.h" #include "Room.h" +#include "Gate.h" +#include "Texture.h" #include namespace ZoomEdit { @@ -28,9 +31,17 @@ namespace Data { class Level { private: + Info info; + std::list rooms; xmlpp::Element *roomsNode; + std::list gates; + xmlpp::Element *gatesNode; + + std::list textures; + xmlpp::Element *texturesNode; + public: Level(xmlpp::Element *levelNode); }; diff --git a/src/Data/Makefile.am b/src/Data/Makefile.am index f4712df..3719262 100644 --- a/src/Data/Makefile.am +++ b/src/Data/Makefile.am @@ -1,4 +1,4 @@ noinst_LTLIBRARIES = libdata.la -libdata_la_SOURCES = Level.cpp Room.cpp Triangle.cpp Vector.cpp Vertex.cpp +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 19de33c..7b7ff9b 100644 --- a/src/Data/Makefile.in +++ b/src/Data/Makefile.in @@ -43,7 +43,8 @@ CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdata_la_LIBADD = -am_libdata_la_OBJECTS = libdata_la-Level.lo libdata_la-Room.lo \ +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 libdata_la_OBJECTS = $(am_libdata_la_OBJECTS) @@ -181,7 +182,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdata.la -libdata_la_SOURCES = Level.cpp Room.cpp Triangle.cpp Vector.cpp Vertex.cpp +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 @@ -234,8 +235,11 @@ 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@ @@ -261,6 +265,20 @@ 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 @@ -275,6 +293,13 @@ libdata_la-Room.lo: Room.cpp @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 diff --git a/src/Data/Room.cpp b/src/Data/Room.cpp index 95003f4..08f02f9 100644 --- a/src/Data/Room.cpp +++ b/src/Data/Room.cpp @@ -23,7 +23,7 @@ namespace ZoomEdit { namespace Data { Room::Room(xmlpp::Element *node) : roomNode(node) { - xmlpp::Node::NodeList triangleList = roomNode->get_children("triangle"); + xmlpp::Node::NodeList triangleList = node->get_children("triangle"); for(xmlpp::Node::NodeList::iterator t = triangleList.begin(); t != triangleList.end(); ++t) { xmlpp::Element *tNode = dynamic_cast(*t); @@ -31,6 +31,8 @@ Room::Room(xmlpp::Element *node) : roomNode(node) { if(tNode) triangles.push_front(Triangle(tNode)); } + + id = node->get_attribute_value("id"); } } diff --git a/src/Data/Room.h b/src/Data/Room.h index dea433d..f01b051 100644 --- a/src/Data/Room.h +++ b/src/Data/Room.h @@ -30,7 +30,9 @@ class Room { private: std::list triangles; xmlpp::Element *roomNode; - + + Glib::ustring id; + public: Room(xmlpp::Element *node); }; diff --git a/src/Data/Texture.cpp b/src/Data/Texture.cpp new file mode 100644 index 0000000..fbcd69a --- /dev/null +++ b/src/Data/Texture.cpp @@ -0,0 +1,31 @@ +/* + * Texture.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * 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 . + */ + +#include "Texture.h" + +namespace ZoomEdit { +namespace Data { + +Texture::Texture(xmlpp::Element *node) : texNode(node) { + id = node->get_attribute_value("id"); + name = node->get_attribute_value("name"); +} + +} +} diff --git a/src/Data/Texture.h b/src/Data/Texture.h new file mode 100644 index 0000000..b6a605a --- /dev/null +++ b/src/Data/Texture.h @@ -0,0 +1,41 @@ +/* + * Texture.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * 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 . + */ + +#ifndef ZOOMEDIT_DATA_TEXTURE_H_ +#define ZOOMEDIT_DATA_TEXTURE_H_ + +#include + +namespace ZoomEdit { +namespace Data { + +class Texture { + private: + xmlpp::Element *texNode; + Glib::ustring id; + Glib::ustring name; + + public: + Texture(xmlpp::Element *node); +}; + +} +} + +#endif /*ZOOMEDIT_DATA_TEXTURE_H_*/ diff --git a/src/Data/Triangle.cpp b/src/Data/Triangle.cpp index c7038c0..8966b09 100644 --- a/src/Data/Triangle.cpp +++ b/src/Data/Triangle.cpp @@ -19,7 +19,6 @@ #include "Triangle.h" #include -#include namespace ZoomEdit { namespace Data { @@ -77,8 +76,6 @@ Triangle::Triangle(xmlpp::Element *node) : triangleNode(node) { texCoordsNodes[i] = e; texCoords[i] = loadTexCoords(e); - std::cout << "TexCoords (" << texCoords[i].getS() << ", " << texCoords[i].getT() << ", " << texCoords[i].getR() << ", " << texCoords[i].getQ() << ")" << std::endl; - continue; } } @@ -86,12 +83,11 @@ Triangle::Triangle(xmlpp::Element *node) : triangleNode(node) { if(e->get_name() == "vertex") { vertexNodes[++i] = e; vertices[i] = loadVertex(e); - - std::cout << "Vertex (" << vertices[i].getX() << ", " << vertices[i].getY() << ", " << vertices[i].getZ() << ")" << std::endl; } } - visibleNode = node->get_attribute("visible"); + visible = (node->get_attribute_value("visible").lowercase() != "false"); + texture = node->get_attribute_value("texture"); } } diff --git a/src/Data/Triangle.h b/src/Data/Triangle.h index 0c17834..f668289 100644 --- a/src/Data/Triangle.h +++ b/src/Data/Triangle.h @@ -33,13 +33,15 @@ class Triangle { xmlpp::Element *vertexNodes[3]; xmlpp::Element *normalNodes[3]; xmlpp::Element *texCoordsNodes[3]; - xmlpp::Attribute *visibleNode; Vertex vertices[3]; Vector normals[3]; TexCoords texCoords[3]; + bool visible; + Glib::ustring texture; + Vertex loadVertex(xmlpp::Element *node) const; Vector loadVector(xmlpp::Element *node) const; TexCoords loadTexCoords(xmlpp::Element *node) const; -- cgit v1.2.3