Index: code/branches/pch/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/pch/src/orxonox/OrxonoxPrereqs.h	(revision 3129)
+++ code/branches/pch/src/orxonox/OrxonoxPrereqs.h	(revision 3130)
@@ -247,6 +247,4 @@
     template <class T>
     class Timer;
-    class DynamicLines;
-    class DynamicRenderable;
 
     // overlays
@@ -254,4 +252,5 @@
     class DebugFPSText;
     class DebugRTRText;
+    class GUIOverlay;
     class HUDBar;
     class HUDNavigation;
@@ -292,4 +291,8 @@
     class PanelOverlayElement;
     class TextAreaOverlayElement;
+
+    // OGRE Wiki adapted code
+    class DynamicLines;
+    class DynamicRenderable;
 }
 
Index: code/branches/pch/src/orxonox/objects/RadarViewable.cc
===================================================================
--- code/branches/pch/src/orxonox/objects/RadarViewable.cc	(revision 3129)
+++ code/branches/pch/src/orxonox/objects/RadarViewable.cc	(revision 3130)
@@ -29,4 +29,5 @@
 #include "RadarViewable.h"
 
+#include <OgreSceneManager.h>
 #include "util/Debug.h"
 #include "util/Exception.h"
@@ -101,5 +102,5 @@
 
             this->line_->end(); */
-            this->line_ = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
+            this->line_ = new Ogre::DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
             this->line_->addPoint( Vector3(0,0,0) );
             this->line_->addPoint( Vector3(0,0,0) );
Index: code/branches/pch/src/orxonox/objects/RadarViewable.h
===================================================================
--- code/branches/pch/src/orxonox/objects/RadarViewable.h	(revision 3129)
+++ code/branches/pch/src/orxonox/objects/RadarViewable.h	(revision 3130)
@@ -105,5 +105,5 @@
         Ogre::SceneNode * MapNode_;
         Ogre::Entity * MapEntity_;
-        DynamicLines* line_;
+        Ogre::DynamicLines* line_;
         Ogre::SceneNode * LineNode_;
         void addMapEntity();
