Changeset 2411 for code/branches/lodfinal/src/orxonox
- Timestamp:
- Dec 11, 2008, 9:21:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lodfinal/src/orxonox/objects/worldentities/Planet.cc
r2402 r2411 74 74 75 75 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(); 79 81 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; 83 85 84 this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale); 86 this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale); 87 } 85 88 86 89 SUPER(Planet, tick, dt); … … 116 119 void Planet::changedMesh() 117 120 { 121 COUT(0) << "changedMesh callback -===================" << endl; 118 122 if (this->mesh_.getEntity()) 119 123 this->getNode()->detachObject(this->mesh_.getEntity()); … … 154 158 155 159 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)); 158 163 } 159 164
Note: See TracChangeset
for help on using the changeset viewer.