summaryrefslogtreecommitdiffstats
path: root/src/View
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2010-01-07 07:03:58 +0100
committerMatthias Schiffer <matthias@gamezock.de>2010-01-07 07:03:58 +0100
commite0cb6bd23b21f126bde42f74f4b1a798c3e15b0f (patch)
treebc9aba37b5b4c6edeb8725720c2ebfe5e80643ab /src/View
parentd71148392055eec06460fa24e3747d2c55d96b38 (diff)
downloadzoomedit-e0cb6bd23b21f126bde42f74f4b1a798c3e15b0f.tar
zoomedit-e0cb6bd23b21f126bde42f74f4b1a798c3e15b0f.zip
Major cleanup
Much better now!
Diffstat (limited to 'src/View')
-rw-r--r--src/View/Makefile.am5
-rw-r--r--src/View/Makefile.in445
-rw-r--r--src/View/MapView.cpp12
-rw-r--r--src/View/TopView.cpp56
-rw-r--r--src/View/TopView.h8
5 files changed, 43 insertions, 483 deletions
diff --git a/src/View/Makefile.am b/src/View/Makefile.am
deleted file mode 100644
index 6c0d653..0000000
--- a/src/View/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-noinst_LTLIBRARIES = libview.la
-
-libview_la_SOURCES = TopView.cpp MapView.cpp
-
-noinst_HEADERS = MapView.h TopView.h View.h \ No newline at end of file
diff --git a/src/View/Makefile.in b/src/View/Makefile.in
deleted file mode 100644
index 8ffb1cc..0000000
--- a/src/View/Makefile.in
+++ /dev/null
@@ -1,445 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = src/View
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libview_la_LIBADD =
-am_libview_la_OBJECTS = TopView.lo MapView.lo
-libview_la_OBJECTS = $(am_libview_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libview_la_SOURCES)
-DIST_SOURCES = $(libview_la_SOURCES)
-HEADERS = $(noinst_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-GREP = @GREP@
-GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@
-GTKGLEXT_LIBS = @GTKGLEXT_LIBS@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-NMEDIT = @NMEDIT@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glademm_CFLAGS = @glademm_CFLAGS@
-glademm_LIBS = @glademm_LIBS@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-libxml_CFLAGS = @libxml_CFLAGS@
-libxml_LIBS = @libxml_LIBS@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-noinst_LTLIBRARIES = libview.la
-libview_la_SOURCES = TopView.cpp MapView.cpp
-noinst_HEADERS = MapView.h TopView.h View.h
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .cpp .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/View/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/View/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libview.la: $(libview_la_OBJECTS) $(libview_la_DEPENDENCIES)
- $(CXXLINK) $(libview_la_OBJECTS) $(libview_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MapView.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TopView.Plo@am__quote@
-
-.cpp.o:
-@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
-
-.cpp.obj:
-@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.cpp.lo:
-@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/View/MapView.cpp b/src/View/MapView.cpp
index 7aa5482..224cd37 100644
--- a/src/View/MapView.cpp
+++ b/src/View/MapView.cpp
@@ -169,19 +169,19 @@ void MapView::getBounds(float *minX, float *maxX, float *minY, float *maxY) {
const std::list<Data::Room*> &rooms = mainView->getLevel()->getRooms();
for(std::list<Data::Room*>::const_iterator room = rooms.begin(); room != rooms.end(); ++room) {
- const std::list<Data::Triangle*> &triangles = (*room)->getFloorTriangles();
+ const std::list<Data::Triangle*> &triangles = (*room)->getTriangles();
for(std::list<Data::Triangle*>::const_iterator t = triangles.begin(); t != triangles.end(); ++t) {
- const Data::Vertex &v1 = (*t)->getVertex(0), &v2 = (*t)->getVertex(1), &v3 = (*t)->getVertex(2);
+ const vmml::vec3f &v1 = (*t)->getVertex(0), &v2 = (*t)->getVertex(1), &v3 = (*t)->getVertex(2);
if(minX)
- *minX = std::min(std::min(*minX, v1.getX()), std::min(v2.getX(), v3.getX()));
+ *minX = std::min(std::min(*minX, v1.x()), std::min(v2.x(), v3.x()));
if(maxX)
- *maxX = std::max(std::max(*maxX, v1.getX()), std::max(v2.getX(), v3.getX()));
+ *maxX = std::max(std::max(*maxX, v1.x()), std::max(v2.x(), v3.x()));
if(minY)
- *minY = std::min(std::min(*minY, v1.getZ()), std::min(v2.getZ(), v3.getZ()));
+ *minY = std::min(std::min(*minY, v1.z()), std::min(v2.z(), v3.z()));
if(maxY)
- *maxY = std::max(std::max(*maxY, v1.getZ()), std::max(v2.getZ(), v3.getZ()));
+ *maxY = std::max(std::max(*maxY, v1.z()), std::max(v2.z(), v3.z()));
}
}
}
diff --git a/src/View/TopView.cpp b/src/View/TopView.cpp
index 6ab00d9..12bbe4a 100644
--- a/src/View/TopView.cpp
+++ b/src/View/TopView.cpp
@@ -31,29 +31,29 @@ namespace ZoomEdit {
namespace View {
bool TopView::Edge::operator<(const Edge &e) const {
- if(v1->getX() < e.v1->getX())
+ if(v1->x() < e.v1->x())
return true;
- if(v1->getX() > e.v1->getX())
+ if(v1->x() > e.v1->x())
return false;
- if(v1->getY() < e.v1->getY())
+ if(v1->y() < e.v1->y())
return true;
- if(v1->getY() > e.v1->getY())
+ if(v1->y() > e.v1->y())
return false;
- if(v1->getZ() < e.v1->getZ())
+ if(v1->z() < e.v1->z())
return true;
- if(v1->getZ() > e.v1->getZ())
+ if(v1->z() > e.v1->z())
return false;
- if(v2->getX() < e.v2->getX())
+ if(v2->x() < e.v2->x())
return true;
- if(v2->getX() > e.v2->getX())
+ if(v2->x() > e.v2->x())
return false;
- if(v2->getY() < e.v2->getY())
+ if(v2->y() < e.v2->y())
return true;
- if(v2->getY() > e.v2->getY())
+ if(v2->y() > e.v2->y())
return false;
- if(v2->getZ() < e.v2->getZ())
+ if(v2->z() < e.v2->z())
return true;
- if(v2->getZ() > e.v2->getZ())
+ if(v2->z() > e.v2->z())
return false;
return false;
@@ -96,7 +96,7 @@ void TopView::drawGrid() {
}
void TopView::renderRoom(Data::Room *room, bool selected) {
- const std::list<Data::Triangle*> &floor = room->getFloorTriangles();
+ const std::list<Data::Triangle*> &triangles = room->getTriangles();
std::multiset<Edge> edges;
if(selected)
@@ -106,12 +106,20 @@ void TopView::renderRoom(Data::Room *room, bool selected) {
glBegin(GL_TRIANGLES);
- for(std::list<Data::Triangle*>::const_iterator t = floor.begin(); t != floor.end(); ++t) {
+ for(std::list<Data::Triangle*>::const_iterator t = triangles.begin(); t != triangles.end(); ++t) {
+ vmml::vec3f edge1 = (*t)->getVertex(1) - (*t)->getVertex(0);
+ vmml::vec3f edge2 = (*t)->getVertex(2) - (*t)->getVertex(0);
+
+ vmml::vec3f normal = edge1.cross(edge2);
+
+ if(normal.y() <= 0)
+ continue;
+
for(int i = 0; i < 3; ++i) {
- const Data::Vertex &v = (*t)->getVertex(i);
- const Data::Vertex &v2 = (*t)->getVertex((i+1)%3);
+ const vmml::vec3f &v = (*t)->getVertex(i);
+ const vmml::vec3f &v2 = (*t)->getVertex((i+1)%3);
- glVertex2f(v.getX(), v.getZ());
+ glVertex2f(v.x(), v.z());
edges.insert(Edge(&v, &v2));
}
@@ -143,8 +151,8 @@ void TopView::renderRoom(Data::Room *room, bool selected) {
glBegin(GL_LINES);
for(std::multiset<Edge>::iterator edge = edges.begin(); edge != edges.end(); ++edge) {
- glVertex2f(edge->v1->getX(), edge->v1->getZ());
- glVertex2f(edge->v2->getX(), edge->v2->getZ());
+ glVertex2f(edge->v1->x(), edge->v1->z());
+ glVertex2f(edge->v2->x(), edge->v2->z());
}
glEnd();
@@ -223,19 +231,19 @@ void TopView::click(float x, float y, unsigned int button) {
if(button != 1)
return;
- Math::Vertex2D v(xCenter + x/scale, yCenter + y/scale);
+ vmml::vec2f v(xCenter + x/scale, yCenter + y/scale);
selectedRoom = 0;
const std::list<Data::Room*>& rooms = level->getRooms();
for(std::list<Data::Room*>::const_iterator room = rooms.begin(); room != rooms.end(); ++room) {
- const std::list<Data::Triangle*>& triangles = (*room)->getFloorTriangles();
+ const std::list<Data::Triangle*>& triangles = (*room)->getTriangles();
for(std::list<Data::Triangle*>::const_iterator t = triangles.begin(); t != triangles.end(); ++t) {
- Math::Vertex2D v1((*t)->getVertex(0).getX(), (*t)->getVertex(0).getZ());
- Math::Vertex2D v2((*t)->getVertex(1).getX(), (*t)->getVertex(1).getZ());
- Math::Vertex2D v3((*t)->getVertex(2).getX(), (*t)->getVertex(2).getZ());
+ vmml::vec2f v1((*t)->getVertex(0).x(), (*t)->getVertex(0).z());
+ vmml::vec2f v2((*t)->getVertex(1).x(), (*t)->getVertex(1).z());
+ vmml::vec2f v3((*t)->getVertex(2).x(), (*t)->getVertex(2).z());
if(Math::Triangle2D(v1, v2, v3).contains(v)) {
selectedRoom = *room;
diff --git a/src/View/TopView.h b/src/View/TopView.h
index 17a324d..c164f31 100644
--- a/src/View/TopView.h
+++ b/src/View/TopView.h
@@ -22,12 +22,14 @@
#include "View.h"
+#include <vmmlib/vector.hpp>
+
+
namespace ZoomEdit {
namespace Data {
class Level;
class Room;
-class Vertex;
}
namespace View {
@@ -36,9 +38,9 @@ class TopView : public View {
private:
class Edge {
public:
- const Data::Vertex *v1, *v2;
+ const vmml::vec3f *v1, *v2;
- Edge(const Data::Vertex *v10, const Data::Vertex *v20)
+ Edge(const vmml::vec3f *v10, const vmml::vec3f *v20)
: v1(v10), v2(v20) {};
bool operator<(const Edge &e) const;
};