Index: code/branches/pch/src/orxonox/tools/DynamicLines.cc
===================================================================
--- code/branches/pch/src/orxonox/tools/DynamicLines.cc	(revision 3130)
+++ code/branches/pch/src/orxonox/tools/DynamicLines.cc	(revision 3130)
@@ -0,0 +1,178 @@
+/*
+ *   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:
+ *      Baxissimo, Emmeran, DWORD, EtherDrive (OGRE Wiki)
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "DynamicLines.h"
+
+#include <cassert>
+#include <cmath>
+
+namespace Ogre
+{
+    enum
+    {
+        POSITION_BINDING,
+        TEXCOORD_BINDING
+    };
+
+    DynamicLines::DynamicLines(OperationType opType)
+    {
+        initialize(opType,false);
+        setMaterial("BaseWhiteNoLighting");
+        mDirty = true;
+    }
+
+    DynamicLines::~DynamicLines()
+    {
+    }
+
+    void DynamicLines::setOperationType(OperationType opType)
+    {
+        mRenderOp.operationType = opType;
+    }
+
+    RenderOperation::OperationType DynamicLines::getOperationType() const
+    {
+        return mRenderOp.operationType;
+    }
+
+    void DynamicLines::addPoint(const Vector3 &p)
+    {
+        mPoints.push_back(p);
+        mDirty = true;
+    }
+
+    void DynamicLines::addPoint(Real x, Real y, Real z)
+    {
+        mPoints.push_back(Vector3(x,y,z));
+        mDirty = true;
+    }
+
+    const Vector3& DynamicLines::getPoint(unsigned short index) const
+    {
+        assert(index < mPoints.size() && "Point index is out of bounds!!");
+        return mPoints[index];
+    }
+
+    unsigned short DynamicLines::getNumPoints(void) const
+    {
+        return (unsigned short)mPoints.size();
+    }
+
+    void DynamicLines::setPoint(unsigned short index, const Vector3 &value)
+    {
+        assert(index < mPoints.size() && "Point index is out of bounds!!");
+
+        mPoints[index] = value;
+        mDirty = true;
+    }
+
+    void DynamicLines::clear()
+    {
+        mPoints.clear();
+        mDirty = true;
+    }
+
+    void DynamicLines::update()
+    {
+        if (mDirty)
+            fillHardwareBuffers();
+    }
+
+    void DynamicLines::createVertexDeclaration()
+    {
+        VertexDeclaration *decl = mRenderOp.vertexData->vertexDeclaration;
+        decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);
+    }
+
+    void DynamicLines::fillHardwareBuffers()
+    {
+        int size = mPoints.size();
+
+        prepareHardwareBuffers(size,0);
+
+        if (!size)
+        {
+            mBox.setExtents(Vector3::ZERO,Vector3::ZERO);
+            mDirty=false;
+            return;
+        }
+
+        Vector3 vaabMin = mPoints[0];
+        Vector3 vaabMax = mPoints[0];
+
+        HardwareVertexBufferSharedPtr vbuf =
+            mRenderOp.vertexData->vertexBufferBinding->getBuffer(0);
+
+        Real *prPos = static_cast<Real*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
+        for (int i = 0; i < size; i++)
+        {
+            *prPos++ = mPoints[i].x;
+            *prPos++ = mPoints[i].y;
+            *prPos++ = mPoints[i].z;
+
+            if (mPoints[i].x < vaabMin.x)
+                vaabMin.x = mPoints[i].x;
+            if (mPoints[i].y < vaabMin.y)
+                vaabMin.y = mPoints[i].y;
+            if (mPoints[i].z < vaabMin.z)
+                vaabMin.z = mPoints[i].z;
+
+            if (mPoints[i].x > vaabMax.x)
+                vaabMax.x = mPoints[i].x;
+            if (mPoints[i].y > vaabMax.y)
+                vaabMax.y = mPoints[i].y;
+            if (mPoints[i].z > vaabMax.z)
+                vaabMax.z = mPoints[i].z;
+        }
+        vbuf->unlock();
+
+        mBox.setExtents(vaabMin, vaabMax);
+
+        mDirty = false;
+    }
+
+    /*
+    void DynamicLines::getWorldTransforms(Matrix4 *xform) const
+    {
+        // return identity matrix to prevent parent transforms
+        *xform = Matrix4::IDENTITY;
+    }
+    */
+
+    /*
+    const Quaternion &DynamicLines::getWorldOrientation(void) const
+    {
+        return Quaternion::IDENTITY;
+    }
+
+    const Vector3 &DynamicLines::getWorldPosition(void) const
+    {
+        return Vector3::ZERO;
+    }
+    */
+}
Index: code/branches/pch/src/orxonox/tools/DynamicLines.cpp
===================================================================
--- code/branches/pch/src/orxonox/tools/DynamicLines.cpp	(revision 3129)
+++ 	(revision )
@@ -1,145 +1,0 @@
-#include "DynamicLines.h"
-#include <Ogre.h>
-#include <cassert>
-#include <cmath>
-
-using namespace Ogre;
-
-namespace orxonox
-{
-enum {
-  POSITION_BINDING,
-  TEXCOORD_BINDING
-};
-
-DynamicLines::DynamicLines(OperationType opType)
-{
-  initialize(opType,false);
-  setMaterial("BaseWhiteNoLighting");
-  mDirty = true;
-}
-
-DynamicLines::~DynamicLines()
-{
-}
-
-void DynamicLines::setOperationType(OperationType opType)
-{
-  mRenderOp.operationType = opType;
-}
-
-RenderOperation::OperationType DynamicLines::getOperationType() const
-{
-  return mRenderOp.operationType;
-}
-
-void DynamicLines::addPoint(const Vector3 &p)
-{
-   mPoints.push_back(p);
-   mDirty = true;
-}
-void DynamicLines::addPoint(Real x, Real y, Real z)
-{
-   mPoints.push_back(Vector3(x,y,z));
-   mDirty = true;
-}
-const Vector3& DynamicLines::getPoint(unsigned short index) const
-{
-   assert(index < mPoints.size() && "Point index is out of bounds!!");
-   return mPoints[index];
-}
-unsigned short DynamicLines::getNumPoints(void) const
-{
-  return (unsigned short)mPoints.size();
-}
-void DynamicLines::setPoint(unsigned short index, const Vector3 &value)
-{
-  assert(index < mPoints.size() && "Point index is out of bounds!!");
-
-  mPoints[index] = value;
-  mDirty = true;
-}
-void DynamicLines::clear()
-{
-  mPoints.clear();
-  mDirty = true;
-}
-
-void DynamicLines::update()
-{
-  if (mDirty) fillHardwareBuffers();
-}
-
-void DynamicLines::createVertexDeclaration()
-{
-  VertexDeclaration *decl = mRenderOp.vertexData->vertexDeclaration;
-  decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);
-}
-
-void DynamicLines::fillHardwareBuffers()
-{
-  int size = mPoints.size();
-
-  prepareHardwareBuffers(size,0);
-
-  if (!size) {
-    mBox.setExtents(Vector3::ZERO,Vector3::ZERO);
-    mDirty=false;
-    return;
-  }
-
-  Vector3 vaabMin = mPoints[0];
-  Vector3 vaabMax = mPoints[0];
-
-  HardwareVertexBufferSharedPtr vbuf =
-    mRenderOp.vertexData->vertexBufferBinding->getBuffer(0);
-
-  Real *prPos = static_cast<Real*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
-  {
-   for(int i = 0; i < size; i++)
-   {
-      *prPos++ = mPoints[i].x;
-      *prPos++ = mPoints[i].y;
-      *prPos++ = mPoints[i].z;
-
-      if(mPoints[i].x < vaabMin.x)
-         vaabMin.x = mPoints[i].x;
-      if(mPoints[i].y < vaabMin.y)
-         vaabMin.y = mPoints[i].y;
-      if(mPoints[i].z < vaabMin.z)
-         vaabMin.z = mPoints[i].z;
-
-      if(mPoints[i].x > vaabMax.x)
-         vaabMax.x = mPoints[i].x;
-      if(mPoints[i].y > vaabMax.y)
-         vaabMax.y = mPoints[i].y;
-      if(mPoints[i].z > vaabMax.z)
-         vaabMax.z = mPoints[i].z;
-   }
-  }
-  vbuf->unlock();
-
-  mBox.setExtents(vaabMin, vaabMax);
-
-  mDirty = false;
-}
-
-/*
-void DynamicLines::getWorldTransforms(Matrix4 *xform) const
-{
-   // return identity matrix to prevent parent transforms
-   *xform = Matrix4::IDENTITY;
-}
-*/
-/*
-const Quaternion &DynamicLines::getWorldOrientation(void) const
-{
-   return Quaternion::IDENTITY;
-}
-
-const Vector3 &DynamicLines::getWorldPosition(void) const
-{
-   return Vector3::ZERO;
-}
-*/
-}
Index: code/branches/pch/src/orxonox/tools/DynamicLines.h
===================================================================
--- code/branches/pch/src/orxonox/tools/DynamicLines.h	(revision 3129)
+++ code/branches/pch/src/orxonox/tools/DynamicLines.h	(revision 3130)
@@ -1,67 +1,96 @@
-#ifndef _DYNAMIC_LINES_H_
-#define _DYNAMIC_LINES_H_
+/*
+ *   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:
+ *      Baxissimo, Emmeran, DWORD, EtherDrive (OGRE Wiki)
+ *   Co-authors:
+ *      ...
+ *
+ */
 
