Changeset 3175 for code/branches/pch/src/orxonox/objects/worldentities
- Timestamp:
- Jun 15, 2009, 10:21:59 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/orxonox/objects/worldentities/Planet.cc
r3110 r3175 70 70 return; 71 71 72 Camera* activeCamera = CameraManager::getInstance().getActiveCamera(); 73 if(activeCamera) 72 if (GameMode::showsGraphics()) 74 73 { 75 float distance = this->getPosition().distance( activeCamera->getWorldPosition() ); 76 // COUT(2) << distance << std::endl; 77 float planetRadius = this->getScale(); 74 Camera* activeCamera = CameraManager::getInstance().getActiveCamera(); 75 if(activeCamera) 76 { 77 float distance = this->getPosition().distance( activeCamera->getWorldPosition() ); 78 // COUT(2) << distance << std::endl; 79 float planetRadius = this->getScale(); 78 80 79 float newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);80 float tempTest = newScale*(1+float(this->atmosphereSize)/float(this->imageSize));81 newScale = tempTest;81 float newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius); 82 float tempTest = newScale*(1+float(this->atmosphereSize)/float(this->imageSize)); 83 newScale = tempTest; 82 84 83 this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale); 85 this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale); 86 } 84 87 } 85 88 … … 145 148 SUPER(Planet, XMLPort, xmlelement, mode); 146 149 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); 150 if (GameMode::showsGraphics()) 151 { 152 XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere"); 153 XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode); 154 XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode); 155 XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 156 XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); 157 } 152 158 } 153 159
Note: See TracChangeset
for help on using the changeset viewer.