Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

network: little bit more code :D

Location:
branches/network/src/lib/graphics/render2D
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.