+#ifndef _DynamicLines_H__
+#define _DynamicLines_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <vector>
 #include "DynamicRenderable.h"
-#include <vector>
 
-namespace orxonox
+namespace Ogre
 {
-class DynamicLines : public DynamicRenderable
-{
-  typedef Ogre::Vector3 Vector3;
-  typedef Ogre::Quaternion Quaternion;
-  typedef Ogre::Camera Camera;
-  typedef Ogre::Real Real;
-  typedef Ogre::RenderOperation::OperationType OperationType;
+    class DynamicLines : public DynamicRenderable
+    {
+        typedef RenderOperation::OperationType OperationType;
 
-public:
-  /// Constructor - see setOperationType() for description of argument.
-  DynamicLines(OperationType opType=Ogre::RenderOperation::OT_LINE_STRIP);
-  virtual ~DynamicLines();
+    public:
+        /// Constructor - see setOperationType() for description of argument.
+        DynamicLines(OperationType opType = RenderOperation::OT_LINE_STRIP);
+        virtual ~DynamicLines();
 
-  /// Add a point to the point list
-  void addPoint(const Ogre::Vector3 &p);
-  /// Add a point to the point list
-  void addPoint(Real x, Real y, Real z);
+        /// Add a point to the point list
+        void addPoint(const Vector3 &p);
+        /// Add a point to the point list
+        void addPoint(Real x, Real y, Real z);
 
-  /// Change the location of an existing point in the point list
-  void setPoint(unsigned short index, const Vector3 &value);
+        /// Change the location of an existing point in the point list
+        void setPoint(unsigned short index, const Vector3 &value);
 
-  /// Return the location of an existing point in the point list
-  const Vector3& getPoint(unsigned short index) const;
+        /// Return the location of an existing point in the point list
+        const Vector3& getPoint(unsigned short index) const;
 
-  /// Return the total number of points in the point list
-  unsigned short getNumPoints(void) const;
+        /// Return the total number of points in the point list
+        unsigned short getNumPoints(void) const;
 
-  /// Remove all points from the point list
-  void clear();
+        /// Remove all points from the point list
+        void clear();
 
-  /// Call this to update the hardware buffer after making changes.
-  void update();
+        /// Call this to update the hardware buffer after making changes.
+        void update();
 
-  /** Set the type of operation to draw with.
-   * @param opType Can be one of
-   *    - RenderOperation::OT_LINE_STRIP
-   *    - RenderOperation::OT_LINE_LIST
-   *    - RenderOperation::OT_POINT_LIST
-   *    - RenderOperation::OT_TRIANGLE_LIST
-   *    - RenderOperation::OT_TRIANGLE_STRIP
-   *    - RenderOperation::OT_TRIANGLE_FAN
-   *    The default is OT_LINE_STRIP.
-   */
-  void setOperationType(OperationType opType);
-  OperationType getOperationType() const;
+        /**
+        @brief
+            Set the type of operation to draw with.
+        @param opType
+            Can be one of
+                - RenderOperation::OT_LINE_STRIP
+                - RenderOperation::OT_LINE_LIST
+                - RenderOperation::OT_POINT_LIST
+                - RenderOperation::OT_TRIANGLE_LIST
+                - RenderOperation::OT_TRIANGLE_STRIP
+                - RenderOperation::OT_TRIANGLE_FAN
+            The default is OT_LINE_STRIP.
+        */
+        void setOperationType(OperationType opType);
+        OperationType getOperationType() const;
 
-protected:
-  /// Implementation DynamicRenderable, creates a simple vertex-only decl
-  virtual void createVertexDeclaration();
-  /// Implementation DynamicRenderable, pushes point list out to hardware memory
-  virtual void fillHardwareBuffers();
+    protected:
+        /// Implementation DynamicRenderable, creates a simple vertex-only decl
+        virtual void createVertexDeclaration();
+        /// Implementation DynamicRenderable, pushes point list out to hardware memory
+        virtual void fillHardwareBuffers();
 
-private:
-  std::vector<Vector3> mPoints;
-  bool mDirty;
-};
+    private:
+        std::vector<Vector3> mPoints;
+        bool mDirty;
+    };
 }
 
