Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 14, 2008, 1:42:17 AM (15 years ago)
Author:
rgrieder
Message:
  • updated msvc files
  • Fixed build by including util/Integer.h in NetworkPrereqs.h instead of util/Math.h
  • Fixed issue with a this pointer used in the base class c'tor initialisation
  • Fixed build under windows: INFINITE seems to be a macro, defined in winbase.h. Constant was somewhere in the quest files.
  • Fixed build: Only integral types can have header-file value when declared as static const. Float is not supported by the standard.
  • Fixed a potential bug in Planet.cc: "if (cond) doOne; doTwo" —> missing brances (indentation was correct, so I assume there have to be brances)
  • Corrected lots of indentation problems with tabs/spaces mix.
  • Changed all "@file Blubb.h" to "@file": Doxygen then assumes the actual filename. This gives more flexibility.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/objects/worldentities/Planet.cc

    r2420 r2435  
    2727 */
    2828
    29 
    3029#include "OrxonoxStableHeaders.h"
    3130#include "Planet.h"
    3231
    33 #include "tinyxml/tinyxml.h"
    34 #include "core/CoreIncludes.h"
    35 #include "GraphicsEngine.h"
    36 #include "core/XMLPort.h"
    37 #include "CameraManager.h"
    38 #include "objects/Scene.h"
    39 #include "Camera.h"
    4032#include <math.h>
    4133
     
    4537#include <OgreMeshManager.h>
    4638
     39#include "core/CoreIncludes.h"
     40#include "core/XMLPort.h"
     41#include "objects/Scene.h"
     42#include "CameraManager.h"
     43#include "Camera.h"
     44#include "GraphicsEngine.h"
    4745
    4846namespace orxonox
     
    6765            this->getNode()->detachObject(this->mesh_.getEntity());
    6866    }   
    69    
     67
    7068    void Planet::tick(float dt)
    7169    {
    7270        if(!this->isVisible())
    7371            return;
    74            
     72
    7573        Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
    76         if(activeCamera)
    77         {
     74        if(activeCamera)
     75        {
    7876            Real distance = this->getPosition().distance( activeCamera->getWorldPosition() );
    79 //             COUT(2) << distance << std::endl;
     77            //             COUT(2) << distance << std::endl;
    8078            Real planetRadius = this->getScale();
    81        
     79
    8280            Real newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
    8381            Real tempTest = newScale*(1+Real(this->atmosphereSize)/Real(this->imageSize));
    8482            newScale = tempTest;
    85        
     83
    8684            this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
    87         }
    88                
     85        }
     86
    8987        SUPER(Planet, tick, dt);
    9088    }
    91  
    92     void Planet::init(){
    93    
     89
     90    void Planet::init()
     91    {
    9492        Real scaleFactor = this->getScale();
    95        
     93
    9694        this->distList.push_back(10.0*scaleFactor);
    9795        this->distList.push_back(19.0*scaleFactor);
     
    104102        this->distList.push_back(54.0*scaleFactor);
    105103        this->distList.push_back(55.0*scaleFactor);
    106        
     104
    107105        Real reductionValue = 0.2;
    108        
     106
    109107        this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
    110108        billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
    111        
     109
    112110        this->getNode()->attachObject(this->billboard_.getBillboardSet());   
    113111        this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
     
    116114        this->mesh_.setCastShadows(true);
    117115    }
    118    
     116
    119117    void Planet::changedMesh()
    120118    {
     
    147145    {
    148146        SUPER(Planet, XMLPort, xmlelement, mode);
    149        
     147
    150148        XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
    151149        XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);     
     
    153151        XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
    154152        XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
    155        
    156153    }
    157154
    158     void Planet::registerVariables(){
     155    void Planet::registerVariables()
     156    {
    159157        registerVariable(this->atmosphere_, variableDirection::toclient);
    160158        registerVariable(this->meshSrc_, variableDirection::toclient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
     
    168166        SUPER(Planet, changedVisibility);
    169167        if (this->isInitialized())
     168        {
    170169            this->mesh_.setVisible(this->isVisible());
    171170            this->billboard_.setVisible(this->isVisible());
     171        }
    172172    }
    173173}
Note: See TracChangeset for help on using the changeset viewer.