Index: code/trunk/src/orxonox/graphics/AnimatedModel.cc
===================================================================
--- code/trunk/src/orxonox/graphics/AnimatedModel.cc	(revision 7163)
+++ code/trunk/src/orxonox/graphics/AnimatedModel.cc	(revision 7163)
@@ -0,0 +1,126 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 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 General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin de Capitani
+ *
+ *
+ */
+
+#include "AnimatedModel.h"
+
+#include <OgreEntity.h>
+#include <OgreAnimationState.h>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(AnimatedModel);
+
+    AnimatedModel::AnimatedModel(BaseObject* creator) : Model(creator)
+    {
+        RegisterObject(AnimatedModel);
+    }
+
+
+    AnimatedModel::~AnimatedModel()
+    {
+        if (this->isInitialized() && this->mesh_.getEntity())
+            this->detachOgreObject(this->mesh_.getEntity());
+    }
+
+    void AnimatedModel::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(AnimatedModel, XMLPort, xmlelement, mode);
+        XMLPortParam(AnimatedModel,"anims",setAnims,getAnims, xmlelement,mode).defaultValues("");
+        XMLPortParam(AnimatedModel,"loop", setAnimLoop,getAnimLoop, xmlelement,mode).defaultValues(true);
+        XMLPortParam(AnimatedModel,"enabled", setAnimEnabled,getAnimEnabled, xmlelement,mode).defaultValues(true);
+    }
+
+
+    void AnimatedModel::changedMesh()
+    {
+        if (GameMode::showsGraphics())
+        {
+            if (this->mesh_.getEntity())
+                this->detachOgreObject(this->mesh_.getEntity());
+
+            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+
+            if (this->mesh_.getEntity())
+            {
+                this->attachOgreObject(this->mesh_.getEntity());
+                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+                this->setAnimationState(this->bAnimLoop_, this->bAnimEnabled_, this->anims_);
+                this->mesh_.setVisible(this->isVisible());
+            }
+        }
+    }
+
+    void AnimatedModel::changedAnimationState()
+    {
+        this->setAnimationState(this->bAnimLoop_, this->bAnimEnabled_, this->anims_);
+    }
+    void AnimatedModel::setAnimationState(bool loop, bool enabled, const std::string& state)
+    {
+        if(state!="")
+        {
+        if(this->mesh_.getEntity()->getAnimationState(state))
+        {
+        Ogre::AnimationState* as = this->mesh_.getEntity()->getAnimationState(state);
+        as->setLoop(loop);
+        as->setEnabled(enabled);
+        this->anims_ = state;
+        }
+        }
+    }
+
+    void AnimatedModel::setAnimLoop(bool loop)
+    {
+        this->bAnimLoop_ = loop;
+    }
+    void AnimatedModel::setAnimEnabled(bool enabled)
+    {
+        this->bAnimEnabled_ = enabled;
+    }
+    void AnimatedModel::tick(float dt)
+    {
+        if(this->mesh_.getEntity()->getAnimationState(anims_))
+        {
+// Test to change Material at runtime!
+
+//            Ogre::MaterialPtr mat = this->mesh_.getEntity()->getSubEntity(0)->getMaterial();
+//            mat->setDiffuse(0.4, 0.3, 0.1, 0.1);
+//            mat->setAmbient(0.3, 0.7, 0.8);
+//            mat->setSpecular(0.5, 0.5, 0.5, 0.1);
+//            Ogre::SceneBlendType sbt = Ogre::SBT_ADD;
+//
+//            mat->setSceneBlending(sbt);
+
+            Ogre::AnimationState* as = this->mesh_.getEntity()->getAnimationState(anims_);
+            as->addTime(dt);
+    }
+}
+}
Index: code/trunk/src/orxonox/graphics/AnimatedModel.h
===================================================================
--- code/trunk/src/orxonox/graphics/AnimatedModel.h	(revision 7163)
+++ code/trunk/src/orxonox/graphics/AnimatedModel.h	(revision 7163)
@@ -0,0 +1,76 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 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 General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _AnimatedModel_H__
+#define _AnimatedModel_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "tools/interfaces/Tickable.h"
+#include "Model.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport AnimatedModel : public Model, public Tickable
+    {
+        public:
+            AnimatedModel(BaseObject* creator);
+            virtual ~AnimatedModel();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedAnimationState();
+            virtual void setAnimationState(bool loop, bool enabled, const std::string& state);
+            virtual void setAnimEnabled(bool enabled);
+            virtual void setAnimLoop(bool loop);
+            virtual void tick(float dt);
+            virtual void changedMesh();
+
+
+            inline void setAnims(const std::string& anims)
+                { this->anims_ = anims; this->changedAnimationState(); }
+            inline const std::string& getAnims() const
+                { return this->anims_; }
+
+            inline const std::string& getAnimationState() const
+                { return this->anims_; }
+            inline const bool&  getAnimLoop() const
+                { return this->bAnimLoop_; }
+            inline const bool&  getAnimEnabled() const
+                { return this->bAnimEnabled_; }
+
+        private:
+            std::string anims_;
+            bool bAnimEnabled_;
+            bool bAnimLoop_;
+    };
+}
+
+#endif /* _AnimatedModel_H__ */
Index: code/trunk/src/orxonox/graphics/Backlight.h
===================================================================
--- code/trunk/src/orxonox/graphics/Backlight.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/Backlight.h	(revision 7163)
@@ -45,5 +45,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void tick(float dt);
@@ -81,4 +80,5 @@
 
         private:
+            void registerVariables();
             virtual void startturnonoff();
             virtual void stopturnonoff();
Index: code/trunk/src/orxonox/graphics/Billboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/Billboard.h	(revision 7163)
@@ -46,5 +46,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void changedVisibility();
@@ -78,4 +77,5 @@
 
         private:
+            void registerVariables();
             void changedMaterial();
 //            void changedRotation();
Index: code/trunk/src/orxonox/graphics/BlinkingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/graphics/BlinkingBillboard.cc	(revision 6501)
+++ code/trunk/src/orxonox/graphics/BlinkingBillboard.cc	(revision 7163)
@@ -66,7 +66,9 @@
     void BlinkingBillboard::registerVariables()
     {
-//        registerVariable(this->amplitude_, VariableDirection::ToClient);
-//        registerVariable(this->frequency_, VariableDirection::ToClient);
-//        registerVariable(this->phase_,     VariableDirection::ToClient);
+        unregisterVariable(this->getScale3D());
+        registerVariable(this->amplitude_,  VariableDirection::ToClient);
+        registerVariable(this->frequency_,  VariableDirection::ToClient);
+        registerVariable(this->phase_,      VariableDirection::ToClient);
+        registerVariable(this->bQuadratic_, VariableDirection::ToClient);
     }
 
@@ -75,5 +77,5 @@
         SUPER(BlinkingBillboard, tick, dt);
 