-#endif
+#endif /* _DynamicLines_H__ */
Index: code/branches/pch/src/orxonox/tools/DynamicRenderable.cc
===================================================================
--- code/branches/pch/src/orxonox/tools/DynamicRenderable.cc	(revision 3130)
+++ code/branches/pch/src/orxonox/tools/DynamicRenderable.cc	(revision 3130)
@@ -0,0 +1,160 @@
+/*
+ *   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:
+ *      Sinbad, Baxissimo, DWORD, TheBren (OGRE Wiki)
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "DynamicRenderable.h"
+
+#include <OgreCamera.h>
+#include <OgreHardwareBufferManager.h>
+
+namespace Ogre
+{
+    DynamicRenderable::DynamicRenderable()
+    {
+    }
+
+    DynamicRenderable::~DynamicRenderable()
+    {
+        delete mRenderOp.vertexData;
+        delete mRenderOp.indexData;
+    }
+
+    void DynamicRenderable::initialize(RenderOperation::OperationType operationType,
+           bool useIndices)
+    {
+        // Initialize render operation
+        mRenderOp.operationType = operationType;
+        mRenderOp.useIndexes = useIndices;
+        mRenderOp.vertexData = new VertexData;
+        if (mRenderOp.useIndexes)
+            mRenderOp.indexData = new IndexData;
+
+        // Reset buffer capacities
+        mVertexBufferCapacity = 0;
+        mIndexBufferCapacity = 0;
+
+        // Create vertex declaration
+        createVertexDeclaration();
+    }
+
+    void DynamicRenderable::prepareHardwareBuffers(size_t vertexCount, size_t indexCount)
+    {
+        // Prepare vertex buffer
+        size_t newVertCapacity = mVertexBufferCapacity;
+        if ((vertexCount > mVertexBufferCapacity) || (!mVertexBufferCapacity))
+        {
+            // vertexCount exceeds current capacity!
+            // It is necessary to reallocate the buffer.
+
+            // Check if this is the first call
+            if (!newVertCapacity)
+                newVertCapacity = 1;
+
+            // Make capacity the next power of two
+            while (newVertCapacity < vertexCount)
+                newVertCapacity <<= 1;
+        }
+        else if (vertexCount < mVertexBufferCapacity>>1)
+        {
+            // Make capacity the previous power of two
+            while (vertexCount < newVertCapacity>>1)
+                newVertCapacity >>= 1;
+        }
+        if (newVertCapacity != mVertexBufferCapacity)
+        {
+            mVertexBufferCapacity = newVertCapacity;
+            // Create new vertex buffer
+            HardwareVertexBufferSharedPtr vbuf =
+                HardwareBufferManager::getSingleton().createVertexBuffer(
+                mRenderOp.vertexData->vertexDeclaration->getVertexSize(0),
+                mVertexBufferCapacity,
+                HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); // TODO: Custom HBU_?
+
+            // Bind buffer
+            mRenderOp.vertexData->vertexBufferBinding->setBinding(0, vbuf);
+        }
+        // Update vertex count in the render operation
+        mRenderOp.vertexData->vertexCount = vertexCount;
+
+        if (mRenderOp.useIndexes)
+        {
+            OgreAssert(indexCount <= std::numeric_limits<unsigned short>::max(), "indexCount exceeds 16 bit");
+
+            size_t newIndexCapacity = mIndexBufferCapacity;
+            // Prepare index buffer
+            if ((indexCount > newIndexCapacity) || (!newIndexCapacity))
+            {
+                // indexCount exceeds current capacity!
+                // It is necessary to reallocate the buffer.
+
+                // Check if this is the first call
+                if (!newIndexCapacity)
+                    newIndexCapacity = 1;
+
+                // Make capacity the next power of two
+                while (newIndexCapacity < indexCount)
+                    newIndexCapacity <<= 1;
+            }
+            else if (indexCount < newIndexCapacity>>1)
+            {
+                // Make capacity the previous power of two
+                while (indexCount < newIndexCapacity>>1)
+                    newIndexCapacity >>= 1;
+            }
+
+            if (newIndexCapacity != mIndexBufferCapacity)
+            {
+                mIndexBufferCapacity = newIndexCapacity;
+                // Create new index buffer
+                mRenderOp.indexData->indexBuffer =
+                    HardwareBufferManager::getSingleton().createIndexBuffer(
+                    HardwareIndexBuffer::IT_16BIT,
+                    mIndexBufferCapacity,
+                    HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); // TODO: Custom HBU_?
+            }
+
+            // Update index count in the render operation
+            mRenderOp.indexData->indexCount = indexCount;
+        }
+    }
+
+    Real DynamicRenderable::getBoundingRadius(void) const
+    {
+        return Math::Sqrt(std::max(mBox.getMaximum().squaredLength(), mBox.getMinimum().squaredLength()));
+    }
+
+    Real DynamicRenderable::getSquaredViewDepth(const Camera* cam) const
+    {
+        Vector3 vMin, vMax, vMid, vDist;
+        vMin = mBox.getMinimum();
+        vMax = mBox.getMaximum();
+        vMid = ((vMax - vMin) * 0.5) + vMin;
+        vDist = cam->getDerivedPosition() - vMid;
+
+        return vDist.squaredLength();
+    }
+}
Index: code/branches/pch/src/orxonox/tools/DynamicRenderable.cpp
===================================================================
--- code/branches/pch/src/orxonox/tools/DynamicRenderable.cpp	(revision 3129)
+++ 	(revision )
@@ -1,136 +1,0 @@
-#include "DynamicRenderable.h"
-#include <OgreCamera.h>
-#include <OgreHardwareBufferManager.h>
-
-using namespace Ogre;
-
-namespace orxonox
-{
-DynamicRenderable::DynamicRenderable()
-{
-}
-
-DynamicRenderable::~DynamicRenderable()
-{
-  delete mRenderOp.vertexData;
-  delete mRenderOp.indexData;
-}
-
-void DynamicRenderable::initialize(RenderOperation::OperationType operationType,
-                                   bool useIndices)
-{
-  // Initialize render operation
-  mRenderOp.operationType = operationType;
-  mRenderOp.useIndexes = useIndices;
-  mRenderOp.vertexData = new VertexData;
-  if (mRenderOp.useIndexes)
-    mRenderOp.indexData = new IndexData;
-
-  // Reset buffer capacities
-  mVertexBufferCapacity = 0;
-  mIndexBufferCapacity = 0;
-
-  // Create vertex declaration
-  createVertexDeclaration();
-}
-
-void DynamicRenderable::prepareHardwareBuffers(size_t vertexCount,
-                                               size_t indexCount)
-{
-  // Prepare vertex buffer
-  size_t newVertCapacity = mVertexBufferCapacity;
-  if ((vertexCount > mVertexBufferCapacity) ||
-      (!mVertexBufferCapacity))
-  {
-    // vertexCount exceeds current capacity!
-    // It is necessary to reallocate the buffer.
-
-    // Check if this is the first call
-    if (!newVertCapacity)
-      newVertCapacity = 1;
-
-    // Make capacity the next power of two
-    while (newVertCapacity < vertexCount)
-      newVertCapacity <<= 1;
-  }
-  else if (vertexCount < mVertexBufferCapacity>>1) {
-    // Make capacity the previous power of two
-    while (vertexCount < newVertCapacity>>1)
-      newVertCapacity >>= 1;
-  }
-  if (newVertCapacity != mVertexBufferCapacity)
-  {
-    mVertexBufferCapacity = newVertCapacity;
-    // Create new vertex buffer
-    HardwareVertexBufferSharedPtr vbuf =
-      HardwareBufferManager::getSingleton().createVertexBuffer(
-        mRenderOp.vertexData->vertexDeclaration->getVertexSize(0),
-        mVertexBufferCapacity,
-        HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); // TODO: Custom HBU_?
-
-    // Bind buffer
-    mRenderOp.vertexData->vertexBufferBinding->setBinding(0, vbuf);
-  }
-  // Update vertex count in the render operation
-  mRenderOp.vertexData->vertexCount = vertexCount;
-
-  if (mRenderOp.useIndexes)
-  {
-    OgreAssert(indexCount <= std::numeric_limits<unsigned short>::max(), "indexCount exceeds 16 bit");
-
-    size_t newIndexCapacity = mIndexBufferCapacity;
-    // Prepare index buffer
-    if ((indexCount > newIndexCapacity) ||
-        (!newIndexCapacity))
-    {
-      // indexCount exceeds current capacity!
-      // It is necessary to reallocate the buffer.
-
-      // Check if this is the first call
-      if (!newIndexCapacity)
-        newIndexCapacity = 1;
-
-      // Make capacity the next power of two
-      while (newIndexCapacity < indexCount)
-        newIndexCapacity <<= 1;
-
-    }
-    else if (indexCount < newIndexCapacity>>1)
-    {
-      // Make capacity the previous power of two
-      while (indexCount < newIndexCapacity>>1)
-        newIndexCapacity >>= 1;
-    }
-
-    if (newIndexCapacity != mIndexBufferCapacity)
-    {
-      mIndexBufferCapacity = newIndexCapacity;
-      // Create new index buffer
-      mRenderOp.indexData->indexBuffer =
-        HardwareBufferManager::getSingleton().createIndexBuffer(
-          HardwareIndexBuffer::IT_16BIT,
-          mIndexBufferCapacity,
-          HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); // TODO: Custom HBU_?
-    }
-
-    // Update index count in the render operation
-    mRenderOp.indexData->indexCount = indexCount;
-  }
-}
-
-Real DynamicRenderable::getBoundingRadius(void) const
-{
-  return Math::Sqrt(std::max(mBox.getMaximum().squaredLength(), mBox.getMinimum().squaredLength()));
-}
-
-Real DynamicRenderable::getSquaredViewDepth(const Camera* cam) const
-{
-   Vector3 vMin, vMax, vMid, vDist;
-   vMin = mBox.getMinimum();
-   vMax = mBox.getMaximum();
-   vMid = ((vMax - vMin) * 0.5) + vMin;
-   vDist = cam->getDerivedPosition() - vMid;
-
-   return vDist.squaredLength();
-}
-}
Index: code/branches/pch/src/orxonox/tools/DynamicRenderable.h
===================================================================
--- code/branches/pch/src/orxonox/tools/DynamicRenderable.h	(revision 3129)
+++ code/branches/pch/src/orxonox/tools/DynamicRenderable.h	(revision 3130)
@@ -1,72 +1,116 @@
-#ifndef DYNAMIC_RENDERABLE_H
-#define DYNAMIC_RENDERABLE_H
+/*
+ *   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:
+ *      Sinbad, Baxissimo, DWORD, TheBren (OGRE Wiki)
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _DynamicRenderable_H__
+#define _DynamicRenderable_H__
+
+#include "OrxonoxPrereqs.h"
 
 #include <OgreSimpleRenderable.h>
 
-namespace orxonox
+namespace Ogre
 {
-/// Abstract base class providing mechanisms for dynamically growing hardware buffers.
-class DynamicRenderable : public Ogre::SimpleRenderable
-{
-public:
-  /// Constructor
-  DynamicRenderable();
-  /// Virtual destructor
-  virtual ~DynamicRenderable();
+    /// Abstract base class providing mechanisms for dynamically growing hardware buffers.
+    class DynamicRenderable : public SimpleRenderable
+    {
+    public:
+        /// Constructor
+        DynamicRenderable();
+        /// Virtual destructor
+        virtual ~DynamicRenderable();
 
-  /** Initializes the dynamic renderable.
-   @remarks
-      This function should only be called once. It initializes the
-      render operation, and calls the abstract function
-      createVertexDeclaration().
-   @param operationType The type of render operation to perform.
-   @param useIndices Specifies whether to use indices to determine the
-          vertices to use as input. */
-  void initialize(Ogre::RenderOperation::OperationType operationType,
-                  bool useIndices);
+        /**
+        @brief
+            Initializes the dynamic renderable.
+        @remarks
+            This function should only be called once. It initializes the
+            render operation, and calls the abstract function
+            createVertexDeclaration().
+        @param operationType
+            The type of render operation to perform.
+        @param useIndices
+            Specifies whether to use indices to determine the vertices to use as input.
+        */
+        void initialize(RenderOperation::OperationType operationType,
+        bool useIndices);
 
