Changeset 6885 in orxonox.OLD for trunk/src/lib/graphics/effects
- Timestamp:
- Jan 31, 2006, 4:06:11 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/effects/lense_flare.cc
r6884 r6885 139 139 Billboard* bb = new Billboard(NULL); 140 140 bb->setTexture(textureName); 141 bb->setSize(50, 50); 141 142 this->flares.push_back(bb); 142 143 PRINTF(0)("Added a Lenseflare Billboard with texture %s\n", textureName); … … 150 151 151 152 153 bool LenseFlare::sourceVisible() const 154 {} 155 152 156 153 157 /** … … 159 163 return; 160 164 165 // refetch light source information if needed 161 166 if( unlikely( this->lightSource == NULL)) 167 { 162 168 this->lightSource = (LightManager::getInstance())->getLight(0); 163 else 164 this->lightSource->debug(); 169 if( this->flares.size() > 0) 170 this->flares[0]->setBindNode(static_cast<PNode*>(this->lightSource)); 171 } 172 165 173 166 174 // always update the screen center, it could be, that the window is resized 167 175 this->screenCenter = Vector(State::getResX()/2.0f, State::getResY()/2.0f, 0.0f); 168 176 // flare vector is the direction from the center to the light source 169 this->flareVector = this-> flares[0]->getAbsCoor2D();177 this->flareVector = this->screenCenter - this->flares[0]->getAbsCoor2D(); 170 178 this->distance = this->flareVector.len(); 171 179 this->flareVector.normalize(); 172 173 PRINTF(0)("Debug: screenCenter: %f, %f - flareVec: %f, %f\n", screenCenter.x, screenCenter.y, flareVector.x, flareVector.y);174 180 175 181 // now calculate the new coordinates of the billboards … … 179 185 { 180 186 // set the new position 181 (*it)->setAbsCoor2D(this->flareVector * this->flareMatrix[i * 2]); 187 if( i == 0) 188 continue; 189 (*it)->setAbsCoor2D( this->screenCenter + this->flareVector * this->flareMatrix[i * 2] * this->distance); 182 190 PRINTF(0)("Tick flare %i @ (%f, %f)\n", i, (*it)->getAbsCoor2D().x, (*it)->getAbsCoor2D().y); 183 191 // tick them … … 195 203 return; 196 204 205 if( !this->sourceVisible()) 206 return; 207 197 208 std::vector<Billboard*>::const_iterator it; 198 209 for( it = flares.begin(); it != flares.end(); it++) -
trunk/src/lib/graphics/effects/lense_flare.h
r6815 r6885 43 43 private: 44 44 GLint charToFogMode(const char* mode); 45 bool sourceVisible() const; 45 46 46 47
Note: See TracChangeset
for help on using the changeset viewer.