-        if (GameMode::isMaster() && this->isActive())
+        if (this->isActive())
         {
             this->time_ += dt;
Index: code/trunk/src/orxonox/graphics/BlinkingBillboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/BlinkingBillboard.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/BlinkingBillboard.h	(revision 7163)
@@ -45,5 +45,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void tick(float dt);
@@ -70,4 +69,6 @@
 
         private:
+            void registerVariables();
+            
             float amplitude_;
             float frequency_;
Index: code/trunk/src/orxonox/graphics/CEGuiSample.cc
===================================================================
--- code/trunk/src/orxonox/graphics/CEGuiSample.cc	(revision 7163)
+++ code/trunk/src/orxonox/graphics/CEGuiSample.cc	(revision 7163)
@@ -0,0 +1,304 @@
+/***********************************************************************
+    filename:   CEGuiSample.cpp
+    created:    24/9/2004
+    author:     Paul D Turner
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGuiSample.h"
+
+#ifdef HAVE_CONFIG_H
+#   include "config.h"
+#endif
+#include "CEGUISamplesConfig.h"
+
+// includes for renderer selector classes
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#   include "Win32CEGuiRendererSelector.h"
+#elif defined(__linux__)
+#   ifdef CEGUI_SAMPLES_USE_GTK2
+#       include "GTK2CEGuiRendererSelector.h"
+#   else
+#       include "CLICEGuiRendererSelector.h"
+#   endif
+#elif defined(__APPLE__)
+#   include "MacCEGuiRendererSelector.h"
+#endif
+
+// includes for application types
+#ifdef CEGUI_SAMPLES_USE_OGRE
+#   include "CEGuiOgreBaseApplication.h"
+#endif
+#ifdef CEGUI_SAMPLES_USE_OPENGL
+#   include "CEGuiOpenGLBaseApplication.h"
+#endif
+#ifdef CEGUI_SAMPLES_USE_IRRLICHT
+#   include "CEGuiIrrlichtBaseApplication.h"
+#endif
+#ifdef CEGUI_SAMPLES_USE_DIRECTFB
+#   include "CEGuiDirectFBBaseApplication.h"
+#endif
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#   ifdef CEGUI_SAMPLES_USE_DIRECTX_8
+#       include "CEGuiD3D81BaseApplication.h"
+#   endif
+#   ifdef CEGUI_SAMPLES_USE_DIRECTX_9
+#       include "CEGuiD3D9BaseApplication.h"
+#   endif
+#   ifdef CEGUI_SAMPLES_USE_DIRECTX_10
+#       include "CEGuiD3D10BaseApplication.h"
+#   endif
+#endif
+// now we include the base CEGuiBaseApplication just in case someone has managed to
+// get this far without any of the renderers.  This ensures the framework will build,
+// although there will be no renderers available for selection in the samples.
+#include "CEGuiBaseApplication.h"
+
+#include "CEGUI.h"
+
+#ifdef CEGUI_WITH_XERCES
+#   include "CEGUIXercesParser.h"
+#endif
+
+// Include iostream if not on windows.
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#else
+#    include <iostream>
+#endif
+
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+CEGuiSample::CEGuiSample() :
+        d_rendererSelector(0),
+        d_sampleApp(0)
+{}
+
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+CEGuiSample::~CEGuiSample()
+{
+    if (d_sampleApp)
+    {
+        d_sampleApp->cleanup();
+        delete d_sampleApp;
+    }
+
+    if (d_rendererSelector)
+    {
+        delete d_rendererSelector;
+    }
+
+}
+
+
+/*************************************************************************
+    Application entry point
+*************************************************************************/
+int CEGuiSample::run()
+{
+    try
+    {
+        if (initialise())
+            cleanup();
+    }
+    catch (CEGUI::Exception& exc)
+    {
+        outputExceptionMessage(exc.getMessage().c_str());
+    }
+    catch (std::exception& exc)
+    {
+        outputExceptionMessage(exc.what());
+    }
+    catch(...)
+    {
+        outputExceptionMessage("Unknown exception was caught!");
+    }
+
+    return 0;
+}
+
+
+/*************************************************************************
+    Initialise the sample application
+*************************************************************************/
+bool CEGuiSample::initialise()
+{
+    // Setup renderer selection dialog for Win32
+#if defined( __WIN32__ ) || defined( _WIN32 )
+    d_rendererSelector = new Win32CEGuiRendererSelector;
+
+    // enable renderer types supported for Win32
+#ifdef CEGUI_SAMPLES_USE_DIRECTX_8
+    d_rendererSelector->setRendererAvailability(Direct3D81GuiRendererType);
+#endif
+#ifdef CEGUI_SAMPLES_USE_DIRECTX_9
+    d_rendererSelector->setRendererAvailability(Direct3D9GuiRendererType);
+#endif
+#ifdef CEGUI_SAMPLES_USE_DIRECTX_10
+    d_rendererSelector->setRendererAvailability(Direct3D10GuiRendererType);
+#endif
+
+#elif defined(__linux__)
+    // decide which method to use for renderer selection
+#   ifdef CEGUI_SAMPLES_USE_GTK2
+        d_rendererSelector = new GTK2CEGuiRendererSelector();
+#   else
+        d_rendererSelector = new CLICEGuiRendererSelector();
+#   endif
+
+#elif defined(__APPLE__)
+     d_rendererSelector = new MacCEGuiRendererSelector();
+#endif
+
+    // enable available renderer types
+#ifdef CEGUI_SAMPLES_USE_OGRE
+    d_rendererSelector->setRendererAvailability(OgreGuiRendererType);
+#endif
+#ifdef CEGUI_SAMPLES_USE_OPENGL
+    d_rendererSelector->setRendererAvailability(OpenGLGuiRendererType);
+#endif
+#ifdef CEGUI_SAMPLES_USE_IRRLICHT
+    d_rendererSelector->setRendererAvailability(IrrlichtGuiRendererType);
+#endif
+#ifdef CEGUI_SAMPLES_USE_DIRECTFB
+    d_rendererSelector->setRendererAvailability(DirectFBGuiRendererType);
+#endif
+
+    // get selection from user
+    if (d_rendererSelector->invokeDialog())
+    {
+        // create appropriate application type based upon users selection
+        switch(d_rendererSelector->getSelectedRendererType())
+        {
+#ifdef CEGUI_SAMPLES_USE_OGRE
+        case OgreGuiRendererType:
+            d_sampleApp = new CEGuiOgreBaseApplication();
+            break;
+#endif
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#ifdef CEGUI_SAMPLES_USE_DIRECTX_8
+        case Direct3D81GuiRendererType:
+            d_sampleApp = new CEGuiD3D81BaseApplication();
+            break;
+#endif
+#ifdef CEGUI_SAMPLES_USE_DIRECTX_9
+        case Direct3D9GuiRendererType:
+            d_sampleApp = new CEGuiD3D9BaseApplication();
+            break;
+#endif // DX9
+#ifdef CEGUI_SAMPLES_USE_DIRECTX_10
+        case Direct3D10GuiRendererType:
+            d_sampleApp = new CEGuiD3D10BaseApplication();
+            break;
+#endif // DX10
+#endif // Win32
+#ifdef CEGUI_SAMPLES_USE_OPENGL
+        case OpenGLGuiRendererType:
+            d_sampleApp = new CEGuiOpenGLBaseApplication();
+            break;
+#endif
+#ifdef CEGUI_SAMPLES_USE_IRRLICHT
+        case IrrlichtGuiRendererType:
+            d_sampleApp = new CEGuiIrrlichtBaseApplication();
+            break;
+#endif
+#ifdef CEGUI_SAMPLES_USE_DIRECTFB
+        case DirectFBGuiRendererType:
+            d_sampleApp = new CEGuiDirectFBBaseApplication();
+            break;
+#endif
+
+        default:
+            throw CEGUI::GenericException("No renderer was selected!");
+            break;
+        }
+
+        // set the default resource groups to be used
+        CEGUI::Imageset::setDefaultResourceGroup("imagesets");
+        CEGUI::Font::setDefaultResourceGroup("fonts");
+        CEGUI::Scheme::setDefaultResourceGroup("schemes");
+        CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
+        CEGUI::WindowManager::setDefaultResourceGroup("layouts");
+        CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
+#ifdef CEGUI_WITH_XERCES
+        CEGUI::XercesParser::setSchemaDefaultResourceGroup("schemas");
+#endif
+
+        // execute the base application (which sets up the demo via 'this' and runs it.
+        if (d_sampleApp->execute(this))
+        {
+            // signal that app initialised and ran
+            return true;
+        }
+
+        // sample app did not initialise, delete the object.
+        delete d_sampleApp;
+        d_sampleApp = 0;
+    }
+
+    // delete renderer selector object
+    delete d_rendererSelector;
+    d_rendererSelector = 0;
+
+    // signal app did not initialise and run.
+    return false;
+}
+
+
+/*************************************************************************
+    Cleanup the sample application.
+*************************************************************************/
+void CEGuiSample::cleanup()
+{
+    if (d_sampleApp)
+    {
+        d_sampleApp->cleanup();
+        delete d_sampleApp;
+        d_sampleApp = 0;
+    }
+
+    if (d_rendererSelector)
+    {
+        delete d_rendererSelector;
+        d_rendererSelector = 0;
+    }
+
+}
+
+
+/*************************************************************************
+    Output a message to the user in some OS independant way.
+*************************************************************************/
+void CEGuiSample::outputExceptionMessage(const char* message) const
+{
+#if defined(__WIN32__) || defined(_WIN32)
+    MessageBoxA(0, message, "CEGUI - Exception", MB_OK|MB_ICONERROR);
+#else
+    std::cout << "An exception was thrown within the sample framework:" << std::endl;
+    std::cout << message << std::endl;
+#endif
+}
Index: code/trunk/src/orxonox/graphics/CEGuiSample.h
===================================================================
--- code/trunk/src/orxonox/graphics/CEGuiSample.h	(revision 7163)
+++ code/trunk/src/orxonox/graphics/CEGuiSample.h	(revision 7163)
@@ -0,0 +1,130 @@
+/***********************************************************************
+    filename:   CEGuiSample.h
+    created:    24/9/2004
+    author:     Paul D Turner
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGuiSample_h_
+#define _CEGuiSample_h_
+
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined (CEGUI_STATIC)
+#   ifdef CEGUISAMPLE_EXPORTS
+#       define CEGUISAMPLE_API __declspec(dllexport)
+#   else
+#       define CEGUISAMPLE_API __declspec(dllimport)
+#   endif
+#else
+#       define CEGUISAMPLE_API
+#endif
+
+
+// forward declarations
+class CEGuiBaseApplication;
+class CEGuiRendererSelector;
+
+
+/*!
+\brief
+    This is a base class that is intended to be used for all sample applications.
+    Here we take care of common things such the renderer selection and application
+    startup.
+*/
+class CEGUISAMPLE_API CEGuiSample
+{
+public:
+    /*!
+    \brief
+        Constructor.
+    */
+    CEGuiSample();
+
+
+    /*!
+    \brief
+        Destructor.
+    */
+    virtual ~CEGuiSample();
+
+
+    /*!
+    \brief
+        Application entry point.
+
+    \return
+        code to be returned by the application.
+    */
+    int run();
+
+
+    /*!
+    \brief
+        Sample specific initialisation goes here.  This method is called by the application base object created
+        as part of the initialise call.
+
+    \return
+        false if something went wrong.
+    */
+    virtual bool initialiseSample()  = 0;
+
+
+    /*!
+    \brief
+        Cleans up resources allocated in the initialiseSample call.
+    */
+    virtual void cleanupSample() = 0;
+
+
+protected:
+    /*!
+    \brief
+        Initialises the sample system, this includes asking the user for a render to use and
+        the subsequent creation of the required systems to support that renderer.
+
+    \return
+        false if anything went wrong.
+    */
+    virtual bool initialise();
+
+
+    /*!
+    \brief
+        Cleans up all resources allocated by the initialise call.
+    */
+    virtual void cleanup();
+
+
+    /*!
+    \brief
+        Output a message to the user in some OS independant way.
+    */
+    void outputExceptionMessage(const char* message) const;
+
+    /*************************************************************************
+        Data fields
+    *************************************************************************/
+    CEGuiRendererSelector*  d_rendererSelector;     //!< Points to the renderer selector object.
+    CEGuiBaseApplication*   d_sampleApp;            //!< Pointer to the base application object.
+};
+
+#endif  // end of guard _CEGuiSample_h_
Index: code/trunk/src/orxonox/graphics/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/graphics/CMakeLists.txt	(revision 6501)
+++ code/trunk/src/orxonox/graphics/CMakeLists.txt	(revision 7163)
@@ -4,5 +4,7 @@
   FadingBillboard.cc
   GlobalShader.cc
+  MeshLodInformation.cc
   Model.cc
+  AnimatedModel.cc
   ParticleEmitter.cc
   ParticleSpawner.cc
Index: code/trunk/src/orxonox/graphics/Camera.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Camera.cc	(revision 6501)
+++ code/trunk/src/orxonox/graphics/Camera.cc	(revision 7163)
@@ -111,5 +111,5 @@
         SUPER(Camera, tick, dt);
 
-        if (this->bDrag_)
+        if (this->bDrag_ && this->getTimeFactor() != 0)
         {
             // this stuff here may need some adjustments
Index: code/trunk/src/orxonox/graphics/FadingBillboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/FadingBillboard.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/FadingBillboard.h	(revision 7163)
@@ -46,5 +46,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void tick(float dt);
@@ -66,4 +65,5 @@
 
         protected:
+            void registerVariables();
             virtual void startturnonoff();
             virtual void stopturnonoff();
Index: code/trunk/src/orxonox/graphics/GlobalShader.h
===================================================================
--- code/trunk/src/orxonox/graphics/GlobalShader.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/GlobalShader.h	(revision 7163)
@@ -45,5 +45,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void changedVisibility();
@@ -53,4 +52,5 @@
 
         private:
+            void registerVariables();
             void changedCompositor();
 
Index: code/trunk/src/orxonox/graphics/Light.h
===================================================================
--- code/trunk/src/orxonox/graphics/Light.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/Light.h	(revision 7163)
@@ -57,5 +57,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void changedVisibility();
@@ -132,4 +131,5 @@
 
         private:
+            void registerVariables();
             void setTypeString(const std::string& type);
             std::string getTypeString() const;
Index: code/trunk/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/trunk/src/orxonox/graphics/MeshLodInformation.cc	(revision 7163)
+++ code/trunk/src/orxonox/graphics/MeshLodInformation.cc	(revision 7163)
@@ -0,0 +1,85 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 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 General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Jan Bernegger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "MeshLodInformation.h"
+
+#include <OgreEntity.h>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(MeshLodInformation);
+
+    MeshLodInformation::MeshLodInformation(BaseObject* creator)
+    : BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15)
+    {
+        RegisterObject(MeshLodInformation);
+    }
+
+    MeshLodInformation::~MeshLodInformation()
+    {    }
+
+    void MeshLodInformation::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(MeshLodInformation, XMLPort, xmlelement, mode);
+
+        XMLPortParam(MeshLodInformation, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
+        XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode);
+        XMLPortParam(MeshLodInformation, "enabled", setEnabled, getEnabled, xmlelement, mode);
+        XMLPortParam(MeshLodInformation, "numLevels", setNumLevels, getNumLevels, xmlelement, mode);
+        XMLPortParam(MeshLodInformation, "reductionRate", setReductionRate, getReductionRate, xmlelement, mode);
+    }
+
+    std::string MeshLodInformation::getMeshName()
+    {
+        return MeshLodInformation::getMeshSource();
+    }
+
+    void MeshLodInformation::setLodLevel(float lodLevel)
+    {
+        if(lodLevel>=0)
+            lodLevel_=lodLevel;
+    }
+    float MeshLodInformation::getLodLevel()
+    {
+        return lodLevel_;
+    }
+    void MeshLodInformation::setMeshSource(std::string meshSource)
+    {
+        meshSource_ = meshSource;
+    }
+    std::string MeshLodInformation::getMeshSource()
+    {
+        return meshSource_;
+    }
+
+}
Index: code/trunk/src/orxonox/graphics/MeshLodInformation.h
===================================================================
--- code/trunk/src/orxonox/graphics/MeshLodInformation.h	(revision 7163)
+++ code/trunk/src/orxonox/graphics/MeshLodInformation.h	(revision 7163)
@@ -0,0 +1,70 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 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 General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Jan Bernegger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _MeshLodInformation_H__
+#define _MeshLodInformation_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "tools/Mesh.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport MeshLodInformation : public BaseObject
+    {
+        public:
+            MeshLodInformation(BaseObject* creator);
+            virtual ~MeshLodInformation();
+
+            float getLodLevel();
+            std::string getMeshName();
+            bool getEnabled(){ return this->bEnabled_; }
+            unsigned int getNumLevels(){ return this->numLevels_; }
+            float getReductionRate(){ return this->reductionRate_; }
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+        private:
+            void setLodLevel(float lodLevel);
+            void setMeshSource(std::string meshSource);
+            void setEnabled( bool enabled ){ this->bEnabled_ = enabled; }
+            void setNumLevels( unsigned int num ){ this->numLevels_ = num; }
+            void setReductionRate( float rate ){ this->reductionRate_ = rate; }
+            std::string getMeshSource();
+            std::string meshSource_;
+            float lodLevel_;
+            bool bEnabled_;
+            unsigned int numLevels_;
+            float reductionRate_;
+
+    };
+}
+
+#endif /* _MeshLodInformation_H__ */
Index: code/trunk/src/orxonox/graphics/Model.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Model.cc	(revision 6501)
+++ code/trunk/src/orxonox/graphics/Model.cc	(revision 7163)
@@ -35,4 +35,6 @@
 #include "core/XMLPort.h"
 #include "Scene.h"
