Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7844 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
May 24, 2006, 11:34:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Ok the Element2D-renderer works, and hides Elements, that are behind the Camera

Location:
trunk/src/lib/graphics
Files:
3 edited

Legend:

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

    r7843 r7844  
    6161  PRINTF(0)("light is: %p\n", this->lightSource);
    6262
    63   this->isVisible = true;
    64 
    6563  if (root != NULL)
    6664  {
     
    6967  }
    7068
     69  this->bVisible = true;
    7170  this->setSourceVisibility(false);
    72   this->isVisible = true;
    7371
    7472}
     
    161159  bb->setSize(50, 50);
    162160  this->flares.push_back(bb);
     161  bb->setVisibility(true);
     162
    163163  PRINTF(4)("Added a Lenseflare ImagePlane with texture %s\n", textureName.c_str());
    164164
     
    167167  {
    168168    bb->setBindNode(static_cast<PNode*>(this->lightSource));
    169     bb->setVisibility(true);
    170169  }
    171170
     
    176175void LenseFlare::setSourceVisibility(bool visibility)
    177176{
    178 //   if (this->isVisible == visibility)
    179 //     return;
    180 
    181   float dist = this->frustumPlane.distancePoint(this->lightSource->getAbsCoor());
    182   PRINTF(0)("dist: %f\n", dist);
     177   if (this->bVisible == visibility)
     178     return;
     179
    183180  std::vector<ImagePlane*>::const_iterator it;
    184     for(it = flares.begin(); it != flares.end(); it++)
     181    for(it = ++flares.begin(); it != flares.end(); it++)
    185182      (*it)->setVisibility(visibility);
    186   this->isVisible = visibility;
     183  this->bVisible = visibility;
    187184}
    188185
     
    205202
    206203    //set the frustum plane
    207 
    208 //   this->frustumPlane = State::getCamera()->getViewFrustum();
    209 //
    210 //   if (State::getCamera()->distance(lightSource) < 0)
    211 //     this->setSourceVisibility(false);
    212 //   else
    213 //     this->setSourceVisibility(true);
     204  if (!flares.empty())
     205    this->setSourceVisibility(this->flares[0]->isVisible());
    214206
    215207
  • trunk/src/lib/graphics/effects/lense_flare.h

    r7810 r7844  
    4848
    4949  private:
    50     float                    isVisible;          //!< Checks visibility
     50    bool                     bVisible;          //!< Checks visibility
    5151    Light*                   lightSource;        //!< reference to the sun (or primary light source)
    5252    std::vector<ImagePlane*>  flares;             //!< the flares array
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r7843 r7844  
    883883      {
    884884        this->bCurrentlyVisible = true;
    885         printf("OK \n");
    886885      }
    887886
     
    10341033void Element2D::draw2D(E2D_LAYER from, E2D_LAYER to) const
    10351034{
    1036   if (this->bVisible && this->bCurrentlyVisible)
     1035  if (this->isVisible())
    10371036    this->draw();
    10381037  if (this->children.size() > 0)
Note: See TracChangeset for help on using the changeset viewer.