Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2008, 9:21:20 PM (16 years ago)
Author:
scheusso
Message:

Client doesn't segfault now anymore, but the atmospheres are all attached to the same planet with the scaling of the
other planet …

File:
1 edited

Legend:

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

    r2402 r2411  
    7474           
    7575        Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
    76         Real distance = this->getPosition().distance( activeCamera->getWorldPosition() );
    77         COUT(2) << distance << std::endl;
    78         Real planetRadius = this->getScale();
     76        if(activeCamera)
     77        {
     78            Real distance = this->getPosition().distance( activeCamera->getWorldPosition() );
     79            COUT(2) << distance << std::endl;
     80            Real planetRadius = this->getScale();
    7981       
    80         Real newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
    81         Real tempTest = newScale*(1+Real(this->atmosphereSize)/Real(this->imageSize));
    82         newScale = tempTest;
     82            Real newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
     83            Real tempTest = newScale*(1+Real(this->atmosphereSize)/Real(this->imageSize));
     84            newScale = tempTest;
    8385       
    84         this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
     86            this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
     87        }
    8588               
    8689        SUPER(Planet, tick, dt);
     
    116119    void Planet::changedMesh()
    117120    {
     121COUT(0) << "changedMesh callback -===================" << endl;
    118122        if (this->mesh_.getEntity())
    119123            this->getNode()->detachObject(this->mesh_.getEntity());
     
    154158
    155159    void Planet::registerVariables(){
    156         //REGISTERSTRING(this->meshSrc_,    network::direction::toclient, new network::NetworkCallback<Planet>(this, &Planet::changedMesh));
    157         //REGISTERDATA(this->bCastShadows_, network::direction::toclient, new network::NetworkCallback<Planet>(this, &Planet::changedShadows));
     160        REGISTERSTRING(this->atmosphere_, direction::toclient);
     161        REGISTERSTRING(this->meshSrc_, direction::toclient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
     162        REGISTERDATA(this->bCastShadows_, direction::toclient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
    158163    }
    159164
Note: See TracChangeset for help on using the changeset viewer.