+#include "graphics/MeshLodInformation.h"
+#include "Level.h"
 
 namespace orxonox
@@ -40,9 +42,8 @@
     CreateFactory(Model);
 
-    Model::Model(BaseObject* creator) : StaticEntity(creator)
+    Model::Model(BaseObject* creator) :
+        StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15)
     {
         RegisterObject(Model);
-
-        this->bCastShadows_ = true;
 
         this->registerVariables();
@@ -59,4 +60,6 @@
         SUPER(Model, XMLPort, xmlelement, mode);
 
+        XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode);
+
         XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
         XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
@@ -67,4 +70,14 @@
         registerVariable(this->meshSrc_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh));
         registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows));
+    }
+
+    float Model::getBiggestScale(Vector3 scale3d)
+    {
+        float scaleFactor = scale3d.x;
+        if(scale3d.y>scaleFactor)
+            scaleFactor = scale3d.y;
+        if(scale3d.z>scaleFactor)
+            scaleFactor = scale3d.z;
+        return scaleFactor;
     }
 
@@ -83,4 +96,86 @@
                 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
                 this->mesh_.setVisible(this->isVisible());
+
+
+                //LOD
+                if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 )
+                {
+                    Level* level = this->getLevel();
+
+                    assert( level != 0 );
+
+                    MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_);
+                    if( lodInfo )
+                    {
+                        setLodLevel(lodInfo->getLodLevel());
+                        this->bLodEnabled_ = lodInfo->getEnabled();
+                        this->numLodLevels_ = lodInfo->getNumLevels();
+                        this->lodReductionRate_ = lodInfo->getReductionRate();
+                    }
+                    if( this->numLodLevels_>10 )
+                    {
+                        CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl;
+                        this->numLodLevels_ = 10;
+                    }
+                    if( this->bLodEnabled_ )
+                    {
+                        float volume = this->mesh_.getEntity()->getBoundingBox().volume();
+    //                     float scaleFactor = 1;
+
+    //                     BaseObject* creatorPtr = this;
+    //
+    //                     while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
+    //                     {
+    //                         scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
+    //                         creatorPtr = creatorPtr->getCreator();
+    //                     }
+    //                     COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
+
+                        COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl;
+
+#if OGRE_VERSION >= 0x010700
+                        Ogre::Mesh::LodValueList distList;
+#else
+                        Ogre::Mesh::LodDistanceList distList;
+#endif
+
+                        if( lodLevel_>0 )
+                        {
+    //                         float factor = scaleFactor*5/lodLevel_;
+                            float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_;
+
+                            COUT(4) << "LodLevel set with factor: " << factor << endl;
+
+                            distList.push_back(70.0f*factor);
+                            distList.push_back(140.0f*factor);
+                            distList.push_back(170.0f*factor);
+                            distList.push_back(200.0f*factor);
+                            distList.push_back(230.0f*factor);
+                            distList.push_back(250.0f*factor);
+                            distList.push_back(270.0f*factor);
+                            distList.push_back(290.0f*factor);
+                            distList.push_back(310.0f*factor);
+                            distList.push_back(330.0f*factor);
+                            while(distList.size()>this->numLodLevels_)
+                                distList.pop_back();
+
+
+                            //Generiert LOD-Levels
+                            this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_);
+                        }
+                        else
+                        {
+                            std::string what;
+                            if(lodLevel_>5)
+                                what = ">5";
+                            else
+                                what = "<0";
+
+                            COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
+                        }
+                    }
+                    else
+                        COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
+                }
             }
         }
