Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2009, 9:20:47 AM (16 years ago)
Author:
rgrieder
Message:

Merged pch branch back to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/worldentities/Planet.cc

    r3110 r3196  
    2929#include "Planet.h"
    3030
    31 #include <math.h>
    32 
    3331#include <OgreEntity.h>
    3432#include <OgreBillboardSet.h>
    35 #include <OgreHardwareVertexBuffer.h>
    36 #include <OgreMeshManager.h>
     33#include <OgreProgressiveMesh.h>
    3734
    3835#include "core/CoreIncludes.h"
     36#include "core/GameMode.h"
    3937#include "core/XMLPort.h"
    4038#include "objects/Scene.h"
     39#include "Camera.h"
    4140#include "CameraManager.h"
    42 #include "Camera.h"
    43 #include "GraphicsManager.h"
    4441
    4542namespace orxonox
     
    7067            return;
    7168
    72         Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
    73         if(activeCamera)
     69        if (GameMode::showsGraphics())
    7470        {
    75             float distance = this->getPosition().distance( activeCamera->getWorldPosition() );
    76             //             COUT(2) << distance << std::endl;
    77             float planetRadius = this->getScale();
     71            Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
     72            if(activeCamera)
     73            {
     74                float distance = this->getPosition().distance( activeCamera->getWorldPosition() );
     75                //             COUT(2) << distance << std::endl;
     76                float planetRadius = this->getScale();
    7877
    79             float newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
    80             float tempTest = newScale*(1+float(this->atmosphereSize)/float(this->imageSize));
    81             newScale = tempTest;
     78                float newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
     79                float tempTest = newScale*(1+float(this->atmosphereSize)/float(this->imageSize));
     80                newScale = tempTest;
    8281
    83             this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
     82                this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
     83            }
    8484        }
    8585
     
    9191        float scaleFactor = this->getScale();
    9292
    93         this->distList.push_back(10.0*scaleFactor);
    94         this->distList.push_back(19.0*scaleFactor);
    95         this->distList.push_back(27.0*scaleFactor);
    96         this->distList.push_back(34.0*scaleFactor);
    97         this->distList.push_back(40.0*scaleFactor);
    98         this->distList.push_back(45.0*scaleFactor);
    99         this->distList.push_back(49.0*scaleFactor);
    100         this->distList.push_back(52.0*scaleFactor);
    101         this->distList.push_back(54.0*scaleFactor);
    102         this->distList.push_back(55.0*scaleFactor);
     93        this->distList.push_back(10.0f*scaleFactor);
     94        this->distList.push_back(19.0f*scaleFactor);
     95        this->distList.push_back(27.0f*scaleFactor);
     96        this->distList.push_back(34.0f*scaleFactor);
     97        this->distList.push_back(40.0f*scaleFactor);
     98        this->distList.push_back(45.0f*scaleFactor);
     99        this->distList.push_back(49.0f*scaleFactor);
     100        this->distList.push_back(52.0f*scaleFactor);
     101        this->distList.push_back(54.0f*scaleFactor);
     102        this->distList.push_back(55.0f*scaleFactor);
    103103
    104         float reductionValue = 0.2;
     104        float reductionValue = 0.2f;
    105105
    106106        this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
     
    145145        SUPER(Planet, XMLPort, xmlelement, mode);
    146146
    147         XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
    148         XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);     
    149         XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);         
    150         XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
    151         XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     147        if (GameMode::showsGraphics())
     148        {
     149            XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
     150            XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);     
     151            XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);         
     152            XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     153            XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     154        }
    152155    }
    153156
Note: See TracChangeset for help on using the changeset viewer.