Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 24, 2006, 10:38:51 PM (19 years ago)
Author:
bensch
Message:

trunk: Elements that are supposed to be on the Background stay there:

Changed:
Element2D: render from - to - LAYERS
Render2D: Renders from - to - LAYERS
GraphicsEngine: new function drawBackgroundElements
ObjectManager: new List OM_BACKGROUND
Skybox/sphere: in OM_LIST OM_BACKGROUND

@patrick: do you like it too ??

Location:
trunk/src/lib
Files:
8 edited

Legend:

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

    r7810 r7840  
    156156
    157157  ImagePlane* bb = new ImagePlane(NULL);
     158  if (this->flares.empty())
     159    bb->setLayer(E2D_LAYER_BELOW_ALL);
    158160  bb->setTexture(textureName);
    159161  bb->setSize(50, 50);
  • trunk/src/lib/graphics/graphics_engine.cc

    r7727 r7840  
    569569}
    570570
     571void GraphicsEngine::drawBackgroundElements() const
     572{
     573  Render2D::getInstance()->draw(E2D_LAYER_BELOW_ALL, E2D_LAYER_BELOW_ALL);
     574}
    571575
    572576void GraphicsEngine::draw() const
     
    583587  GraphicsEngine::storeMatrices();
    584588  Shader::suspendShader();
    585 
    586   Render2D::getInstance()->draw(E2D_LAYER_ALL);
     589  Render2D::getInstance()->draw(E2D_LAYER_BOTTOM, E2D_LAYER_ABOVE_ALL);
    587590  Shader::restoreShader();
    588591}
  • trunk/src/lib/graphics/graphics_engine.h

    r7370 r7840  
    6868    void update(float dt);
    6969    void tick(float dt);
     70
     71    void drawBackgroundElements() const;
    7072    void draw() const;
    7173    void displayFPS(bool display);
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r7727 r7840  
    3232SHELL_COMMAND(debug, Element2D, debug2DSC);
    3333
    34 using namespace std;
    3534
    3635/**
     
    199198
    200199/**
    201  * moves a Element to another layer
     200 * @brief moves a Element to another layer
    202201 * @param layer the Layer this is drawn on
    203202 */
     
    254253
    255254/**
    256  * sets the relative coordinate of the Element2D to its parent
     255 * @brief sets the relative coordinate of the Element2D to its parent
    257256 * @param relCoord the relative coordinate to the parent
    258257 */
     
    269268
    270269/**
    271  * sets the relative coordinate of the Element2D to its Parent
     270 * @brief sets the relative coordinate of the Element2D to its Parent
    272271 * @param x the x coordinate
    273272 * @param y the y coordinate
     
    279278
    280279/**
    281  * sets the Relative coordinate to the parent in Pixels
     280 * @brief sets the Relative coordinate to the parent in Pixels
    282281 * @param x the relCoord X
    283282 * @param y the relCoord Y
     
    290289
    291290/**
    292  * sets a new relative position smoothely
     291 * @brief sets a new relative position smoothely
    293292 * @param relCoordSoft the new Position to iterate to
    294293 * @param bias how fast to iterate to this position
     
    304303
    305304/**
    306  * sets a new relative position smoothely
     305 * @brief sets a new relative position smoothely
    307306 * @param x the new x-coordinate in Pixels of the Position to iterate to
    308307 * @param y the new y-coordinate in Pixels of the Position to iterate to
     
    317316
    318317/**
    319  * set relative coordinates smoothely
     318 * @brief set relative coordinates smoothely
    320319 * @param x x-relative coordinates to its parent
    321320 * @param y y-relative coordinates to its parent
     
    420419
    421420/**
    422  * shift coordinate ralative
     421 * @brief shift coordinate ralative
    423422 * @param shift shift vector
    424423 *
     
    433432
    434433/**
    435  * shifts in PixelSpace
     434 * @brief shifts in PixelSpace
    436435 * @param x the pixels to shift in X
    437436 * @param y the pixels to shift in Y
     
    444443
    445444/**
    446  * set relative direction
     445 * @brief set relative direction
    447446 * @param relDir to its parent
    448447 */
     
    460459
    461460/**
    462  * sets the Relative Direction of this node to its parent in a Smoothed way
     461 * @brief sets the Relative Direction of this node to its parent in a Smoothed way
    463462 * @param relDirSoft the direction to iterate to smoothely.
    464463 * @param bias how fast to iterate to the new Direction
     
    474473
    475474/**
    476  * sets the absolute direction
     475 * @brief sets the absolute direction
    477476 * @param absDir absolute coordinates
    478477 */
     
    494493
    495494/**
    496  * sets the absolute direction softly
     495 * @brief sets the absolute direction softly
    497496 * @param absDir absolute coordinates
    498497 */
     
    553552      {
    554553        // Inserting the Element at the right Layer depth.
    555         list<Element2D*>::iterator elem;
     554        std::list<Element2D*>::iterator elem;
    556555        for (elem = this->children.begin(); elem != this->children.end(); elem++)
    557556        {
     
    628627
    629628/**
    630  * remove this Element from the tree and adds all children to NullElement2D
     629 * @brief remove this Element from the tree and adds all children to NullElement2D
    631630 *
    632631 * afterwards this Node is free, and can be reattached, or deleted freely.
     
    634633void Element2D::remove2D()
    635634{
    636   list<Element2D*>::iterator child = this->children.begin();
    637   list<Element2D*>::iterator reparenter;
     635  std::list<Element2D*>::iterator child = this->children.begin();
     636  std::list<Element2D*>::iterator reparenter;
    638637  while (child != this->children.end())
    639638  {
     
    671670
    672671/**
    673  * does the reparenting in a very smooth way
     672 * @brief does the reparenting in a very smooth way
    674673 * @param parentNode the new Node to connect this node to.
    675674 * @param bias the speed to iterate to this new Positions
     
    928927  if(!this->children.empty() || this->parentMode & E2D_UPDATE_CHILDREN_IF_INACTIVE)
    929928  {
    930     list<Element2D*>::iterator child;
     929    std::list<Element2D*>::iterator child;
    931930    for (child = this->children.begin(); child != this->children.end(); child++)
    932931    {
     
    949948
    950949/**
    951  * displays some information about this pNode
     950 * @brief displays some information about this pNode
    952951 * @param depth The deph into which to debug the children of this Element2D to.
    953952 * (0: all children will be debugged, 1: only this Element2D, 2: this and direct children...)
     
    975974  if (depth >= 2 || depth == 0)
    976975  {
    977     list<Element2D*>::const_iterator child;
     976    std::list<Element2D*>::const_iterator child;
    978977    for (child = this->children.begin(); child != this->children.end(); child++)
    979978    {
     
    987986
    988987/**
    989  * ticks the 2d-Element
     988 * @brief ticks the 2d-Element
    990989 * @param dt the time elapsed since the last tick
    991990 *
     
    1000999  if (this->children.size() > 0)
    10011000  {
    1002     list<Element2D*>::iterator child;
     1001    std::list<Element2D*>::iterator child;
    10031002    for (child = this->children.begin(); child != this->children.end(); child++)
    10041003      (*child)->tick2D(dt);
     
    10071006
    10081007/**
    1009  * draws all the Elements from this element2D downwards
     1008 * @brief draws all the Elements from this element2D downwards
    10101009 * @param layer the maximal Layer to draw. @see E2D_LAYER
    10111010 */
    1012 void Element2D::draw2D(short layer) const
     1011void Element2D::draw2D(E2D_LAYER from, E2D_LAYER to) const
    10131012{
    10141013  if (this->bVisible)
     
    10161015  if (this->children.size() > 0)
    10171016  {
    1018     list<Element2D*>::const_iterator child;
     1017    std::list<Element2D*>::const_iterator child;
    10191018    for (child = this->children.begin(); child != this->children.end(); child++)
    1020       if (likely(layer >= this->layer))
    1021         (*child)->draw2D(layer);
     1019      if (likely( (*child)->layer >= from && (*child)->layer <= to))
     1020        (*child)->draw2D(from, to);
    10221021  }
    10231022}
     
    10571056  {
    10581057    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
    1059     list<Element2D*>::const_iterator child;
     1058    std::list<Element2D*>::const_iterator child;
    10601059    for (child = this->children.begin(); child != this->children.end(); child++)
    10611060    {
  • trunk/src/lib/graphics/render2D/element_2d.h

    r7332 r7840  
    136136    virtual void draw() const  {};
    137137    void tick2D(float dt);
    138     void draw2D(short layer) const;
     138    void draw2D(E2D_LAYER from, E2D_LAYER to) const;
    139139
    140140    // LIKE PNODE
  • trunk/src/lib/graphics/render2D/render_2d.cc

    r7457 r7840  
    2525
    2626/**
    27  * standard constructor
     27 * @brief standard constructor
    2828 */
    2929Render2D::Render2D ()
     
    3636
    3737/**
    38  * the singleton reference to this class
     38 * @brief the singleton reference to this class
    3939 */
    4040Render2D* Render2D::singletonRef = NULL;
    4141
    4242/**
    43  * standard deconstructor
     43 * @brief standard deconstructor
    4444 */
    4545Render2D::~Render2D ()
     
    5151
    5252/**
    53  * updates all the 2d-elements
     53 * @brief updates all the 2d-elements
    5454 * @param dt the timestep since last dt
    5555 */
     
    6161
    6262/**
    63  * ticks all the 2d-elements
     63 * @brief ticks all the 2d-elements
    6464 * @param dt the timestep since last dt
    6565 */
     
    7070
    7171/**
    72  * renders all the Elements of the Render2D-engine's layer
     72 * @brief renders all the Elements of the Render2D-engine's layer
    7373 * @param layer the Layer to draw (if E2D_LAYER_ALL then all layers will be drawn)
    7474 */
    75 void Render2D::draw(short layer) const
     75void Render2D::draw(E2D_LAYER from, E2D_LAYER to) const
    7676{
    7777  GraphicsEngine::enter2DMode();
    78   Element2D::getNullElement()->draw2D(E2D_LAYER_ALL);
     78
     79  Element2D::getNullElement()->draw2D(from, to);
    7980  if (this->showNodes)
    8081    Element2D::getNullElement()->debugDraw2D(0);
     82
    8183  GraphicsEngine::leave2DMode();
    8284}
  • trunk/src/lib/graphics/render2D/render_2d.h

    r5776 r7840  
    2424    void update(float dt);
    2525    void tick(float dt);
    26     void draw(short layer) const;
     26    void draw(E2D_LAYER from, E2D_LAYER to) const;
    2727
    2828  private:
  • trunk/src/lib/gui/gl_gui/glgui_handler.cc

    r7779 r7840  
    6868  void GLGuiHandler::draw()
    6969  {
    70     GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP);
     70//    GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP);
    7171  }
    7272
Note: See TracChangeset for help on using the changeset viewer.