Index: code/branches/ogre1.9/src/modules/objects/Planet.cc
===================================================================
--- code/branches/ogre1.9/src/modules/objects/Planet.cc	(revision 11125)
+++ code/branches/ogre1.9/src/modules/objects/Planet.cc	(revision 11128)
@@ -47,7 +47,8 @@
      * @brief Constructor
      */
-    Planet::Planet(Context* context) : MovableEntity(context)
+    Planet::Planet(Context* context) : Model(context)
     {
         RegisterObject(Planet);
+        this->setLodEnabled(false);
         this->registerVariables();
     }
@@ -58,6 +59,4 @@
     Planet::~Planet()
     {
-        if (this->isInitialized() && this->mesh_.getEntity())
-            this->detachOgreObject(this->mesh_.getEntity());
     }
 
@@ -87,62 +86,17 @@
     }
 
-    void Planet::changedMesh()
+    void Planet::changedAtmosphere()
     {
         if( GameMode::showsGraphics() )
         {
-            if (this->mesh_.getEntity())
-                this->detachOgreObject(this->mesh_.getEntity());
-
-            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
-
-            if (this->mesh_.getEntity())
+            if (this->getMesh().getEntity())
             {
-                this->attachOgreObject(this->mesh_.getEntity());
-                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
-                this->mesh_.setVisible(this->isVisible());
-
-                float scaleFactor = this->getScale();
-
-#if OGRE_VERSION >= 0x010800
-                Ogre::ProgressiveMesh::LodValueList distList;
-#elif OGRE_VERSION >= 0x010700
-                Ogre::Mesh::LodValueList distList;
-#else
-                Ogre::Mesh::LodDistanceList distList;
-#endif
-
-                distList.push_back(10.0f*scaleFactor);
-                distList.push_back(19.0f*scaleFactor);
-                distList.push_back(27.0f*scaleFactor);
-                distList.push_back(34.0f*scaleFactor);
-                distList.push_back(40.0f*scaleFactor);
-                distList.push_back(45.0f*scaleFactor);
-                distList.push_back(49.0f*scaleFactor);
-                distList.push_back(52.0f*scaleFactor);
-                distList.push_back(54.0f*scaleFactor);
-                distList.push_back(55.0f*scaleFactor);
-
-                float reductionValue = 0.2f;
-
-#if OGRE_VERSION >= 0x010800
-                Ogre::ProgressiveMesh::generateLodLevels(this->mesh_.getEntity()->getMesh().get(), distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL,
-                    reductionValue);
-#else
-                this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
-#endif
-                billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
+                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
 
                 this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
-                this->setCastShadows(true);
-                this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
-                this->mesh_.setCastShadows(true);
+                this->billboard_.getBillboardSet()->setRenderQueueGroup(this->getMesh().getEntity()->getRenderQueueGroup());
             }
         }
-    }
-
-    void Planet::changedShadows()
-    {
-        this->mesh_.setCastShadows(this->bCastShadows_);
     }
 
@@ -154,16 +108,11 @@
         XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);
         XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);
-        XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
-        XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     }
 
     void Planet::registerVariables()
     {
-        registerVariable(this->atmosphere_, VariableDirection::ToClient);
+        registerVariable(this->atmosphere_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedAtmosphere));
         registerVariable(this->atmosphereSize, VariableDirection::ToClient);
         registerVariable(this->imageSize, VariableDirection::ToClient);
-        // Note: the meshSrc should be synchronised after atmosphere and other values, because the meshSrc callback setts the atmosphere billboards
-        registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
-        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
     }
 
@@ -171,9 +120,6 @@
     {
         SUPER(Planet, changedVisibility);
-        if (this->isInitialized())
-        {
-            this->mesh_.setVisible(this->isVisible());
-            this->billboard_.setVisible(this->isVisible());
-        }
+
+        this->billboard_.setVisible(this->isVisible());
     }
 }
