Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4736 in orxonox.OLD for orxonox/trunk/src/lib/graphics/light.h


Ignore:
Timestamp:
Jun 30, 2005, 1:06:53 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: cleaned up LightManager, this was quite messy….

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/light.h

    r4735 r4736  
    2626{
    2727 public:
    28   Light(int lightNumber);
    29   Light(const TiXmlElement* root);
     28  Light(const TiXmlElement* root = NULL);
    3029  virtual ~Light(void);
    3130
    32   void init(int lightNumber);
     31  void init();
    3332  void loadParams(const TiXmlElement* root);
    3433
     
    4342  int getLightNumber(void) const {return this->lightNumber;}
    4443
    45   virtual void draw();
     44  virtual void draw() const;
    4645
    4746  void debug(void) const;
     
    6665
    6766   <b>Usage:</b>\n
    68    First you have to get the Light Manager up and running by using LightManager::getInstance.
     67   First you have to get the Light Manager up and running by using LightManager::getInstance().
    6968   This automatically initiates the GL_LIGHTING, and sets some default stuff about the light.\n
    7069   Then you will create a new light using:
    71    \li int addLight(void);
    72    \li int addLight(int lightNumber);
     70   \li new Light();
    7371
    7472   now you can operate on the light as follows:
    75    \li void setPosition(Vector position);
    76    \li void setPosition(GLfloat x, GLfloat y, GLfloat z);
    7773   \li void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
    7874   \li void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
     
    8076   \li void setSpotDirection(Vector direction);
    8177   \li void setSpotCutoff(GLfloat cutoff);
    82 
    83    These functions are preatty selv-explaining, but you can read about them below.\n
    84    If you want to fetch info, or the a Light use:
    85    \li Vector getPosition(void) const;
    86    \li Vector getPosition(int lightNumber) const;
    87    \li Light* getLight(int LightNumber) const;
     78   \li all PNode stuff also works
    8879
    8980   To redraw the light use
    90    \li void draw();
     81   \li void draw() const;
    9182
    9283   and to delete one just use
     
    9788
    9889   You can also operate on the single Lights themselves, by first retreaving them with
    99    \li Light* getLight(int LightNumber);
     90   \li Light* getLight(int LightNumber) const;
    10091   \n
    10192   and then using the same functions on this to change settings.
     
    10394class LightManager : public BaseObject
    10495{
     96  friend class Light;
    10597
    10698 public:
     
    112104  void loadLights(const TiXmlElement* root);
    113105
    114   // set Attributes
    115   int addLight(void);
    116   int addLight(int lightNumber);
    117   void editLightNumber(int lightNumber);
    118   void deleteLight(void);
    119   void deleteLight(int lightNumber);
    120 
    121106  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
    122107
    123   void draw();
     108  Light* getLight(int lightNumber) const;
     109  inline Light* getLight() const { return this->currentLight; };
    124110
    125   //set Attributes
    126   void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
    127   void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
    128   void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
    129   void setSpotDirection(Vector direction);
    130   void setSpotCutoff(GLfloat cutoff);
    131 
    132   // get Attributes
    133   Vector getPosition(void) const;
    134   Vector getPosition(int lightNumber) const;
    135 
    136   Light* getLight(int lightNumber) const;
    137   Light* getLight() const { return this->currentLight; };
     111  void draw() const;
    138112
    139113  void debug(void) const;
    140114
    141 
    142115 private:
    143116  LightManager(void);
    144   void initLight(int LightNumber);
    145117
     118  int  registerLight(Light* light);
     119  void unregisterLight(Light* light);
    146120
    147121 private:
Note: See TracChangeset for help on using the changeset viewer.