Index: code/trunk/src/orxonox/graphics/Model.h
===================================================================
--- code/trunk/src/orxonox/graphics/Model.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/Model.h	(revision 7163)
@@ -45,5 +45,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void changedVisibility();
@@ -62,11 +61,26 @@
                 { return this->bCastShadows_; }
 
-        private:
+        protected:
+            void registerVariables();
             void changedMesh();
             void changedShadows();
+
+            //LoD
+            inline void setLodLevel(float lodLevel)
+                { this->lodLevel_ =  lodLevel; }
+            inline float getLodLevel() const
+                { return this->lodLevel_; }
+            float getBiggestScale(Vector3 scale3d);
 
             std::string meshSrc_;
             Mesh mesh_;
             bool bCastShadows_;
+
+            //LoD
+            float lodLevel_;
+            bool bLodEnabled_;
+            unsigned int numLodLevels_;
+            float lodReductionRate_;
+
     };
 }
Index: code/trunk/src/orxonox/graphics/ParticleEmitter.h
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleEmitter.h	(revision 6501)
+++ code/trunk/src/orxonox/graphics/ParticleEmitter.h	(revision 7163)
@@ -44,5 +44,4 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            void registerVariables();
 
             virtual void changedVisibility();
@@ -74,4 +73,7 @@
             std::string        source_;
             LODParticle::Value   LOD_;
+
+        private:
+            void registerVariables();
     };
 }
