Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/Makefile.in
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/Makefile.in	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/Makefile.in	(revision 12)
@@ -0,0 +1,460 @@
+# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+BOOST_CFLAGS = @BOOST_CFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
+BUILD_PYTHON_INTERFACE_FALSE = @BUILD_PYTHON_INTERFACE_FALSE@
+BUILD_PYTHON_INTERFACE_TRUE = @BUILD_PYTHON_INTERFACE_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFGTK_DEPS_CFLAGS = @CFGTK_DEPS_CFLAGS@
+CFGTK_DEPS_LIBS = @CFGTK_DEPS_LIBS@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FT2_CFLAGS = @FT2_CFLAGS@
+FT2_CONFIG = @FT2_CONFIG@
+FT2_LIBS = @FT2_LIBS@
+GLSUPPORT_CFLAGS = @GLSUPPORT_CFLAGS@
+GLSUPPORT_LIBS = @GLSUPPORT_LIBS@
+GL_LIBS = @GL_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OGREMAIN_VERSION_INFO = @OGREMAIN_VERSION_INFO@
+OGRE_CFGTK = @OGRE_CFGTK@
+OGRE_CFLAGS = @OGRE_CFLAGS@
+OGRE_GLSUPPORT = @OGRE_GLSUPPORT@
+OGRE_PLATFORM = @OGRE_PLATFORM@
+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@
+PLATFORM_CFLAGS = @PLATFORM_CFLAGS@
+PLATFORM_LIBS = @PLATFORM_LIBS@
+PYTHON_CFLAGS = @PYTHON_CFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SET_MAKE = @SET_MAKE@
+SHARED_FLAGS = @SHARED_FLAGS@
+SHELL = @SHELL@
+STLPORT_CFLAGS = @STLPORT_CFLAGS@
+STLPORT_LIBS = @STLPORT_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUBDIRS = src include
+subdir = PlugIns/BSPSceneManager
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/OgreMain/include/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
+	ps-recursive install-info-recursive uninstall-info-recursive \
+	all-recursive install-data-recursive install-exec-recursive \
+	installdirs-recursive install-recursive uninstall-recursive \
+	check-recursive installcheck-recursive
+DIST_COMMON = Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  PlugIns/BSPSceneManager/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	else \
+	  include_option=--include; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -f $$subdir/TAGS && \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS: ctags-recursive $(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; } \
+	       END { 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
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    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
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d $(distdir)/$$subdir \
+	    || mkdir $(distdir)/$$subdir \
+	    || exit 1; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$(top_distdir)" \
+	        distdir=../$(distdir)/$$subdir \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
+	clean-generic clean-libtool clean-recursive ctags \
+	ctags-recursive distclean distclean-generic distclean-libtool \
+	distclean-recursive distclean-tags distdir dvi dvi-am \
+	dvi-recursive info info-am info-recursive install install-am \
+	install-data install-data-am install-data-recursive \
+	install-exec install-exec-am install-exec-recursive \
+	install-info install-info-am install-info-recursive install-man \
+	install-recursive install-strip installcheck installcheck-am \
+	installdirs installdirs-am installdirs-recursive \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am \
+	pdf-recursive ps ps-am ps-recursive tags tags-recursive \
+	uninstall uninstall-am uninstall-info-am \
+	uninstall-info-recursive uninstall-recursive
+
+# 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:
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotScene.vcproj
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotScene.vcproj	(revision 48)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotScene.vcproj	(revision 48)
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="TestCullingDotScene"
+	ProjectGUID="{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib"
+				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingDotScene.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/TestCullingDotScene.pdb"
+				SubSystem="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+				RuntimeLibrary="4"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/TestCullingDotScene.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\TestCullingDotSceneApplication.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\TestCullingDotSceneApplication.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="tinyxml"
+			Filter="">
+			<File
+				RelativePath="..\tinyxml\tinystr.cpp">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinystr.h">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxml.cpp">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxml.h">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxmlerror.cpp">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxmlparser.cpp">
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.cpp	(revision 42)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.cpp	(revision 42)
@@ -0,0 +1,594 @@
+/**
+    \file 
+        TestCullingApplication.cpp
+    \brief
+        Tests the occlusion culling algorithm
+*/
+
+#include <OgreNoMemoryMacros.h>
+#include <CEGUI/CEGUI.h>
+#include <../CEGUIRenderer/include/OgreCEGUIRenderer.h>
+#include <../CEGUIRenderer/include/OgreCEGUIResourceProvider.h>
+#include <../CEGUIRenderer/include/OgreCEGUITexture.h>
+#include <OgreMemoryMacros.h>
+
+#include "Ogre.h"
+#include "OgreLight.h"
+#include "tinyxml.h"
+#include "TestCullingDotSceneApplication.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+
+/***********************************************/
+/* TestCullingDotSceneApplication implementation       */
+/***********************************************/
+void TestCullingDotSceneApplication::ParseDotScene( const String &SceneName, const String& groupName )
+{
+	TiXmlDocument	*XMLDoc;
+	TiXmlElement	*XMLRoot, *XMLNodes, *XMLPathFind;
+	try
+	{
+		DataStreamPtr pStream = ResourceGroupManager::getSingleton().openResource( SceneName, groupName );
+
+		String data = pStream->getAsString();
+
+		// Open the .scene File
+		XMLDoc = new TiXmlDocument();
+		XMLDoc->Parse( data.c_str() );
+		pStream->close();
+		pStream.setNull();
+
+		if( XMLDoc->Error() )
+		{
+			//We'll just log, and continue on gracefully
+			LogManager::getSingleton().logMessage("Error in dotscene demo app!!!!!");
+			delete XMLDoc;
+			return;
+		}
+	}
+	catch(...)
+	{
+		//We'll just log, and continue on gracefully
+		LogManager::getSingleton().logMessage("Error in dotscene demo app!!!!!");
+		delete XMLDoc;
+		return;
+	}
+
+	// Validate the File
+	XMLRoot = XMLDoc->RootElement();
+	if( String( XMLRoot->Value()) != "scene"  ) {
+		LogManager::getSingleton().logMessage( "Error: Invalid .scene File. Missing <scene>" );
+		delete XMLDoc;		
+		return;
+	}
+		
+	XMLNodes = XMLRoot->FirstChildElement( "nodes" );
+	
+	// Read in the scene nodes
+	if( XMLNodes )
+	{
+		TiXmlElement *XMLNode, *XMLPosition, *XMLRotation, *XMLScale,  *XMLEntity, *XMLBillboardSet,  *XMLLight;
+
+		XMLNode = XMLNodes->FirstChildElement( "node" );
+		
+		while( XMLNode )
+		{
+			// Process the current node
+			// Grab the name of the node
+			String NodeName = XMLNode->Attribute("name");
+			// First create the new scene node
+			SceneNode* NewNode = static_cast<SceneNode*>( mSceneMgr->getRootSceneNode()->createChild( NodeName ) );
+
+			Vector3 TempVec;
+			String TempValue;
+				
+			// Now position it...
+			XMLPosition = XMLNode->FirstChildElement("position");
+			
+			if( XMLPosition )
+			{
+				TempValue = XMLPosition->Attribute("x");
+				TempVec.x = StringConverter::parseReal(TempValue);
+				TempValue = XMLPosition->Attribute("y");
+				TempVec.y = StringConverter::parseReal(TempValue);
+				TempValue = XMLPosition->Attribute("z");
+				TempVec.z = StringConverter::parseReal(TempValue);
+				NewNode->setPosition( TempVec );
+			}
+
+			// Rotate it...
+			XMLRotation = XMLNode->FirstChildElement("rotation");
+			if( XMLRotation )
+			{
+				Quaternion TempQuat;
+				TempValue = XMLRotation->Attribute("qx");
+				TempQuat.x = StringConverter::parseReal(TempValue);
+				TempValue = XMLRotation->Attribute("qy");
+				TempQuat.y = StringConverter::parseReal(TempValue);
+				TempValue = XMLRotation->Attribute("qz");
+				TempQuat.z = StringConverter::parseReal(TempValue);
+				TempValue = XMLRotation->Attribute("qw");
+				TempQuat.w = StringConverter::parseReal(TempValue);
+				NewNode->setOrientation( TempQuat );
+			}
+
+			// Scale it.
+			XMLScale = XMLNode->FirstChildElement("scale");
+			
+			if( XMLScale )
+			{
+				TempValue = XMLScale->Attribute("x");
+				TempVec.x = StringConverter::parseReal(TempValue);
+				TempValue = XMLScale->Attribute("y");
+				TempVec.y = StringConverter::parseReal(TempValue);
+				TempValue = XMLScale->Attribute("z");
+				TempVec.z = StringConverter::parseReal(TempValue);
+				NewNode->setScale( TempVec );
+			}
+
+			XMLLight = XMLNode->FirstChildElement( "light" );
+			
+			if( XMLLight )
+				NewNode->attachObject( LoadLight( XMLLight ) );
+
+			// Check for an Entity
+			XMLEntity = XMLNode->FirstChildElement("entity");
+			
+			if( XMLEntity )
+			{
+				if( XMLEntity->Attribute("static") )
+				{
+					if( strcmp( XMLEntity->Attribute("static"), "false" )==0 ){
+						String EntityName, EntityMeshFilename;
+						EntityName = XMLEntity->Attribute( "name" );
+						EntityMeshFilename = XMLEntity->Attribute( "meshFile" );
+
+						// Create entity
+						Entity* NewEntity = mSceneMgr->createEntity(EntityName, EntityMeshFilename);
+						NewNode->attachObject( NewEntity );
+					}
+				}
+			}
+
+			XMLBillboardSet = XMLNode->FirstChildElement( "billboardSet" );
+			if( XMLBillboardSet )
+			{
+				String TempValue;
+
+				BillboardSet* bSet = mSceneMgr->createBillboardSet( NewNode->getName() );
+
+				BillboardType Type;
+				TempValue = XMLBillboardSet->Attribute( "type" );
+				if( TempValue == "orientedCommon" ) 
+					Type = BBT_ORIENTED_COMMON;
+				else if( TempValue == "orientedSelf" )
+					Type = BBT_ORIENTED_SELF;
+				else Type = BBT_POINT;
+
+				BillboardOrigin Origin;
+				TempValue = XMLBillboardSet->Attribute( "type" );
+				if( TempValue == "bottom_left" )
+					Origin = BBO_BOTTOM_LEFT;
+				else if( TempValue == "bottom_center" )
+					Origin = BBO_BOTTOM_CENTER;
+				else if( TempValue == "bottomRight"  )
+					Origin = BBO_BOTTOM_RIGHT;
+				else if( TempValue == "left" )
+					Origin = BBO_CENTER_LEFT;
+				else if( TempValue == "right" )
+					Origin = BBO_CENTER_RIGHT;
+				else if( TempValue == "topLeft" )
+					Origin = BBO_TOP_LEFT;
+				else if( TempValue == "topCenter" )
+					Origin = BBO_TOP_CENTER;
+				else if( TempValue == "topRight" )
+					Origin = BBO_TOP_RIGHT;
+				else 
+					Origin = BBO_CENTER;
+
+				bSet->setBillboardType( Type );
+				bSet->setBillboardOrigin( Origin );
+
+				TempValue = XMLBillboardSet->Attribute( "name" );
+				bSet->setMaterialName( TempValue );
+
+				int width, height;
+				width = StringConverter::parseReal( XMLBillboardSet->Attribute( "width" ) );
+				height = StringConverter::parseReal( XMLBillboardSet->Attribute( "height" ) );
+				bSet->setDefaultDimensions( width, height );
+				bSet->setVisible( true );
+				NewNode->attachObject( bSet );
+
+				TiXmlElement *XMLBillboard;
+
+				XMLBillboard = XMLBillboardSet->FirstChildElement( "billboard" );
+
+				while( XMLBillboard )
+				{
+					Billboard *b;
+					TempValue;
+					TempVec = Vector3( 0, 0, 0 );
+					ColourValue TempColour(1,1,1,1);
+
+					XMLPosition = XMLBillboard->FirstChildElement( "position" );
+					if( XMLPosition ){
+						TempValue = XMLPosition->Attribute("x");
+						TempVec.x = StringConverter::parseReal(TempValue);
+						TempValue = XMLPosition->Attribute("y");
+						TempVec.y = StringConverter::parseReal(TempValue);
+						TempValue = XMLPosition->Attribute("z");
+						TempVec.z = StringConverter::parseReal(TempValue);
+					}
+
+					TiXmlElement* XMLColour = XMLBillboard->FirstChildElement( "colourDiffuse" );
+					if( XMLColour )
+					{
+						TempValue = XMLColour->Attribute("r");
+						TempColour.r = StringConverter::parseReal(TempValue);
+						TempValue = XMLColour->Attribute("g");
+						TempColour.g = StringConverter::parseReal(TempValue);
+						TempValue = XMLColour->Attribute("b");
+						TempColour.b = StringConverter::parseReal(TempValue);
+					}
+
+					b = bSet->createBillboard( TempVec, TempColour);
+
+					XMLBillboard = XMLBillboard->NextSiblingElement( "billboard" );
+				}
+			}
+
+			// Move to the next node
+			XMLNode = XMLNode->NextSiblingElement( "node" );
+		}
+	}
+
+	// Close the XML File
+	delete XMLDoc;
+}
+
+Light* TestCullingDotSceneApplication::LoadLight( TiXmlElement *XMLLight )
+{
+	TiXmlElement *XMLDiffuse, *XMLSpecular, *XMLAttentuation, *XMLPosition;
+
+	// Create a light (point | directional | spot | radPoint)
+	Light* light = mSceneMgr->createLight( XMLLight->Attribute("name") );
+	if( !XMLLight->Attribute("type") || String(XMLLight->Attribute("type")) == "point" )
+		light->setType( Light::LT_POINT );
+	else if( String(XMLLight->Attribute("type")) == "directional")
+		light->setType( Light::LT_DIRECTIONAL );
+	else if( String(XMLLight->Attribute("type")) == "spot")
+		light->setType( Light::LT_SPOTLIGHT );
+	else if( String(XMLLight->Attribute("type")) == "radPoint")
+		light->setType( Light::LT_POINT );
+
+	XMLDiffuse = XMLLight->FirstChildElement("colourDiffuse");
+	if( XMLDiffuse )
+	{
+		ColourValue Diffuse;
+		Diffuse.r = Ogre::StringConverter::parseReal( XMLDiffuse->Attribute("r") );
+		Diffuse.g = Ogre::StringConverter::parseReal( XMLDiffuse->Attribute("g") );
+		Diffuse.b = Ogre::StringConverter::parseReal( XMLDiffuse->Attribute("b") );
+		Diffuse.a = 1;
+		light->setDiffuseColour(Diffuse);
+	}
+	
+	XMLSpecular = XMLLight->FirstChildElement("colourSpecular");
+	
+	if( XMLSpecular )
+	{
+		ColourValue Specular;
+		Specular.r = Ogre::StringConverter::parseReal( XMLSpecular->Attribute("r") );
+		Specular.g = Ogre::StringConverter::parseReal( XMLSpecular->Attribute("g") );
+		Specular.b = Ogre::StringConverter::parseReal( XMLSpecular->Attribute("b") );
+		Specular.a = 1;
+		light->setSpecularColour(Specular);
+	}
+
+	XMLAttentuation = XMLLight->FirstChildElement("lightAttenuation");
+	if( XMLAttentuation )
+	{
+		//get defaults incase not all values specified
+		Real range, constant, linear, quadratic;
+		range = light->getAttenuationRange();
+		constant = light->getAttenuationConstant();
+		linear = light->getAttenuationLinear();
+		quadratic = light->getAttenuationQuadric();
+			
+		if( XMLAttentuation->Attribute("range") )
+			range = StringConverter::parseReal( XMLAttentuation->Attribute("range") );
+		if( XMLAttentuation->Attribute("constant") )
+			constant = StringConverter::parseReal( XMLAttentuation->Attribute("constant") );
+		if( XMLAttentuation->Attribute("linear") )
+			linear = StringConverter::parseReal( XMLAttentuation->Attribute("linear") );
+		if( XMLAttentuation->Attribute("quadratic") )
+			quadratic = StringConverter::parseReal( XMLAttentuation->Attribute("quadratic") );
+			light->setAttenuation( range, constant, linear, quadratic );
+	}
+
+	XMLPosition = XMLLight->FirstChildElement("position");
+	if( XMLPosition ) 
+	{
+		Vector3 p = Vector3(0,0,0);
+		if( XMLPosition->Attribute("x") )
+			p.x = StringConverter::parseReal( XMLPosition->Attribute("x") );
+		if( XMLPosition->Attribute("y") )
+			p.y = StringConverter::parseReal( XMLPosition->Attribute("y") );
+		if( XMLPosition->Attribute("z") )
+			p.z = StringConverter::parseReal( XMLPosition->Attribute("z") );
+            
+		light->setPosition( p );
+	}
+
+	//castShadows		(true | false) "true"
+	light->setCastShadows( true );
+	if( XMLLight->Attribute("visible") )
+		if( String(XMLLight->Attribute("visible")) == "false" )
+				light->setCastShadows( false );
+			
+	//visible			(true | false) "true"		
+	light->setVisible( true );
+	if( XMLLight->Attribute("visible") )
+		if( String(XMLLight->Attribute("visible")) == "false" )
+			light->setVisible( false );
+
+	return light;
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::createScene(void)
+{
+	mSceneMgr->setAmbientLight(ColourValue(0.09f, 0.09f, 0.09f));
+	mSceneMgr->setSkyBox(true, "Examples/MorningSkyBox" );
+		
+	//This is default, though, set it anyway :)
+	ResourceGroupManager::getSingleton().setWorldResourceGroupName("General");
+	mSceneMgr->setWorldGeometry( "MyScene.scene" );
+	//mSceneMgr->SetOctreeVisible( 1 );
+		
+	ParseDotScene( "MyScene.scene", "General" );
+	// CEGUI setup
+	setupGui();
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::setupGui( void )
+{
+	 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_GENERIC);
+     mGUISystem = new CEGUI::System(mGUIRenderer);
+
+	 // Mouse
+     CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");
+     CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
+	 mGUISystem->setDefaultMouseCursor(
+                (CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
+
+	 CEGUI::MouseCursor::getSingleton().show( );
+     
+	/* CEGUI::Window* sheet = 
+            CEGUI::WindowManager::getSingleton().loadWindowLayout(
+                (CEGUI::utf8*)"ogregui.layout"); 
+
+     mGUISystem->setGUISheet(sheet);*/
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::createFrameListener(void)
+{
+	mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer);
+	mFrameListener->showDebugOverlay(true);
+	mRoot->addFrameListener(mFrameListener);
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::chooseSceneManager(void)
+{
+	mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::createViewports(void)
+{
+	// Create one viewport, entire window
+	Viewport* vp = mWindow->addViewport(mCamera);
+	// Look back along -Z
+    mCamera->lookAt(Vector3(0, 0, -300));
+	mCamera->setPosition(0 , 100, 600);
+}
+
+/***********************************************/
+/* MouseQueryListener implementation           */
+/***********************************************/
+
+//-----------------------------------------------------------------------
+MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer)
+        : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 
+		mShutdownRequested(false)
+{
+
+	// Setup default variables
+//	mCurrentObject = NULL;
+	mLMouseDown = false;
+	mRMouseDown = false;
+	mSceneMgr = sceneManager;
+
+    // Reduce move speed
+	mMoveSpeed = 50;
+	mRotateSpeed *= 2;
+
+	mCurrentAlgorithm = OcclusionCullingSceneTraverser::RENDER_COHERENT;
+	mThreshold = 0;
+    
+	// Register this so that we get mouse events.
+	mEventProcessor->addMouseListener(this);
+	mEventProcessor->addMouseMotionListener(this);
+	mEventProcessor->addKeyListener(this);
+
+	// show overlay
+	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/OcclusionCullingDemoOverlay"); 
+
+	mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo");
+	mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo");
+	mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo");
+	mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo");
+    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo");
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mThresholdInfo->setCaption(": 0");
+	mFrustumCulledNodesInfo->setCaption(": 0");
+	mQueryCulledNodesInfo->setCaption(": 0");
+	mTraversedNodesInfo->setCaption(": 0");
+
+    pOver->show();
+} // MouseQueryListener
+//-----------------------------------------------------------------------
+void MouseQueryListener::mouseMoved (MouseEvent *e)
+{
+	// Update CEGUI with the mouse motion
+    CEGUI::System::getSingleton().injectMouseMove(e->getRelX() * mGUIRenderer->getWidth(), e->getRelY() * mGUIRenderer->getHeight());
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::mousePressed(MouseEvent* e)
+{
+     // Left mouse button down
+     if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+     {
+		 CEGUI::MouseCursor::getSingleton().hide( );
+		 mLMouseDown = true;
+     } // if
+     // Right mouse button down
+     else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+     {
+         CEGUI::MouseCursor::getSingleton().hide( );
+         mRMouseDown = true;
+     } // else if
+} // mousePressed
+
+ //-----------------------------------------------------------------------
+void MouseQueryListener::mouseReleased(MouseEvent* e)
+{
+    // Left mouse button up
+    if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+    {
+		CEGUI::MouseCursor::getSingleton().show( );
+        mLMouseDown = false;
+    }
+    // Right mouse button up
+    else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+    {
+        CEGUI::MouseCursor::getSingleton().show( );
+        mRMouseDown = false;
+    }
+} 
+//-----------------------------------------------------------------------
+void MouseQueryListener::mouseDragged (MouseEvent *e)
+ {
+	 // If we are dragging the left mouse button.	 
+	 if ( mLMouseDown )
+	 {
+		mCamera->yaw( -e->getRelX() * mRotateSpeed );
+		mCamera->pitch( -e->getRelY() * mRotateSpeed );
+     }
+	 	 
+	 // If we are dragging the right mouse button.
+	 if ( mRMouseDown )
+	 {
+		 Vector3 translation;
+		 translation.x += -e->getRelX() * 0.13;
+		 translation.y -= -e->getRelY() * 0.13;
+
+		 mCamera->moveRelative(translation);		
+	 }
+}
+//-----------------------------------------------------------------------
+bool MouseQueryListener::frameEnded(const FrameEvent& evt)
+{
+	if (mShutdownRequested)
+		return false;
+
+    if (timeDelay >= 0) 
+        timeDelay -= evt.timeSinceLastFrame;
+
+    KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());
+
+	KEY_PRESSED(KC_SUBTRACT, 0.0, changeThreshold(-10));
+	KEY_PRESSED(KC_ADD, 0, changeThreshold(10));
+	//KEY_PRESSED(KC_T, 1, change);
+      
+	changeStats();
+
+    return ExampleFrameListener::frameStarted(evt) && ExampleFrameListener::frameEnded(evt);        
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeThreshold(int incr)
+{
+	mThreshold += incr; if(mThreshold < 0) mThreshold = 0;
+	
+	char str[100]; sprintf(str,": %d", mThreshold);
+
+	mSceneMgr->setOption("Threshold", &mThreshold); 
+	mThresholdInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeAlgorithm()
+{
+    mCurrentAlgorithm = ++mCurrentAlgorithm % OcclusionCullingSceneTraverser::NUM_RENDERMODES;
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeStats()
+{
+	unsigned int opt = 0;
+	char str[100];
+	
+	mSceneMgr->getOption("NumFrustumCulledNodes", &opt); sprintf(str,": %d", opt); 
+	mFrustumCulledNodesInfo->setCaption(str);
+	
+	mSceneMgr->getOption("NumQueryCulledNodes", &opt); sprintf(str,": %d", opt); 
+	mQueryCulledNodesInfo->setCaption(str);
+	
+	mSceneMgr->getOption("NumTraversedNodes", &opt); sprintf(str,": %d", opt); 
+	mTraversedNodesInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyPressed(KeyEvent* e)
+{
+	if(e->getKey() == KC_ESCAPE)
+    {
+		mShutdownRequested = true;
+		e->consume();
+		return;
+	}
+
+	CEGUI::System::getSingleton().injectKeyDown(e->getKey());
+	CEGUI::System::getSingleton().injectChar(e->getKeyChar());
+	e->consume();
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyReleased(KeyEvent* e)
+{
+	CEGUI::System::getSingleton().injectKeyUp(e->getKey());
+	e->consume();
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyClicked(KeyEvent* e) 
+{
+	// Do nothing
+	e->consume();
+}
+//-----------------------------------------------------------------------
+INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
+{
+    // Create application object
+    TestCullingDotSceneApplication app;
+
+	try 
+	{
+        app.go();
+    } 
+	catch( Ogre::Exception& e ) 
+	{
+        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+    }	
+
+    return 0;
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.h	(revision 42)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.h	(revision 42)
@@ -0,0 +1,110 @@
+/**
+    \file 
+        TestCullingApplication.h
+*/
+#include "CEGUIForwardRefs.h"
+#include "ExampleApplication.h"
+#include "OgreLight.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+Real timeDelay = 0;
+#define KEY_PRESSED(_key,_timeDelay, _macro) \
+{ \
+    if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
+{ \
+    timeDelay = _timeDelay; \
+    _macro ; \
+} \
+}
+
+String mCurrentAlgorithmCaptions[OcclusionCullingSceneTraverser::NUM_RENDERMODES] = 
+{
+    "Cull Frustum", 
+	"Stop and Wait", 
+	"Coherent Occlusion Culling"
+};
+
+class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
+{
+public:
+
+    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer);
+
+
+    ~MouseQueryListener( )
+    {
+    }
+
+//	bool frameStarted(const FrameEvent& evt);
+	bool frameEnded(const FrameEvent& evt);
+
+    /* MouseListener callbacks. */
+    virtual void mouseClicked(MouseEvent* e) { }
+    virtual void mouseEntered(MouseEvent* e) { }
+    virtual void mouseExited(MouseEvent* e)  { }
+
+    // This is when the mouse button goes DOWN.
+    virtual void mousePressed(MouseEvent* e);
+
+    // This is when the mouse button is let UP.
+    virtual void mouseReleased(MouseEvent* e);
+
+    /* MouseMotionListener callbacks */
+    virtual void mouseMoved (MouseEvent *e);
+   
+    // This is when the mouse is clicked, held and dragged.
+    virtual void mouseDragged (MouseEvent *e);
+
+    void keyPressed(KeyEvent* e);
+
+	void keyReleased(KeyEvent* e);
+	void keyClicked(KeyEvent* e);
+
+	void changeAlgorithm();
+	void changeThreshold(int incr);
+	void changeStats();
+
+protected:
+    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
+    SceneManager *mSceneMgr;           // A pointer to the scene manager
+    
+	CEGUI::Renderer *mGUIRenderer;     // cegui renderer
+	
+	bool mShutdownRequested;
+	int mCurrentAlgorithm;
+	int mThreshold;
+
+	OverlayElement *mAlgorithmInfo;
+	OverlayElement *mThresholdInfo;
+	OverlayElement *mFrustumCulledNodesInfo;
+	OverlayElement *mQueryCulledNodesInfo;
+    OverlayElement *mTraversedNodesInfo;
+	OverlayElement *mSceneNodesInfo;
+};
+
+
+class TestCullingDotSceneApplication : public ExampleApplication
+{
+public:
+	//~TestCullingDotSceneApplication();
+
+protected:
+	void createScene(void);
+	void createFrameListener(void);
+	void setupGui(void);
+	void ParseDotScene( const String &SceneName, const String& groupName );
+	Light* LoadLight( TiXmlElement *XMLLight );
+
+	virtual void createViewports(void);
+
+	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
+	CEGUI::System *mGUISystem;
+
+private:
+	void chooseSceneManager(void);
+
+	//SceneManager* mSceneMgr;
+	//Entity* mShip;
+	//SceneNode* mShipNode;
+};
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.dsw
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.dsw	(revision 47)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.dsw	(revision 47)
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Demo_TestCullingTerrain"=.\TestCullingTerrainApplication.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrain.vcproj
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrain.vcproj	(revision 48)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrain.vcproj	(revision 48)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="TestCullingTerrain"
+	ProjectGUID="{248F19A6-2FE0-4F5D-8928-E0EA10609887}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			ReferencesPath="">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib"
+				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingTerrain.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/TestCullingTerrain.pdb"
+				SubSystem="2"
+				ImportLibrary=""
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include"
+				PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OGREMain.LIB"
+				OutputFile="..\..\..\Samples\Common\Bin\Release\TestCullingTerrain.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\OgreMain\Lib\Release"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\TerrainContentGenerator.cpp">
+			</File>
+			<File
+				RelativePath=".\TestCullingTerrainApplication.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\TerrainContentGenerator.h">
+			</File>
+			<File
+				RelativePath=".\TestCullingTerrainApplication.h">
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TerrainContentGenerator.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TerrainContentGenerator.cpp	(revision 55)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TerrainContentGenerator.cpp	(revision 55)
@@ -0,0 +1,96 @@
+/**
+    \file 
+        TerrainContentGenerator.cpp
+    \brief
+        Creates content for the terrain,
+*/
+#include "TerrainContentGenerator.h"
+
+//-----------------------------------------------------------------------
+TerrainContentGenerator::TerrainContentGenerator( SceneManager *sm, RayQueryExecutor *rayQueryEx )
+{
+	mSceneMgr = sm;
+	mRayQueryExecutor = rayQueryEx;
+
+	mMinTranslation = Vector3(-70.0f, -70.0f, 0.0f);
+	mMaxTranslation = Vector3(70.0f, 70.0f, 600.0f);
+
+	mMinAngle = 0;
+	mMaxAngle = 360;
+
+	mCount = 0;
+}
+//-----------------------------------------------------------------------
+void TerrainContentGenerator::generateScene( int numObjects )
+{
+	srand (time (0));
+	
+	Vector3 rotationRatio;
+	Vector3 translationRatio;
+
+	for(int i=0; i < numObjects; i++)
+	{
+		rotationRatio.x = rand() / (float) RAND_MAX;
+		rotationRatio.y = rand() / (float) RAND_MAX;
+		rotationRatio.z = rand() / (float) RAND_MAX;
+
+		translationRatio.x = rand() / (float) RAND_MAX;
+		translationRatio.y = rand() / (float) RAND_MAX;
+		translationRatio.z = rand() / (float) RAND_MAX;
+
+		generateSceneObject(translationRatio, rotationRatio, i, "sphere.mesh");
+	}
+}
+//-----------------------------------------------------------------------
+void TerrainContentGenerator::generateSceneObject(const Vector3 &translationRatio, 
+					 const Vector3 &rotationRatio, const int idx, const String& entName)
+{
+	// Setup the ray scene query
+	Real rotation = mMinAngle + rotationRatio.x * (mMaxAngle - mMinAngle);
+	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
+
+	translation.y = 5000;
+    
+	Vector3 queryResult;
+
+	if(mRayQueryExecutor->executeRayQuery(&queryResult, translation, Vector3::NEGATIVE_UNIT_Y))
+	{
+		char name[16];
+		sprintf( name, "%s%d", entName.c_str(), mCount++);
+
+		Entity *ent = mSceneMgr->createEntity(name, entName);
+		SceneNode *currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", queryResult);
+		currentObject->attachObject(ent);
+		currentObject->setScale(0.1f, 0.1f, 0.1f);
+	}
+}
+//-----------------------------------------------------------------------
+RayQueryExecutor::RayQueryExecutor( SceneManager *sm )
+{
+	mRaySceneQuery = sm->createRayQuery(Ray());
+}
+//-----------------------------------------------------------------------
+RayQueryExecutor::~RayQueryExecutor()
+{
+	delete mRaySceneQuery;
+}
+//-----------------------------------------------------------------------
+bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir )
+{
+	Ray ray(pos, dir);
+    mRaySceneQuery->setRay(ray);
+
+    // Perform the scene query
+    RaySceneQueryResult &queryResult = mRaySceneQuery->execute();
+    RaySceneQueryResult::iterator it = queryResult.begin( );
+
+	if (it != queryResult.end() && it->worldFragment)
+	{
+		SceneQuery::WorldFragment* wf = it->worldFragment;
+
+		*result = wf->singleIntersection; 
+		return true;
+	}
+
+	return false;
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 55)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 55)
@@ -0,0 +1,421 @@
+/**
+    \file 
+        TestCullingTerrainApplication.cpp
+    \brief
+        Tests the occlusion culling algorithm
+*/
+
+#include <OgreNoMemoryMacros.h>
+#include <CEGUI/CEGUI.h>
+#include <../CEGUIRenderer/include/OgreCEGUIRenderer.h>
+#include <../CEGUIRenderer/include/OgreCEGUIResourceProvider.h>
+#include <../CEGUIRenderer/include/OgreCEGUITexture.h>
+#include <OgreMemoryMacros.h>
+
+#include "Ogre.h"
+#include "TestCullingTerrainApplication.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+
+
+/************************************************/
+/* TestCullingTerrainApplication implementation */
+/************************************************/
+TestCullingTerrainApplication::~TestCullingTerrainApplication()
+{
+	delete mRayQueryExecutor;
+	delete mTerrainContentGenerator;
+}
+
+//-----------------------------------------------------------------------
+void TestCullingTerrainApplication::createCamera( void )
+{
+	// Create the camera
+	mCamera = mSceneMgr->createCamera("PlayerCam");
+
+	// Position it at 500 in Z direction
+	mCamera->setPosition(Vector3(128,25,128));
+
+	// Look back along -Z
+    mCamera->lookAt(Vector3(0,0,-300));
+    mCamera->setNearClipDistance(1);
+    mCamera->setFarClipDistance(1000);
+}
+//-----------------------------------------------------------------------
+void TestCullingTerrainApplication::generateSceneObject(const Vector3 &translationRatio, 
+					 const Vector3 &rotationRatio, const int idx, const String& entName)
+{
+	// Setup the ray scene query
+	/*Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);
+	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
+
+	translation.y = 5000;
+    Ray ray(translation, Vector3::NEGATIVE_UNIT_Y);
+    mRaySceneQuery->setRay(ray);
+
+    // Execute query
+	RaySceneQueryResult &result = mRaySceneQuery->execute();
+	RaySceneQueryResult::iterator itr = result.begin( );
+
+	// Get results, create a node/entity on the position
+	if ( itr != result.end() && itr->worldFragment )
+	{
+		char name[16];
+		sprintf( name, "%s%d", entName.c_str(), mCount++ );
+
+		Entity *ent = mSceneMgr->createEntity( name, entName );
+		SceneNode currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );
+		currentObject->attachObject( ent );
+		currentObject->setScale( 0.1f, 0.1f, 0.1f );
+	}*/
+}
+
+//-----------------------------------------------------------------------
+void TestCullingTerrainApplication::createScene( void )
+{
+	mRayQueryExecutor = new RayQueryExecutor(mSceneMgr);
+	mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr, mRayQueryExecutor);
+	// Set ambient light
+	mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
+	
+	// Create a light
+	Light* l = mSceneMgr->createLight("MainLight");
+	// Accept default settings: point light, white diffuse, just set position
+	// NB I could attach the light to a SceneNode if I wanted it to move automatically with
+	//  other objects, but I don't
+	l->setPosition(20,80,50);
+
+	// --Fog
+	// NB it's VERY important to set this before calling setWorldGeometry 
+	// because the vertex program picked will be different
+	ColourValue fadeColour(0.93, 0.86, 0.76);
+	mWindow->getViewport(0)->setBackgroundColour(fadeColour);
+	//mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000);
+
+	// Create a skybox
+    //mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 500, false);
+	//mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8, 500, false );
+
+	/*	// Define the required skyplane
+	Plane plane;
+	// 5000 world units from the camera
+	plane.d = 5000;
+	// Above the camera, facing down
+	plane.normal = -Vector3::UNIT_Y;
+	// Create the plane 10000 units wide, tile the texture 3 times
+    mSceneMgr->setSkyPlane(true, plane, "Examples/SpaceSkyPlane",10000,3);*/
+
+	std::string terrain_cfg("terrain.cfg");
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+	terrain_cfg = mResourcePath + terrain_cfg;
+#endif
+	mSceneMgr -> setWorldGeometry( terrain_cfg );
+	// Infinite far plane?
+	if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
+	{
+		mCamera->setFarClipDistance(0);
+	}
+
+	// Set a nice viewpoint
+	mCamera->setPosition(707,2500,528);
+	mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
+
+	// CEGUI setup
+	setupGui();
+}
+//-----------------------------------------------------------------------
+void TestCullingTerrainApplication::setupGui( void )
+{
+	 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE);
+     mGUISystem = new CEGUI::System(mGUIRenderer);
+
+	 // Mouse
+     CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");
+     CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
+	 mGUISystem->setDefaultMouseCursor(
+                (CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
+
+	 CEGUI::MouseCursor::getSingleton().show( );
+}
+//-----------------------------------------------------------------------
+void TestCullingTerrainApplication::createFrameListener(void)
+{
+	mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer, mRayQueryExecutor);
+	mFrameListener->showDebugOverlay(true);
+	mRoot->addFrameListener(mFrameListener);
+}
+//-----------------------------------------------------------------------
+void TestCullingTerrainApplication::chooseSceneManager(void)
+{
+    //mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+	mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);
+}
+
+/***********************************************/
+/* MouseQueryListener implementation           */
+/***********************************************/
+//-----------------------------------------------------------------------
+MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer, RayQueryExecutor *rqe)
+        : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), mShutdownRequested(false), mRayQueryExecutor(rqe)
+{
+
+	// Setup default variables
+	mCurrentObject = NULL;
+	mLMouseDown = false;
+	mRMouseDown = false;
+	mSceneMgr = sceneManager;
+
+    // Reduce move speed
+	mMoveSpeed = 50;
+	mRotateSpeed *= 2;
+
+	mCurrentAlgorithm = OcclusionCullingSceneTraverser::RENDER_COHERENT;
+	mThreshold = 0;
+    
+	// Register this so that we get mouse events.
+	mEventProcessor->addMouseListener(this);
+	mEventProcessor->addMouseMotionListener(this);
+	mEventProcessor->addKeyListener(this);
+
+	mRaySceneQuery = mSceneMgr->createRayQuery(Ray());
+
+	// show overlay
+	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/OcclusionCullingDemoOverlay"); 
+
+	mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo");
+	mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo");
+	mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo");
+	mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo");
+    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo");
+	mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo");
+	mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo");
+	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo");
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mThresholdInfo->setCaption(": 0");
+	mFrustumCulledNodesInfo->setCaption(": 0");
+	mQueryCulledNodesInfo->setCaption(": 0");
+	mTraversedNodesInfo->setCaption(": 0");
+	mSceneNodesInfo->setCaption(": 0");
+	mHierarchyNodesInfo->setCaption(": 0");
+	mRenderedNodesInfo->setCaption(": 0");
+		
+    pOver->show();
+} 
+//-----------------------------------------------------------------------
+MouseQueryListener::~MouseQueryListener( )
+{
+	delete mRaySceneQuery;
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::mouseMoved (MouseEvent *e)
+{
+	// Update CEGUI with the mouse motion
+    CEGUI::System::getSingleton().injectMouseMove(e->getRelX() * mGUIRenderer->getWidth(), e->getRelY() * mGUIRenderer->getHeight());
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::mousePressed(MouseEvent* e)
+{
+     // Left mouse button down
+     if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+     {
+		 CEGUI::MouseCursor::getSingleton().hide( );
+
+		 // Setup the ray scene query
+         Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
+         mRaySceneQuery->setRay( mouseRay );
+
+         // Execute query
+         RaySceneQueryResult &result = mRaySceneQuery->execute();
+         RaySceneQueryResult::iterator itr = result.begin( );
+
+         // Get results, create a node/entity on the position
+         if ( itr != result.end() && itr->worldFragment )
+         {
+			 char name[16];
+             sprintf( name, "Robot%d", mCount++ );
+
+             Entity *ent = mSceneMgr->createEntity( name, "robot.mesh" );
+             mCurrentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );
+             mCurrentObject->attachObject( ent );
+             mCurrentObject->setScale( 0.1f, 0.1f, 0.1f );
+         }
+
+         mLMouseDown = true; 
+     }
+     // Right mouse button down
+     else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+     {
+         CEGUI::MouseCursor::getSingleton().hide( );
+         mRMouseDown = true;
+     } // else if
+} // mousePressed
+
+ //-----------------------------------------------------------------------
+void MouseQueryListener::mouseReleased(MouseEvent* e)
+{
+    // Left mouse button up
+    if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+    {
+		CEGUI::MouseCursor::getSingleton().show( );
+        mLMouseDown = false;
+    }
+    // Right mouse button up
+    else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+    {
+        CEGUI::MouseCursor::getSingleton().show( );
+        mRMouseDown = false;
+    }
+} 
+//-----------------------------------------------------------------------
+void MouseQueryListener::mouseDragged (MouseEvent *e)
+ {
+	 // If we are dragging the left mouse button.	 	 
+	 if ( mLMouseDown )
+     {
+		 Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
+		 mRaySceneQuery->setRay( mouseRay );
+
+		 RaySceneQueryResult &result = mRaySceneQuery->execute();
+		 RaySceneQueryResult::iterator itr = result.begin( );
+
+		 if ( itr != result.end() && itr->worldFragment )
+		 {
+			 mCurrentObject->setPosition( itr->worldFragment->singleIntersection );
+		 } 
+     }
+	 // If we are dragging the right mouse button.
+	 if ( mRMouseDown )
+	 {
+		 mCamera->yaw( -e->getRelX() * mRotateSpeed );
+		 mCamera->pitch( -e->getRelY() * mRotateSpeed );
+	 }
+}
+//-----------------------------------------------------------------------
+bool MouseQueryListener::frameStarted(const FrameEvent &evt)
+{
+	// clamp to terrain
+	Vector3 camPos = mCamera->getPosition( );
+    Ray cameraRay( Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y );
+    mRaySceneQuery->setRay( cameraRay );
+
+    // Perform the scene query
+    RaySceneQueryResult &queryResult = mRaySceneQuery->execute();
+    RaySceneQueryResult::iterator it = queryResult.begin( );
+
+	if (it != queryResult.end() && it->worldFragment)
+	{
+		SceneQuery::WorldFragment* wf = it->worldFragment;
+
+		mCamera->setPosition(mCamera->getPosition().x, wf->singleIntersection.y + 10, 
+			mCamera->getPosition().z);
+	}
+	 
+	return ExampleFrameListener::frameStarted(evt);
+}
+//-----------------------------------------------------------------------
+bool MouseQueryListener::frameEnded(const FrameEvent& evt)
+{
+	if (mShutdownRequested)
+		return false;
+
+    if (timeDelay >= 0) 
+        timeDelay -= evt.timeSinceLastFrame;
+
+    KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());
+
+	KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10));
+	KEY_PRESSED(KC_ADD, 0, changeThreshold(10));
+	//KEY_PRESSED(KC_T, 1, change);
+      
+	changeStats();
+
+    return ExampleFrameListener::frameStarted(evt) && ExampleFrameListener::frameEnded(evt);        
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeThreshold(int incr)
+{
+	mThreshold += incr; if(mThreshold < 0) mThreshold = 0;
+	
+	char str[100]; sprintf(str,": %d", mThreshold);
+
+	mSceneMgr->setOption("Threshold", &mThreshold); 
+	mThresholdInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeAlgorithm()
+{
+    mCurrentAlgorithm = ++mCurrentAlgorithm % OcclusionCullingSceneTraverser::NUM_RENDERMODES;
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeStats()
+{
+	unsigned int opt = 0;
+	char str[100];
+	
+	mSceneMgr->getOption("NumFrustumCulledNodes", &opt); sprintf(str,": %d", opt); 
+	mFrustumCulledNodesInfo->setCaption(str);
+	
+	mSceneMgr->getOption("NumQueryCulledNodes", &opt); sprintf(str,": %d", opt); 
+	mQueryCulledNodesInfo->setCaption(str);
+	
+	mSceneMgr->getOption("NumTraversedNodes", &opt); sprintf(str,": %d", opt); 
+	mTraversedNodesInfo->setCaption(str);
+
+	mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt); 
+	mSceneNodesInfo->setCaption(str);
+
+	mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt); 
+	mHierarchyNodesInfo->setCaption(str);
+
+	mSceneMgr->getOption("NumRenderedNodes", &opt); sprintf(str,": %d", opt); 
+	mRenderedNodesInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyPressed(KeyEvent* e)
+{
+	if(e->getKey() == KC_ESCAPE)
+    {
+		mShutdownRequested = true;
+		e->consume();
+		return;
+	}
+
+	CEGUI::System::getSingleton().injectKeyDown(e->getKey());
+	CEGUI::System::getSingleton().injectChar(e->getKeyChar());
+	e->consume();
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyReleased(KeyEvent* e)
+{
+	CEGUI::System::getSingleton().injectKeyUp(e->getKey());
+	e->consume();
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyClicked(KeyEvent* e) 
+{
+	// Do nothing
+	e->consume();
+}
+//-----------------------------------------------------------------------
+INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
+{
+    // Create application object
+    TestCullingTerrainApplication app;
+
+	try 
+	{
+        app.go();
+    } 
+	catch( Ogre::Exception& e ) 
+	{
+        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+    }	
+
+    return 0;
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.dsp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.dsp	(revision 47)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.dsp	(revision 47)
@@ -0,0 +1,109 @@
+# Microsoft Developer Studio Project File - Name="Demo_TestCullingTerrainApplication" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=Demo_TestCullingTerrainApplication - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "TestCullingTerrainApplication.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "TestCullingTerrainApplication.mak" CFG="Demo_TestCullingTerrainApplication - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Demo_TestCullingTerrainApplication - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "Demo_TestCullingTerrainApplication - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Demo_TestCullingTerrainApplication - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "..\bin\Release"
+# PROP BASE Intermediate_Dir "..\obj\Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\bin\Release"
+# PROP Intermediate_Dir "..\obj\Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /I "$(OGRE_PATH)\OgreMain\include" /I "$(OGRE_PATH)\Samples/Common/include" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /YX /FD /Zm1000 /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib OgreMain.lib /nologo /subsystem:windows /machine:I386 /out:"$(OGRE_PATH)\Samples\Common\Bin\Release\Demo_TestCullingTerrainApplication.exe" /libpath:"$(OGRE_PATH)\OgreMain\lib\release" 
+# SUBTRACT LINK32 /profile /debug
+
+!ELSEIF  "$(CFG)" == "Demo_TestCullingTerrainApplication - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "..\bin\Debug"
+# PROP BASE Intermediate_Dir "..\obj\Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\bin\Debug"
+# PROP Intermediate_Dir "..\obj\Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "$(OGRE_PATH)\OgreMain\include" /I "$(OGRE_PATH)\Samples/Common/include" /D "_MBCS" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /FD /GZ /Zm1000 /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib OgreMain_d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMT" /out:"$(OGRE_PATH)\Samples\Common\Bin\Debug\Demo_TestCullingTerrainApplication.exe" /pdbtype:sept /libpath:"$(OGRE_PATH)\OgreMain\lib\debug" 
+# SUBTRACT LINK32 /verbose
+
+!ENDIF 
+
+# Begin Target
+
+# Name "Demo_TestCullingTerrainApplication - Win32 Release"
+# Name "Demo_TestCullingTerrainApplication - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=TestCullingTerrainApplication.cpp
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TerrainContentGenerator.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TerrainContentGenerator.h	(revision 55)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TerrainContentGenerator.h	(revision 55)
@@ -0,0 +1,46 @@
+/**
+    \file 
+        TerrainContentGenerator.h
+*/
+#include "ExampleApplication.h"
+
+class RayQueryExecutor
+{
+public:
+	RayQueryExecutor( SceneManager *sm );
+	~RayQueryExecutor( );
+	bool executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir );
+protected:
+	RaySceneQuery *mRaySceneQuery;
+};
+
+class TerrainContentGenerator
+{
+public:
+	TerrainContentGenerator(  SceneManager *sm, RayQueryExecutor *rayQueryEx );
+	/** generates a the scene hierarchy with random values 
+	@param number of objects to generate
+	*/
+	void generateScene( int numObjects );
+	/** 
+		generates a new scene object 
+		@param tranlationRatio ratio between minimal and maximal possible translation
+		@param rotationRatio ratio between minimal and maximal possible rotation
+		@idx the index of the new object
+		@entName the name of the object entity
+	*/
+	void generateSceneObject( const Vector3 &translationRatio, const Vector3 &rotationRatio, 
+							  const int idx, const String &entName );
+
+protected:
+
+	Real mMinAngle;
+	Real mMaxAngle;
+	Vector3 mMaxTranslation;
+	Vector3 mMinTranslation;
+
+	RayQueryExecutor *mRayQueryExecutor;
+	SceneManager *mSceneMgr;
+	int mCount;		// The number of objects on the screen
+};
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 55)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 55)
@@ -0,0 +1,128 @@
+/**
+    \file 
+        TestCullingTerrainApplication.h
+*/
+#include "CEGUIForwardRefs.h"
+#include "ExampleApplication.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+#include "TerrainContentGenerator.h"
+
+Real timeDelay = 0;
+#define KEY_PRESSED(_key,_timeDelay, _macro) \
+{ \
+    if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
+{ \
+    timeDelay = _timeDelay; \
+    _macro ; \
+} \
+}
+
+String mCurrentAlgorithmCaptions[OcclusionCullingSceneTraverser::NUM_RENDERMODES] = 
+{
+    "Cull Frustum", 
+	"Stop and Wait", 
+	"Coherent Occlusion Culling"
+};
+
+class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
+{
+public:
+
+    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 
+		CEGUI::Renderer *renderer, RayQueryExecutor *rqe);
+
+
+    ~MouseQueryListener( );
+
+	bool frameStarted(const FrameEvent& evt);
+	bool frameEnded(const FrameEvent& evt);
+
+    /* MouseListener callbacks. */
+    virtual void mouseClicked(MouseEvent* e) { }
+    virtual void mouseEntered(MouseEvent* e) { }
+    virtual void mouseExited(MouseEvent* e)  { }
+
+    // This is when the mouse button goes DOWN.
+    virtual void mousePressed(MouseEvent* e);
+
+    // This is when the mouse button is let UP.
+    virtual void mouseReleased(MouseEvent* e);
+
+    /* MouseMotionListener callbacks */
+    virtual void mouseMoved (MouseEvent *e);
+   
+    // This is when the mouse is clicked, held and dragged.
+    virtual void mouseDragged (MouseEvent *e);
+
+    void keyPressed(KeyEvent* e);
+
+	void keyReleased(KeyEvent* e);
+	void keyClicked(KeyEvent* e);
+
+	void changeAlgorithm();
+	void changeThreshold(int incr);
+	void changeStats();
+
+protected:
+    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
+    SceneManager *mSceneMgr;           // A pointer to the scene manager
+    
+	CEGUI::Renderer *mGUIRenderer;     // cegui renderer
+	
+	bool mShutdownRequested;
+	int mCurrentAlgorithm;
+	int mThreshold;
+
+	OverlayElement *mAlgorithmInfo;
+	OverlayElement *mThresholdInfo;
+	OverlayElement *mFrustumCulledNodesInfo;
+	OverlayElement *mQueryCulledNodesInfo;
+    OverlayElement *mTraversedNodesInfo;
+	OverlayElement *mHierarchyNodesInfo;
+	OverlayElement *mSceneNodesInfo;
+	OverlayElement *mRenderedNodesInfo;
+
+	SceneNode *mCurrentObject;         // The newly created object
+	RaySceneQuery *mRaySceneQuery;     // The ray scene query pointer
+	int mCount;                        // The number of robots on the screen
+
+	RayQueryExecutor *mRayQueryExecutor;
+};
+
+
+class TestCullingTerrainApplication : public ExampleApplication
+{
+public:
+	~TestCullingTerrainApplication();
+
+protected:
+	void createScene(void);
+	void createFrameListener(void);
+	void setupGui(void);
+	virtual void createCamera(void);
+
+	/** 
+		generates a new scene object 
+		@param tranlationRatio ratio between minimal and maximal possible translation
+		@param rotationRatio ratio between minimal and maximal possible rotation
+		@idx the index of the new object
+		@entName the name of the object entity
+	*/
+	void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 
+							 const int idx, const String &entName);
+
+	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
+	CEGUI::System *mGUISystem;
+	RayQueryExecutor *mRayQueryExecutor;
+	TerrainContentGenerator *mTerrainContentGenerator;
+
+	Vector3 mMinTranslation;
+	Vector3 mMaxTranslation;
+
+	Vector3 mMinAngle;
+	Vector3 mMaxAngle;
+
+private:
+	void chooseSceneManager(void);
+};
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingDotSceneManager.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingDotSceneManager.h	(revision 33)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingDotSceneManager.h	(revision 33)
@@ -0,0 +1,47 @@
+#ifndef _OcclusionCullingDotSceneManager_H__
+#define _OcclusionCullingDotSceneManager_H__
+
+#include "OgreSceneNode.h"
+#include "DotSceneManager.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+#include "OgrePrerequisites.h"
+
+using namespace std;
+
+namespace Ogre {
+	
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingDotSceneManager: public DotSceneManager
+	{
+	public:
+		OcclusionCullingDotSceneManager();
+		~OcclusionCullingDotSceneManager();
+	
+		void _renderVisibleObjects(void);
+		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+		void _updateSceneGraph(Camera* cam);
+
+		/** Sets the given option for the SceneManager
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		virtual bool setOption( const String &, const void * );
+		/** Gets the given option for the Scene Manager.
+	        @remarks
+		    See setOption
+		*/
+		virtual bool getOption( const String &, void * );
+
+		bool getOptionValues( const String & key, StringVector &refValueList );
+		bool getOptionKeys( StringVector &refKeys );
+
+	protected:
+		OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser;
+	};
+
+}
+#endif // OcclusionCullingDotSceneManager_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/SceneTraverser.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/SceneTraverser.h	(revision 56)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/SceneTraverser.h	(revision 56)
@@ -0,0 +1,134 @@
+#ifndef _OcclusionCullingSceneTraverser_H__
+#define _OcclusionCullingSceneTraverser_H__
+
+#include "OgreSceneNode.h"
+#include "OgreSceneManager.h"
+#include "OgrePrerequisites.h"
+#include "OgreSolidHalfBoundingBox.h"
+#include "OgreCamera.h"
+#include "OgreRenderSystem.h"
+#include <queue>
+
+using namespace std;
+
+namespace Ogre {
+	/**
+		This class implements the compare operator for the priority queue.
+		a lower distance has a higher value in the queue
+	*/
+	template <typename T> class myless
+	{
+	public:
+		myless(Camera *cam) { mCamera = cam; }
+		//bool operator() (HierarchyNode *v1, HierarchyNode *v2) const
+		bool operator() (T v1, T v2) const
+		{
+			return v1->getSquaredViewDepth(mCamera) > v2->getSquaredViewDepth(mCamera);
+		}
+	private:
+		Camera *mCamera;
+	};
+
+	typedef pair<SceneNode *, HardwareOcclusionQuery *> QueryPair;
+	typedef priority_queue<SceneNode *, vector<SceneNode *>, myless<vector<SceneNode *>::value_type> > PriorityQueue;
+	typedef queue<QueryPair> QueryQueue;
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class SceneTraverser
+	{
+	public:
+		/** Construction taking the current scene manager and the current rendersystem as argument
+		@param sm current scene manager
+		@param rsys current render system 
+		*/
+		SceneTraverser(SceneManager *sm, RenderSystem *rsys);
+		~SceneTraverser();
+	
+		/** Sets pointer to the current scene manager.
+		@param the scene manager */
+		void setSceneManager( SceneManager *sm );
+		
+		/** Sets pointer to the current render system 
+		@param the rendersystem */
+		void setRenderSystem( RenderSystem *rsys );
+		
+		/** Sets the root of the scene hierarchy. */
+		void setSceneRoot(SceneNode *root);
+
+		/** Doing some necessary preprocessing.
+		@comment e.g., initialises occlusion queries */
+		//void preprocess( void );
+
+	protected:
+	
+		/** returns true if current node is leaf of the hierarchy */
+		bool isLeaf( ) = 0;
+		
+		void traverseNode( HierarchyNode *node);
+		/** Renders current scene node 
+		@param cam current camera
+		@param node current scene node to be rendered
+		*/
+		void renderNode( HierarchyNode *node);
+			
+		/** Issue a occlusion query for this node. 
+			@param box the axis aligned bounding box of the node
+			@wasVisible if the node was visible in previous frame
+		*/
+		HardwareOcclusionQuery *issueOcclusionQuery( AxisAlignedBox *box, bool wasVisible );
+		/** Returns next available occlusion query or creates new one.
+		@return the next occlusion query
+		*/
+		HardwareOcclusionQuery *getNextOcclusionQuery(void);
+		/** Pulls up the visibility from the child node. 
+		@param the child node 
+		*/
+		void pullUpVisibility(SceneNode *node);
+		/** delete all previously defined occlusion queries */
+		void deleteQueries();
+		/** Renders bounding box of specified node.
+		@param box the bounding box of the scene node to be rendered */
+		void renderBoundingBox( AxisAlignedBox *box );
+		/** Returns one half of the bounding box.
+		@param half the half index of the bouding box (0 or 1)
+		*/
+		SolidHalfBoundingBox *getSolidHalfBoundingBox( int half );
+
+		/** Initialises the distance queue. */
+		virtual void initDistanceQueue(Camera *cam);
+		
+		std::vector<HardwareOcclusionQuery *> mOcclusionQueries;
+		// two halfes of a aabb
+		SolidHalfBoundingBox *mHalfBoundingBox[2];	
+
+		int mCurrentAlgorithm;
+
+		unsigned int mFrameId;
+		unsigned int mVisibilityThreshold;
+		
+		SceneManager *mSceneManager;
+		RenderSystem *mRenderSystem;
+	
+		int mCurrentTestIdx;
+		int mQueryMode;
+
+		unsigned int mNumQueries;
+
+		//--- statistics
+		unsigned int mNumSceneNodes;
+		unsigned int mNumTraversedNodes;
+		unsigned int mNumQueryCulledNodes;
+		unsigned int mNumFrustumCulledNodes;
+		unsigned int mNumRenderedGeometry;
+		unsigned int mNumRenderedNodes;
+		
+	private:
+		// the scene root
+		HierarchyNode *mHierarchyRoot;
+		// we use a priority queue ordered by distance
+		PriorityQueue *mDistanceQueue; 
+	};
+
+}
+#endif // SCENETRAVERSER_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/Makefile.in
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/Makefile.in	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/Makefile.in	(revision 12)
@@ -0,0 +1,372 @@
+# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+BOOST_CFLAGS = @BOOST_CFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
+BUILD_PYTHON_INTERFACE_FALSE = @BUILD_PYTHON_INTERFACE_FALSE@
+BUILD_PYTHON_INTERFACE_TRUE = @BUILD_PYTHON_INTERFACE_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFGTK_DEPS_CFLAGS = @CFGTK_DEPS_CFLAGS@
+CFGTK_DEPS_LIBS = @CFGTK_DEPS_LIBS@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FT2_CFLAGS = @FT2_CFLAGS@
+FT2_CONFIG = @FT2_CONFIG@
+FT2_LIBS = @FT2_LIBS@
+GLSUPPORT_CFLAGS = @GLSUPPORT_CFLAGS@
+GLSUPPORT_LIBS = @GLSUPPORT_LIBS@
+GL_LIBS = @GL_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OGREMAIN_VERSION_INFO = @OGREMAIN_VERSION_INFO@
+OGRE_CFGTK = @OGRE_CFGTK@
+OGRE_CFLAGS = @OGRE_CFLAGS@
+OGRE_GLSUPPORT = @OGRE_GLSUPPORT@
+OGRE_PLATFORM = @OGRE_PLATFORM@
+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@
+PLATFORM_CFLAGS = @PLATFORM_CFLAGS@
+PLATFORM_LIBS = @PLATFORM_LIBS@
+PYTHON_CFLAGS = @PYTHON_CFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SET_MAKE = @SET_MAKE@
+SHARED_FLAGS = @SHARED_FLAGS@
+SHELL = @SHELL@
+STLPORT_CFLAGS = @STLPORT_CFLAGS@
+STLPORT_LIBS = @STLPORT_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+noinst_HEADERS = OgreBspLevel.h \
+                 OgreBspNode.h \
+                 OgreBspPrerequisites.h \
+                 OgreBspResourceManager.h \
+                 OgreBspSceneManager.h \
+				 OgreBspSceneNode.h \
+                 OgreQuake3Level.h \
+                 OgreQuake3Shader.h \
+                 OgreQuake3ShaderManager.h \
+                 OgreQuake3Types.h
+
+subdir = PlugIns/BSPSceneManager/include
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/OgreMain/include/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  PlugIns/BSPSceneManager/include/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+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; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS:  $(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; } \
+	       END { 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
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    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 $(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_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(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 mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool ctags distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am info \
+	info-am install install-am install-data install-data-am \
+	install-exec install-exec-am install-info install-info-am \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags uninstall uninstall-am uninstall-info-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:
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingResourceManager.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingResourceManager.h	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingResourceManager.h	(revision 12)
@@ -0,0 +1,98 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright © 2000-2002 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _OcclusionCullingResourceManager_H__
+#define _OcclusionCullingResourceManager_H__
+
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+    /** Manages the locating and loading of BSP-based indoor levels.
+    Like other ResourceManager specialisations it manages the location and loading
+    of a specific type of resource, in this case files containing Binary
+    Space Partition (BSP) based level files e.g. Quake3 levels.</p>
+    However, note that unlike other ResourceManager implementations,
+    only 1 BspLevel resource is allowed to be loaded at one time. Loading
+    another automatically unloads the currently loaded level if any.
+    */
+    class OcclusionCullingResourceManager : public ResourceManager, public Singleton<OcclusionCullingResourceManager>
+    {
+    public:
+        OcclusionCullingResourceManager();
+        ~OcclusionCullingResourceManager();
+
+        /** Loads a BSP-based level from the named file.
+            Currently only supports loading of Quake3 .bsp files.
+        */
+    //    BspLevel* load( const String& filename, int priority = 1);
+
+
+        /** Creates a BspLevel resource - mainly used internally. */
+      //  Resource* create( const String& name);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static OcclusionCullingResourceManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static OcclusionCullingResourceManager* getSingletonPtr(void);
+
+
+    protected:
+        // Singleton managed by this class
+       // Quake3ShaderManager *mShaderMgr;
+
+    };
+
+}
+
+#endif
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreSolidHalfBoundingBox.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreSolidHalfBoundingBox.h	(revision 54)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreSolidHalfBoundingBox.h	(revision 54)
@@ -0,0 +1,47 @@
+#ifndef _SolidHalfBoundingBox_H__
+#define _SolidHalfBoundingBox_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreWireBoundingBox.h"
+
+namespace Ogre {
+
+    /** Allows the rendering of one half of a solid bounding box.
+        @remarks
+            This class builds a wireframe renderable from a given aabb. A pointer to this class can be
+			added to a render queue to display the bounding box of an object.
+    */
+	class SolidHalfBoundingBox : public WireBoundingBox
+	{
+	public:
+
+		SolidHalfBoundingBox( bool isFirstHalf );
+		void setupBoundingBox( const AxisAlignedBox& aabb );
+		/** Override this method to prevent parent transforms (rotation,translation,scale)
+		and to make it public.
+        */
+		void getWorldTransforms( Matrix4* xform ) const;
+
+    protected:
+       
+        /** Builds the wireframe line list.
+		@param the axis aligned bounding box for setting up the list.
+        */
+		void setupBoundingBoxVertices( const AxisAlignedBox& aab );
+		/** 
+			Sets the material used for occlusion queries. 
+			@remarks the material is called "OcclusionQuery" and
+			uses no lighting, no depth write, and no colours
+		*/
+		void setOcclusionQueryMaterial( void );
+		/** Whether this half box is the first or the second half of the bounding box. 
+		*/
+		bool mIsFirstHalf;	
+	};
+
+}// namespace
+
+#endif
+
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h	(revision 38)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h	(revision 38)
@@ -0,0 +1,56 @@
+#ifndef _OcclusionCullingSceneManager_H__
+#define _OcclusionCullingSceneManager_H__
+
+#include "OgreSceneNode.h"
+#include "OgreSceneManager.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+#include "OgrePrerequisites.h"
+#include "OgreSolidHalfBoundingBox.h"
+#include <queue>
+
+using namespace std;
+
+namespace Ogre {
+	
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingSceneManager : public SceneManager
+	{
+	public:
+		OcclusionCullingSceneManager();
+		~OcclusionCullingSceneManager();
+	
+		/** Overriden from SceneManager. Renders the scene with the specified algorithm
+		/**
+			The algorithm is one of
+			RENDER_CULL_FRUSTUM: renders the scene with view frustum culling only
+			RENDER_STOP_AND_WAIT: renders the scene with the hierarchical stop and wait algorithm
+			RENDER_COHERENT: renders the scene with the coherent hierarchical algorithm
+		*/
+		void _renderVisibleObjects(void);
+		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+		void _updateSceneGraph(Camera* cam);
+
+		/** Sets the given option for the SceneManager
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		virtual bool setOption( const String &, const void * );
+		/** Gets the given option for the Scene Manager.
+	        @remarks
+		    See setOption
+		*/
+		virtual bool getOption( const String &, void * );
+
+		bool getOptionValues( const String & key, StringVector &refValueList );
+		bool getOptionKeys( StringVector &refKeys );
+
+	protected:
+		
+		OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser;
+	};
+
+}
+#endif // OCCLUSIONCULLINGSCENEMANAGER_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/Makefile.am
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/Makefile.am	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/Makefile.am	(revision 12)
@@ -0,0 +1,10 @@
+noinst_HEADERS = OgreBspLevel.h \
+                 OgreBspNode.h \
+                 OgreBspPrerequisites.h \
+                 OgreBspResourceManager.h \
+                 OgreBspSceneManager.h \
+				 OgreBspSceneNode.h \
+                 OgreQuake3Level.h \
+                 OgreQuake3Shader.h \
+                 OgreQuake3ShaderManager.h \
+                 OgreQuake3Types.h
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingOctreeSceneManager.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingOctreeSceneManager.h	(revision 51)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingOctreeSceneManager.h	(revision 51)
@@ -0,0 +1,54 @@
+#ifndef _OcclusionCullingOctreeSceneManager_H__
+#define _OcclusionCullingOctreeSceneManager_H__
+
+#include <OgreSceneNode.h>
+#include <OgreOctreeSceneManager.h>
+#include <OgreOctreeNode.h>
+#include <OgreOctreeCamera.h>
+
+#include "OgrePrerequisites.h"
+#include "OgreOcclusionCullingOctreeSceneTraverser.h"
+
+using namespace std;
+
+namespace Ogre {
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingOctreeSceneManager: public OctreeSceneManager
+	{
+	public:
+		OcclusionCullingOctreeSceneManager();
+		~OcclusionCullingOctreeSceneManager();
+	
+		void _renderVisibleObjects(void);
+		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+		void _updateSceneGraph(Camera* cam);
+
+		/** Sets the given option for the SceneManager
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		
+		virtual bool setOption( const String &, const void * );
+		/** Gets the given option for the Scene Manager.
+	        @remarks
+		    See setOption
+		*/
+		virtual bool getOption( const String &, void * );
+
+		bool getOptionValues( const String & key, StringVector &refValueList );
+		bool getOptionKeys( StringVector &refKeys );
+
+	protected:
+		/** Recursively counts octree size (i.e., number of octree instances)
+		@param root current octree
+		*/
+		//unsigned int countOctreeSize(Octree *root);
+
+		OcclusionCullingOctreeSceneTraverser *mOcclusionCullingOctreeSceneTraverser;
+	};
+
+}
+#endif // OcclusionCullingTerrainSceneManager_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneTraverser.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneTraverser.h	(revision 52)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneTraverser.h	(revision 52)
@@ -0,0 +1,184 @@
+#ifndef _OcclusionCullingSceneTraverser_H__
+#define _OcclusionCullingSceneTraverser_H__
+
+#include "OgreSceneNode.h"
+#include "OgreSceneManager.h"
+#include "OgrePrerequisites.h"
+#include "OgreSolidHalfBoundingBox.h"
+#include "OgreCamera.h"
+#include "OgreRenderSystem.h"
+#include <queue>
+
+using namespace std;
+
+namespace Ogre {
+	/**
+		This class implements the compare operator for the priority queue.
+		a lower distance has a higher value in the queue
+	*/
+	template <typename T> class myless
+	{
+	public:
+		myless(Camera *cam) { mCamera = cam; }
+		//bool operator() (HierarchyNode *v1, HierarchyNode *v2) const
+		bool operator() (T v1, T v2) const
+		{
+			return v1->getSquaredViewDepth(mCamera) > v2->getSquaredViewDepth(mCamera);
+		}
+	private:
+		Camera *mCamera;
+	};
+
+	typedef pair<SceneNode *, HardwareOcclusionQuery *> QueryPair;
+	typedef priority_queue<SceneNode *, vector<SceneNode *>, myless<vector<SceneNode *>::value_type> > PriorityQueue;
+	typedef queue<QueryPair> QueryQueue;
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingSceneTraverser
+	{
+	public:
+		/** Construction taking the current scene manager and the current rendersystem as argument
+		@param sm current scene manager
+		@param rsys current render system 
+		*/
+		OcclusionCullingSceneTraverser(SceneManager *sm, RenderSystem *rsys);
+		~OcclusionCullingSceneTraverser();
+	
+		enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES};
+		
+		/** Renders the scene with the specified algorithm
+			@comment 
+			The algorithm type can be set with the parameter "Algorithm" and setOption.
+
+			The algorithm is one of:
+			RENDER_CULL_FRUSTUM: renders the scene with view frustum culling only
+			RENDER_STOP_AND_WAIT: renders the scene with the hierarchical stop and wait algorithm
+			RENDER_COHERENT: renders the scene with the coherent hierarchical algorithm
+			
+			@param cam current camera
+		*/
+		void renderScene( Camera *cam );
+	
+		/** Sets the given option for the scene traverser.
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		bool setOption( const String &, const void * );
+		/** Gets the given option for the scene traverser.
+	        @remarks
+		    See setOption
+		*/
+		bool getOption( const String &, void * );
+		bool getOptionKeys( StringVector &refKeys );
+		
+		/** Sets pointer to the current scene manager.
+		@param the scene manager */
+		void setSceneManager( SceneManager *sm );
+		
+		/** Sets pointer to the current render system 
+		@param the rendersystem */
+		void setRenderSystem( RenderSystem *rsys );
+		
+		/** Sets the current number of scene nodes in the scene.
+		@param num number of scene nodes
+		*/
+		void setNumSceneNodes(int num );
+
+		/** Sets the root of the scene hierarchy. */
+		void setSceneRoot(SceneNode *root);
+
+		/** Sets the required number of occlusion queries.
+		@param num number occlusion queries
+		*/
+		//void setNumQueries( int num );
+
+		/** Doing some necessary preprocessing.
+		@comment e.g., initialises occlusion queries */
+		//void preprocess( void );
+
+	protected:
+		/** query mode (= without color) or RENDER_MODE */
+		enum {MODE_QUERY, MODE_RENDER};
+		/** returns true if node is leaf of the hierarchy */
+		bool isLeaf( SceneNode *node );
+		//HACK
+		//unsigned int countSceneNodes(SceneNode *node);
+		void traverseNode( Camera *cam, SceneNode *node );
+		/** Renders current scene node 
+		@param cam current camera
+		@param node current scene node to be rendered
+		*/
+		void renderSceneNode( Camera *cam, SceneNode *node);
+		/** Sets rendering mode, e.g. query mode or render mode*/
+		void setRenderingMode( int mode );
+		
+		
+		/** Renders the scene with view frustum culling only. */
+		virtual void renderCullFrustum( Camera *cam );
+		/** Renders the scene with the hierarchical stop and wait algorithm. */
+		virtual void renderStopAndWait( Camera *cam );
+		/** Renders the scene with the coherent hierarchical algorithm and the query queye. */
+		virtual void renderCoherentWithQueue( Camera *cam );
+
+		/** Issue a occlusion query for this node. 
+		@param box the axis aligned bounding box of the node
+		@wasVisible if the node was visible in previous frame
+		*/
+		HardwareOcclusionQuery *issueOcclusionQuery( AxisAlignedBox *box, bool wasVisible );
+		/** Returns next available occlusion query or creates new one.
+		@return the next occlusion query
+		*/
+		HardwareOcclusionQuery *getNextOcclusionQuery(void);
+		/** Pulls up the visibility from the child node. 
+		@param the child node 
+		*/
+		void pullUpVisibility(SceneNode *node);
+		/** delete all previously defined occlusion queries */
+		void deleteQueries();
+		/** Renders bounding box of specified node.
+		@param box the bounding box of the scene node to be rendered */
+		void renderBoundingBox( AxisAlignedBox *box );
+		/** Returns one half of the bounding box.
+		@param half the half index of the bouding box (0 or 1)
+		*/
+		SolidHalfBoundingBox *getSolidHalfBoundingBox( int half );
+
+		/** Initialises the distance queue. */
+		virtual void initDistanceQueue(Camera *cam);
+		
+		std::vector<HardwareOcclusionQuery *> mOcclusionQueries;
+		// two halfes of a aabb
+		SolidHalfBoundingBox *mHalfBoundingBox[2];	
+
+		int mCurrentAlgorithm;
+
+		unsigned int mFrameId;
+		unsigned int mVisibilityThreshold;
+		
+		SceneManager *mSceneManager;
+		RenderSystem *mRenderSystem;
+	
+		int mCurrentTestIdx;
+		int mQueryMode;
+
+		unsigned int mNumQueries;
+
+		//--- statistics
+		unsigned int mNumSceneNodes;
+		unsigned int mNumTraversedNodes;
+		unsigned int mNumQueryCulledNodes;
+		unsigned int mNumFrustumCulledNodes;
+		unsigned int mNumRenderedGeometry;
+		unsigned int mNumRenderedNodes;
+		
+	private:
+		// the scene root
+		SceneNode *mSceneRoot;
+		// we use a priority queue ordered by distance
+		PriorityQueue *mDistanceQueue; 
+	};
+
+}
+#endif // OCCLUSIONCULLINGSCENEMANAGER_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingOctreeSceneTraverser.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingOctreeSceneTraverser.h	(revision 52)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingOctreeSceneTraverser.h	(revision 52)
@@ -0,0 +1,90 @@
+#ifndef _OcclusionCullingOctreeSceneTraverser_H__
+#define _OcclusionCullingOctreeSceneTraverser_H__
+
+#include "OgreOctree.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+using namespace std;
+
+namespace Ogre {
+	/**
+		This class implements the compare operator for the priority queue
+		especially for octree hierarchies using getCullBounds for bounding
+		box computation. A lower distance has a higher value in the queue.
+	*/
+	template <typename T> class octreeless 
+	{
+	public:
+		octreeless(Camera *cam) { mCamera = cam; }
+		
+		bool operator() (T v1, T v2) const
+		{
+			AxisAlignedBox box1, box2;
+			v1->_getCullBounds(&box1);
+			v2->_getCullBounds(&box2);
+
+			return getSquaredViewDepth(mCamera, &box1) > getSquaredViewDepth(mCamera, &box2);
+		}
+
+	private:
+		Real getSquaredViewDepth(const Ogre::Camera* cam, const Ogre::AxisAlignedBox* box) const
+		{
+			Vector3 mid  = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum();
+			return (cam->getDerivedPosition() - mid).squaredLength();                                                                   
+		}
+
+		Camera *mCamera;
+		//AxisAlignedBox mBox1, mBox2;
+		//Ogre::Vector3 min, max, mid, dist;
+	};
+
+	typedef pair<Octree *, HardwareOcclusionQuery *> OctreeQueryPair;
+	typedef priority_queue<Octree *, vector<Octree *>, octreeless<vector<Octree *>::value_type> > OctreePriorityQueue;
+	typedef queue<OctreeQueryPair> OctreeQueryQueue;
+
+	class OcclusionCullingOctreeSceneTraverser: public OcclusionCullingSceneTraverser
+	{
+	public:
+		OcclusionCullingOctreeSceneTraverser(SceneManager *sm, RenderSystem *rsys);
+		~OcclusionCullingOctreeSceneTraverser();
+		//void renderScene( Camera *cam );
+		void setSceneRoot(Octree *root);
+		/** Sets the number of nodes in this octree 
+		@remark do not confuse this with the OctreeNode class 
+		which is derived from SceneNode
+		@param num number of nodes in the octree
+		*/
+		void setNumOctreeNodes( unsigned int num );
+	
+		/** Gets the given option for the scene traverser.
+	        @remarks
+		    See setOption
+		*/
+		bool getOption( const String &, void * );
+		bool getOptionKeys( StringVector &refKeys );
+		
+	protected:
+		/** Renders the scene with view frustum culling only. */
+		void renderCullFrustum( Camera *cam );
+		/** Renders the scene with the hierarchical stop and wait algorithm. */
+		void renderStopAndWait( Camera *cam );
+		/** Renders the scene with the coherent hierarchical algorithm and the query queye. */
+		void renderCoherentWithQueue( Camera *cam );
+		/** Issue a occlusion query for this node. */
+		
+		void initDistanceQueue(Camera *cam);
+		void pullUpVisibility(Octree *octree);
+		void traverseOctant(Camera *cam, Octree *octant);
+		void renderOctant(Camera *cam, Octree *octant);
+		bool isLeaf(Octree *octant);
+
+	private:
+		OctreePriorityQueue *mOctreeDistanceQueue;
+		// the octree root
+		Octree *mOctreeSceneRoot;
+
+		unsigned int mNumOctreeNodes;
+	};
+
+}
+#endif // OcclusionCullingOctreeSceneTraverser_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h	(revision 51)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h	(revision 51)
@@ -0,0 +1,52 @@
+#ifndef _OcclusionCullingTerrainSceneManager_H__
+#define _OcclusionCullingTerrainSceneManager_H__
+
+#include <OgreSceneNode.h>
+#include <OgreOctreeSceneManager.h>
+#include <OgreTerrainSceneManager.h>
+#include <OgreOctreeSceneQuery.h>
+#include <OgreOctreeNode.h>
+#include <OgreOctreeCamera.h>
+
+#include "OgrePrerequisites.h"
+#include "OgreOcclusionCullingOctreeSceneTraverser.h"
+
+using namespace std;
+
+namespace Ogre {
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingTerrainSceneManager: public TerrainSceneManager
+	{
+	public:
+		OcclusionCullingTerrainSceneManager();
+		~OcclusionCullingTerrainSceneManager();
+	
+		void _renderVisibleObjects(void);
+		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+		void _updateSceneGraph(Camera* cam);
+
+		/** Sets the given option for the SceneManager
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		
+		virtual bool setOption( const String &, const void * );
+		/** Gets the given option for the Scene Manager.
+	        @remarks
+		    See setOption
+		*/
+		virtual bool getOption( const String &, void * );
+
+		bool getOptionValues( const String & key, StringVector &refValueList );
+		bool getOptionKeys( StringVector &refKeys );
+
+	protected:
+
+		OcclusionCullingOctreeSceneTraverser *mOcclusionCullingOctreeSceneTraverser;
+	};
+
+}
+#endif // OcclusionCullingTerrainSceneManager_H
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxmlerror.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxmlerror.cpp	(revision 37)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxmlerror.cpp	(revision 37)
@@ -0,0 +1,50 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+// The goal of the seperate error file is to make the first
+// step towards localization. tinyxml (currently) only supports
+// latin-1, but at least the error messages could now be translated.
+//
+// It also cleans up the code a bit.
+//
+
+const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+{
+	"No error",
+	"Error",
+	"Failed to open file",
+	"Memory allocation failed.",
+	"Error parsing Element.",
+	"Failed to read Element name",
+	"Error reading Element value.",
+	"Error reading Attributes.",
+	"Error: empty tag.",
+	"Error reading end tag.",
+	"Error parsing Unknown.",
+	"Error parsing Comment.",
+	"Error parsing Declaration.",
+	"Error document empty."
+};
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinystr.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinystr.h	(revision 37)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinystr.h	(revision 37)
@@ -0,0 +1,228 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this 
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+*/
+
+#include "tinyxml.h"
+
+
+#ifndef TIXML_USE_STL
+
+#ifndef TIXML_STRING_INCLUDED
+#define TIXML_STRING_INCLUDED
+
+#pragma warning( disable : 4514 )
+
+#include <assert.h>
+
+/*
+   TiXmlString is an emulation of the std::string template.
+   Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
+   Only the member functions relevant to the TinyXML project have been implemented.
+   The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
+   a string and there's no more room, we allocate a buffer twice as big as we need.
+*/
+class TiXmlString
+{
+  public :
+    // TiXmlString constructor, based on a string
+    TiXmlString (const char * instring);
+
+    // TiXmlString empty constructor
+    TiXmlString ()
+    {
+        allocated = 0;
+        cstring = NULL;
+    }
+
+    // TiXmlString copy constructor
+    TiXmlString (const TiXmlString& copy);
+
+    // TiXmlString destructor
+    ~ TiXmlString ()
+    {
+        empty_it ();
+    }
+
+    // Convert a TiXmlString into a classical char *
+    const char * c_str () const
+    {
+        if (allocated)
+            return cstring;
+        return "";
+    }
+
+    // Return the length of a TiXmlString
+    unsigned length () const;
+
+    // TiXmlString = operator
+    void operator = (const char * content);
+
+    // = operator
+    void operator = (const TiXmlString & copy);
+
+    // += operator. Maps to append
+    TiXmlString& operator += (const char * suffix)
+    {
+        append (suffix);
+		return *this;
+    }
+
+    // += operator. Maps to append
+    TiXmlString& operator += (char single)
+    {
+        append (single);
+		return *this;
+    }
+
+    // += operator. Maps to append
+    TiXmlString& operator += (TiXmlString & suffix)
+    {
+        append (suffix);
+		return *this;
+    }
+    bool operator == (const TiXmlString & compare) const;
+    bool operator < (const TiXmlString & compare) const;
+    bool operator > (const TiXmlString & compare) const;
+
+    // Checks if a TiXmlString is empty
+    bool empty () const
+    {
+        return length () ? false : true;
+    }
+
+    // Checks if a TiXmlString contains only whitespace (same rules as isspace)
+	// Not actually used in tinyxml. Conflicts with a C macro, "isblank",
+	// which is a problem. Commenting out. -lee
+//    bool isblank () const;
+
+    // single char extraction
+    const char& at (unsigned index) const
+    {
+        assert( index < length ());
+        return cstring [index];
+    }
+
+    // find a char in a string. Return TiXmlString::notfound if not found
+    unsigned find (char lookup) const
+    {
+        return find (lookup, 0);
+    }
+
+    // find a char in a string from an offset. Return TiXmlString::notfound if not found
+    unsigned find (char tofind, unsigned offset) const;
+
+    /*	Function to reserve a big amount of data when we know we'll need it. Be aware that this
+		function clears the content of the TiXmlString if any exists.
+    */
+    void reserve (unsigned size)
+    {
+        empty_it ();
+        if (size)
+        {
+            allocated = size;
+            cstring = new char [size];
+            cstring [0] = 0;
+        }
+    }
+
+    // [] operator 
+    char& operator [] (unsigned index) const
+    {
+        assert( index < length ());
+        return cstring [index];
+    }
+
+    // Error value for find primitive 
+    enum {	notfound = 0xffffffff,
+            npos = notfound };
+
+    void append (const char *str, int len );
+
+  protected :
+
+    // The base string
+    char * cstring;
+    // Number of chars allocated
+    unsigned allocated;
+
+    // New size computation. It is simplistic right now : it returns twice the amount
+    // we need
+    unsigned assign_new_size (unsigned minimum_to_allocate)
+    {
+        return minimum_to_allocate * 2;
+    }
+
+    // Internal function that clears the content of a TiXmlString
+    void empty_it ()
+    {
+        if (cstring)
+            delete [] cstring;
+        cstring = NULL;
+        allocated = 0;
+    }
+
+    void append (const char *suffix );
+
+    // append function for another TiXmlString
+    void append (const TiXmlString & suffix)
+    {
+        append (suffix . c_str ());
+    }
+
+    // append for a single char. This could be improved a lot if needed
+    void append (char single)
+    {
+        char smallstr [2];
+        smallstr [0] = single;
+        smallstr [1] = 0;
+        append (smallstr);
+    }
+
+} ;
+
+/* 
+   TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
+   Only the operators that we need for TinyXML have been developped.
+*/
+class TiXmlOutStream : public TiXmlString
+{
+public :
+    TiXmlOutStream () : TiXmlString () {}
+
+    // TiXmlOutStream << operator. Maps to TiXmlString::append
+    TiXmlOutStream & operator << (const char * in)
+    {
+        append (in);
+        return (* this);
+    }
+
+    // TiXmlOutStream << operator. Maps to TiXmlString::append
+    TiXmlOutStream & operator << (const TiXmlString & in)
+    {
+        append (in . c_str ());
+        return (* this);
+    }
+} ;
+
+#endif	// TIXML_STRING_INCLUDED
+#endif	// TIXML_USE_STL
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxmlparser.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxmlparser.cpp	(revision 37)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxmlparser.cpp	(revision 37)
@@ -0,0 +1,939 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and 
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+*/
+
+#include "tinyxml.h"
+#include <ctype.h>
+
+//#define DEBUG_PARSER
+
+// Note tha "PutString" hardcodes the same list. This
+// is less flexible than it appears. Changing the entries
+// or order will break putstring.	
+TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = 
+{
+	{ "&amp;",  5, '&' },
+	{ "&lt;",   4, '<' },
+	{ "&gt;",   4, '>' },
+	{ "&quot;", 6, '\"' },
+	{ "&apos;", 6, '\'' }
+};
+
+
+const char* TiXmlBase::SkipWhiteSpace( const char* p )
+{
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+	while ( p && *p )
+	{
+		if ( isspace( *p ) || *p == '\n' || *p =='\r' )		// Still using old rules for white space.
+			++p;
+		else
+			break;
+	}
+
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+/*static*/ bool TiXmlBase::StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	for( ;; )
+	{
+		if ( !in->good() ) return false;
+
+		int c = in->peek();
+		if ( !IsWhiteSpace( c ) )
+			return true;
+		*tag += in->get();
+	}
+}
+
+/*static*/ bool TiXmlBase::StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();
+		if ( c == character )
+			return true;
+
+		in->get();
+		*tag += c;
+	}
+	return false;
+}
+#endif
+
+const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name )
+{
+	*name = "";
+	assert( p );
+
+	// Names start with letters or underscores.
+	// After that, they can be letters, underscores, numbers,
+	// hyphens, or colons. (Colons are valid ony for namespaces,
+	// but tinyxml can't tell namespaces from names.)
+	if (    p && *p 
+		 && ( isalpha( (unsigned char) *p ) || *p == '_' ) )
+	{
+		while(		p && *p
+				&&	(		isalnum( (unsigned char ) *p ) 
+						 || *p == '_'
+						 || *p == '-'
+						 || *p == ':' ) )
+		{
+			(*name) += *p;
+			++p;
+		}
+		return p;
+	}
+	return 0;
+}
+
+const char* TiXmlBase::GetEntity( const char* p, char* value )
+{
+	// Presume an entity, and pull it out.
+    TIXML_STRING ent;
+	int i;
+
+	// Ignore the &#x entities.
+	if (    strncmp( "&#x", p, 3 ) == 0 
+	     && *(p+3) 
+		 && *(p+4) )
+	{
+		*value = 0;
+		
+		if ( isalpha( *(p+3) ) ) *value += ( tolower( *(p+3) ) - 'a' + 10 ) * 16;
+		else				     *value += ( *(p+3) - '0' ) * 16;
+
+		if ( isalpha( *(p+4) ) ) *value += ( tolower( *(p+4) ) - 'a' + 10 );
+		else				     *value += ( *(p+4) - '0' );
+
+		return p+6;
+	}
+
+	// Now try to match it.
+	for( i=0; i<NUM_ENTITY; ++i )
+	{
+		if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
+		{
+			assert( strlen( entity[i].str ) == entity[i].strLength );
+			*value = entity[i].chr;
+			return ( p + entity[i].strLength );
+		}
+	}
+
+	// So it wasn't an entity, its unrecognized, or something like that.
+	*value = *p;	// Don't put back the last one, since we return it!
+	return p+1;
+}
+
+
+bool TiXmlBase::StringEqual( const char* p,
+							 const char* tag,
+							 bool ignoreCase )
+{
+	assert( p );
+	if ( !p || !*p )
+	{
+		assert( 0 );
+		return false;
+	}
+
+    if ( tolower( *p ) == tolower( *tag ) )
+	{
+		const char* q = p;
+
+		if (ignoreCase)
+		{
+			while ( *q && *tag && *q == *tag )
+			{
+				++q;
+				++tag;
+			}
+
+			if ( *tag == 0 )		// Have we found the end of the tag, and everything equal?
+			{
+				return true;
+			}
+		}
+		else
+		{
+			while ( *q && *tag && tolower( *q ) == tolower( *tag ) )
+			{
+				++q;
+				++tag;
+			}
+
+			if ( *tag == 0 )
+			{
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+const char* TiXmlBase::ReadText(	const char* p, 
+									TIXML_STRING * text, 
+									bool trimWhiteSpace, 
+									const char* endTag, 
+									bool caseInsensitive )
+{
+    *text = "";
+	if (    !trimWhiteSpace			// certain tags always keep whitespace
+		 || !condenseWhiteSpace )	// if true, whitespace is always kept
+	{
+		// Keep all the white space.
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive )
+			  )
+		{
+			char c;
+			p = GetChar( p, &c );
+            (* text) += c;
+		}
+	}
+	else
+	{
+		bool whitespace = false;
+
+		// Remove leading white space:
+		p = SkipWhiteSpace( p );
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive ) )
+		{
+			if ( *p == '\r' || *p == '\n' )
+			{
+				whitespace = true;
+				++p;
+			}
+			else if ( isspace( *p ) )
+			{
+				whitespace = true;
+				++p;
+			}
+			else
+			{
+				// If we've found whitespace, add it before the
+				// new character. Any whitespace just becomes a space.
+				if ( whitespace )
+				{
+               (* text) += ' ';
+					whitespace = false;
+				}
+				char c;
+				p = GetChar( p, &c );
+            (* text) += c;
+			}
+		}
+	}
+	return p + strlen( endTag );
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	// The basic issue with a document is that we don't know what we're
+	// streaming. Read something presumed to be a tag (and hope), then
+	// identify it, and call the appropriate stream method on the tag.
+	//
+	// This "pre-streaming" will never read the closing ">" so the
+	// sub-tag can orient itself.
+
+	if ( !StreamTo( in, '<', tag ) ) 
+	{
+		SetError( TIXML_ERROR_PARSING_EMPTY );
+		return;
+	}
+
+	while ( in->good() )
+	{
+		size_t tagIndex = tag->length();
+		while ( in->good() && in->peek() != '>' )
+		{
+			int c = in->get();
+			(*tag) += (char) c;
+		}
+
+		if ( in->good() )
+		{
+			// We now have something we presume to be a node of 
+			// some sort. Identify it, and call the node to
+			// continue streaming.
+			TiXmlNode* node = Identify( tag->c_str() + tagIndex );
+
+			if ( node )
+			{
+				node->StreamIn( in, tag );
+				bool isElement = node->ToElement() != 0;
+				delete node;
+				node = 0;
+
+				// If this is the root element, we're done. Parsing will be
+				// done by the >> operator.
+				if ( isElement )
+				{
+					return;
+				}
+			}
+			else
+			{
+				SetError( TIXML_ERROR );
+				return;
+			}
+		}
+	}
+	// We should have returned sooner.
+	SetError( TIXML_ERROR );
+}
+
+#endif
+
+const char* TiXmlDocument::Parse( const char* p )
+{
+	// Parse away, at the document level. Since a document
+	// contains nothing but other tags, most of what happens
+	// here is skipping white space.
+	//
+	// In this variant (as opposed to stream and Parse) we
+	// read everything we can.
+
+
+	if ( !p || !*p )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
+		return false;
+	}
+
+    p = SkipWhiteSpace( p );
+	if ( !p )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
+		return false;
+	}
+
+	while ( p && *p )
+	{
+		TiXmlNode* node = Identify( p );
+		if ( node )
+		{
+			p = node->Parse( p );
+			LinkEndChild( node );
+		}
+		else
+		{
+			break;
+		}
+		p = SkipWhiteSpace( p );
+	}
+	// All is well.
+	return p;
+}
+
+
+TiXmlNode* TiXmlNode::Identify( const char* p )
+{
+	TiXmlNode* returnNode = 0;
+
+	p = SkipWhiteSpace( p );
+	if( !p || !*p || *p != '<' )
+	{
+		return 0;
+	}
+
+	TiXmlDocument* doc = GetDocument();
+	p = SkipWhiteSpace( p );
+
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+
+	// What is this thing? 
+	// - Elements start with a letter or underscore, but xml is reserved.
+	// - Comments: <!--
+	// - Decleration: <?xml
+	// - Everthing else is unknown to tinyxml.
+	//
+
+	const char* xmlHeader = { "<?xml" };
+	const char* commentHeader = { "<!--" };
+
+	if ( StringEqual( p, xmlHeader, true ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Declaration\n" );
+		#endif
+		returnNode = new TiXmlDeclaration();
+	}
+	else if (    isalpha( *(p+1) )
+			  || *(p+1) == '_' )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Element\n" );
+		#endif
+		returnNode = new TiXmlElement( "" );
+	}
+	else if ( StringEqual( p, commentHeader, false ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Comment\n" );
+		#endif
+		returnNode = new TiXmlComment();
+	}
+	else
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Unknown\n" );
+		#endif
+		returnNode = new TiXmlUnknown();
+	}
+
+	if ( returnNode )
+	{
+		// Set the parent, so it can report errors
+		returnNode->parent = this;
+		//p = returnNode->Parse( p );
+	}
+	else
+	{
+		if ( doc )
+			doc->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+	return returnNode;
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
+{
+	// We're called with some amount of pre-parsing. That is, some of "this"
+	// element is in "tag". Go ahead and stream to the closing ">"
+	while( in->good() )
+	{
+		int c = in->get();
+		(*tag) += (char) c ;
+		
+		if ( c == '>' )
+			break;
+	}
+
+	if ( tag->length() < 3 ) return;
+
+	// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
+	// If not, identify and stream.
+
+	if (    tag->at( tag->length() - 1 ) == '>' 
+		 && tag->at( tag->length() - 2 ) == '/' )
+	{
+		// All good!
+		return;
+	}
+	else if ( tag->at( tag->length() - 1 ) == '>' )
+	{
+		// There is more. Could be:
+		//		text
+		//		closing tag
+		//		another node.
+		for ( ;; )
+		{
+			StreamWhiteSpace( in, tag );
+
+			// Do we have text?
+			if ( in->peek() != '<' )
+			{
+				// Yep, text.
+				TiXmlText text( "" );
+				text.StreamIn( in, tag );
+
+				// What follows text is a closing tag or another node.
+				// Go around again and figure it out.
+				continue;
+			}
+
+			// We now have either a closing tag...or another node.
+			// We should be at a "<", regardless.
+			if ( !in->good() ) return;
+			assert( in->peek() == '<' );
+			size_t tagIndex = tag->length();
+
+			bool closingTag = false;
+			bool firstCharFound = false;
+
+			for( ;; )
+			{
+				if ( !in->good() )
+					return;
+
+				int c = in->peek();
+				
+				if ( c == '>' )
+					break;
+
+				*tag += c;
+				in->get();
+
+				if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
+				{
+					firstCharFound = true;
+					if ( c == '/' )
+						closingTag = true;
+				}
+			}
+			// If it was a closing tag, then read in the closing '>' to clean up the input stream.
+			// If it was not, the streaming will be done by the tag.
+			if ( closingTag )
+			{
+				int c = in->get();
+				assert( c == '>' );
+				*tag += c;
+
+				// We are done, once we've found our closing tag.
+				return;
+			}
+			else
+			{
+				// If not a closing tag, id it, and stream.
+				const char* tagloc = tag->c_str() + tagIndex;
+				TiXmlNode* node = Identify( tagloc );
+				if ( !node )
+					return;
+				node->StreamIn( in, tag );
+				delete node;
+				node = 0;
+
+				// No return: go around from the beginning: text, closing tag, or node.
+			}
+		}
+	}
+}
+#endif
+
+const char* TiXmlElement::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	TiXmlDocument* document = GetDocument();
+
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT );
+		return false;
+	}
+
+	p = SkipWhiteSpace( p+1 );
+
+	// Read the name.
+    p = ReadName( p, &value );
+	if ( !p || !*p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME );
+		return false;
+	}
+
+    TIXML_STRING endTag ("</");
+	endTag += value;
+	endTag += ">";
+
+	// Check for and read attributes. Also look for an empty
+	// tag or an end tag.
+	while ( p && *p )
+	{
+		p = SkipWhiteSpace( p );
+		if ( !p || !*p )
+		{
+			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+			return 0;
+		}
+		if ( *p == '/' )
+		{
+			++p;
+			// Empty tag.
+			if ( *p  != '>' )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY );		
+				return 0;
+			}
+			return (p+1);
+		}
+		else if ( *p == '>' )
+		{
+			// Done with attributes (if there were any.)
+			// Read the value -- which can include other
+			// elements -- read the end tag, and return.
+			++p;
+			p = ReadValue( p );		// Note this is an Element method, and will set the error if one happens.
+			if ( !p || !*p )
+				return 0;
+
+			// We should find the end tag now
+			if ( StringEqual( p, endTag.c_str(), false ) )
+			{
+				p += endTag.length();
+				return p;
+			}
+			else
+			{
+				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG );
+				return 0;
+			}
+		}
+		else
+		{
+			// Try to read an element:
+			TiXmlAttribute attrib;
+			attrib.SetDocument( document );
+			p = attrib.Parse( p );
+
+			if ( !p || !*p )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT );
+				return 0;
+			}
+			SetAttribute( attrib.Name(), attrib.Value() );
+		}
+	}
+	return p;
+}
+
+
+const char* TiXmlElement::ReadValue( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+
+	// Read in text and elements in any order.
+	p = SkipWhiteSpace( p );
+	while ( p && *p )
+	{
+		if ( *p != '<' )
+		{
+			// Take what we have, make a text element.
+			TiXmlText* textNode = new TiXmlText( "" );
+
+			if ( !textNode )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+				    return 0;
+			}
+
+			p = textNode->Parse( p );
+
+			if ( !textNode->Blank() )
+				LinkEndChild( textNode );
+			else
+				delete textNode;
+		} 
+		else 
+		{
+			// We hit a '<'
+			// Have we hit a new element or an end tag?
+			if ( StringEqual( p, "</", false ) )
+			{
+				return p;
+			}
+			else
+			{
+				TiXmlNode* node = Identify( p );
+				if ( node )
+				{
+					p = node->Parse( p );
+					LinkEndChild( node );
+				}				
+				else
+				{
+					return 0;
+				}
+			}
+		}
+		p = SkipWhiteSpace( p );
+	}
+
+	if ( !p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE );
+	}	
+	return p;
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();	
+		(*tag) += c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;		
+		}
+	}
+}
+#endif
+
+
+const char* TiXmlUnknown::Parse( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN );
+		return 0;
+	}
+	++p;
+    value = "";
+
+	while ( p && *p && *p != '>' )
+	{
+		value += *p;
+		++p;
+	}
+
+	if ( !p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_PARSING_UNKNOWN );
+	}
+	if ( *p == '>' )
+		return p+1;
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();	
+		(*tag) += c;
+
+		if ( c == '>' 
+			 && tag->at( tag->length() - 2 ) == '-'
+			 && tag->at( tag->length() - 3 ) == '-' )
+		{
+			// All is well.
+			return;		
+		}
+	}
+}
+#endif
+
+
+const char* TiXmlComment::Parse( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+	value = "";
+
+	p = SkipWhiteSpace( p );
+	const char* startTag = "<!--";
+	const char* endTag   = "-->";
+
+	if ( !StringEqual( p, startTag, false ) )
+	{
+		document->SetError( TIXML_ERROR_PARSING_COMMENT );
+		return 0;
+	}
+	p += strlen( startTag );
+	p = ReadText( p, &value, false, endTag, false );
+	return p;
+}
+
+
+const char* TiXmlAttribute::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p ) return 0;
+
+	// Read the name, the '=' and the value.
+	p = ReadName( p, &name );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p || *p != '=' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+
+	++p;	// skip '='
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+	
+	const char* end;
+
+	if ( *p == '\'' )
+	{
+		++p;
+		end = "\'";
+		p = ReadText( p, &value, false, end, false );
+	}
+	else if ( *p == '"' )
+	{
+		++p;
+		end = "\"";
+		p = ReadText( p, &value, false, end, false );
+	}
+	else
+	{
+		// All attribute values should be in single or double quotes.
+		// But this is such a common error that the parser will try
+		// its best, even without them.
+		value = "";
+		while (    p && *p										// existence
+				&& !isspace( *p ) && *p != '\n' && *p != '\r'	// whitespace
+				&& *p != '/' && *p != '>' )						// tag end
+		{
+			value += *p;
+			++p;
+		}
+	}
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();	
+		if ( c == '<' )
+			return;
+
+		(*tag) += c;
+		in->get();
+	}
+}
+#endif
+
+const char* TiXmlText::Parse( const char* p )
+{
+	value = "";
+
+	//TiXmlDocument* doc = GetDocument();
+	bool ignoreWhite = true;
+//	if ( doc && !doc->IgnoreWhiteSpace() ) ignoreWhite = false;
+
+	const char* end = "<";
+	p = ReadText( p, &value, ignoreWhite, end, false );
+	if ( p )
+		return p-1;	// don't truncate the '<'
+	return 0;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		(*tag) += c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+#endif
+
+const char* TiXmlDeclaration::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	// Find the beginning, find the end, and look for
+	// the stuff in-between.
+	TiXmlDocument* document = GetDocument();
+	if ( !p || !*p || !StringEqual( p, "<?xml", true ) )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION );
+		return 0;
+	}
+
+	p += 5;
+//	const char* start = p+5;
+//	const char* end  = strstr( start, "?>" );
+
+	version = "";
+	encoding = "";
+	standalone = "";
+
+	while ( p && *p )
+	{
+		if ( *p == '>' )
+		{
+			++p;
+			return p;
+		}
+
+		p = SkipWhiteSpace( p );
+		if ( StringEqual( p, "version", true ) )
+		{
+//			p += 7;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			version = attrib.Value();
+		}
+		else if ( StringEqual( p, "encoding", true ) )
+		{
+//			p += 8;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			encoding = attrib.Value();
+		}
+		else if ( StringEqual( p, "standalone", true ) )
+		{
+//			p += 10;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			standalone = attrib.Value();
+		}
+		else
+		{
+			// Read over whatever it is.
+			while( p && *p && *p != '>' && !isspace( *p ) )
+				++p;
+		}
+	}
+	return 0;
+}
+
+bool TiXmlText::Blank() const
+{
+	for ( unsigned i=0; i<value.length(); i++ )
+		if ( !isspace( value[i] ) )
+			return false;
+	return true;
+}
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxml.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxml.cpp	(revision 37)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxml.cpp	(revision 37)
@@ -0,0 +1,1108 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include <ctype.h>
+#include "tinyxml.h"
+
+bool TiXmlBase::condenseWhiteSpace = true;
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream )
+{
+	TIXML_STRING buffer;
+	PutString( str, &buffer );
+	(*stream) << buffer;
+}
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
+{
+	int i=0;
+
+	while( i<(int)str.length() )
+	{
+		int c = str[i];
+
+		if (    c == '&' 
+		     && i < ( (int)str.length() - 2 )
+			 && str[i+1] == '#'
+			 && str[i+2] == 'x' )
+		{
+			// Hexadecimal character reference.
+			// Pass through unchanged.
+			// &#xA9;	-- copyright symbol, for example.
+			while ( i<(int)str.length() )
+			{
+				outString->append( str.c_str() + i, 1 );
+				++i;
+				if ( str[i] == ';' )
+					break;
+			}
+		}
+		else if ( c == '&' )
+		{
+			outString->append( entity[0].str, entity[0].strLength );
+			++i;
+		}
+		else if ( c == '<' )
+		{
+			outString->append( entity[1].str, entity[1].strLength );
+			++i;
+		}
+		else if ( c == '>' )
+		{
+			outString->append( entity[2].str, entity[2].strLength );
+			++i;
+		}
+		else if ( c == '\"' )
+		{
+			outString->append( entity[3].str, entity[3].strLength );
+			++i;
+		}
+		else if ( c == '\'' )
+		{
+			outString->append( entity[4].str, entity[4].strLength );
+			++i;
+		}
+		else if ( c < 32 || c > 126 )
+		{
+			// Easy pass at non-alpha/numeric/symbol
+			// 127 is the delete key. Below 32 is symbolic.
+			char buf[ 32 ];
+			sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
+			outString->append( buf, strlen( buf ) );
+			++i;
+		}
+		else
+		{
+			char realc = (char) c;
+			outString->append( &realc, 1 );
+			++i;
+		}
+	}
+}
+
+
+TiXmlNode::TiXmlNode( NodeType _type )
+{
+	parent = 0;
+	type = _type;
+	firstChild = 0;
+	lastChild = 0;
+	prev = 0;
+	next = 0;
+	userData = 0;
+}
+
+
+TiXmlNode::~TiXmlNode()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}	
+}
+
+
+void TiXmlNode::Clear()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}	
+
+	firstChild = 0;
+	lastChild = 0;
+}
+
+
+TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
+{
+	node->parent = this;
+
+	node->prev = lastChild;
+	node->next = 0;
+
+	if ( lastChild )
+		lastChild->next = node;
+	else
+		firstChild = node;			// it was an empty list.
+
+	lastChild = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
+{
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+
+	return LinkEndChild( node );
+}
+
+
+TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
+{	
+	if ( !beforeThis || beforeThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+
+	node->next = beforeThis;
+	node->prev = beforeThis->prev;
+	if ( beforeThis->prev )
+	{
+		beforeThis->prev->next = node;
+	}
+	else
+	{
+		assert( firstChild == beforeThis );
+		firstChild = node;
+	}
+	beforeThis->prev = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
+{
+	if ( !afterThis || afterThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+
+	node->prev = afterThis;
+	node->next = afterThis->next;
+	if ( afterThis->next )
+	{
+		afterThis->next->prev = node;
+	}
+	else
+	{
+		assert( lastChild == afterThis );
+		lastChild = node;
+	}
+	afterThis->next = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
+{
+	if ( replaceThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = withThis.Clone();
+	if ( !node )
+		return 0;
+
+	node->next = replaceThis->next;
+	node->prev = replaceThis->prev;
+
+	if ( replaceThis->next )
+		replaceThis->next->prev = node;
+	else
+		lastChild = node;
+
+	if ( replaceThis->prev )
+		replaceThis->prev->next = node;
+	else
+		firstChild = node;
+
+	delete replaceThis;
+	node->parent = this;
+	return node;
+}
+
+
+bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
+{
+	if ( removeThis->parent != this )
+	{	
+		assert( 0 );
+		return false;
+	}
+
+	if ( removeThis->next )
+		removeThis->next->prev = removeThis->prev;
+	else
+		lastChild = removeThis->prev;
+
+	if ( removeThis->prev )
+		removeThis->prev->next = removeThis->next;
+	else
+		firstChild = removeThis->next;
+
+	delete removeThis;
+	return true;
+}
+
+TiXmlNode* TiXmlNode::FirstChild( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = firstChild; node; node = node->next )
+	{
+		if ( node->SValue() == TIXML_STRING( value ))
+			return node;
+	}
+	return 0;
+}
+
+TiXmlNode* TiXmlNode::LastChild( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = lastChild; node; node = node->prev )
+	{
+		if ( node->SValue() == TIXML_STRING (value))
+			return node;
+	}
+	return 0;
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild();
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling();
+	}
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( const char * val, TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild( val );
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling( val );
+	}
+}
+
+TiXmlNode* TiXmlNode::NextSibling( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = next; node; node = node->next )
+	{
+		if ( node->SValue() == TIXML_STRING (value))
+			return node;
+	}
+	return 0;
+}
+
+
+TiXmlNode* TiXmlNode::PreviousSibling( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = prev; node; node = node->prev )
+	{
+		if ( node->SValue() == TIXML_STRING (value))
+			return node;
+	}
+	return 0;
+}
+
+void TiXmlElement::RemoveAttribute( const char * name )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement() const
+{
+	TiXmlNode* node;
+
+	for (	node = FirstChild();
+	node;
+	node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement( const char * value ) const
+{
+	TiXmlNode* node;
+
+	for (	node = FirstChild( value );
+	node;
+	node = node->NextSibling( value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+TiXmlElement* TiXmlNode::NextSiblingElement() const
+{
+	TiXmlNode* node;
+
+	for (	node = NextSibling();
+	node;
+	node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+TiXmlElement* TiXmlNode::NextSiblingElement( const char * value ) const
+{
+	TiXmlNode* node;
+
+	for (	node = NextSibling( value );
+	node;
+	node = node->NextSibling( value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+
+TiXmlDocument* TiXmlNode::GetDocument() const
+{
+	const TiXmlNode* node;
+
+	for( node = this; node; node = node->parent )
+	{
+		if ( node->ToDocument() )
+			return node->ToDocument();
+	}
+	return 0;
+}
+
+
+TiXmlElement::TiXmlElement (const char * _value)
+: TiXmlNode( TiXmlNode::ELEMENT )
+{
+	firstChild = lastChild = 0;
+	value = _value;
+}
+
+TiXmlElement::~TiXmlElement()
+{
+	while( attributeSet.First() )
+	{
+		TiXmlAttribute* node = attributeSet.First();
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+// BEGIN OGRE CHANGES
+// USE STL ALONE
+#ifndef TIXML_USE_STL
+const char * TiXmlElement::Attribute( const char * name ) const
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+
+	if ( node )
+		return node->Value();
+
+	return 0;
+}
+
+
+const char * TiXmlElement::Attribute( const char * name, int* i ) const
+{
+	const char * s = Attribute( name );
+	if ( i )
+	{
+		if ( s )
+			*i = atoi( s );
+		else
+			*i = 0;
+	}
+	return s;
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, int val )
+{	
+	char buf[64];
+	sprintf( buf, "%d", val );
+	SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, const char * value )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		node->SetValue( value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( name, value );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+}
+
+#endif
+
+#ifdef TIXML_USE_STL
+
+const char * TiXmlElement::Attribute( const std::string& name ) const
+{
+	TiXmlAttribute* node = attributeSet.Find( name.c_str() );
+
+	if ( node )
+		return node->Value();
+
+	return 0;
+}
+
+
+const char * TiXmlElement::Attribute( const std::string& name, int* i ) const
+{
+	const char * s = Attribute( name );
+	if ( i )
+	{
+		if ( s )
+			*i = atoi( s );
+		else
+			*i = 0;
+	}
+	return s;
+}
+
+
+void TiXmlElement::SetAttribute( const std::string& name, int val )
+{	
+	char buf[64];
+	sprintf( buf, "%d", val );
+	SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const std::string& name, const std::string& value )
+{
+	TiXmlAttribute* node = attributeSet.Find( name.c_str() );
+	if ( node )
+	{
+		node->SetValue( value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( name, value );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+}
+
+#endif
+// END OGRE CHANGES
+void TiXmlElement::Print( FILE* cfile, int depth ) const
+{
+	int i;
+	for ( i=0; i<depth; i++ )
+	{
+		fprintf( cfile, "    " );
+	}
+
+	fprintf( cfile, "<%s", value.c_str() );
+
+	TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{
+		fprintf( cfile, " " );
+		attrib->Print( cfile, depth );
+	}
+
+	// There are 3 different formatting approaches:
+	// 1) An element without children is printed as a <foo /> node
+	// 2) An element with only a text child is printed as <foo> text </foo>
+	// 3) An element with children is printed on multiple lines.
+	TiXmlNode* node;
+	if ( !firstChild )
+	{
+		fprintf( cfile, " />" );
+	}
+	else if ( firstChild == lastChild && firstChild->ToText() )
+	{
+		fprintf( cfile, ">" );
+		firstChild->Print( cfile, depth + 1 );
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+	else
+	{
+		fprintf( cfile, ">" );
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+			if ( !node->ToText() )
+			{
+				fprintf( cfile, "\n" );
+			}
+			node->Print( cfile, depth+1 );
+		}
+		fprintf( cfile, "\n" );
+		for( i=0; i<depth; ++i )
+		fprintf( cfile, "    " );
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+}
+
+void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<" << value;
+
+	TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{	
+		(*stream) << " ";
+		attrib->StreamOut( stream );
+	}
+
+	// If this node has children, give it a closing tag. Else
+	// make it an empty tag.
+	TiXmlNode* node;
+	if ( firstChild )
+	{ 		
+		(*stream) << ">";
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+			node->StreamOut( stream );
+		}
+		(*stream) << "</" << value << ">";
+	}
+	else
+	{
+		(*stream) << " />";
+	}
+}
+
+TiXmlNode* TiXmlElement::Clone() const
+{
+	TiXmlElement* clone = new TiXmlElement( Value() );
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+
+	// Clone the attributes, then clone the children.
+	TiXmlAttribute* attribute = 0;
+	for(	attribute = attributeSet.First();
+	attribute;
+	attribute = attribute->Next() )
+	{
+		clone->SetAttribute( attribute->Name(), attribute->Value() );
+	}
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		clone->LinkEndChild( node->Clone() );
+	}
+	return clone;
+}
+
+
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	error = false;
+	//	ignoreWhiteSpace = true;
+}
+
+TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	//	ignoreWhiteSpace = true;
+	value = documentName;
+	error = false;
+}
+
+bool TiXmlDocument::LoadFile()
+{
+	if ( LoadFile( value.c_str() ) )
+		return true;
+
+	return false;
+}
+
+
+bool TiXmlDocument::SaveFile() const
+{
+	if ( SaveFile( value.c_str() ) )
+		return true;
+
+	return false;
+}
+
+bool TiXmlDocument::LoadFile( const char* filename )
+{
+	// Delete the existing data:
+	Clear();
+
+	// There was a really terrifying little bug here. The code:
+	//		value = filename
+	// in the STL case, cause the assignment method of the std::string to
+	// be called. What is strange, is that the std::string had the same
+	// address as it's c_str() method, and so bad things happen. Looks
+	// like a bug in the Microsoft STL implementation.
+	// See STL_STRING_BUG above.
+	// Fixed with the StringToBuffer class.
+	value = filename;
+
+	FILE* file = fopen( value.c_str (), "r" );
+
+	if ( file )
+	{
+		// Get the file size, so we can pre-allocate the string. HUGE speed impact.
+		long length = 0;
+		fseek( file, 0, SEEK_END );
+		length = ftell( file );
+		fseek( file, 0, SEEK_SET );
+
+		// Strange case, but good to handle up front.
+		if ( length == 0 )
+		{
+			fclose( file );
+			return false;
+		}
+
+		// If we have a file, assume it is all one big XML file, and read it in.
+		// The document parser may decide the document ends sooner than the entire file, however.
+		TIXML_STRING data;
+		data.reserve( length );
+
+		const int BUF_SIZE = 2048;
+		char buf[BUF_SIZE];
+
+		while( fgets( buf, BUF_SIZE, file ) )
+		{
+			data += buf;
+		}
+		fclose( file );
+
+		Parse( data.c_str() );
+		if (  !Error() )
+		{
+			return true;
+		}
+	}
+	SetError( TIXML_ERROR_OPENING_FILE );
+	return false;
+}
+
+bool TiXmlDocument::SaveFile( const char * filename ) const
+{
+	// The old c stuff lives on...
+	FILE* fp = fopen( filename, "w" );
+	if ( fp )
+	{
+		Print( fp, 0 );
+		fclose( fp );
+		return true;
+	}
+	return false;
+}
+
+
+TiXmlNode* TiXmlDocument::Clone() const
+{
+	TiXmlDocument* clone = new TiXmlDocument();
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	clone->error = error;
+	clone->errorDesc = errorDesc.c_str ();
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		clone->LinkEndChild( node->Clone() );
+	}
+	return clone;
+}
+
+
+void TiXmlDocument::Print( FILE* cfile, int depth ) const
+{
+	TiXmlNode* node;
+	for ( node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->Print( cfile, depth );
+		fprintf( cfile, "\n" );
+	}
+}
+
+void TiXmlDocument::StreamOut( TIXML_OSTREAM * out ) const
+{
+	TiXmlNode* node;
+	for ( node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->StreamOut( out );
+
+		// Special rule for streams: stop after the root element.
+		// The stream in code will only read one element, so don't
+		// write more than one.
+		if ( node->ToElement() )
+			break;
+	}
+}
+
+TiXmlAttribute* TiXmlAttribute::Next() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( next->value.empty() && next->name.empty() )
+		return 0;
+	return next;
+}
+
+
+TiXmlAttribute* TiXmlAttribute::Previous() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( prev->value.empty() && prev->name.empty() )
+		return 0;
+	return prev;
+}
+
+
+void TiXmlAttribute::Print( FILE* cfile, int /*depth*/ ) const
+{
+	TIXML_STRING n, v;
+
+	PutString( Name(), &n );
+	PutString( Value(), &v );
+
+	if (value.find ('\"') == TIXML_STRING::npos)
+		fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
+	else
+		fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
+}
+
+
+void TiXmlAttribute::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	if (value.find( '\"' ) != TIXML_STRING::npos)
+	{
+		PutString( name, stream );
+		(*stream) << "=" << "'";
+		PutString( value, stream );
+		(*stream) << "'";
+	}
+	else
+	{
+		PutString( name, stream );
+		(*stream) << "=" << "\"";
+		PutString( value, stream );
+		(*stream) << "\"";
+	}
+}
+
+void TiXmlAttribute::SetIntValue( int value )
+{
+	char buf [64];
+	sprintf (buf, "%d", value);
+	SetValue (buf);
+}
+
+void TiXmlAttribute::SetDoubleValue( double value )
+{
+	char buf [64];
+	sprintf (buf, "%lf", value);
+	SetValue (buf);
+}
+
+const int TiXmlAttribute::IntValue() const
+{
+	return atoi (value.c_str ());
+}
+
+const double  TiXmlAttribute::DoubleValue() const
+{
+	return atof (value.c_str ());
+}
+
+void TiXmlComment::Print( FILE* cfile, int depth ) const
+{
+	for ( int i=0; i<depth; i++ )
+	{
+		fputs( "    ", cfile );
+	}
+	fprintf( cfile, "<!--%s-->", value.c_str() );
+}
+
+void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<!--";
+	PutString( value, stream );
+	(*stream) << "-->";
+}
+
+TiXmlNode* TiXmlComment::Clone() const
+{
+	TiXmlComment* clone = new TiXmlComment();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+void TiXmlText::Print( FILE* cfile, int /*depth*/ ) const
+{
+	TIXML_STRING buffer;
+	PutString( value, &buffer );
+	fprintf( cfile, "%s", buffer.c_str() );
+}
+
+
+void TiXmlText::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	PutString( value, stream );
+}
+
+
+TiXmlNode* TiXmlText::Clone() const
+{	
+	TiXmlText* clone = 0;
+	clone = new TiXmlText( "" );
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+	const char * _encoding,
+	const char * _standalone )
+: TiXmlNode( TiXmlNode::DECLARATION )
+{
+	version = _version;
+	encoding = _encoding;
+	standalone = _standalone;
+}
+
+
+void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/ ) const
+{
+	fprintf (cfile, "<?xml ");
+
+	if ( !version.empty() )
+		fprintf (cfile, "version=\"%s\" ", version.c_str ());
+	if ( !encoding.empty() )
+		fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
+	if ( !standalone.empty() )
+		fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
+	fprintf (cfile, "?>");
+}
+
+void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<?xml ";
+
+	if ( !version.empty() )
+	{
+		(*stream) << "version=\"";
+		PutString( version, stream );
+		(*stream) << "\" ";
+	}
+	if ( !encoding.empty() )
+	{
+		(*stream) << "encoding=\"";
+		PutString( encoding, stream );
+		(*stream ) << "\" ";
+	}
+	if ( !standalone.empty() )
+	{
+		(*stream) << "standalone=\"";
+		PutString( standalone, stream );
+		(*stream) << "\" ";
+	}
+	(*stream) << "?>";
+}
+
+TiXmlNode* TiXmlDeclaration::Clone() const
+{	
+	TiXmlDeclaration* clone = new TiXmlDeclaration();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	clone->version = version;
+	clone->encoding = encoding;
+	clone->standalone = standalone;
+	return clone;
+}
+
+
+void TiXmlUnknown::Print( FILE* cfile, int depth ) const
+{
+	for ( int i=0; i<depth; i++ )
+		fprintf( cfile, "    " );
+	fprintf( cfile, "%s", value.c_str() );
+}
+
+void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<" << value << ">";		// Don't use entities hear! It is unknown.
+}
+
+TiXmlNode* TiXmlUnknown::Clone() const
+{
+	TiXmlUnknown* clone = new TiXmlUnknown();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+TiXmlAttributeSet::TiXmlAttributeSet()
+{
+	sentinel.next = &sentinel;
+	sentinel.prev = &sentinel;
+}
+
+
+TiXmlAttributeSet::~TiXmlAttributeSet()
+{
+	assert( sentinel.next == &sentinel );
+	assert( sentinel.prev == &sentinel );
+}
+
+
+void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
+{
+	assert( !Find( addMe->Name() ) );	// Shouldn't be multiply adding to the set.
+
+	addMe->next = &sentinel;
+	addMe->prev = sentinel.prev;
+
+	sentinel.prev->next = addMe;
+	sentinel.prev      = addMe;
+}
+
+void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node == removeMe )
+		{
+			node->prev->next = node->next;
+			node->next->prev = node->prev;
+			node->next = 0;
+			node->prev = 0;
+			return;
+		}
+	}
+	assert( 0 );		// we tried to remove a non-linked attribute.
+}
+
+TiXmlAttribute*	TiXmlAttributeSet::Find( const char * name ) const
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node->name == name )
+			return node;
+	}
+	return 0;
+}
+
+
+#ifdef TIXML_USE_STL	
+TIXML_ISTREAM & operator >> (TIXML_ISTREAM & in, TiXmlNode & base)
+{
+	TIXML_STRING tag;
+	tag.reserve( 8 * 1000 );
+	base.StreamIn( &in, &tag );
+
+	base.Parse( tag.c_str() );
+	return in;
+}
+#endif
+
+
+TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
+{
+	base.StreamOut (& out);
+	return out;
+}
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxml.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxml.h	(revision 37)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinyxml.h	(revision 37)
@@ -0,0 +1,956 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+
+#ifndef TINYXML_INCLUDED
+#define TINYXML_INCLUDED
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4530 )
+#pragma warning( disable : 4786 )
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+// Help out windows:
+#if defined( _DEBUG ) && !defined( DEBUG )
+#define DEBUG
+#endif
+
+#if defined( DEBUG ) && defined( _MSC_VER )
+#define NOMINMAX
+#include <windows.h>
+#define TIXML_LOG OutputDebugString
+#else
+#define TIXML_LOG printf
+#endif
+
+
+#ifdef TIXML_USE_STL
+	#include <string>
+    #include <iostream>
+	#define TIXML_STRING	std::string
+	#define TIXML_ISTREAM	std::istream
+	#define TIXML_OSTREAM	std::ostream
+#else
+	#include "tinystr.h"
+	#define TIXML_STRING	TiXmlString
+	#define TIXML_OSTREAM	TiXmlOutStream
+#endif
+
+class TiXmlDocument;
+class TiXmlElement;
+class TiXmlComment;
+class TiXmlUnknown;
+class TiXmlAttribute;
+class TiXmlText;
+class TiXmlDeclaration;
+
+
+/** TiXmlBase is a base class for every class in TinyXml.
+	It does little except to establish that TinyXml classes
+	can be printed and provide some utility functions.
+
+	In XML, the document and elements can contain
+	other elements and other types of nodes.
+
+	@verbatim
+	A Document can contain:	Element	(container or leaf)
+							Comment (leaf)
+							Unknown (leaf)
+							Declaration( leaf )
+
+	An Element can contain:	Element (container or leaf)
+							Text	(leaf)
+							Attributes (not on tree)
+							Comment (leaf)
+							Unknown (leaf)
+
+	A Decleration contains: Attributes (not on tree)
+	@endverbatim
+*/
+class TiXmlBase
+{
+	friend class TiXmlNode;
+	friend class TiXmlElement;
+	friend class TiXmlDocument;
+
+public:
+	TiXmlBase()								{}
+	virtual ~TiXmlBase()					{}
+
+	/**	All TinyXml classes can print themselves to a filestream.
+		This is a formatted print, and will insert tabs and newlines.
+		
+		(For an unformatted stream, use the << operator.)
+	*/
+	virtual void Print( FILE* cfile, int depth ) const = 0;
+
+	/**	The world does not agree on whether white space should be kept or
+		not. In order to make everyone happy, these global, static functions
+		are provided to set whether or not TinyXml will condense all white space
+		into a single space or not. The default is to condense. Note changing these
+		values is not thread safe.
+	*/
+	static void SetCondenseWhiteSpace( bool condense )		{ condenseWhiteSpace = condense; }
+
+	/// Return the current white space setting.
+	static bool IsWhiteSpaceCondensed()						{ return condenseWhiteSpace; }
+
+protected:
+
+	static const char*	SkipWhiteSpace( const char* );
+	inline static bool	IsWhiteSpace( int c )		{ return ( isspace( c ) || c == '\n' || c == '\r' ); }
+
+	virtual void StreamOut (TIXML_OSTREAM *) const = 0;
+
+	#ifdef TIXML_USE_STL
+	    static bool	StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	    static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
+	#endif
+
+	/*	Reads an XML name into the string provided. Returns
+		a pointer just past the last character of the name,
+		or 0 if the function has an error.
+	*/
+	static const char* ReadName( const char* p, TIXML_STRING* name );
+
+	/*	Reads text. Returns a pointer past the given end tag.
+		Wickedly complex options, but it keeps the (sensitive) code in one place.
+	*/
+	static const char* ReadText(	const char* in,				// where to start
+									TIXML_STRING* text,			// the string read
+									bool ignoreWhiteSpace,		// whether to keep the white space
+									const char* endTag,			// what ends this text
+									bool ignoreCase );			// whether to ignore case in the end tag
+	virtual const char* Parse( const char* p ) = 0;
+
+	// If an entity has been found, transform it into a character.
+	static const char* GetEntity( const char* in, char* value );
+
+	// Get a character, while interpreting entities.
+	inline static const char* GetChar( const char* p, char* value )
+	{
+		assert( p );
+		if ( *p == '&' )
+		{
+			return GetEntity( p, value );
+		}
+		else
+		{
+			*value = *p;
+			return p+1;
+		}
+	}
+
+	// Puts a string to a stream, expanding entities as it goes.
+	// Note this should not contian the '<', '>', etc, or they will be transformed into entities!
+	static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
+
+	static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
+
+	// Return true if the next characters in the stream are any of the endTag sequences.
+	bool static StringEqual(	const char* p,
+								const char* endTag,
+								bool ignoreCase );
+
+
+	enum
+	{
+		TIXML_NO_ERROR = 0,
+		TIXML_ERROR,
+		TIXML_ERROR_OPENING_FILE,
+		TIXML_ERROR_OUT_OF_MEMORY,
+		TIXML_ERROR_PARSING_ELEMENT,
+		TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
+		TIXML_ERROR_READING_ELEMENT_VALUE,
+		TIXML_ERROR_READING_ATTRIBUTES,
+		TIXML_ERROR_PARSING_EMPTY,
+		TIXML_ERROR_READING_END_TAG,
+		TIXML_ERROR_PARSING_UNKNOWN,
+		TIXML_ERROR_PARSING_COMMENT,
+		TIXML_ERROR_PARSING_DECLARATION,
+		TIXML_ERROR_DOCUMENT_EMPTY,
+
+		TIXML_ERROR_STRING_COUNT
+	};
+	static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
+
+private:
+	struct Entity
+	{
+		const char*     str;
+		unsigned int	strLength;
+		char		    chr;
+	};
+	enum
+	{
+		NUM_ENTITY = 5,
+		MAX_ENTITY_LENGTH = 6
+
+	};
+	static Entity entity[ NUM_ENTITY ];
+	static bool condenseWhiteSpace;
+};
+
+
+/** The parent class for everything in the Document Object Model.
+	(Except for attributes, which are contained in elements.)
+	Nodes have siblings, a parent, and children. A node can be
+	in a document, or stand on its own. The type of a TiXmlNode
+	can be queried, and it can be cast to its more defined type.
+*/
+class TiXmlNode : public TiXmlBase
+{
+	friend class TiXmlDocument;
+	friend class TiXmlElement;
+
+public:
+	#ifdef TIXML_USE_STL	
+
+	    /** An input stream operator, for every class. Tolerant of newlines and
+		    formatting, but doesn't expect them.
+	    */
+	    friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
+
+	    /** An output stream operator, for every class. Note that this outputs
+		    without any newlines or formatting, as opposed to Print(), which
+		    includes tabs and new lines.
+
+		    The operator<< and operator>> are not completely symmetric. Writing
+		    a node to a stream is very well defined. You'll get a nice stream
+		    of output, without any extra whitespace or newlines.
+		    
+		    But reading is not as well defined. (As it always is.) If you create
+		    a TiXmlElement (for example) and read that from an input stream,
+		    the text needs to define an element or junk will result. This is
+		    true of all input streams, but it's worth keeping in mind.
+
+		    A TiXmlDocument will read nodes until it reads a root element.
+	    */	
+	    friend std::ostream & operator<< (std::ostream& out, const TiXmlNode& base);
+
+	#else
+	    // Used internally, not part of the public API.
+	    friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
+	#endif
+
+	/** The types of XML nodes supported by TinyXml. (All the
+			unsupported types are picked up by UNKNOWN.)
+	*/
+	enum NodeType
+	{
+		DOCUMENT,
+		ELEMENT,
+		COMMENT,
+		UNKNOWN,
+		TEXT,
+		DECLARATION,
+		TYPECOUNT
+	};
+
+	virtual ~TiXmlNode();
+
+	/** The meaning of 'value' changes for the specific type of
+		TiXmlNode.
+		@verbatim
+		Document:	filename of the xml file
+		Element:	name of the element
+		Comment:	the comment text
+		Unknown:	the tag contents
+		Text:		the text string
+		@endverbatim
+
+		The subclasses will wrap this function.
+	*/
+	const char * Value () const { return value.c_str (); }
+
+	/** Changes the value of the node. Defined as:
+		@verbatim
+		Document:	filename of the xml file
+		Element:	name of the element
+		Comment:	the comment text
+		Unknown:	the tag contents
+		Text:		the text string
+		@endverbatim
+	*/
+	void SetValue (const char * _value) { value = _value;}
+
+    #ifdef TIXML_USE_STL
+	/// STL std::string form.
+	void SetValue( const std::string& value )    
+	{	  
+		SetValue( value.c_str() );    	
+	}	
+	#endif
+
+	/// Delete all the children of this node. Does not affect 'this'.
+	void Clear();
+
+	/// One step up the DOM.
+	TiXmlNode* Parent() const					{ return parent; }
+
+	TiXmlNode* FirstChild()	const	{ return firstChild; }		///< The first child of this node. Will be null if there are no children.
+	TiXmlNode* FirstChild( const char * value ) const;			///< The first child of this node with the matching 'value'. Will be null if none found.
+
+	TiXmlNode* LastChild() const	{ return lastChild; }		/// The last child of this node. Will be null if there are no children.
+	TiXmlNode* LastChild( const char * value ) const;			/// The last child of this node matching 'value'. Will be null if there are no children.
+
+    #ifdef TIXML_USE_STL
+	TiXmlNode* FirstChild( const std::string& value ) const	{	return FirstChild (value.c_str ());	}	///< STL std::string form.
+	TiXmlNode* LastChild( const std::string& value ) const	{	return LastChild (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/** An alternate way to walk the children of a node.
+		One way to iterate over nodes is:
+		@verbatim
+			for( child = parent->FirstChild(); child; child = child->NextSibling() )
+		@endverbatim
+
+		IterateChildren does the same thing with the syntax:
+		@verbatim
+			child = 0;
+			while( child = parent->IterateChildren( child ) )
+		@endverbatim
+
+		IterateChildren takes the previous child as input and finds
+		the next one. If the previous child is null, it returns the
+		first. IterateChildren will return null when done.
+	*/
+	TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
+
+	/// This flavor of IterateChildren searches for children with a particular 'value'
+	TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* previous ) const	{	return IterateChildren (value.c_str (), previous);	}	///< STL std::string form.
+	#endif
+
+	/** Add a new node related to this. Adds a child past the LastChild.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
+
+	/** Add a new node related to this. Adds a child before the specified child.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
+
+	/** Add a new node related to this. Adds a child after the specified child.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
+
+	/** Replace a child of this node.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
+
+	/// Delete a child of this node.
+	bool RemoveChild( TiXmlNode* removeThis );
+
+	/// Navigate to a sibling node.
+	TiXmlNode* PreviousSibling() const			{ return prev; }
+
+	/// Navigate to a sibling node.
+	TiXmlNode* PreviousSibling( const char * ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlNode* PreviousSibling( const std::string& value ) const	{	return PreviousSibling (value.c_str ());	}	///< STL std::string form.
+	TiXmlNode* NextSibling( const std::string& value) const	{	return NextSibling (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/// Navigate to a sibling node.
+	TiXmlNode* NextSibling() const				{ return next; }
+
+	/// Navigate to a sibling node with the given 'value'.
+	TiXmlNode* NextSibling( const char * ) const;
+
+	/** Convenience function to get through elements.
+		Calls NextSibling and ToElement. Will skip all non-Element
+		nodes. Returns 0 if there is not another element.
+	*/
+	TiXmlElement* NextSiblingElement() const;
+
+	/** Convenience function to get through elements.
+		Calls NextSibling and ToElement. Will skip all non-Element
+		nodes. Returns 0 if there is not another element.
+	*/
+	TiXmlElement* NextSiblingElement( const char * ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlElement* NextSiblingElement( const std::string& value) const	{	return NextSiblingElement (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/// Convenience function to get through elements.
+	TiXmlElement* FirstChildElement()	const;
+
+	/// Convenience function to get through elements.
+	TiXmlElement* FirstChildElement( const char * value ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlElement* FirstChildElement( const std::string& value ) const	{	return FirstChildElement (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/// Query the type (as an enumerated value, above) of this node.
+	virtual int Type() const	{ return type; }
+
+	/** Return a pointer to the Document this node lives in.
+		Returns null if not in a document.
+	*/
+	TiXmlDocument* GetDocument() const;
+
+	/// Returns true if this node has no children.
+	bool NoChildren() const						{ return !firstChild; }
+
+	TiXmlDocument* ToDocument()	const		{ return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlElement*  ToElement() const		{ return ( this && type == ELEMENT  ) ? (TiXmlElement*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlComment*  ToComment() const		{ return ( this && type == COMMENT  ) ? (TiXmlComment*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlUnknown*  ToUnknown() const		{ return ( this && type == UNKNOWN  ) ? (TiXmlUnknown*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlText*	   ToText()    const		{ return ( this && type == TEXT     ) ? (TiXmlText*)     this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlDeclaration* ToDeclaration() const	{ return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+
+	virtual TiXmlNode* Clone() const = 0;
+
+	void  SetUserData( void* user )			{ userData = user; }
+	void* GetUserData()						{ return userData; }
+
+protected:
+	TiXmlNode( NodeType type );
+
+	#ifdef TIXML_USE_STL
+	    // The real work of the input operator.
+	    virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
+	#endif
+
+	// The node is passed in by ownership. This object will delete it.
+	TiXmlNode* LinkEndChild( TiXmlNode* addThis );
+
+	// Figure out what is at *p, and parse it. Returns null if it is not an xml node.
+	TiXmlNode* Identify( const char* start );
+	void CopyToClone( TiXmlNode* target ) const	{ target->SetValue (value.c_str() );
+												  target->userData = userData; }
+
+	// Internal Value function returning a TIXML_STRING
+	TIXML_STRING SValue() const	{ return value ; }
+
+	TiXmlNode*		parent;
+	NodeType		type;
+
+	TiXmlNode*		firstChild;
+	TiXmlNode*		lastChild;
+
+	TIXML_STRING	value;
+
+	TiXmlNode*		prev;
+	TiXmlNode*		next;
+	void*			userData;
+};
+
+
+/** An attribute is a name-value pair. Elements have an arbitrary
+	number of attributes, each with a unique name.
+
+	@note The attributes are not TiXmlNodes, since they are not
+		  part of the tinyXML document object model. There are other
+		  suggested ways to look at this problem.
+
+	@note Attributes have a parent
+*/
+class TiXmlAttribute : public TiXmlBase
+{
+	friend class TiXmlAttributeSet;
+
+public:
+	/// Construct an empty attribute.
+	TiXmlAttribute() : prev( 0 ), next( 0 )	{}
+
+	#ifdef TIXML_USE_STL
+	/// std::string constructor.
+	TiXmlAttribute( const std::string& _name, const std::string& _value )
+	{
+		name = _name;
+		value = _value;
+	}
+	#endif
+
+	/// Construct an attribute with a name and value.
+	TiXmlAttribute( const char * _name, const char * _value ): name( _name ), value( _value ), prev( 0 ), next( 0 ) {}
+	const char*		Name()  const		{ return name.c_str (); }		///< Return the name of this attribute.
+	const char*		Value() const		{ return value.c_str (); }		///< Return the value of this attribute.
+	const int       IntValue() const;									///< Return the value of this attribute, converted to an integer.
+	const double	DoubleValue() const;								///< Return the value of this attribute, converted to a double.
+
+	void SetName( const char* _name )	{ name = _name; }				///< Set the name of this attribute.
+	void SetValue( const char* _value )	{ value = _value; }				///< Set the value.
+
+	void SetIntValue( int value );										///< Set the value from an integer.
+	void SetDoubleValue( double value );								///< Set the value from a double.
+
+    #ifdef TIXML_USE_STL
+	/// STL std::string form.
+	void SetName( const std::string& _name )	
+	{	
+		SetName(_name.c_str() );	
+	}
+	/// STL std::string form.	
+	void SetValue( const std::string& _value )	
+	{	
+		SetValue( value.c_str() );	
+	}
+	#endif
+
+	/// Get the next sibling attribute in the DOM. Returns null at end.
+	TiXmlAttribute* Next() const;
+	/// Get the previous sibling attribute in the DOM. Returns null at beginning.
+	TiXmlAttribute* Previous() const;
+
+	bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
+	bool operator<( const TiXmlAttribute& rhs )	 const { return name < rhs.name; }
+	bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
+
+	/*	[internal use]
+		Attribtue parsing starts: first letter of the name
+						 returns: the next char after the value end quote
+	*/
+	virtual const char* Parse( const char* p );
+
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+
+	virtual void StreamOut( TIXML_OSTREAM * out ) const;
+	// [internal use]
+	// Set the document pointer so the attribute can report errors.
+	void SetDocument( TiXmlDocument* doc )	{ document = doc; }
+
+private:
+	TiXmlDocument*	document;	// A pointer back to a document, for error reporting.
+	TIXML_STRING name;
+	TIXML_STRING value;
+	TiXmlAttribute*	prev;
+	TiXmlAttribute*	next;
+};
+
+
+/*	A class used to manage a group of attributes.
+	It is only used internally, both by the ELEMENT and the DECLARATION.
+	
+	The set can be changed transparent to the Element and Declaration
+	classes that use it, but NOT transparent to the Attribute
+	which has to implement a next() and previous() method. Which makes
+	it a bit problematic and prevents the use of STL.
+
+	This version is implemented with circular lists because:
+		- I like circular lists
+		- it demonstrates some independence from the (typical) doubly linked list.
+*/
+class TiXmlAttributeSet
+{
+public:
+	TiXmlAttributeSet();
+	~TiXmlAttributeSet();
+
+	void Add( TiXmlAttribute* attribute );
+	void Remove( TiXmlAttribute* attribute );
+
+	TiXmlAttribute* First() const	{ return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+	TiXmlAttribute* Last()  const	{ return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+	TiXmlAttribute*	Find( const char * name ) const;
+
+private:
+	TiXmlAttribute sentinel;
+};
+
+
+/** The element is a container class. It has a value, the element name,
+	and can contain other elements, text, comments, and unknowns.
+	Elements also contain an arbitrary number of attributes.
+*/
+class TiXmlElement : public TiXmlNode
+{
+public:
+	/// Construct an element.
+	TiXmlElement (const char * in_value);
+
+	#ifdef TIXML_USE_STL
+	/// std::string constructor.
+	TiXmlElement( const std::string& _value ) : 	TiXmlNode( TiXmlNode::ELEMENT )
+	{
+		firstChild = lastChild = 0;
+		value = _value;
+	}
+	#endif
+
+	virtual ~TiXmlElement();
+
+// OGRE CHANGE 
+// Resolve ambiguity of std::string / const char* conversion of Ogre::String
+#ifndef TIXML_USE_STL
+// OGRE CHANGE
+	/** Given an attribute name, attribute returns the value
+		for the attribute of that name, or null if none exists.
+	*/
+	const char* Attribute( const char* name ) const;
+
+	/** Given an attribute name, attribute returns the value
+		for the attribute of that name, or null if none exists.
+		If the attribute exists and can be converted to an integer,
+		the integer value will be put in the return 'i', if 'i'
+		is non-null.
+	*/
+	const char* Attribute( const char* name, int* i ) const;
+
+	/** Sets an attribute of name to a given value. The attribute
+		will be created if it does not exist, or changed if it does.
+	*/
+	void SetAttribute( const char* name, const char * value );
+// OGRE CHANGE
+#endif
+// OGRE CHANGE
+    #ifdef TIXML_USE_STL
+	const char* Attribute( const std::string& name ) const;
+	const char* Attribute( const std::string& name, int* i ) const;
+
+	/// STL std::string form.
+	void SetAttribute( const std::string& name, const std::string& value );
+	///< STL std::string form.
+	void SetAttribute( const std::string& name, int value );
+	#endif
+
+	/** Sets an attribute of name to a given value. The attribute
+		will be created if it does not exist, or changed if it does.
+	*/
+	void SetAttribute( const char * name, int value );
+
+	/** Deletes an attribute with the given name.
+	*/
+	void RemoveAttribute( const char * name );
+    #ifdef TIXML_USE_STL
+	void RemoveAttribute( const std::string& name )	{	RemoveAttribute (name.c_str ());	}	///< STL std::string form.
+	#endif
+
+	TiXmlAttribute* FirstAttribute() const	{ return attributeSet.First(); }		///< Access the first attribute in this element.
+	TiXmlAttribute* LastAttribute()	const 	{ return attributeSet.Last(); }		///< Access the last attribute in this element.
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+
+	virtual void Print( FILE* cfile, int depth ) const;
+
+protected:
+
+	// Used to be public [internal use]
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut( TIXML_OSTREAM * out ) const;
+
+	/*	[internal use]
+		Attribtue parsing starts: next char past '<'
+						 returns: next char past '>'
+	*/
+	virtual const char* Parse( const char* p );
+
+	/*	[internal use]
+		Reads the "value" of the element -- another element, or text.
+		This should terminate with the current end tag.
+	*/
+	const char* ReadValue( const char* in );
+
+private:
+	TiXmlAttributeSet attributeSet;
+};
+
+
+/**	An XML comment.
+*/
+class TiXmlComment : public TiXmlNode
+{
+public:
+	/// Constructs an empty comment.
+	TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
+	virtual ~TiXmlComment()	{}
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+protected:
+	// used to be public
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut( TIXML_OSTREAM * out ) const;
+	/*	[internal use]
+		Attribtue parsing starts: at the ! of the !--
+						 returns: next char past '>'
+	*/
+	virtual const char* Parse( const char* p );
+};
+
+
+/** XML text. Contained in an element.
+*/
+class TiXmlText : public TiXmlNode
+{
+	friend class TiXmlElement;
+public:
+	/// Constructor.
+	TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
+	{
+		SetValue( initValue );
+	}
+	virtual ~TiXmlText() {}
+
+	#ifdef TIXML_USE_STL
+	/// Constructor.
+	TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
+	{
+		SetValue( initValue );
+	}
+	#endif
+
+protected :
+	// [internal use] Creates a new Element and returns it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+	virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+	// [internal use]
+	bool Blank() const;	// returns true if all white space and new lines
+	/*	[internal use]
+			Attribtue parsing starts: First char of the text
+							 returns: next char past '>'
+		*/
+	virtual const char* Parse( const char* p );
+	// [internal use]
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+};
+
+
+/** In correct XML the declaration is the first entry in the file.
+	@verbatim
+		<?xml version="1.0" standalone="yes"?>
+	@endverbatim
+
+	TinyXml will happily read or write files without a declaration,
+	however. There are 3 possible attributes to the declaration:
+	version, encoding, and standalone.
+
+	Note: In this version of the code, the attributes are
+	handled as special cases, not generic attributes, simply
+	because there can only be at most 3 and they are always the same.
+*/
+class TiXmlDeclaration : public TiXmlNode
+{
+public:
+	/// Construct an empty declaration.
+	TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
+
+#ifdef TIXML_USE_STL
+	/// Constructor.
+	TiXmlDeclaration(
+						const std::string& _version,
+						const std::string& _encoding,
+						const std::string& _standalone )
+					: TiXmlNode( TiXmlNode::DECLARATION )
+	{
+		version = _version;
+		encoding = _encoding;
+		standalone = _standalone;
+	}
+#endif
+
+	/// Construct.
+	TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+										const char * _encoding,
+										const char * _standalone );
+
+	virtual ~TiXmlDeclaration()	{}
+
+	/// Version. Will return empty if none was found.
+	const char * Version() const		{ return version.c_str (); }
+	/// Encoding. Will return empty if none was found.
+	const char * Encoding() const		{ return encoding.c_str (); }
+	/// Is this a standalone document?
+	const char * Standalone() const		{ return standalone.c_str (); }
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+
+protected:
+	// used to be public
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut ( TIXML_OSTREAM * out) const;
+	//	[internal use]
+	//	Attribtue parsing starts: next char past '<'
+	//					 returns: next char past '>'
+
+	virtual const char* Parse( const char* p );
+
+private:
+	TIXML_STRING version;
+	TIXML_STRING encoding;
+	TIXML_STRING standalone;
+};
+
+
+/** Any tag that tinyXml doesn't recognize is save as an
+	unknown. It is a tag of text, but should not be modified.
+	It will be written back to the XML, unchanged, when the file
+	is saved.
+*/
+class TiXmlUnknown : public TiXmlNode
+{
+public:
+	TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
+	virtual ~TiXmlUnknown() {}
+
+	// [internal use]
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+protected:
+	// used to be public
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+	/*	[internal use]
+		Attribute parsing starts: First char of the text
+						 returns: next char past '>'
+	*/
+	virtual const char* Parse( const char* p );
+};
+
+
+/** Always the top level node. A document binds together all the
+	XML pieces. It can be saved, loaded, and printed to the screen.
+	The 'value' of a document node is the xml file name.
+*/
+class TiXmlDocument : public TiXmlNode
+{
+public:
+	/// Create an empty document, that has no name.
+	TiXmlDocument();
+	/// Create a document with a name. The name of the document is also the filename of the xml.
+	TiXmlDocument( const char * documentName );
+
+	#ifdef TIXML_USE_STL
+	/// Constructor.
+	TiXmlDocument( const std::string& documentName ) :
+	    TiXmlNode( TiXmlNode::DOCUMENT )
+	{
+        value = documentName;
+		error = false;
+	}
+	#endif
+
+	virtual ~TiXmlDocument() {}
+
+	/** Load a file using the current document value.
+		Returns true if successful. Will delete any existing
+		document data before loading.
+	*/
+	bool LoadFile();
+	/// Save a file using the current document value. Returns true if successful.
+	bool SaveFile() const;
+	/// Load a file using the given filename. Returns true if successful.
+	bool LoadFile( const char * filename );
+	/// Save a file using the given filename. Returns true if successful.
+	bool SaveFile( const char * filename ) const;
+
+	#ifdef TIXML_USE_STL
+	bool LoadFile( const std::string& filename )			///< STL std::string version.
+	{
+		return ( LoadFile( filename.c_str() ));
+	}
+	bool SaveFile( const std::string& filename ) const		///< STL std::string version.
+	{
+		//StringToBuffer f( filename );
+		return ( SaveFile( filename.c_str() ));
+	}
+	#endif
+
+	/// Parse the given null terminated block of xml data.
+	virtual const char* Parse( const char* p );
+
+	/** Get the root element -- the only top level element -- of the document.
+		In well formed XML, there should only be one. TinyXml is tolerant of
+		multiple elements at the document level.
+	*/
+	TiXmlElement* RootElement() const		{ return FirstChildElement(); }
+
+	/// If, during parsing, a error occurs, Error will be set to true.
+	bool Error() const						{ return error; }
+
+	/// Contains a textual (english) description of the error if one occurs.
+	const char * ErrorDesc() const	{ return errorDesc.c_str (); }
+
+	/** Generally, you probably want the error string ( ErrorDesc() ). But if you
+			prefer the ErrorId, this function will fetch it.
+		*/
+	const int ErrorId()	const				{ return errorId; }
+
+	/// If you have handled the error, it can be reset with this call.
+	void ClearError()						{ error = false; errorId = 0; errorDesc = ""; }
+
+	/** Dump the document to standard out. */
+	void Print() const						{ Print( stdout, 0 ); }
+
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth = 0 ) const;
+	// [internal use]
+	void SetError( int err ) {		assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
+		error   = true;
+		errorId = err;
+	errorDesc = errorString[ errorId ]; }
+
+protected :
+	virtual void StreamOut ( TIXML_OSTREAM * out) const;
+	// [internal use]
+	virtual TiXmlNode* Clone() const;
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+
+private:
+	bool error;
+	int  errorId;
+	TIXML_STRING errorDesc;
+};
+
+#endif
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinystr.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinystr.cpp	(revision 37)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/tinyxml/tinystr.cpp	(revision 37)
@@ -0,0 +1,265 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this 
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+*/
+
+#include "tinyxml.h"
+
+#ifndef TIXML_USE_STL
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "tinystr.h"
+
+// TiXmlString constructor, based on a C string
+TiXmlString::TiXmlString (const char* instring)
+{
+    unsigned newlen;
+    char * newstring;
+
+    if (!instring)
+    {
+        allocated = 0;
+        cstring = NULL;
+        return;
+    }
+    newlen = strlen (instring) + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, instring);
+    allocated = newlen;
+    cstring = newstring;
+}
+
+// TiXmlString copy constructor
+TiXmlString::TiXmlString (const TiXmlString& copy)
+{
+    unsigned newlen;
+    char * newstring;
+
+	// Prevent copy to self!
+	if ( &copy == this )
+		return;
+
+    if (! copy . allocated)
+    {
+        allocated = 0;
+        cstring = NULL;
+        return;
+    }
+    newlen = strlen (copy . cstring) + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, copy . cstring);
+    allocated = newlen;
+    cstring = newstring;
+}
+
+// TiXmlString = operator. Safe when assign own content
+void TiXmlString ::operator = (const char * content)
+{
+    unsigned newlen;
+    char * newstring;
+
+    if (! content)
+    {
+        empty_it ();
+        return;
+    }
+    newlen = strlen (content) + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, content);
+    empty_it ();
+    allocated = newlen;
+    cstring = newstring;
+}
+
+// = operator. Safe when assign own content
+void TiXmlString ::operator = (const TiXmlString & copy)
+{
+    unsigned newlen;
+    char * newstring;
+
+    if (! copy . length ())
+    {
+        empty_it ();
+        return;
+    }
+    newlen = copy . length () + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, copy . c_str ());
+    empty_it ();
+    allocated = newlen;
+    cstring = newstring;
+}
+
+
+//// Checks if a TiXmlString contains only whitespace (same rules as isspace)
+//bool TiXmlString::isblank () const
+//{
+//    char * lookup;
+//    for (lookup = cstring; * lookup; lookup++)
+//        if (! isspace (* lookup))
+//            return false;
+//    return true;
+//}
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char* str, int len )
+{
+    char * new_string;
+    unsigned new_alloc, new_size;
+
+    new_size = length () + len + 1;
+    // check if we need to expand
+    if (new_size > allocated)
+    {
+        // compute new size
+        new_alloc = assign_new_size (new_size);
+
+        // allocate new buffer
+        new_string = new char [new_alloc];        
+        new_string [0] = 0;
+
+        // copy the previous allocated buffer into this one
+        if (allocated && cstring)
+            strcpy (new_string, cstring);
+
+        // append the suffix. It does exist, otherwize we wouldn't be expanding 
+        strncat (new_string, str, len);
+
+        // return previsously allocated buffer if any
+        if (allocated && cstring)
+            delete [] cstring;
+
+        // update member variables
+        cstring = new_string;
+        allocated = new_alloc;
+    }
+    else
+        // we know we can safely append the new string
+        strncat (cstring, str, len);
+}
+
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char * suffix )
+{
+    char * new_string;
+    unsigned new_alloc, new_size;
+
+    new_size = length () + strlen (suffix) + 1;
+    // check if we need to expand
+    if (new_size > allocated)
+    {
+        // compute new size
+        new_alloc = assign_new_size (new_size);
+
+        // allocate new buffer
+        new_string = new char [new_alloc];        
+        new_string [0] = 0;
+
+        // copy the previous allocated buffer into this one
+        if (allocated && cstring)
+            strcpy (new_string, cstring);
+
+        // append the suffix. It does exist, otherwize we wouldn't be expanding 
+        strcat (new_string, suffix);
+
+        // return previsously allocated buffer if any
+        if (allocated && cstring)
+            delete [] cstring;
+
+        // update member variables
+        cstring = new_string;
+        allocated = new_alloc;
+    }
+    else
+        // we know we can safely append the new string
+        strcat (cstring, suffix);
+}
+
+// Check for TiXmlString equuivalence
+//bool TiXmlString::operator == (const TiXmlString & compare) const
+//{
+//    return (! strcmp (c_str (), compare . c_str ()));
+//}
+
+unsigned TiXmlString::length () const
+{
+    if (allocated)
+        return strlen (cstring);
+    return 0;
+}
+
+
+unsigned TiXmlString::find (char tofind, unsigned offset) const
+{
+    char * lookup;
+
+    if (offset >= length ())
+        return (unsigned) notfound;
+    for (lookup = cstring + offset; * lookup; lookup++)
+        if (* lookup == tofind)
+            return lookup - cstring;
+    return (unsigned) notfound;
+}
+
+
+bool TiXmlString::operator == (const TiXmlString & compare) const
+{
+	if ( allocated && compare.allocated )
+	{
+		assert( cstring );
+		assert( compare.cstring );
+		return ( strcmp( cstring, compare.cstring ) == 0 );
+ 	}
+	return false;
+}
+
+
+bool TiXmlString::operator < (const TiXmlString & compare) const
+{
+	if ( allocated && compare.allocated )
+	{
+		assert( cstring );
+		assert( compare.cstring );
+		return ( strcmp( cstring, compare.cstring ) > 0 );
+ 	}
+	return false;
+}
+
+
+bool TiXmlString::operator > (const TiXmlString & compare) const
+{
+	if ( allocated && compare.allocated )
+	{
+		assert( cstring );
+		assert( compare.cstring );
+		return ( strcmp( cstring, compare.cstring ) < 0 );
+ 	}
+	return false;
+}
+
+
+#endif	// TIXML_USE_STL
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/OcclusionCullingDemo.overlay
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/OcclusionCullingDemo.overlay	(revision 52)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/OcclusionCullingDemo.overlay	(revision 52)
@@ -0,0 +1,261 @@
+Example/OcclusionCullingDemoOverlay
+{
+	zorder 500
+	// Stats block
+	container BorderPanel(Example/Occlusion/OcclusionPanel)
+	{
+		metrics_mode pixels
+		vert_align top
+		left 5 
+		top 5
+		width 450
+		height 55
+		material Core/StatsBlockCenter
+        	border_size 1 1 1 1
+        	border_material Core/StatsBlockBorder
+        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
+	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
+	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
+	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
+	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
+	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
+        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
+	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
+
+
+		element TextArea(Example/Occlusion/Algorithm)
+		{
+			metrics_mode pixels
+			left 5
+			top 5
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption [A] Algorithm
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/AlgorithmInfo)
+		{
+			metrics_mode pixels
+			left 155
+			top 5
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+
+		element TextArea(Example/Occlusion/Threshold)
+		{
+			metrics_mode pixels
+			left 5
+			top 20
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption [-][+] Threshold
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/ThresholdInfo)
+		{
+			metrics_mode pixels
+			left 155
+			top 20
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+	}
+
+	container BorderPanel(Example/Occlusion/OcclusionStatsPanel)
+	{
+		metrics_mode pixels
+		vert_align top
+		horz_align right
+		left -355 
+		top 5
+		width 450
+		height 105
+		material Core/StatsBlockCenter
+        	border_size 1 1 1 1
+        	border_material Core/StatsBlockBorder
+        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
+	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
+	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
+	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
+	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
+	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
+        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
+	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
+
+		element TextArea(Example/Occlusion/FrustumCulledNodes)
+		{
+			metrics_mode pixels
+			left 5
+			top 5
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption Frustum Culled Nodes
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/FrustumCulledNodesInfo)
+		{
+			metrics_mode pixels
+			left 180
+			top 5
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/QueryCulledNodes)
+		{
+			metrics_mode pixels
+			left 5
+			top 20
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption Query Culled Nodes
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}	
+		element TextArea(Example/Occlusion/QueryCulledNodesInfo)
+		{
+			metrics_mode pixels
+			left 180
+			top 20
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/TraversedNodes)
+		{
+			metrics_mode pixels
+			left 5
+			top 35
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption Traversed Nodes
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}	
+		element TextArea(Example/Occlusion/TraversedNodesInfo)
+		{
+			metrics_mode pixels
+			left 180
+			top 35
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/SceneNodes)
+		{
+			metrics_mode pixels
+			left 5
+			top 50
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption Scene Nodes
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}	
+		element TextArea(Example/Occlusion/SceneNodesInfo)
+		{
+			metrics_mode pixels
+			left 180
+			top 50
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/HierarchyNodes)
+		{
+			metrics_mode pixels
+			left 5
+			top 65
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption Hierarchy Nodes
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}	
+		element TextArea(Example/Occlusion/HierarchyNodesInfo)
+		{
+			metrics_mode pixels
+			left 180
+			top 65
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+		element TextArea(Example/Occlusion/RenderedNodes)
+		{
+			metrics_mode pixels
+			left 5
+			top 80
+			width 180
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption Rendered Nodes
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}	
+		element TextArea(Example/Occlusion/RenderedNodesInfo)
+		{
+			metrics_mode pixels
+			left 180
+			top 80
+			width 90
+			height 30
+			font_name TrebuchetMSBold
+			char_height 16
+			caption :
+			colour_top 0.5 0.7 0.5
+			colour_bottom 0.3 0.5 0.3
+		}
+
+
+	}
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj	(revision 56)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj	(revision 56)
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="Plugin_OcclusionCullingSceneManager"
+	ProjectGUID="{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS;OGRE_COHERENT_OCCLUSION_CULLING"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="TRUE"
+				AdditionalDependencies="OgreMain_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_OctreeSceneManager.lib Plugin_DotSceneManager.lib"
+				OutputFile="$(OutDir)/Plugin_OcclusionCullingSceneManager.dll"
+				Version="0.99"
+				LinkIncremental="2"
+				SuppressStartupBanner="TRUE"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;"
+				ModuleDefinitionFile="..\misc\OgreOcclusionCullingSceneManager.def"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/Plugin_OcclusionCullingSceneManager.pdb"
+				SubSystem="2"
+				ImportLibrary="$(OUTDIR)\Plugin_OcclusionCullingSceneManager.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				ImproveFloatingPointConsistency="TRUE"
+				FavorSizeOrSpeed="1"
+				OmitFramePointers="TRUE"
+				EnableFiberSafeOptimizations="TRUE"
+				OptimizeForProcessor="2"
+				AdditionalIncludeDirectories="..\include;$(OGRE_PATH)\OgreMain\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS"
+				StringPooling="TRUE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="TRUE"
+				AdditionalDependencies="OgreMain.lib"
+				OutputFile="$(OutDir)/Plugin_OcclusionCullingSceneManager.dll"
+				Version="0.99"
+				LinkIncremental="1"
+				SuppressStartupBanner="TRUE"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Dependencies\lib\$(ConfigurationName)&quot;"
+				ModuleDefinitionFile="..\misc\OgreOcclusionCullingSceneManager.def"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/Plugin_OcclusionCullingSceneManager.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+			<File
+				RelativePath="..\src\OgreOcclusionCullingResourceManager.cpp">
+			</File>
+			<File
+				RelativePath="..\src\OgreOcclusionCullingSceneManager.cpp">
+			</File>
+			<File
+				RelativePath="..\src\OgreOcclusionCullingSceneManagerDll.cpp">
+			</File>
+			<File
+				RelativePath="..\src\OgreOcclusionCullingSceneTraverser.cpp">
+			</File>
+			<File
+				RelativePath="..\src\OgreSolidHalfBoundingBox.cpp">
+			</File>
+			<File
+				RelativePath="..\src\SceneTraverser.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc">
+			<File
+				RelativePath="..\include\OgreOcclusionCullingResourceManager.h">
+			</File>
+			<File
+				RelativePath="..\include\OgreOcclusionCullingSceneManager.h">
+			</File>
+			<File
+				RelativePath="..\include\OgreOcclusionCullingSceneTraverser.h">
+			</File>
+			<File
+				RelativePath="..\include\OgreSolidHalfBoundingBox.h">
+			</File>
+			<File
+				RelativePath="..\include\SceneTraverser.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+		</Filter>
+		<Filter
+			Name="OctreeOcclusionCullingSceneManager"
+			Filter="">
+			<Filter
+				Name="Source Files"
+				Filter="">
+				<File
+					RelativePath="..\src\OgreOcclusionCullingOctreeSceneManager.cpp">
+				</File>
+				<File
+					RelativePath="..\src\OgreOcclusionCullingOctreeSceneTraverser.cpp">
+				</File>
+				<File
+					RelativePath="..\src\OgreOcclusionCullingTerrainSceneManager.cpp">
+				</File>
+			</Filter>
+			<Filter
+				Name="Header Files"
+				Filter="">
+				<File
+					RelativePath="..\include\OgreOcclusionCullingOctreeSceneManager.h">
+				</File>
+				<File
+					RelativePath="..\include\OgreOcclusionCullingOctreeSceneTraverser.h">
+				</File>
+				<File
+					RelativePath="..\include\OgreOcclusionCullingTerrainSceneManager.h">
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="DotSceneOcclusionCullingSceneManager"
+			Filter="">
+			<Filter
+				Name="Source Files"
+				Filter="">
+				<File
+					RelativePath="..\src\OgreOcclusionCullingDotSceneManager.cpp">
+				</File>
+			</Filter>
+			<Filter
+				Name="Header Files"
+				Filter="">
+				<File
+					RelativePath="..\include\OgreOcclusionCullingDotSceneManager.h">
+				</File>
+			</Filter>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.dsp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.dsp	(revision 15)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.dsp	(revision 15)
@@ -0,0 +1,137 @@
+# Microsoft Developer Studio Project File - Name="Plugin_OcclusionCullingSceneManager" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=Plugin_OcclusionCullingSceneManager - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "Plugin_OcclusionCullingSceneManager.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "Plugin_OcclusionCullingSceneManager.mak" CFG="Plugin_OcclusionCullingSceneManager - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Plugin_OcclusionCullingSceneManager - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Plugin_OcclusionCullingSceneManager - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Plugin_OcclusionCullingSceneManager - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\bin\Release"
+# PROP Intermediate_Dir "..\obj\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "$(OGRE_PATH)\OgreMain\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x418 /d "NDEBUG"
+# ADD RSC /l 0x418 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib OgreMain.lib /nologo /dll /machine:I386 /libpath:"$(OGRE_PATH)\OgreMain\lib\Release"
+# SUBTRACT LINK32 /pdb:none
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Cmds=copy ..\bin\Release\*.dll $(OGRE_PATH)\Samples\Common\bin\Release
+# End Special Build Tool
+
+!ELSEIF  "$(CFG)" == "Plugin_OcclusionCullingSceneManager - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\bin\Debug"
+# PROP Intermediate_Dir "..\obj\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "$(OGRE_PATH)\OgreMain\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS" /YX /FD /GZ /Zm200 /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x418 /d "_DEBUG"
+# ADD RSC /l 0x418 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib OgreMain_d.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"$(OGRE_PATH)\OgreMain\lib\Debug"
+# SUBTRACT LINK32 /pdb:none
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Cmds=copy ..\bin\Debug\*.dll $(OGRE_PATH)\Samples\Common\bin\Debug
+# End Special Build Tool
+
+!ENDIF 
+
+# Begin Target
+
+# Name "Plugin_OcclusionCullingSceneManager - Win32 Release"
+# Name "Plugin_OcclusionCullingSceneManager - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\OgreOcclusionCullingResourceManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\OgreOcclusionCullingSceneManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\misc\OgreOcclusionCullingSceneManager.def
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\OgreOcclusionCullingSceneManagerDll.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\include\OgreOcclusionCullingResourceManager.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\OgreOcclusionCullingSceneManager.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.sln
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.sln	(revision 52)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.sln	(revision 52)
@@ -0,0 +1,47 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_OcclusionCullingSceneManager", "Plugin_OcclusionCullingSceneManager.vcproj", "{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCulling", "..\TestCulling\TestCulling.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}"
+	ProjectSection(ProjectDependencies) = postProject
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingDotScene", "..\TestCullingDotScene\TestCullingDotScene.vcproj", "{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}"
+	ProjectSection(ProjectDependencies) = postProject
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingTerrain", "..\TestCullingTerrain\TestCullingTerrain.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Debug.ActiveCfg = Debug|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Debug.Build.0 = Debug|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.ActiveCfg = Release|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.Build.0 = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.ActiveCfg = Debug|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.Build.0 = Debug|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.ActiveCfg = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.Build.0 = Release|Win32
+		{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Debug.ActiveCfg = Debug|Win32
+		{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Debug.Build.0 = Debug|Win32
+		{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Release.ActiveCfg = Release|Win32
+		{BE13944C-D05E-467F-B0AC-8A65A3B5FE60}.Release.Build.0 = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.ActiveCfg = Debug|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.Build.0 = Debug|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.ActiveCfg = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp	(revision 51)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp	(revision 51)
@@ -0,0 +1,64 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright © 2000-2002 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreOcclusionCullingTerrainSceneManager.h"
+#include "OgreOcclusionCullingOctreeSceneManager.h"
+//#include "OgreOcclusionCullingDotSceneManager.h"
+#include "OgreHeightmapTerrainPageSource.h"
+#include <OgreRoot.h>
+
+//#include <windows.h>
+
+namespace Ogre {
+
+	// OcclusionCullingDotSceneManager *occlusionDotPlugin;
+	OcclusionCullingOctreeSceneManager *occlusionOctreePlugin;
+	OcclusionCullingTerrainSceneManager *occlusionTerrainPlugin;
+	HeightmapTerrainPageSource* heightmapTerrainPageSource;
+
+    //-----------------------------------------------------------------------
+    extern "C" void dllStartPlugin(void)
+    {
+		// Create new scene manager
+		//occlusionDotPlugin = new OcclusionCullingDotSceneManager();
+		occlusionOctreePlugin = new OcclusionCullingOctreeSceneManager();
+		occlusionTerrainPlugin = new OcclusionCullingTerrainSceneManager();
+		heightmapTerrainPageSource = new HeightmapTerrainPageSource();
+
+		occlusionTerrainPlugin->registerPageSource("Heightmap", heightmapTerrainPageSource);
+
+	    // Register
+		//Root::getSingleton().setSceneManager( ST_GENERIC, occlusionDotPlugin );
+		Root::getSingleton().setSceneManager( ST_GENERIC, occlusionOctreePlugin );
+		Root::getSingleton().setSceneManager( ST_EXTERIOR_CLOSE, occlusionTerrainPlugin );
+    }
+    extern "C" void dllStopPlugin(void)
+    {
+		delete heightmapTerrainPageSource;
+        //delete occlusionDotPlugin;
+		delete occlusionOctreePlugin;
+		delete occlusionTerrainPlugin;
+    }
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/Makefile.in
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/Makefile.in	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/Makefile.in	(revision 12)
@@ -0,0 +1,501 @@
+# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+BOOST_CFLAGS = @BOOST_CFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
+BUILD_PYTHON_INTERFACE_FALSE = @BUILD_PYTHON_INTERFACE_FALSE@
+BUILD_PYTHON_INTERFACE_TRUE = @BUILD_PYTHON_INTERFACE_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFGTK_DEPS_CFLAGS = @CFGTK_DEPS_CFLAGS@
+CFGTK_DEPS_LIBS = @CFGTK_DEPS_LIBS@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FT2_CFLAGS = @FT2_CFLAGS@
+FT2_CONFIG = @FT2_CONFIG@
+FT2_LIBS = @FT2_LIBS@
+GLSUPPORT_CFLAGS = @GLSUPPORT_CFLAGS@
+GLSUPPORT_LIBS = @GLSUPPORT_LIBS@
+GL_LIBS = @GL_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OGREMAIN_VERSION_INFO = @OGREMAIN_VERSION_INFO@
+OGRE_CFGTK = @OGRE_CFGTK@
+OGRE_CFLAGS = @OGRE_CFLAGS@
+OGRE_GLSUPPORT = @OGRE_GLSUPPORT@
+OGRE_PLATFORM = @OGRE_PLATFORM@
+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@
+PLATFORM_CFLAGS = @PLATFORM_CFLAGS@
+PLATFORM_LIBS = @PLATFORM_LIBS@
+PYTHON_CFLAGS = @PYTHON_CFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SET_MAKE = @SET_MAKE@
+SHARED_FLAGS = @SHARED_FLAGS@
+SHELL = @SHELL@
+STLPORT_CFLAGS = @STLPORT_CFLAGS@
+STLPORT_LIBS = @STLPORT_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+INCLUDES = $(STLPORT_CFLAGS) -I$(top_srcdir)/PlugIns/BSPSceneManager/include -I$(top_srcdir)/OgreMain/include
+
+pkglib_PROGRAMS = Plugin_BSPSceneManager.so
+
+Plugin_BSPSceneManager_so_SOURCES = OgreBspLevel.cpp \
+                             OgreBspNode.cpp \
+                             OgreBspResourceManager.cpp \
+                             OgreBspSceneManager.cpp \
+                             OgreBspSceneManagerDll.cpp \
+							 OgreBspSceneNode.cpp \
+                             OgreQuake3ShaderManager.cpp \
+                             OgreQuake3Shader.cpp \
+                             OgreQuake3Level.cpp
+
+
+Plugin_BSPSceneManager_so_LDFLAGS = $(SHARED_FLAGS) -L$(top_srcdir)/OgreMain/src
+Plugin_BSPSceneManager_so_LDADD = -lOgreMain
+subdir = PlugIns/BSPSceneManager/src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/OgreMain/include/config.h
+CONFIG_CLEAN_FILES =
+pkglib_PROGRAMS = Plugin_BSPSceneManager.so$(EXEEXT)
+PROGRAMS = $(pkglib_PROGRAMS)
+
+am_Plugin_BSPSceneManager_so_OBJECTS = OgreBspLevel.$(OBJEXT) \
+	OgreBspNode.$(OBJEXT) OgreBspResourceManager.$(OBJEXT) \
+	OgreBspSceneManager.$(OBJEXT) OgreBspSceneManagerDll.$(OBJEXT) \
+	OgreBspSceneNode.$(OBJEXT) OgreQuake3ShaderManager.$(OBJEXT) \
+	OgreQuake3Shader.$(OBJEXT) OgreQuake3Level.$(OBJEXT)
+Plugin_BSPSceneManager_so_OBJECTS = \
+	$(am_Plugin_BSPSceneManager_so_OBJECTS)
+Plugin_BSPSceneManager_so_DEPENDENCIES =
+
+DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)/OgreMain/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/OgreBspLevel.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreBspNode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreBspResourceManager.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreBspSceneManager.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreBspSceneManagerDll.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreBspSceneNode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreQuake3Level.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreQuake3Shader.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/OgreQuake3ShaderManager.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(Plugin_BSPSceneManager_so_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(Plugin_BSPSceneManager_so_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  PlugIns/BSPSceneManager/src/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+pkglibPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+install-pkglibPROGRAMS: $(pkglib_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
+	@list='$(pkglib_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(pkglibPROGRAMS_INSTALL) $$p $(DESTDIR)$(pkglibdir)/$$f"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(pkglibPROGRAMS_INSTALL) $$p $(DESTDIR)$(pkglibdir)/$$f || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-pkglibPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkglib_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f $(DESTDIR)$(pkglibdir)/$$f"; \
+	  rm -f $(DESTDIR)$(pkglibdir)/$$f; \
+	done
+
+clean-pkglibPROGRAMS:
+	@list='$(pkglib_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+Plugin_BSPSceneManager.so$(EXEEXT): $(Plugin_BSPSceneManager_so_OBJECTS) $(Plugin_BSPSceneManager_so_DEPENDENCIES) 
+	@rm -f Plugin_BSPSceneManager.so$(EXEEXT)
+	$(CXXLINK) $(Plugin_BSPSceneManager_so_LDFLAGS) $(Plugin_BSPSceneManager_so_OBJECTS) $(Plugin_BSPSceneManager_so_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreBspLevel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreBspNode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreBspResourceManager.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreBspSceneManager.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreBspSceneManagerDll.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreBspSceneNode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreQuake3Level.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreQuake3Shader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OgreQuake3ShaderManager.Po@am__quote@
+
+distclean-depend:
+	-rm -rf ./$(DEPDIR)
+
+.cpp.o:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCXX_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCXX_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCXX_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCXX_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCXX_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+@am__fastdepCXX_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCXX_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+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; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS:  $(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; } \
+	       END { 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
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    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 $(PROGRAMS)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
+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_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(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-pkglibPROGRAMS \
+	mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+	distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-pkglibPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+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: uninstall-info-am uninstall-pkglibPROGRAMS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-pkglibPROGRAMS ctags distclean \
+	distclean-compile distclean-depend distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am info \
+	info-am install install-am install-data install-data-am \
+	install-exec install-exec-am install-info install-info-am \
+	install-man install-pkglibPROGRAMS 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 uninstall-info-am \
+	uninstall-pkglibPROGRAMS
+
+# 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:
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreSolidHalfBoundingBox.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreSolidHalfBoundingBox.cpp	(revision 54)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreSolidHalfBoundingBox.cpp	(revision 54)
@@ -0,0 +1,118 @@
+#include "OgreStableHeaders.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+#include "OgreSimpleRenderable.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreCamera.h"
+#include "OgreMaterialManager.h"
+//#include <windows.h>
+
+namespace Ogre {
+    #define POSITION_BINDING 0
+	//-----------------------------------------------------------------------
+	SolidHalfBoundingBox::SolidHalfBoundingBox(bool isFirstHalf)
+		:WireBoundingBox(), mIsFirstHalf(isFirstHalf)
+    {
+		setOcclusionQueryMaterial();
+		
+		mRenderOp.vertexData->vertexCount = 8;
+        mRenderOp.operationType = RenderOperation::OT_TRIANGLE_FAN; 
+	}
+	//-----------------------------------------------------------------------
+	void SolidHalfBoundingBox::setupBoundingBoxVertices(const AxisAlignedBox& aab) {
+
+		Vector3 vmax = aab.getMaximum();
+		Vector3 vmin = aab.getMinimum();
+		
+		
+		Real sqLen = std::max(vmax.squaredLength(), vmin.squaredLength());
+        mRadius = Math::Sqrt(sqLen);
+		
+		Real maxx = vmax.x;
+		Real maxy = vmax.y;
+		Real maxz = vmax.z;
+		
+		Real minx = vmin.x;
+		Real miny = vmin.y;
+		Real minz = vmin.z;
+		
+		// fill in the Vertex buffer: 12 lines with 2 endpoints each make up a box
+        HardwareVertexBufferSharedPtr vbuf =
+            mRenderOp.vertexData->vertexBufferBinding->getBuffer(POSITION_BINDING);     
+
+        float* pPos = static_cast<float*>(
+            vbuf->lock(HardwareBuffer::HBL_DISCARD));
+
+		//     5+------+7
+		//     /|     /|
+		//    / |    / |
+		//   / 1+---/--+3
+		// 2+------+6 /    y   z
+		//  | /    | /     |  /
+		//  |/     |/      |/
+		// 0+------+4      *---x
+
+		// fan 1
+		if(mIsFirstHalf)
+		{
+			*pPos++ = minx; *pPos++ = maxy; *pPos++ = maxz; //011
+			*pPos++ = minx; *pPos++ = miny; *pPos++ = maxz; //001
+			*pPos++ = maxx; *pPos++ = miny; *pPos++ = maxz; //101
+			*pPos++ = maxx; *pPos++ = maxy; *pPos++ = maxz; //111
+			
+			*pPos++ = maxx; *pPos++ = maxy; *pPos++ = minz; //110
+			*pPos++ = minx; *pPos++ = maxy; *pPos++ = minz; //010
+			*pPos++ = minx; *pPos++ = miny; *pPos++ = minz; //000
+			*pPos++ = minx; *pPos++ = miny; *pPos++ = maxz; //001
+
+		}
+		else
+		// fan 2
+		{
+			*pPos++ = maxx; *pPos++ = miny; *pPos++ = minz; //100
+			*pPos++ = minx; *pPos++ = miny; *pPos++ = minz; //000 					
+			*pPos++ = minx; *pPos++ = maxy; *pPos++ = minz; //010
+			*pPos++ = maxx; *pPos++ = maxy; *pPos++ = minz; //110
+
+			*pPos++ = maxx; *pPos++ = maxy; *pPos++ = maxz; //111
+			*pPos++ = maxx; *pPos++ = miny; *pPos++ = maxz; //101
+			*pPos++ = minx; *pPos++ = miny; *pPos++ = maxz; //001
+			*pPos++ = minx; *pPos++ = miny; *pPos++ = minz; //000
+		}
+
+        vbuf->unlock();
+	}
+
+	void SolidHalfBoundingBox::setupBoundingBox(const AxisAlignedBox& aabb) 
+    {
+		// init the vertices to the aabb
+		SolidHalfBoundingBox::setupBoundingBoxVertices(aabb);
+
+    	// setup the bounding box of this SimpleRenderable
+		setBoundingBox(aabb);
+	}
+	// Override this method to prevent parent transforms (rotation,translation,scale)
+    void SolidHalfBoundingBox::getWorldTransforms( Matrix4* xform ) const
+    {
+		// return identity matrix to prevent parent transforms
+        *xform = Matrix4::IDENTITY;
+    }
+
+	void SolidHalfBoundingBox::setOcclusionQueryMaterial( void )
+	{
+		m_pMaterial = MaterialManager::getSingleton().getByName("OcclusionQuery");
+
+		if(m_pMaterial.isNull())
+		{
+			m_pMaterial = MaterialManager::getSingleton().
+				create("OcclusionQuery", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+		}
+
+		m_pMaterial->setColourWriteEnabled(false);
+		m_pMaterial->setDepthWriteEnabled(false);
+		m_pMaterial->setLightingEnabled(false);
+
+		setMaterial("OcclusionQuery");
+	}
+}
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp	(revision 42)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp	(revision 42)
@@ -0,0 +1,101 @@
+#include "OgreOcclusionCullingSceneManager.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystem.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+//#include "OgreWireBoundingBox.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+#include <windows.h>
+
+namespace Ogre {
+	
+	//-----------------------------------------------------------------------
+	OcclusionCullingSceneManager::OcclusionCullingSceneManager()
+	{
+		mOcclusionCullingSceneTraverser = new OcclusionCullingSceneTraverser(this, mDestRenderSystem);
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingSceneManager::~OcclusionCullingSceneManager()
+	{
+		delete mOcclusionCullingSceneTraverser;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneManager::_findVisibleObjects( Camera* cam, bool onlyShadowCasters )
+	{
+		// empty because we have to find objects in _renderVisibleObjects
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneManager::_renderVisibleObjects( void )
+	{
+			//-- render background
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
+		addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
+	
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
+		SceneManager::_renderVisibleObjects( );
+		_deleteRenderedQueueGroups();
+
+		//-- render visible objects (i.e., all but overlay)
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
+
+		mOcclusionCullingSceneTraverser->setSceneRoot(mSceneRoot);
+		mOcclusionCullingSceneTraverser->renderScene(mCameraInProgress);
+
+		_deleteRenderedQueueGroups();
+
+		//-- render overlay
+		clearSpecialCaseRenderQueues();
+		SceneManager::_renderVisibleObjects( );
+	
+		clearSpecialCaseRenderQueues();
+	}
+	//-----------------------------------------------------------------------
+	/*void OcclusionCullingSceneManager::renderZPass()
+	{
+		traverseNode(mSceneRoot);
+	}*/
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneManager::_updateSceneGraph( Camera* cam )
+	{
+		mOcclusionCullingSceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
+		mOcclusionCullingSceneTraverser->setRenderSystem(mDestRenderSystem);
+		
+		//mOcclusionCullingSceneTraverser->setNumQueries((int)mSceneNodes.size());
+        //mOcclusionCullingSceneTraverser->preprocess();
+		
+		SceneManager::_updateSceneGraph(cam);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneManager::setOption( const String & key, const void * val )
+	{
+		mOcclusionCullingSceneTraverser->setOption(key, val);
+			
+		return SceneManager::setOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneManager::getOption( const String & key, void *val )
+	{
+		mOcclusionCullingSceneTraverser->getOption(key, val);
+		
+		return SceneManager::getOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
+	{
+		return SceneManager::getOptionValues( key, refValueList );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneManager::getOptionKeys( StringVector & refKeys )
+	{
+		SceneManager::getOptionKeys( refKeys );
+
+		mOcclusionCullingSceneTraverser->getOptionKeys( refKeys );
+
+		return true;
+	}
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneManager.cpp	(revision 52)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneManager.cpp	(revision 52)
@@ -0,0 +1,89 @@
+#include "OgreOcclusionCullingOctreeSceneManager.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystem.h"
+#include "OgreCamera.h"
+
+#include <windows.h>
+
+namespace Ogre {
+	//-----------------------------------------------------------------------
+	OcclusionCullingOctreeSceneManager::OcclusionCullingOctreeSceneManager()
+	{
+		mOcclusionCullingOctreeSceneTraverser = 
+			new OcclusionCullingOctreeSceneTraverser(this, mDestRenderSystem);
+
+		//mDisplayNodes = true;
+		//mShowBoundingBoxes = true;
+		//mShowBoxes = true;
+		//mMaxDepth = 20;
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingOctreeSceneManager::~OcclusionCullingOctreeSceneManager()
+	{
+		delete mOcclusionCullingOctreeSceneTraverser;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneManager::_renderVisibleObjects(void)
+	{
+		//-- render background
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
+		addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
+	
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
+		SceneManager::_renderVisibleObjects( );
+		_deleteRenderedQueueGroups();
+
+		//-- render visible objects (i.e., all but overlay)
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
+
+		mOcclusionCullingOctreeSceneTraverser->setSceneRoot(mOctree);
+		mOcclusionCullingOctreeSceneTraverser->renderScene(mCameraInProgress);
+
+		_deleteRenderedQueueGroups();
+
+		//-- render rest, e.g., overlay
+		clearSpecialCaseRenderQueues();
+		SceneManager::_renderVisibleObjects();
+		//_deleteRenderedQueueGroups();
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
+	{
+		// must be empty because objects are found and rendered in an interleaved fashion
+		// in _renderVisibibleObjects 
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneManager::_updateSceneGraph(Camera* cam)
+	{
+		mOcclusionCullingOctreeSceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
+		mOcclusionCullingOctreeSceneTraverser->setRenderSystem(mDestRenderSystem);
+        
+		mOcclusionCullingOctreeSceneTraverser->setNumOctreeNodes(mNumOctreeNodes);
+
+		OctreeSceneManager::_updateSceneGraph(cam);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneManager::setOption( const String & key, const void * val )
+	{
+		return mOcclusionCullingOctreeSceneTraverser->setOption( key, val) || OctreeSceneManager::setOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneManager::getOption( const String & key, void *val )
+	{
+		return mOcclusionCullingOctreeSceneTraverser->getOption( key, val) || OctreeSceneManager::getOption( key, val ) ;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
+	{
+		return OctreeSceneManager::getOptionValues( key, refValueList );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneManager::getOptionKeys( StringVector & refKeys )
+	{
+		return mOcclusionCullingOctreeSceneTraverser->getOptionKeys ( refKeys ) || OctreeSceneManager::getOptionKeys( refKeys );
+	}
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp	(revision 59)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp	(revision 59)
@@ -0,0 +1,509 @@
+#include "OgreOcclusionCullingSceneTraverser.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+
+#include <windows.h>
+
+namespace Ogre {
+	
+	//-----------------------------------------------------------------------
+	OcclusionCullingSceneTraverser::OcclusionCullingSceneTraverser(SceneManager *sm, RenderSystem *rsys): 
+	mFrameId(1), mDistanceQueue(NULL), mVisibilityThreshold(0), mCurrentTestIdx(0),
+	mQueryMode(MODE_RENDER), mNumSceneNodes(0), mCurrentAlgorithm(RENDER_COHERENT),
+	mNumQueries(0), mNumTraversedNodes(0), mNumQueryCulledNodes(0), mNumFrustumCulledNodes(0), 
+	mNumRenderedNodes(0),mNumRenderedGeometry(0), mSceneManager(sm), mRenderSystem(rsys), mSceneRoot(NULL)
+	{		
+		mHalfBoundingBox[0] = mHalfBoundingBox[1] = 0;
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingSceneTraverser::~OcclusionCullingSceneTraverser()
+	{		
+		if(mHalfBoundingBox[0]) delete mHalfBoundingBox[0];
+		if(mHalfBoundingBox[1]) delete mHalfBoundingBox[1];
+
+		deleteQueries();
+
+		if(mDistanceQueue)
+			delete mDistanceQueue;
+		//SceneManager::~SceneManager();
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::renderScene( Camera *cam )
+	{
+		mNumTraversedNodes = 0;
+		mNumQueryCulledNodes = 0;
+		mNumFrustumCulledNodes = 0;
+		mNumRenderedGeometry = 0;
+		mNumRenderedNodes = 0;
+
+		mCurrentTestIdx = 0;
+
+		initDistanceQueue(cam);
+
+		switch(mCurrentAlgorithm)
+		{
+			case RENDER_CULL_FRUSTUM:
+				renderCullFrustum(cam);
+		        break;
+			case RENDER_STOP_AND_WAIT:
+				renderStopAndWait(cam);
+				break;
+			case RENDER_COHERENT:
+				renderCoherentWithQueue(cam);
+				break;
+			default:
+				renderCullFrustum(cam);
+				break;
+		}	
+
+		mFrameId ++;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::renderCoherentWithQueue(Camera *cam)
+	{
+		QueryQueue queryQueue;
+
+		//-- PART 1: process finished occlusion queries
+		while(!mDistanceQueue->empty() || !queryQueue.empty())
+		{
+			 
+				SceneNode *node = queryQueue.front().first;
+				HardwareOcclusionQuery *query = queryQueue.front().second;
+
+				queryQueue.pop();
+			
+				// wait until result available
+				unsigned int visiblePixels;
+				query->pullOcclusionQuery(&visiblePixels);
+
+				if(visiblePixels > mVisibilityThreshold)
+				{
+					pullUpVisibility(node);
+					traverseNode(cam, node);
+				}
+				else
+				{
+					mNumQueryCulledNodes ++;
+				}
+			}	
+
+			//-- PART 2: hierarchical traversal
+			if(!mDistanceQueue->empty())
+			{
+				SceneNode *node = mDistanceQueue->top();
+				mDistanceQueue->pop();
+				
+				bool intersects = false;
+				//TODO: Isvisible also checked inside scenenode::findvisibleobjects
+				if(!cam->isVisible(node->_getWorldAABB(), intersects))
+				{
+                    mNumFrustumCulledNodes ++;
+					continue;
+				}
+
+				// if intersects near plane => skip occlusion query because wrong results possible
+				if(intersects)
+				{
+					// update node's visited flag
+					node->setLastVisited(mFrameId);
+					pullUpVisibility(node);			
+					traverseNode(cam, node);
+
+					continue;
+				}
+
+				// identify previously visible nodes
+				bool wasVisible = node->isNodeVisible() && (node->lastVisited() == mFrameId - 1);
+					
+				// identify nodes that we cannot skip queries for
+				bool mustQuery= !wasVisible || (node->numAttachedObjects() > 0) || isLeaf(node);
+
+				// reset node's visibility classification 
+				node->setNodeVisible(false);
+
+				// update node's visited flag
+				node->setLastVisited(mFrameId);
+				
+				// skip testing previously visible interior nodes without geometry
+				if(mustQuery)
+				{
+					HardwareOcclusionQuery *query = issueOcclusionQuery(&node->_getWorldAABB(), wasVisible);
+					queryQueue.push(QueryPair(node, query));
+				}
+					
+				// always traverse a node if it was visible
+				if(wasVisible)
+				{
+					traverseNode(cam, node);
+				}
+				else
+				{
+					mNumFrustumCulledNodes ++;
+				}
+			}
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::renderCullFrustum(Camera *cam)
+	{
+		while(!mDistanceQueue->empty())
+		{
+			SceneNode *node = mDistanceQueue->top();
+			mDistanceQueue->pop();
+	
+			// interesting for visualization purpose
+			node->setNodeVisible(false);
+
+			//TODO: IsVisible also checked inside scenenode::_findvisibleobjects
+			if(!cam->isVisible(node->_getWorldAABB()))
+			{			
+				mNumFrustumCulledNodes ++;
+				continue;
+			}
+
+			// update node's visited flag 
+			node->setLastVisited(mFrameId);
+			node->setNodeVisible(true);
+			traverseNode(cam, node);
+		}
+	}	
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::renderStopAndWait(Camera *cam)
+	{
+		while(!mDistanceQueue->empty())
+		{
+			SceneNode *node = mDistanceQueue->top();
+			mDistanceQueue->pop();
+		
+			// interesting for the visualization
+			node->setNodeVisible(false);
+			node->setLastVisited(mFrameId);
+
+			bool intersects = false;
+			//TODO: Isvisible also checked inside scenenode::findvisibleobjects
+			if(!cam->isVisible(node->_getWorldAABB(), intersects))
+			{
+				mNumFrustumCulledNodes ++;
+				continue;
+			}
+
+			// if intersects near plane => skip occlusion query because wrong results possible
+			if(intersects)
+			{
+				node->setNodeVisible(true);
+				traverseNode(cam, node);
+
+				continue;
+			}
+
+			HardwareOcclusionQuery *query = issueOcclusionQuery(&node->_getWorldAABB(), false);
+				
+			unsigned int visiblePixels;
+			// wait if result not available
+			query->pullOcclusionQuery(&visiblePixels);
+	
+			// node visible
+			if(visiblePixels > mVisibilityThreshold)
+			{
+				node->setNodeVisible(true);
+				traverseNode(cam, node);
+			}
+			else
+			{
+				mNumQueryCulledNodes ++;
+			}
+		}
+	}
+	//-----------------------------------------------------------------------
+	HardwareOcclusionQuery *OcclusionCullingSceneTraverser::issueOcclusionQuery( 
+		AxisAlignedBox *box, bool wasVisible )
+	{
+		// change state so the bounding box gets not actually rendered on the screen
+		// TODO: in rendervisibleobjects, the rendermode is changed by ogre itself => change this!!
+		
+		//setRenderingMode(MODE_QUERY);
+		//mRenderSystem->_setRasterisationMode(SDL_SOLID); setRenderingMode(MODE_RENDER);
+
+		// get next available test id
+		HardwareOcclusionQuery *query = getNextOcclusionQuery();
+
+		//-- the actual query test
+		query->beginOcclusionQuery();
+				
+		renderBoundingBox(box);
+
+		query->endOcclusionQuery();
+	
+		/*mRenderSystem->_setRasterisationMode(SDL_WIREFRAME);
+		setRenderingMode(MODE_RENDER);
+		renderBoundingBox(box);
+		mRenderSystem->_setRasterisationMode(SDL_SOLID);*/
+		
+		return query;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setRenderingMode( int mode )
+	{	
+		// avoid unnecessary state changes
+		if(mode != mQueryMode)
+		{
+			mQueryMode = mode;
+			bool enabled = (mode == MODE_RENDER);
+			
+			//if(mode == MODE_RENDER) return;
+
+			/*
+			mRenderSystem->_setRasterisationMode(SDL_SOLID);
+			mRenderSystem->_setSurfaceParams(ColourValue(0.9, 0.2, 0.2),
+			ColourValue(0.2, 0.2, 0.2), ColourValue(0.2, 0.2, 0.2),
+			ColourValue(0, 0, 0), Real(100));
+			mRenderSystem->_setDepthBufferCheckEnabled(false);
+			mRenderSystem->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 255);
+			*/
+
+          	mRenderSystem->_setColourBufferWriteEnabled(enabled, enabled, enabled, enabled);
+			mRenderSystem->_setDepthBufferWriteEnabled(enabled);
+			//mRenderSystem->setLightingEnabled(enabled);
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::traverseNode( Camera *cam, SceneNode *node )
+	{
+		mNumTraversedNodes ++;
+		
+		if(node->numAttachedObjects() > 0)
+		{
+			renderSceneNode(cam, node);
+		}
+
+		// internal node: add children to priority queue for further processing
+		Node::ChildNodeIterator it = node->getChildIterator();
+					
+		while (it.hasMoreElements())			
+		{ 
+			SceneNode* sceneChild = static_cast<SceneNode*>(it.getNext());
+			mDistanceQueue->push(sceneChild);
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::renderSceneNode( Camera *cam, SceneNode *node )
+	{
+		//TODO: does not do any changes
+		//setRenderingMode(MODE_RENDER);
+		
+		if(node->lastRendered() != node->lastVisited())
+		{
+			node->setLastRendered(node->lastVisited());
+			mNumRenderedNodes ++;
+
+			mSceneManager->_renderSceneNode(cam, node);
+		}
+	}
+	//-----------------------------------------------------------------------
+/*	void OcclusionCullingSceneTraverser::preprocess( void )
+	{
+		//-- initialise occlusion queries.
+		deleteQueries();
+
+		for(unsigned int i=0; i < mNumQueries; i++)
+		{
+			mOcclusionQueries.push_back(mRenderSystem->createHardwareOcclusionQuery());
+		}	
+	}*/
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setSceneManager( SceneManager *sm )
+	{
+		mSceneManager = sm;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setRenderSystem( RenderSystem *rsys )
+	{
+		mRenderSystem = rsys;
+	}
+	//-----------------------------------------------------------------------
+	/*unsigned int OcclusionCullingSceneManager::countSceneNodes(SceneNode *node)
+	{
+		unsigned int result = 1;
+		
+		Node::ChildNodeIterator it = node->getChildIterator();
+		
+		while (it.hasMoreElements())
+		{ 
+			SceneNode* sceneChild = static_cast<SceneNode*>(it.getNext());
+			result += countSceneNodes(sceneChild);
+        }
+
+		return result;
+	}*/
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneTraverser::isLeaf( SceneNode *node )
+	{
+		return (node->numChildren() == 0);
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::pullUpVisibility(SceneNode *node )
+	{
+		while(node && !node->isNodeVisible())
+		{
+			node->setNodeVisible(true);
+			node = node->getParentSceneNode();
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::deleteQueries( void )
+	{
+		for(unsigned int i=0; i < (unsigned int)mOcclusionQueries.size(); ++i)
+			delete mOcclusionQueries[i];
+
+		mOcclusionQueries.clear();
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::renderBoundingBox( AxisAlignedBox *box )
+	{
+		// Render two halfes of the bounding box (using triangle fans)
+		for(int half = 0; half < 2; half ++)
+		{
+			static Matrix4 xform[256];
+			//TODO: this should be full bounding box
+			SolidHalfBoundingBox *halfbox = getSolidHalfBoundingBox(half);
+			halfbox->setupBoundingBox(*box);
+			
+			/*mRenderSystem->_setWorldMatrix(Matrix4::IDENTITY);
+
+			halfbox->getWorldTransforms(xform);
+
+			int numMatrices = halfbox->getNumWorldTransforms();
+			if (numMatrices > 1)
+			{
+				mRenderSystem->_setWorldMatrices(xform, numMatrices);
+			}
+			else
+			{
+				mRenderSystem->_setWorldMatrix(*xform);
+			}
+			mRenderSystem->setClipPlanes(halfbox->getClipPlanes());
+
+			static RenderOperation ro;
+
+			mSceneManager->useRenderableViewProjMode(halfbox);
+			halfbox->getRenderOperation(ro);
+			ro.srcRenderable = halfbox; 
+			mRenderSystem->_render(ro);*/
+			
+			mSceneManager->myrenderSingleObject(getSolidHalfBoundingBox(half), 
+				getSolidHalfBoundingBox(half)->getTechnique()->getPass(0), true);
+		}
+	}
+	//-----------------------------------------------------------------------
+	SolidHalfBoundingBox *OcclusionCullingSceneTraverser::getSolidHalfBoundingBox( int half )
+	{
+		if(!mHalfBoundingBox[half])
+			mHalfBoundingBox[half] = new SolidHalfBoundingBox(half == 1);
+
+		return mHalfBoundingBox[half];	
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setNumSceneNodes(int num)
+	{
+		mNumSceneNodes = num;
+	}
+	//-----------------------------------------------------------------------
+	/*void OcclusionCullingSceneTraverser::setNumQueries(int num)
+	{
+		mNumQueries = num;
+	}*/
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setSceneRoot(SceneNode *root)
+	{
+		mSceneRoot = root;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::initDistanceQueue(Camera *cam)
+	{
+		mDistanceQueue = new PriorityQueue(myless<SceneNode *>(cam));
+		mDistanceQueue->push(mSceneRoot);
+	}
+	//-----------------------------------------------------------------------
+	HardwareOcclusionQuery *OcclusionCullingSceneTraverser::getNextOcclusionQuery(void)
+	{
+		if(mCurrentTestIdx == mOcclusionQueries.size())
+		{
+			mOcclusionQueries.push_back(mRenderSystem->createHardwareOcclusionQuery());
+		}
+		
+		return mOcclusionQueries[mCurrentTestIdx ++];
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneTraverser::setOption( const String & key, const void * val )
+	{
+		if ( key == "Algorithm" )
+		{
+			mCurrentAlgorithm = * static_cast < const int * > ( val );
+			return true;
+		}
+		if ( key == "Threshold" )
+		{
+			mVisibilityThreshold = * static_cast < const int * > ( val );
+			return true;
+		}
+
+		return false;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneTraverser::getOption( const String & key, void *val )
+	{
+		if ( key == "Algorithm" )
+		{
+			* static_cast < int * > ( val ) = mCurrentAlgorithm;
+			return true;
+		}
+		if ( key == "Threshold" )
+		{
+			* static_cast < unsigned int * > ( val ) = mVisibilityThreshold;
+			return true;
+		}
+		if ( key == "NumSceneNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumSceneNodes;
+			return true;
+		}
+		if ( key == "NumTraversedNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumTraversedNodes;
+			return true;
+		}
+		if ( key == "NumQueryCulledNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumQueryCulledNodes;
+			return true;
+		}
+		if ( key == "NumFrustumCulledNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumFrustumCulledNodes;
+			return true;
+		}
+		if ( key == "NumRenderedNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumRenderedNodes;
+			return true;
+		}
+		return false;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneTraverser::getOptionKeys( StringVector & refKeys )
+	{
+		refKeys.push_back( "Algorithm" );
+		refKeys.push_back( "Threshold" );
+		refKeys.push_back( "NumSceneNodes" );
+		refKeys.push_back( "NumTraversedNodes" );
+		refKeys.push_back( "NumQueryCulledNodes" );
+		refKeys.push_back( "NumFrustumCulledNodes" );
+		refKeys.push_back( "mNumRenderedGeometry" );
+
+		return true;
+	}
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneTraverser.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneTraverser.cpp	(revision 55)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneTraverser.cpp	(revision 55)
@@ -0,0 +1,282 @@
+#include "OgreOcclusionCullingOctreeSceneTraverser.h"
+#include "OgreOcclusionCullingOctreeSceneManager.h"
+#include "OgreHardwareOcclusionQuery.h"
+
+#include <windows.h>
+
+namespace Ogre {
+	//-----------------------------------------------------------------------
+	OcclusionCullingOctreeSceneTraverser::OcclusionCullingOctreeSceneTraverser(SceneManager *sm, RenderSystem *rsys): 
+	OcclusionCullingSceneTraverser(sm, rsys), mOctreeSceneRoot(0), mOctreeDistanceQueue(0)
+	{
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingOctreeSceneTraverser::~OcclusionCullingOctreeSceneTraverser()
+	{		
+		if(mOctreeDistanceQueue)
+			delete mOctreeDistanceQueue;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::traverseOctant(Camera *cam, Octree *octant)
+	{
+		mNumTraversedNodes ++;
+	
+		// if we come across some renderable geometry => render it
+		renderOctant(cam, octant);
+		
+		for(int i=0; i<8; i++)
+		{
+			Octree *nextChild = octant->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1];
+
+			if(nextChild)
+			{
+				mOctreeDistanceQueue->push(nextChild);
+			}
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::renderCullFrustum(Camera *cam)
+	{
+		AxisAlignedBox box;
+
+		while(!mOctreeDistanceQueue->empty())
+		{
+			Octree *octant = mOctreeDistanceQueue->top();
+			mOctreeDistanceQueue->pop();
+	
+			// interesting for visualization purpose
+			octant->setOctreeVisible(false);
+			octant->_getCullBounds(&box);
+			
+			if(!cam->isVisible(box))
+			{
+				mNumFrustumCulledNodes ++;
+				continue;
+			}
+
+			mRenderSystem->_setRasterisationMode(SDL_WIREFRAME);
+			renderBoundingBox(&box);
+			mRenderSystem->_setRasterisationMode(SDL_SOLID);
+			// update node's visited flag 
+			octant->setLastVisited(mFrameId);
+			octant->setOctreeVisible(true);
+		
+			traverseOctant(cam, octant);
+		}
+	}	
+	//-----------------------------------------------------------------------
+	/** Renders the scene with the hierarchical stop and wait algorithm. */
+	void OcclusionCullingOctreeSceneTraverser::renderStopAndWait( Camera *cam )
+	{
+		AxisAlignedBox box;
+
+		while(!mOctreeDistanceQueue->empty())
+		{
+			Octree *octant = mOctreeDistanceQueue->top();
+			mOctreeDistanceQueue->pop();
+		
+			// interesting for visualization purpose
+			octant->setOctreeVisible(false);
+			octant->setLastVisited(mFrameId);
+
+			//TODO: Isvisible also checked inside scenenode::findvisibleobjects
+			octant->_getCullBounds(&box);
+
+			bool intersects = false;
+
+			if(!cam->isVisible(box, intersects))
+			{
+				mNumFrustumCulledNodes ++;
+				continue;
+			}
+			//if intersects near plane => skip occlusion query because wrong results possible
+			if(intersects)
+			{
+				octant->setOctreeVisible(true);
+				traverseOctant(cam, octant);
+				continue;
+			}
+
+			HardwareOcclusionQuery *query = issueOcclusionQuery(&box, false);
+				
+			unsigned int visiblePixels;
+			// wait if result not available
+			query->pullOcclusionQuery(&visiblePixels);
+
+			//char msg[100]; sprintf(msg, "visible pixels: %d\n", visiblePixels);
+			//OutputDebugString(msg);
+
+			// node visible
+			if(visiblePixels > mVisibilityThreshold)
+			{
+				traverseOctant(cam, octant);
+			}
+			else
+			{
+				mNumQueryCulledNodes ++;
+			}
+		}
+	}
+	//-----------------------------------------------------------------------
+	/** Renders the scene with the coherent hierarchical algorithm and the query queye. */
+	void OcclusionCullingOctreeSceneTraverser::renderCoherentWithQueue( Camera *cam )
+	{
+		OctreeQueryQueue queryQueue;
+		AxisAlignedBox box;
+
+		//-- PART 1: process finished occlusion queries
+		while(!mOctreeDistanceQueue->empty() || !queryQueue.empty())
+		{
+			while(!queryQueue.empty() && 
+				  ((queryQueue.front().second)->resultAvailable() || mOctreeDistanceQueue->empty()))
+			{
+				Octree *octant = queryQueue.front().first;
+				HardwareOcclusionQuery *query = queryQueue.front().second;
+
+				queryQueue.pop();
+			
+				// wait until result available
+				unsigned int visiblePixels;
+				query->pullOcclusionQuery(&visiblePixels);
+
+				if(visiblePixels > mVisibilityThreshold)
+				{
+					pullUpVisibility(octant);
+					traverseOctant(cam, octant);
+				}
+				else
+				{
+					mNumQueryCulledNodes ++;
+				}
+			}	
+
+			//-- PART 2: hierarchical traversal
+			if(!mOctreeDistanceQueue->empty())
+			{
+				Octree *octant = mOctreeDistanceQueue->top();
+				mOctreeDistanceQueue->pop();
+					
+				octant->_getCullBounds(&box);
+
+				bool intersects = false;
+				//TODO: Isvisible also checked inside scenenode::findvisibleobjects
+				if(!cam->isVisible(box, intersects))
+				{
+                    mNumFrustumCulledNodes ++;
+					continue;
+				}
+
+				// if intersects near plane => skip occlusion query because wrong results possible
+				if(intersects)
+				{
+					// update octant's visited flag
+					octant->setLastVisited(mFrameId);
+
+					pullUpVisibility(octant);			
+					traverseOctant(cam, octant);
+
+					continue;
+				}
+
+				// identify previously visible nodes
+				bool wasVisible = octant->isOctreeVisible() && (octant->lastVisited() == mFrameId - 1);
+				
+				// identify nodes that we cannot skip queries for
+				bool mustQuery = !wasVisible || (octant->numNodes() > 0) || isLeaf(octant);
+
+				// reset node's visibility classification 
+				octant->setOctreeVisible(false);
+
+				// update node's visited flag
+				octant->setLastVisited(mFrameId);
+			
+				// skip testing previously visible interior nodes
+				if(mustQuery)
+				{
+					HardwareOcclusionQuery *query = issueOcclusionQuery(&box, wasVisible);
+					queryQueue.push(OctreeQueryPair(octant, query));
+				}
+					
+				// always traverse a node if it was visible
+				if(wasVisible)
+				{
+					traverseOctant(cam, octant);
+				}
+			}
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::pullUpVisibility( Octree *octant )
+	{
+		while(octant && !octant->isOctreeVisible())
+		{
+			octant->setOctreeVisible(true);
+			octant = octant->getParent();
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::renderOctant( Camera *cam, Octree *octant )
+	{
+		if(octant->lastRendered() != mFrameId)
+		{
+			octant->setLastRendered(mFrameId);
+
+			if(octant->numNodes() == 0) return;
+
+			//TODO: does nothing useful
+			//setRenderingMode(MODE_RENDER);
+
+			((OctreeSceneManager *)mSceneManager)->_renderOctant(cam, octant);
+
+			mNumRenderedNodes ++;
+		}
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::setSceneRoot( Octree *root )
+	{
+		mOctreeSceneRoot = root;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::initDistanceQueue( Camera *cam )
+	{
+		if(mOctreeDistanceQueue)
+			delete mOctreeDistanceQueue;
+
+		mOctreeDistanceQueue = new OctreePriorityQueue(octreeless<Octree *>(cam));
+		mOctreeDistanceQueue->push(mOctreeSceneRoot);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneTraverser::isLeaf(Octree *octant)
+	{
+		for(int i=0; i<8; i++)
+		{
+			if(octant->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1])
+				return false;
+		}
+
+		return true;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingOctreeSceneTraverser::setNumOctreeNodes(unsigned int num)
+	{
+		mNumOctreeNodes = num;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneTraverser::getOption( const String & key, void *val )
+	{
+		if (key == "NumOctreeNodes")
+		{
+			* static_cast < unsigned int * > ( val ) = mNumOctreeNodes;
+			return true;
+		}
+
+		return OcclusionCullingSceneTraverser::getOption(key, val);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingOctreeSceneTraverser::getOptionKeys( StringVector & refKeys )
+	{
+		refKeys.push_back("NumOctreeNodes");
+		
+		return OcclusionCullingSceneTraverser::getOptionKeys(refKeys);		
+	}
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp	(revision 56)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp	(revision 56)
@@ -0,0 +1,91 @@
+#include "OgreOcclusionCullingTerrainSceneManager.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystem.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+#include <windows.h>
+
+namespace Ogre {
+	//-----------------------------------------------------------------------
+	OcclusionCullingTerrainSceneManager::OcclusionCullingTerrainSceneManager()
+	{
+		mOcclusionCullingOctreeSceneTraverser = 
+			new OcclusionCullingOctreeSceneTraverser(this, mDestRenderSystem);
+
+		//mShowBoxes = true;
+		//mDisplayNodes = true;
+		//mShowBoundingBoxes = true;
+		mMaxDepth = 20;
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingTerrainSceneManager::~OcclusionCullingTerrainSceneManager()
+	{
+		delete mOcclusionCullingOctreeSceneTraverser;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingTerrainSceneManager::_renderVisibleObjects(void)
+	{
+		//-- render background
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
+		addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
+	
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
+		SceneManager::_renderVisibleObjects();
+		_deleteRenderedQueueGroups();
+
+		//-- render visible objects (i.e., all but overlay)
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
+
+		mOcclusionCullingOctreeSceneTraverser->setSceneRoot(mOctree);
+		mOcclusionCullingOctreeSceneTraverser->renderScene(mCameraInProgress);
+		
+		_deleteRenderedQueueGroups();
+
+		//-- render overlay
+		clearSpecialCaseRenderQueues();
+		SceneManager::_renderVisibleObjects( );
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
+	{
+		// must be empty because objects are found and rendered in an interleaved fashion
+		// in _renderVisibibleObjects 
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingTerrainSceneManager::_updateSceneGraph(Camera* cam)
+	{
+		mOcclusionCullingOctreeSceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
+		mOcclusionCullingOctreeSceneTraverser->setRenderSystem(mDestRenderSystem);
+        
+		mOcclusionCullingOctreeSceneTraverser->setNumOctreeNodes(mNumOctreeNodes);
+
+		TerrainSceneManager::_updateSceneGraph(cam);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::setOption( const String & key, const void * val )
+	{
+		return mOcclusionCullingOctreeSceneTraverser->setOption( key, val) || TerrainSceneManager::setOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::getOption( const String & key, void *val )
+	{
+		return mOcclusionCullingOctreeSceneTraverser->getOption( key, val) || TerrainSceneManager::getOption( key, val ) ;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
+	{
+		return TerrainSceneManager::getOptionValues( key, refValueList );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::getOptionKeys( StringVector & refKeys )
+	{
+		return mOcclusionCullingOctreeSceneTraverser->getOptionKeys ( refKeys ) || TerrainSceneManager::getOptionKeys( refKeys );
+	}
+	//-----------------------------------------------------------------------
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/Makefile.am
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/Makefile.am	(revision 16)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/Makefile.am	(revision 16)
@@ -0,0 +1,11 @@
+INCLUDES = $(STLPORT_CFLAGS) -I$(top_srcdir)/PlugIns/OcclusionCullingSceneManager/include -I$(top_srcdir)/OgreMain/include
+
+pkglib_PROGRAMS = Plugin_BSPSceneManager.so
+
+Plugin_OcclusionCullingSceneManager_so_SOURCES = OgreBspLevel.cpp \
+                             OcclusionCullingResourceManager.cpp \
+                             OcclusionCullingSceneManager.cpp \
+                             OcclusionCullingSceneManagerDll.cpp
+					
+Plugin_OcclusionCullingSceneManager_so_LDFLAGS = $(SHARED_FLAGS) -L$(top_srcdir)/OgreMain/src
+Plugin_OcclusionCullingSceneManager_so_LDADD = -lOgreMain
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingDotSceneManager.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingDotSceneManager.cpp	(revision 44)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingDotSceneManager.cpp	(revision 44)
@@ -0,0 +1,89 @@
+#include "OgreOcclusionCullingDotSceneManager.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystem.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+//#include <windows.h>
+
+namespace Ogre {
+	//-----------------------------------------------------------------------
+	OcclusionCullingDotSceneManager::OcclusionCullingDotSceneManager()
+	{
+		mOcclusionCullingSceneTraverser = new OcclusionCullingSceneTraverser(this, mDestRenderSystem);
+		//mDisplayNodes = true;
+		mShowBoundingBoxes = true;
+		//mShowBoxes = true;
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingDotSceneManager::~OcclusionCullingDotSceneManager()
+	{
+		delete mOcclusionCullingSceneTraverser;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingDotSceneManager::_renderVisibleObjects(void)
+	{
+		//-- render background
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
+		addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
+	
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
+		DotSceneManager::_renderVisibleObjects( );
+		_deleteRenderedQueueGroups();
+
+		//-- render visible objects (i.e., all but overlay)
+		clearSpecialCaseRenderQueues();
+		addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
+		setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
+
+		mOcclusionCullingSceneTraverser->setSceneRoot(mSceneRoot);
+		mOcclusionCullingSceneTraverser->renderScene(mCameraInProgress);
+		_deleteRenderedQueueGroups();
+
+		//-- render overlay
+		clearSpecialCaseRenderQueues();
+		DotSceneManager::_renderVisibleObjects( );
+	
+		clearSpecialCaseRenderQueues();
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingDotSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
+	{
+		// must be empty because objects are found and rendered in an interleaved fashion
+		// in _renderVisibibleObjects 
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingDotSceneManager::_updateSceneGraph(Camera* cam)
+	{
+		mOcclusionCullingSceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
+		mOcclusionCullingSceneTraverser->setRenderSystem(mDestRenderSystem);
+
+        //mOcclusionCullingSceneTraverser->preprocess();
+		
+		DotSceneManager::_updateSceneGraph(cam);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::setOption( const String & key, const void * val )
+	{
+		return mOcclusionCullingSceneTraverser->setOption( key, val) || DotSceneManager::setOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::getOption( const String & key, void *val )
+	{
+		return mOcclusionCullingSceneTraverser->getOption( key, val) || DotSceneManager::getOption( key, val ) ;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
+	{
+		return DotSceneManager::getOptionValues( key, refValueList );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::getOptionKeys( StringVector & refKeys )
+	{
+		return mOcclusionCullingSceneTraverser->getOptionKeys ( refKeys ) || DotSceneManager::getOptionKeys( refKeys );
+	}
+	
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/SceneTraverser.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/SceneTraverser.cpp	(revision 56)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/SceneTraverser.cpp	(revision 56)
@@ -0,0 +1,235 @@
+#include "OgreOcclusionCullingSceneTraverser.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+
+#include <windows.h>
+
+namespace Ogre {
+	
+	//-----------------------------------------------------------------------
+	SceneTraverser::OcclusionCullingSceneTraverser(SceneManager *sm, RenderSystem *rsys): 
+	mFrameId(1), mDistanceQueue(NULL), mVisibilityThreshold(0), mCurrentTestIdx(0),
+	mNumSceneNodes(0), mNumTraversedNodes(0), mNumQueryCulledNodes(0), mNumFrustumCulledNodes(0), 
+	mNumRenderedNodes(0),mNumRenderedGeometry(0), mSceneManager(sm), mRenderSystem(rsys), mSceneRoot(NULL)
+	{		
+		mHalfBoundingBox[0] = mHalfBoundingBox[1] = 0;
+	}
+	//-----------------------------------------------------------------------
+	SceneTraverser::~OcclusionCullingSceneTraverser()
+	{		
+		if(mHalfBoundingBox[0]) delete mHalfBoundingBox[0];
+		if(mHalfBoundingBox[1]) delete mHalfBoundingBox[1];
+
+		deleteQueries();
+
+		if(mDistanceQueue)
+			delete mDistanceQueue;
+		//SceneManager::~SceneManager();
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::traverseNode( Camera *cam, HierarchyNode *node )
+	{
+		mNumTraversedNodes ++;
+		
+		if(node->numAttachedObjects() > 0)
+		{
+			renderSceneNode(cam, node);
+		}
+
+		// internal node: add children to priority queue for further processing
+		Node::ChildNodeIterator it = node->getChildIterator();
+					
+		while (it.hasMoreElements())			
+		{ 
+			SceneNode* sceneChild = static_cast<SceneNode*>(it.getNext());
+			mDistanceQueue->push(sceneChild);
+		}
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::renderSceneNode( Camera *cam, HierarchyNode *node )
+	{
+		if(node->lastRendered() != node->lastVisited())
+		{
+			node->setLastRendered(node->lastVisited());
+			mNumRenderedNodes ++;
+
+			mSceneManager->_renderSceneNode(cam, node);
+		}
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::setSceneManager( SceneManager *sm )
+	{
+		mSceneManager = sm;
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::setRenderSystem( RenderSystem *rsys )
+	{
+		mRenderSystem = rsys;
+	}
+	//-----------------------------------------------------------------------
+	bool SceneTraverser::isLeaf( SceneNode *node )
+	{
+		return (node->numChildren() == 0);
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::pullUpVisibility(SceneNode *node )
+	{
+		while(node && !node->isNodeVisible())
+		{
+			node->setNodeVisible(true);
+			node = node->getParentSceneNode();
+		}
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::deleteQueries( void )
+	{
+		for(unsigned int i=0; i < (unsigned int)mOcclusionQueries.size(); ++i)
+			delete mOcclusionQueries[i];
+
+		mOcclusionQueries.clear();
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::renderBoundingBox( AxisAlignedBox *box )
+	{
+		// Render two halfes of the bounding box (using triangle fans)
+		for(int half = 0; half < 2; half ++)
+		{
+			static Matrix4 xform[256];
+			//TODO: this should be full bounding box
+			SolidHalfBoundingBox *halfbox = getSolidHalfBoundingBox(half);
+			halfbox->setupBoundingBox(*box);
+			
+			/*mRenderSystem->_setWorldMatrix(Matrix4::IDENTITY);
+
+			halfbox->getWorldTransforms(xform);
+
+			int numMatrices = halfbox->getNumWorldTransforms();
+			if (numMatrices > 1)
+			{
+				mRenderSystem->_setWorldMatrices(xform, numMatrices);
+			}
+			else
+			{
+				mRenderSystem->_setWorldMatrix(*xform);
+			}
+			mRenderSystem->setClipPlanes(halfbox->getClipPlanes());
+
+			static RenderOperation ro;
+
+			mSceneManager->useRenderableViewProjMode(halfbox);
+			halfbox->getRenderOperation(ro);
+			ro.srcRenderable = halfbox; 
+			mRenderSystem->_render(ro);*/
+			
+			mSceneManager->myrenderSingleObject(getSolidHalfBoundingBox(half), 
+				getSolidHalfBoundingBox(half)->getTechnique()->getPass(0), true);
+		}
+	}
+	//-----------------------------------------------------------------------
+	SolidHalfBoundingBox *SceneTraverser::getSolidHalfBoundingBox( int half )
+	{
+		if(!mHalfBoundingBox[half])
+			mHalfBoundingBox[half] = new SolidHalfBoundingBox(half == 1);
+
+		return mHalfBoundingBox[half];	
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setNumSceneNodes(int num)
+	{
+		mNumSceneNodes = num;
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::setSceneRoot(SceneNode *root)
+	{
+		mSceneRoot = root;
+	}
+	//-----------------------------------------------------------------------
+	void SceneTraverser::initDistanceQueue(Camera *cam)
+	{
+		mDistanceQueue = new PriorityQueue(myless<SceneNode *>(cam));
+		mDistanceQueue->push(mSceneRoot);
+	}
+	//-----------------------------------------------------------------------
+	HardwareOcclusionQuery *SceneTraverser::getNextOcclusionQuery(void)
+	{
+		if(mCurrentTestIdx == mOcclusionQueries.size())
+		{
+			mOcclusionQueries.push_back(mRenderSystem->createHardwareOcclusionQuery());
+		}
+		
+		return mOcclusionQueries[mCurrentTestIdx ++];
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneTraverser::setOption( const String & key, const void * val )
+	{
+		if ( key == "Algorithm" )
+		{
+			mCurrentAlgorithm = * static_cast < const int * > ( val );
+			return true;
+		}
+		if ( key == "Threshold" )
+		{
+			mVisibilityThreshold = * static_cast < const int * > ( val );
+			return true;
+		}
+
+		return false;
+	}
+	//-----------------------------------------------------------------------
+	bool SceneTraverser::getOption( const String & key, void *val )
+	{
+		if ( key == "Algorithm" )
+		{
+			* static_cast < int * > ( val ) = mCurrentAlgorithm;
+			return true;
+		}
+		if ( key == "Threshold" )
+		{
+			* static_cast < unsigned int * > ( val ) = mVisibilityThreshold;
+			return true;
+		}
+		if ( key == "NumSceneNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumSceneNodes;
+			return true;
+		}
+		if ( key == "NumTraversedNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumTraversedNodes;
+			return true;
+		}
+		if ( key == "NumQueryCulledNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumQueryCulledNodes;
+			return true;
+		}
+		if ( key == "NumFrustumCulledNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumFrustumCulledNodes;
+			return true;
+		}
+		if ( key == "NumRenderedNodes" )
+		{
+			* static_cast < unsigned int * > ( val ) = mNumRenderedNodes;
+			return true;
+		}
+		return false;
+	}
+	//-----------------------------------------------------------------------
+	bool SceneTraverser::getOptionKeys( StringVector & refKeys )
+	{
+		refKeys.push_back( "Algorithm" );
+		refKeys.push_back( "Threshold" );
+		refKeys.push_back( "NumSceneNodes" );
+		refKeys.push_back( "NumTraversedNodes" );
+		refKeys.push_back( "NumQueryCulledNodes" );
+		refKeys.push_back( "NumFrustumCulledNodes" );
+		refKeys.push_back( "mNumRenderedGeometry" );
+
+		return true;
+	}
+}	
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingResourceManager.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingResourceManager.cpp	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingResourceManager.cpp	(revision 12)
@@ -0,0 +1,72 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright © 2000-2002 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#include "OgreOcclusionCullingResourceManager.h"
+
+
+namespace Ogre {
+
+    //-----------------------------------------------------------------------
+    template<> OcclusionCullingResourceManager* Singleton<OcclusionCullingResourceManager>::ms_Singleton = 0;
+    OcclusionCullingResourceManager* OcclusionCullingResourceManager::getSingletonPtr(void)
+    {
+        return ms_Singleton;
+    }
+    OcclusionCullingResourceManager& OcclusionCullingResourceManager::getSingleton(void)
+    {  
+        assert( ms_Singleton );  return ( *ms_Singleton );  
+    }
+    //-----------------------------------------------------------------------
+
+    //-----------------------------------------------------------------------
+    OcclusionCullingResourceManager::OcclusionCullingResourceManager()
+    {
+        // Also create related shader manager (singleton managed)
+       // mShaderMgr = new Quake3ShaderManager();
+    }
+    //-----------------------------------------------------------------------
+    OcclusionCullingResourceManager::~OcclusionCullingResourceManager()
+    {
+        //delete mShaderMgr;
+    }
+    //-----------------------------------------------------------------------
+  /*  BspLevel* OcclusionCullingResourceManager::load( const String& filename, int priority)
+    {
+        // Only 1 BSP level allowed loaded at once
+        unloadAndDestroyAll();
+
+        BspLevel* pBsp = (BspLevel*)create(filename);
+        ResourceManager::load(pBsp, priority);
+        return pBsp;
+
+    }*/
+    //-----------------------------------------------------------------------
+    /*Resource* OcclusionCullingResourceManager::create( const String& name)
+    {
+        return new BspLevel(name);
+
+    }*/
+
+
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/Makefile.am
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/Makefile.am	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/Makefile.am	(revision 12)
@@ -0,0 +1,1 @@
+SUBDIRS = src include
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/misc/OgreOcclusionCullingSceneManager.def
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/misc/OgreOcclusionCullingSceneManager.def	(revision 12)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/misc/OgreOcclusionCullingSceneManager.def	(revision 12)
@@ -0,0 +1,4 @@
+LIBRARY Plugin_OcclusionCullingSceneManager
+EXPORTS	
+	dllStartPlugin
+	dllStopPlugin
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/misc/todo_occlusionculling.txt
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/misc/todo_occlusionculling.txt	(revision 59)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/misc/todo_occlusionculling.txt	(revision 59)
@@ -0,0 +1,30 @@
+1) write into ogre forum
+2) mode_render does not do any change
+3) scenenode::_rendervisibleobjects already uses frustum culling
+4) implement for bsp trees
+5) improve mouse control (strave)
+6) cull camera for testing
+7) error when near plane crosses bounding volume
+8) bounding box should be not two parts
+9) implement z-buffer pass
+10) nice scene for dotscenemanager + terrainscenemanager
+11) ask about ogre changes
+12) preprocess: do not always destroy occlusion queries
+13) prevent multiple rendering of objects, scene nodes and hierarchy nodes
+14) learn to create terrains (heightmaps)
+15) work with maya
+16) occlusion culling + transparent materials, shadows!!
+17) minimize code for new scenemanager (macros?)
+18) make more flexible: callbacks
+19) find out how rotations happen
+20) investigate time coherence options (i.e., query only every nth frame
+21) möllers acceleration for frustum culling
+22) update so less code has to be replicated in terrainscenetraverser
+23) implement frustum test where intersect by near plane is considered
+24) tell ogre-people about changes
+25) check glfinish error
+26) also disable frustum culling on mouse click
+27) better comments
+28) setrendermode: change!!!
+29) problems with coherent & geometry not in leave
+30) split up into occlusioncullingscenemanager + visibilitymodule projects
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj	(revision 45)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj	(revision 45)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="TestCulling"
+	ProjectGUID="{248F19A6-2FE0-4F5D-8928-E0EA10609887}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			ReferencesPath="">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib"
+				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/TestCulling.pdb"
+				SubSystem="2"
+				ImportLibrary=""
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include"
+				PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OGREMain.LIB"
+				OutputFile="..\..\..\Samples\Common\Bin\Release\TestCulling.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\OgreMain\Lib\Release"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\TestCullingApplication.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\TestCullingApplication.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 52)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 52)
@@ -0,0 +1,350 @@
+/**
+    \file 
+        TestCullingApplication.cpp
+    \brief
+        Tests the occlusion culling algorithm
+*/
+
+#include <OgreNoMemoryMacros.h>
+#include <CEGUI/CEGUI.h>
+#include <../CEGUIRenderer/include/OgreCEGUIRenderer.h>
+#include <../CEGUIRenderer/include/OgreCEGUIResourceProvider.h>
+#include <../CEGUIRenderer/include/OgreCEGUITexture.h>
+#include <OgreMemoryMacros.h>
+
+#include "Ogre.h"
+#include "TestCullingApplication.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+
+
+/***********************************************/
+/* TestCullingApplication implementation       */
+/***********************************************/
+TestCullingApplication::~TestCullingApplication()
+{
+}
+//-----------------------------------------------------------------------
+/*void TestCullingApplication::createCamera( void )
+{
+	// Create the camera
+	mCamera = mSceneMgr->createCamera("PlayerCam");
+
+	// Position it at 500 in Z direction
+	mCamera->setPosition(Vector3(128,25,128));
+
+	// Look back along -Z
+    mCamera->lookAt(Vector3(0,0,-300));
+    mCamera->setNearClipDistance( 1 );
+    mCamera->setFarClipDistance( 1000 );
+}*/
+//-----------------------------------------------------------------------
+void TestCullingApplication::createScene(void)
+{
+	// Set ambient light
+	mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
+	
+	// Create a light
+	Light* l = mSceneMgr->createLight("MainLight");
+	//l->setPosition(20,80,50);
+
+	mMinTranslation = Vector3(-70.0f, -70.0f, 0.0f);
+	mMaxTranslation = Vector3(70.0f, 70.0f, 600.0f);
+
+	mMinAngle = Vector3(0, 0, 0);
+	mMaxAngle = Vector3(360, 360, 360);
+
+	generateScene(330);
+
+	// Create a skybox
+    //mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 1000, false);
+    ColourValue fadeColour(0.1, 0.1, 0.6);
+	mWindow->getViewport(0)->setBackgroundColour(fadeColour);
+
+	// CEGUI setup
+	setupGui();
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::setupGui( void )
+{
+	 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE);
+     mGUISystem = new CEGUI::System(mGUIRenderer);
+
+	 // Mouse
+     CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");
+     CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
+	 mGUISystem->setDefaultMouseCursor(
+                (CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
+
+	 CEGUI::MouseCursor::getSingleton().show( );
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::createFrameListener(void)
+{
+	mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer);
+	mFrameListener->showDebugOverlay(true);
+	mRoot->addFrameListener(mFrameListener);
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::chooseSceneManager(void)
+{
+    mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::generateSceneObject(const Vector3 &translationRatio, 
+												 const Vector3 &rotationRatio, const int idx, const String& entName)
+{
+	Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);
+	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
+
+	char name[16];
+    sprintf( name, "object%d", idx );
+
+    Entity *ent = mSceneMgr->createEntity( name, entName );
+	SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode( String(name) + "Node", translation);
+	node->attachObject(ent);
+	node->scale(0.1,0.1,0.1);
+
+	node->yaw(Degree(rotation.x));
+    node->pitch(Degree(rotation.y));
+	node->roll(Degree(rotation.z));
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::generateScene( int numObjects )
+{
+	srand (time (0));
+	
+	Vector3 rotationRatio;
+	Vector3 translationRatio;
+
+	for(int i=0; i < numObjects; i++)
+	{
+		rotationRatio.x = rand() / (float) RAND_MAX;
+		rotationRatio.y = rand() / (float) RAND_MAX;
+		rotationRatio.z = rand() / (float) RAND_MAX;
+
+		translationRatio.x = rand() / (float) RAND_MAX;
+		translationRatio.y = rand() / (float) RAND_MAX;
+		translationRatio.z = rand() / (float) RAND_MAX;
+
+		generateSceneObject(translationRatio, rotationRatio, i, "sphere.mesh");
+	}
+}
+/***********************************************/
+/* MouseQueryListener implementation           */
+/***********************************************/
+//-----------------------------------------------------------------------
+MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer)
+        : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 
+		mShutdownRequested(false)
+{
+
+	// Setup default variables
+	//mOgreHead = NULL;
+	mLMouseDown = false;
+	mRMouseDown = false;
+	mSceneMgr = sceneManager;
+
+    // Reduce move speed
+	mMoveSpeed = 50;
+	mRotateSpeed *= 2;
+
+	mCurrentAlgorithm = OcclusionCullingSceneTraverser::RENDER_COHERENT;
+	mThreshold = 0;
+    
+	// Register this so that we get mouse events.
+	mEventProcessor->addMouseListener(this);
+	mEventProcessor->addMouseMotionListener(this);
+	mEventProcessor->addKeyListener(this);
+
+	// show overlay
+	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/OcclusionCullingDemoOverlay"); 
+
+	mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo");
+	mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo");
+	mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo");
+	mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo");
+    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo");
+	mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo");
+	mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo");
+	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo");
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mThresholdInfo->setCaption(": 0");
+	mFrustumCulledNodesInfo->setCaption(": 0");
+	mQueryCulledNodesInfo->setCaption(": 0");
+	mTraversedNodesInfo->setCaption(": 0");
+	mSceneNodesInfo->setCaption(": 0");
+	mHierarchyNodesInfo->setCaption(": 0");
+	mRenderedNodesInfo->setCaption(": 0");
+
+    pOver->show();
+} 
+//-----------------------------------------------------------------------
+MouseQueryListener::~MouseQueryListener( )
+{
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::mouseMoved (MouseEvent *e)
+{
+	// Update CEGUI with the mouse motion
+    CEGUI::System::getSingleton().injectMouseMove(e->getRelX() * mGUIRenderer->getWidth(), e->getRelY() * mGUIRenderer->getHeight());
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::mousePressed(MouseEvent* e)
+{
+     // Left mouse button down
+     if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+     {
+		mLMouseDown = true; 
+     }
+     // Right mouse button down
+     else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+     {
+         CEGUI::MouseCursor::getSingleton().hide( );
+         mRMouseDown = true;
+     } // else if
+} // mousePressed
+
+ //-----------------------------------------------------------------------
+void MouseQueryListener::mouseReleased(MouseEvent* e)
+{
+    // Left mouse button up
+    if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+    {
+		CEGUI::MouseCursor::getSingleton().show( );
+        mLMouseDown = false;
+    }
+    // Right mouse button up
+    else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+    {
+        CEGUI::MouseCursor::getSingleton().show( );
+        mRMouseDown = false;
+    }
+} 
+//-----------------------------------------------------------------------
+void MouseQueryListener::mouseDragged (MouseEvent *e)
+ {
+	 // If we are dragging the left mouse button.	 	 
+	 if ( mLMouseDown )
+     {
+		
+     }
+	 // If we are dragging the right mouse button.
+	 if ( mRMouseDown )
+	 {
+		 mCamera->yaw( -e->getRelX() * mRotateSpeed );
+		 mCamera->pitch( -e->getRelY() * mRotateSpeed );
+	 }
+}
+//-----------------------------------------------------------------------
+bool MouseQueryListener::frameStarted(const FrameEvent &evt)
+{	 
+	return ExampleFrameListener::frameStarted(evt);
+}
+//-----------------------------------------------------------------------
+bool MouseQueryListener::frameEnded(const FrameEvent& evt)
+{
+	if (mShutdownRequested)
+		return false;
+
+    if (timeDelay >= 0) 
+        timeDelay -= evt.timeSinceLastFrame;
+
+    KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());
+
+	KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10));
+	KEY_PRESSED(KC_ADD, 0, changeThreshold(10));
+	//KEY_PRESSED(KC_T, 1, change);
+      
+	changeStats();
+
+    return ExampleFrameListener::frameStarted(evt) && ExampleFrameListener::frameEnded(evt);        
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeThreshold(int incr)
+{
+	mThreshold += incr; if(mThreshold < 0) mThreshold = 0;
+	
+	char str[100]; sprintf(str,": %d", mThreshold);
+
+	mSceneMgr->setOption("Threshold", &mThreshold); 
+	mThresholdInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeAlgorithm()
+{
+    mCurrentAlgorithm = ++mCurrentAlgorithm % OcclusionCullingSceneTraverser::NUM_RENDERMODES;
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::changeStats()
+{
+	unsigned int opt = 0;
+	char str[100];
+	
+	mSceneMgr->getOption("NumFrustumCulledNodes", &opt); sprintf(str,": %d", opt); 
+	mFrustumCulledNodesInfo->setCaption(str);
+	
+	mSceneMgr->getOption("NumQueryCulledNodes", &opt); sprintf(str,": %d", opt); 
+	mQueryCulledNodesInfo->setCaption(str);
+	
+	mSceneMgr->getOption("NumTraversedNodes", &opt); sprintf(str,": %d", opt); 
+	mTraversedNodesInfo->setCaption(str);
+
+	mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt); 
+	mSceneNodesInfo->setCaption(str);
+
+	mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt); 
+	mHierarchyNodesInfo->setCaption(str);
+
+	mSceneMgr->getOption("NumRenderedNodes", &opt); sprintf(str,": %d", opt); 
+	mRenderedNodesInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyPressed(KeyEvent* e)
+{
+	if(e->getKey() == KC_ESCAPE)
+    {
+		mShutdownRequested = true;
+		e->consume();
+		return;
+	}
+
+	CEGUI::System::getSingleton().injectKeyDown(e->getKey());
+	CEGUI::System::getSingleton().injectChar(e->getKeyChar());
+	e->consume();
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyReleased(KeyEvent* e)
+{
+	CEGUI::System::getSingleton().injectKeyUp(e->getKey());
+	e->consume();
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::keyClicked(KeyEvent* e) 
+{
+	// Do nothing
+	e->consume();
+}
+//-----------------------------------------------------------------------
+INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
+{
+    // Create application object
+    TestCullingApplication app;
+
+	try 
+	{
+        app.go();
+    } 
+	catch( Ogre::Exception& e ) 
+	{
+        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+    }	
+
+    return 0;
+}
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.dsp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.dsp	(revision 15)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.dsp	(revision 15)
@@ -0,0 +1,109 @@
+# Microsoft Developer Studio Project File - Name="Demo_TestCullingApplication" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=Demo_TestCullingApplication - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "TestCullingApplication.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "TestCullingApplication.mak" CFG="Demo_TestCullingApplication - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Demo_TestCullingApplication - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "Demo_TestCullingApplication - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Demo_TestCullingApplication - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "..\bin\Release"
+# PROP BASE Intermediate_Dir "..\obj\Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\bin\Release"
+# PROP Intermediate_Dir "..\obj\Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /I "$(OGRE_PATH)\OgreMain\include" /I "$(OGRE_PATH)\Samples/Common/include" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /YX /FD /Zm1000 /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib OgreMain.lib /nologo /subsystem:windows /machine:I386 /out:"$(OGRE_PATH)\Samples\Common\Bin\Release\Demo_TestCullingApplication.exe" /libpath:"$(OGRE_PATH)\OgreMain\lib\release" 
+# SUBTRACT LINK32 /profile /debug
+
+!ELSEIF  "$(CFG)" == "Demo_TestCullingApplication - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "..\bin\Debug"
+# PROP BASE Intermediate_Dir "..\obj\Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\bin\Debug"
+# PROP Intermediate_Dir "..\obj\Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "$(OGRE_PATH)\OgreMain\include" /I "$(OGRE_PATH)\Samples/Common/include" /D "_MBCS" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /FD /GZ /Zm1000 /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib OgreMain_d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMT" /out:"$(OGRE_PATH)\Samples\Common\Bin\Debug\Demo_TestCullingApplication.exe" /pdbtype:sept /libpath:"$(OGRE_PATH)\OgreMain\lib\debug" 
+# SUBTRACT LINK32 /verbose
+
+!ENDIF 
+
+# Begin Target
+
+# Name "Demo_TestCullingApplication - Win32 Release"
+# Name "Demo_TestCullingApplication - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=TestCullingApplication.cpp
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TerrainContentGenerator.cpp
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TerrainContentGenerator.cpp	(revision 44)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TerrainContentGenerator.cpp	(revision 44)
@@ -0,0 +1,14 @@
+/**
+    \file 
+        TerrainContentGenerator.cpp
+    \brief
+        Creates content for the terrain,
+*/
+
+#include "TerrainContentGenerator.h"
+
+//-----------------------------------------------------------------------
+TerrainContentGenerator::TerrainContentGenerator( void )
+{
+}
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 55)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 55)
@@ -0,0 +1,124 @@
+/**
+    \file 
+        TestCullingApplication.h
+*/
+#include "CEGUIForwardRefs.h"
+#include "ExampleApplication.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+
+Real timeDelay = 0;
+#define KEY_PRESSED(_key,_timeDelay, _macro) \
+{ \
+    if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
+{ \
+    timeDelay = _timeDelay; \
+    _macro ; \
+} \
+}
+
+String mCurrentAlgorithmCaptions[OcclusionCullingSceneTraverser::NUM_RENDERMODES] = 
+{
+    "Cull Frustum", 
+	"Stop and Wait", 
+	"Coherent Occlusion Culling"
+};
+
+class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
+{
+public:
+
+    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 
+			CEGUI::Renderer *renderer);
+
+
+    ~MouseQueryListener( );
+
+	bool frameStarted(const FrameEvent& evt);
+	bool frameEnded(const FrameEvent& evt);
+
+    /* MouseListener callbacks. */
+    virtual void mouseClicked(MouseEvent* e) { }
+    virtual void mouseEntered(MouseEvent* e) { }
+    virtual void mouseExited(MouseEvent* e)  { }
+
+    // This is when the mouse button goes DOWN.
+    virtual void mousePressed(MouseEvent* e);
+
+    // This is when the mouse button is let UP.
+    virtual void mouseReleased(MouseEvent* e);
+
+    /* MouseMotionListener callbacks */
+    virtual void mouseMoved (MouseEvent *e);
+   
+    // This is when the mouse is clicked, held and dragged.
+    virtual void mouseDragged (MouseEvent *e);
+
+    void keyPressed(KeyEvent* e);
+
+	void keyReleased(KeyEvent* e);
+	void keyClicked(KeyEvent* e);
+
+	void changeAlgorithm();
+	void changeThreshold(int incr);
+	void changeStats();
+
+protected:
+    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
+    SceneManager *mSceneMgr;           // A pointer to the scene manager
+    
+	CEGUI::Renderer *mGUIRenderer;     // cegui renderer
+	
+	bool mShutdownRequested;
+	int mCurrentAlgorithm;
+	int mThreshold;
+
+	OverlayElement *mAlgorithmInfo;
+	OverlayElement *mThresholdInfo;
+	OverlayElement *mFrustumCulledNodesInfo;
+	OverlayElement *mQueryCulledNodesInfo;
+    OverlayElement *mTraversedNodesInfo;
+	OverlayElement *mHierarchyNodesInfo;
+	OverlayElement *mSceneNodesInfo;
+	OverlayElement *mRenderedNodesInfo;
+};
+
+
+class TestCullingApplication : public ExampleApplication
+{
+public:
+	//~TestCullingApplication();
+
+protected:
+	void createScene(void);
+	void createFrameListener(void);
+	void setupGui(void);
+	/** generates a the scene hierarchy with random values 
+	@param number of objects to generate
+	*/
+	void generateScene(int numObjects);
+
+	/** generates a new scene object 
+	@param tranlationRatio ratio between minimal and maximal possible translation
+	@param rotationRatio ratio between minimal and maximal possible rotation
+	@idx the index of the new object
+	@entName the name of the object entity
+	*/
+	void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 
+							 const int idx, const String &entName);
+
+	//virtual void createCamera(void);
+
+	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
+	CEGUI::System *mGUISystem;
+
+	Vector3 mMinTranslation;
+	Vector3 mMaxTranslation;
+
+	Vector3 mMinAngle;
+	Vector3 mMaxAngle;
+
+private:
+	void chooseSceneManager(void);
+};
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TerrainContentGenerator.h
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TerrainContentGenerator.h	(revision 44)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TerrainContentGenerator.h	(revision 44)
@@ -0,0 +1,14 @@
+/**
+    \file 
+        TerrainContentGenerator.h
+*/
+
+class TerrainContentGenerator
+{
+public:
+	TerrainContentGenerator();
+
+protected:
+
+};
+
Index: trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.dsw
===================================================================
--- trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.dsw	(revision 15)
+++ trunk/VUT/obsolete/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.dsw	(revision 15)
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Demo_TestCulling"=.\TestCullingApplication.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