-  /// Implementation of Ogre::SimpleRenderable
-  virtual Ogre::Real getBoundingRadius(void) const;
-  /// Implementation of Ogre::SimpleRenderable
-  virtual Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const;
+        /// Implementation of SimpleRenderable
+        virtual Real getBoundingRadius(void) const;
+        /// Implementation of SimpleRenderable
+        virtual Real getSquaredViewDepth(const Camera* cam) const;
 
-protected:
-  /// Maximum capacity of the currently allocated vertex buffer.
-  size_t mVertexBufferCapacity;
-  /// Maximum capacity of the currently allocated index buffer.
-  size_t mIndexBufferCapacity;
+    protected:
+        /// Maximum capacity of the currently allocated vertex buffer.
+        size_t mVertexBufferCapacity;
+        /// Maximum capacity of the currently allocated index buffer.
+        size_t mIndexBufferCapacity;
 
-  /** Creates the vertex declaration.
-   @remarks
-      Override and set mRenderOp.vertexData->vertexDeclaration here.
-      mRenderOp.vertexData will be created for you before this method
-      is called. */
-  virtual void createVertexDeclaration() = 0;
+        /**
+        @brief
+            Creates the vertex declaration.
+        @remarks
+            Override and set mRenderOp.vertexData->vertexDeclaration here.
+            mRenderOp.vertexData will be created for you before this method
+            is called.
+        */
+        virtual void createVertexDeclaration() = 0;
 
