Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7843 in orxonox.OLD for trunk


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

compiles

Location:
trunk/src/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/cr_engine.h

    r7842 r7843  
    4646
    4747  /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */
    48   inline Collision* getCollisionObject() { /* return the first element of the cache list*/ }
     48inline Collision* getCollisionObject() { /* return the first element of the cache list*/ }
    4949  /** @param collision: returns the Collision object back to the cache list */
    5050  inline void putCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); }
     
    5252
    5353private:
    54   CREngine(void);
    55   static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
    5654
    5755  std::vector<CollisionHandle*>       collisionHandles;         //!< list with the collision handles
    5856  std::vector<Collision*>             cachedCollisions;         //!< a list of unused, cached collision events
    5957#endif
     58private:
     59  CREngine(void);
     60  static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
    6061};
    6162
  • trunk/src/lib/graphics/effects/lense_flare.cc

    r7840 r7843  
    4141
    4242/**
    43  * default constructor
     43 * @brief default constructor
    4444 * @param root The XML-element to load the LenseFlare from
    4545 */
     
    128128
    129129/**
    130  * converts a gl mode char to a GLint
     130 * @brief converts a gl mode char to a GLint
    131131 * @param mode the mode character
    132132 */
     
    136136
    137137/**
    138  * adds a texture flare
     138 * @brief adds a texture flare
    139139 * @param textureName the name of the flare texture
    140140 *
     
    169169    bb->setVisibility(true);
    170170  }
     171
    171172  PRINTF(4)("Finished adding\n");
    172173}
     
    175176void LenseFlare::setSourceVisibility(bool visibility)
    176177{
    177   if (this->isVisible == visibility)
    178     return;
     178//   if (this->isVisible == visibility)
     179//     return;
    179180
    180181  float dist = this->frustumPlane.distancePoint(this->lightSource->getAbsCoor());
     
    205206    //set the frustum plane
    206207
    207   this->frustumPlane = State::getCamera()->getViewFrustum();
    208 
    209   if (State::getCamera()->distance(lightSource) < 0)
    210     this->setSourceVisibility(false);
    211   else
    212     this->setSourceVisibility(true);
     208//   this->frustumPlane = State::getCamera()->getViewFrustum();
     209//
     210//   if (State::getCamera()->distance(lightSource) < 0)
     211//     this->setSourceVisibility(false);
     212//   else
     213//     this->setSourceVisibility(true);
    213214
    214215
     
    233234    (*it)->setSize2D(50.0f * this->flareMatrix[i * 2 + 1], 50.0f * this->flareMatrix[i * 2 + 1]);
    234235    PRINTF(5)("Tick flare %i @ (%f, %f)\n", i, (*it)->getAbsCoor2D().x, (*it)->getAbsCoor2D().y);
    235     // tick them
    236     (*it)->tick(dt);
    237236  }
    238237}
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r7840 r7843  
    2121#include <algorithm>
    2222
     23// ONLY IF PNODE ENABLED //
     24#include "state.h"
    2325#include "p_node.h"
     26#include "camera.h"
     27///////////////////////////
    2428
    2529#include "graphics_engine.h"
     
    4549
    4650  this->setVisibility(true);
     51  this->bCurrentlyVisible = true;
    4752  this->activate2D();
    4853  this->setAlignment(E2D_ALIGN_NONE);
     
    240245
    241246
     247/**
     248 * @brief sets a node, this 2D-Element should be shown upon
     249 * @param bindNode the Node of the Node. (if NULL it will be unset).
     250 */
     251void Element2D::setBindNode(const PNode* bindNode)
     252{
     253  this->bindNode = bindNode;
     254  if (bindNode == NULL)
     255    this->bCurrentlyVisible = true;
     256}
    242257
    243258/**
     
    863878    else if (unlikely(this->bindNode != NULL))
    864879    {
     880      if (State::getCamera()->distance(this->bindNode) < 0)
     881        this->bCurrentlyVisible = false;
     882      else
     883      {
     884        this->bCurrentlyVisible = true;
     885        printf("OK \n");
     886      }
     887
    865888      GLdouble projectPos[3] = {0.0, 0.0, 0.0};
    866889      gluProject(this->bindNode->getAbsCoor().x,
     
    10111034void Element2D::draw2D(E2D_LAYER from, E2D_LAYER to) const
    10121035{
    1013   if (this->bVisible)
     1036  if (this->bVisible && this->bCurrentlyVisible)
    10141037    this->draw();
    10151038  if (this->children.size() > 0)
  • trunk/src/lib/graphics/render2D/element_2d.h

    r7840 r7843  
    116116    inline void setVisibility(bool visible) { this->bVisible = visible; };
    117117    /** @returns the visibility state */
    118     inline bool isVisible() const { return this->bVisible; };
     118    inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible); };
    119119
    120120
    121121    // POSITIONAL (E2D-specials) //
    122122    /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
    123     inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };
     123    void setBindNode(const PNode* bindNode);
    124124    void setBindNode(const std::string& bindNode);
    125125    inline const PNode* getBindNode() const { return this->bindNode; };
     
    244244    E2D_ALIGNMENT           alignment;          //!< How the Element is aligned around its Position
    245245
    246     bool                    bVisible;            //!< If the given Element2D is visible.
    247     bool                    bActive;             //!< If the given Element2D is active.
     246    bool                    bVisible;           //!< If the given Element2D is visible.
     247    bool                    bCurrentlyVisible;  //!< Evaluated in the TICK process, to see if the Element is Currently visible.
     248    bool                    bActive;            //!< If the given Element2D is active.
    248249    E2D_LAYER               layer;              //!< What layer this Element2D is on.
    249250
  • trunk/src/lib/graphics/render2D/image_plane.cc

    r7810 r7843  
    2121
    2222#include "graphics_engine.h"
    23 #include "material.h"
    2423#include "glincl.h"
    25 #include "state.h"
    2624#include "p_node.h"
    2725
     
    5048ImagePlane::~ImagePlane ()
    5149{
    52   if (this->material)
    53     delete this->material;
    5450}
    5551
     
    6763
    6864  //this->setBindNode(this);
    69   this->material = new Material();
    7065  this->setTexture("pictures/error_texture.png");
    7166}
     
    7873void ImagePlane::loadParams(const TiXmlElement* root)
    7974{
    80   LoadParam(root, "texture", this->material, Material, setDiffuseMap)
     75  LoadParam(root, "texture", &this->material, Material, setDiffuseMap)
    8176      .describe("the texture-file to load onto the ImagePlane");
    8277
     
    10297void ImagePlane::setTexture(const std::string& textureFile)
    10398{
    104   this->material->setDiffuseMap(textureFile);
     99  this->material.setDiffuseMap(textureFile);
    105100}
    106101
     
    149144void ImagePlane::draw() const
    150145{
    151   if( !this->isVisible())
    152     return;
    153 
    154146  glPushMatrix();
    155147
    156148  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
    157   this->material->select();
     149  this->material.select();
    158150
    159151  glBegin(GL_TRIANGLE_STRIP);
  • trunk/src/lib/graphics/render2D/image_plane.h

    r7810 r7843  
    1111
    1212#include "vector.h"
     13#include "material.h"
    1314
    14 
    15 
    16 class Material;
    17 class TiXmlElement;
    1815
    1916//! A class that enables the
     
    3734
    3835  private:
    39     Material*        material;             //!< a material for the ImagePlane
     36    Material         material;             //!< a material for the ImagePlane
    4037    float            rotationSpeed;        //!< Speed of the Rotation.
    4138
Note: See TracChangeset for help on using the changeset viewer.