Changeset 6889 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jan 31, 2006, 1:21:29 PM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/effects/lense_flare.cc
r6888 r6889 31 31 32 32 #include "light.h" 33 #include "camera.h" 33 34 34 35 using namespace std; … … 147 148 { 148 149 bb->setBindNode(static_cast<PNode*>(this->lightSource)); 150 bb->setVisibility(true); 149 151 } 150 152 } … … 154 156 { 155 157 156 return true; 158 float dist = this->frustumPlane.distancePoint(this->lightSource->getAbsCoor()); 159 if( dist < 0.0f) 160 { 161 std::vector<Billboard*>::const_iterator it = flares.begin(); it++; 162 for(; it != flares.end(); it++) 163 (*it)->setVisibility(true); 164 return true; 165 } 166 167 std::vector<Billboard*>::const_iterator it = flares.begin(); it++; 168 for(; it != flares.end(); it++) 169 (*it)->setVisibility(false); 170 171 return false; 157 172 } 158 173 … … 173 188 this->flares[0]->setBindNode(static_cast<PNode*>(this->lightSource)); 174 189 } 190 191 //set the frustum plane 192 Vector psTarget = (State::getCameraTarget())->getAbsCoor(); 193 Vector psCamera = (State::getCamera())->getAbsCoor(); 194 Vector psCameraDir = psCamera - psTarget; 195 //PRINTF(0)("camera Dir: %f %f %f, camera: %f %f %f\n", psCameraDir.x, psCameraDir.y, psCameraDir.z, psCamera.x, psCamera.y, psCamera.z); 196 this->frustumPlane = Plane(psCameraDir, Vector(-70.0,0.0,0.0)); 175 197 176 198 … … 191 213 if( i == 0) 192 214 continue; 193 PRINTF(0)("calculus: (%f %f %f) * %f * %f\n", this->flareVector.x, this->flareVector.y, this->flareVector.z, this->flareMatrix[i * 2], this->distance); 215 194 216 (*it)->setAbsCoor2D( this->screenCenter + this->flareVector * this->flareMatrix[i * 2] * this->distance); 195 217 (*it)->setSize2D(50.0f * this->flareMatrix[i * 2 + 1], 50.0f * this->flareMatrix[i * 2 + 1]); … … 209 231 return; 210 232 211 if( !this->sourceVisible()) 212 return; 213 214 std::vector<Billboard*>::const_iterator it; 215 for( it = flares.begin(); it != flares.end(); it++) 216 (*it)->draw(); 217 } 233 this->sourceVisible(); 234 } -
trunk/src/lib/graphics/effects/lense_flare.h
r6885 r6889 12 12 13 13 #include "vector.h" 14 #include "plane.h" 14 15 15 16 … … 55 56 56 57 float* flareMatrix; 58 Plane frustumPlane; //!< plane that marks the view frustum 57 59 }; 58 60 -
trunk/src/lib/graphics/render2D/billboard.cc
r6815 r6889 149 149 void Billboard::draw() const 150 150 { 151 if( !this->isVisible()) 152 return; 153 151 154 glPushMatrix(); 152 155
Note: See TracChangeset
for help on using the changeset viewer.