Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6884 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 31, 2006, 3:28:26 AM (19 years ago)
Author:
patrick
Message:

trunk: working on the lenseflare

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/effects/lense_flare.cc

    r6815 r6884  
    2929
    3030#include "render2D/billboard.h"
     31
     32#include "light.h"
    3133
    3234using namespace std;
     
    5456  this->flareMatrix[10] = -0.25f; this->flareMatrix[11] = 0.25f;
    5557  this->flareMatrix[12] = 1.82f; this->flareMatrix[13] = 0.25f;
     58
     59  this->lightSource = (LightManager::getInstance())->getLight(0);
    5660}
    5761
     
    127131void LenseFlare::addFlare(const char* textureName)
    128132{
    129   if( this->flares.size() < LF_MAX_FLARES)
     133  if( this->flares.size() > LF_MAX_FLARES)
    130134  {
    131135    PRINTF(2)("You tried to add more than %i lense flares, ignoring\n", LF_MAX_FLARES);
     
    154158  if( unlikely(!this->bActivated || this->flares.size() == 0))
    155159    return;
     160
     161  if( unlikely( this->lightSource == NULL))
     162    this->lightSource = (LightManager::getInstance())->getLight(0);
     163  else
     164    this->lightSource->debug();
     165
    156166  // always update the screen center, it could be, that the window is resized
    157167  this->screenCenter = Vector(State::getResX()/2.0f, State::getResY()/2.0f, 0.0f);
     
    160170  this->distance = this->flareVector.len();
    161171  this->flareVector.normalize();
     172
     173  PRINTF(0)("Debug: screenCenter: %f, %f - flareVec: %f, %f\n", screenCenter.x, screenCenter.y, flareVector.x, flareVector.y);
    162174
    163175  // now calculate the new coordinates of the billboards
     
    168180    // set the new position
    169181    (*it)->setAbsCoor2D(this->flareVector * this->flareMatrix[i * 2]);
    170     PRINTF(0)("Drawing flare %i @ (%f, %f)\n", i, (this->flareVector * this->flareMatrix[i * 2]).x, (this->flareVector * this->flareMatrix[i * 2]).y);
     182    PRINTF(0)("Tick flare %i @ (%f, %f)\n", i, (*it)->getAbsCoor2D().x, (*it)->getAbsCoor2D().y);
    171183    // tick them
    172184    (*it)->tick(dt);
  • trunk/src/lib/graphics/graphics_engine.cc

    r6815 r6884  
    3838#include "effects/graphics_effect.h"
    3939#include "effects/fog_effect.h"
     40#include "effects/lense_flare.h"
    4041
    4142#include "shell_command.h"
     
    171172//   fe->activate();
    172173//   PRINTF(0)("--------------------------------------------------------------\n");
     174
     175  LenseFlare* ge = new LenseFlare();
     176  this->loadGraphicsEffect(ge);
     177
     178  ge->addFlare("pictures/lense_flares/lens1.jpg");
     179  ge->addFlare("pictures/lense_flares/lens2.jpg");
     180  ge->addFlare("pictures/lense_flares/lens3.jpg");
     181  ge->addFlare("pictures/lense_flares/lens4.jpg");
     182
     183
     184  ge->activate();
    173185}
    174186
     
    610622  Shader::restoreShader();
    611623
    612   //draw the graphics
     624  //draw the graphics effects
    613625  list<GraphicsEffect*>::const_iterator it;
    614626  for (it = this->graphicsEffects.begin(); it != this->graphicsEffects.end(); it++)
  • trunk/src/lib/graphics/light.cc

    r6778 r6884  
    337337}
    338338
     339
     340Light* LightManager::getLight(int lightNumber) const
     341{
     342  if( lightNumber < NUMBEROFLIGHTS)
     343    return this->lights[lightNumber];
     344
     345  return NULL;
     346}
     347
    339348/**
    340349 *  draws all the Lights in their appropriate position
  • trunk/src/story_entities/simple_game_menu.cc

    r6883 r6884  
    230230      ie->setBindNode((const PNode*)NULL);
    231231      ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f, 0.0f);
    232       ie->setSize2D(100.0f, 75.0f);
     232      ie->setSize2D(140.0f, 105.0f);
    233233      this->menuLayer[1]->screenshootList.push_back(ie);
    234234    }
Note: See TracChangeset for help on using the changeset viewer.