-  /** Prepares the hardware buffers for the requested vertex and index counts.
-   @remarks
-      This function must be called before locking the buffers in
-      fillHardwareBuffers(). It guarantees that the hardware buffers
-      are large enough to hold at least the requested number of
-      vertices and indices (if using indices). The buffers are
-      possibly reallocated to achieve this.
-   @par
-      The vertex and index count in the render operation are set to
-      the values of vertexCount and indexCount respectively.
-   @param vertexCount The number of vertices the buffer must hold.
+        /**
+        @brief
+            Prepares the hardware buffers for the requested vertex and index counts.
+        @remarks
+            This function must be called before locking the buffers in
+            fillHardwareBuffers(). It guarantees that the hardware buffers
+            are large enough to hold at least the requested number of
+            vertices and indices (if using indices). The buffers are
+            possibly reallocated to achieve this.
+        @par
+            The vertex and index count in the render operation are set to
+            the values of vertexCount and indexCount respectively.
+        @param vertexCount
+            The number of vertices the buffer must hold.
+        @param indexCount
+            The number of indices the buffer must hold. This
+            parameter is ignored if not using indices.
+        */
+        void prepareHardwareBuffers(size_t vertexCount, size_t indexCount);
 
-   @param indexCount The number of indices the buffer must hold. This
-          parameter is ignored if not using indices. */
-  void prepareHardwareBuffers(size_t vertexCount, size_t indexCount);
-
-  /** Fills the hardware vertex and index buffers with data.
-   @remarks
-      This function must call prepareHardwareBuffers() before locking
-      the buffers to ensure the they are large enough for the data to
-      be written. Afterwards the vertex and index buffers (if using
-      indices) can be locked, and data can be written to them. */
-  virtual void fillHardwareBuffers() = 0;
-};
+        /**
+        @brief
+            Fills the hardware vertex and index buffers with data.
+        @remarks
+            This function must call prepareHardwareBuffers() before locking
+            the buffers to ensure the they are large enough for the data to
+            be written. Afterwards the vertex and index buffers (if using
+            indices) can be locked, and data can be written to them.
+        */
+        virtual void fillHardwareBuffers() = 0;
+    };
 }
 
-#endif // DYNAMIC_RENDERABLE_H
+#endif /* _DynamicRenderable_H__ */
