Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6782 in orxonox.OLD for branches/network/src/lib/graphics


Ignore:
Timestamp:
Jan 26, 2006, 7:43:44 PM (19 years ago)
Author:
patrick
Message:

network: little bit more code :D

Location:
branches/network/src/lib/graphics
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/graphics/Makefile.am

    r6779 r6782  
    99                           render2D/render_2d.cc \
    1010                           render2D/element_2d.cc \
     11                           render2D/billboard.cc \
    1112                           text_engine/text_engine.cc \
    1213                           text_engine/text.cc \
     
    2122                 render2D/render_2d.h \
    2223                 render2D/element_2d.h \
     24                 render2D/billboard.h \
    2325                 text_engine/text_engine.h \
    2426                 text_engine/text.h \
  • branches/network/src/lib/graphics/effects/lense_flare.cc

    r6779 r6782  
    2525#include "texture.h"
    2626
     27#include "render2D/billboard.h"
    2728
    2829using namespace std;
     
    3839 LenseFlare::LenseFlare(const TiXmlElement* root)
    3940{
    40 
    4141  if (root != NULL)
    4242    this->loadParams(root);
     
    6060    LoadParam(root, "add-flare-texture", this, LenseFlare, addFlare)
    6161        .describe("adds a lensflare texture to the engine");
    62 
    6362}
    6463
     
    6867 */
    6968bool LenseFlare::init()
    70 {
    71 
    72 }
     69{}
    7370
    7471
     
    7875bool LenseFlare::activate()
    7976{
    80 
     77  this->bActivated = true;
    8178}
    8279
     
    8784bool LenseFlare::deactivate()
    8885{
    89 
     86  this->bActivated = false;
    9087}
    9188
     
    103100 * @param textureName the name of the flare texture
    104101 */
    105 void addFlare(const char* textureName)
     102void LenseFlare::addFlare(const char* textureName)
    106103{
    107   Texture* texture = new Texture (textureName, GL_TEXTURE);
    108 
    109 
     104  Billboard* bb = new Billboard(NULL);
     105  bb->setTexture(textureName);
    110106}
    111107
    112108
     109/**
     110 * draws the LenseFlares
     111 */
     112void LenseFlare::draw() const
     113{
     114  if( !this->bActivated)
     115    return;
     116
     117}
  • branches/network/src/lib/graphics/effects/lense_flare.h

    r6779 r6782  
    1414class TiXmlElement;
    1515class Light;
    16 class Element2D;
     16class Billboard;
    1717
    1818//! A class that handles LenseFlares. The LenseFlareManager operates on this.
     
    4141  private:
    4242    Light*                   lightSource;        //!< reference to the sun (or primary light source)
    43     std::vector<Element2D*>  flares;             //!< the flares array
     43    std::vector<Billboard*>  flares;             //!< the flares array
    4444};
    4545
  • branches/network/src/lib/graphics/render2D/billboard.cc

    r6781 r6782  
    1111### File Specific:
    1212   main-programmer: Patrick Boenzli
    13    co-programmer: ...
    1413*/
    1514
    1615#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1716
    18 #include "image_entity.h"
     17#include "billboard.h"
    1918
    2019#include "load_param.h"
     
    2524#include "glincl.h"
    2625#include "state.h"
     26#include "p_node.h"
    2727
    2828
     
    3939{
    4040  this->init();
    41   this->loadParams(root);
     41
     42  if( root)
     43    this->loadParams(root);
    4244}
    4345
     
    6466  this->setSize(GraphicsEngine::getInstance()->getResolutionX()/10.0, GraphicsEngine::getInstance()->getResolutionY()/10.0);
    6567
    66   this->setBindNode(this);
    67   this->material = new Material;
     68  //this->setBindNode(this);
     69  this->material = new Material();
    6870  this->setTexture("pictures/error_texture.png");
    6971}
    7072
    7173
     74/**
     75 *  load params
     76 * @param root TiXmlElement object
     77 */
    7278void Billboard::loadParams(const TiXmlElement* root)
    7379{
    74   PNode::loadParams(root);
    75 
    7680  LoadParam(root, "texture", this, Billboard, setTexture)
    7781      .describe("the texture-file to load onto the Billboard");
     
    7983  LoadParam(root, "size", this, Billboard, setSize)
    8084      .describe("the size of the Billboard in Pixels");
    81 
    82   LoadParam(root, "rotation-speed", this, Billboard, setRotationSpeed)
    83       .describe("the Speed with which the Billboard should rotate");
    84 
    85 
    8685}
    8786
     
    107106
    108107
    109 /** this turns on/off the billboarding of this WorldEntity
    110  *
    111  * This means that the image will always look in the direction of the Player
     108/**
     109 * attaches this billboard to a parent
     110 * @param pNode node to attach to
    112111 */
    113 void Billboard::toggleBillboard()
     112void Billboard::attachTo(PNode* pNode)
    114113{
    115   this->bBillboarding = !this->bBillboarding;
     114  this->source->setParent(pNode);
    116115}
    117116
     
    151150{
    152151  glPushMatrix();
     152
    153153  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
     154  this->material->select();
    154155
    155   //glRotatef(this->getAbsDir2D(), 0,0,1);
    156   this->material->select();
    157156  glBegin(GL_TRIANGLE_STRIP);
    158157  glTexCoord2f(0, 0);
     
    165164  glVertex2f(this->getSizeX2D(), this->getSizeY2D());
    166165  glEnd();
     166
    167167  glPopMatrix();
    168 
    169168}
  • branches/network/src/lib/graphics/render2D/billboard.h

    r6781 r6782  
    77#define _BILLBOARD_H
    88
    9 #include "p_node.h"
     9
    1010#include "element_2d.h"
    11 #include "event_listener.h"
    1211
    1312#include "vector.h"
     
    3231    void setSize(float sizeX, float sizeY);
    3332    void setTexture(const char* textureFile);
    34     /** @param rotationSpeed the speed at what the crosshair should rotate */
    35     void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
    36     void toggleBillboard();
     33    void attachTo(PNode* pnode);
    3734
    3835    virtual void tick(float dt);
Note: See TracChangeset for help on using the changeset viewer.