Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9936 in orxonox.OLD


Ignore:
Timestamp:
Nov 17, 2006, 10:07:44 AM (17 years ago)
Author:
hdavid
Message:

branches/volumetric_fog

Location:
branches/volumetric_fog/src/world_entities/weather_effects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc

    r9935 r9936  
    2020#include "p_node.h"
    2121#include "state.h"
     22#include "shell_command.h"
    2223
    2324#include "glincl.h"
    2425#include "debug.h"
    25 
    2626
    2727#define GLX_GLXEXT_PROTOTYPES
     
    3131CREATE_FACTORY(VolFogEffect);
    3232
     33SHELL_COMMAND(activate, VolFogEffect, activateFog);
     34SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog);
     35
     36
     37typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);    // Declare Function Prototype
     38PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL;          // Our glFogCoordfEXT Function
    3339
    3440
     
    3642  this->registerObject(this, VolFogEffect::_objectList);
    3743
    38     if (root != NULL)
    39         this->loadParams(root);
     44  if (root != NULL)
     45      this->loadParams(root);
    4046
    41     // Initialize Effect
    42     this->init();
     47  // Initialize Effect
     48  this->init();
    4349
    44     // Activate Effect
    45     if(fogActivate)
    46       this->activate();
     50  // Activate Effect
     51  if(fogActivate)
     52    this->activate();
    4753}
    4854
    4955
    5056VolFogEffect::~VolFogEffect() {
     57  if(fogActivate)
    5158    this->deactivate();
    5259}
    5360
    5461void VolFogEffect::loadParams(const TiXmlElement* root) {
    55     WeatherEffect::loadParams(root);
     62  WeatherEffect::loadParams(root);
    5663}
    5764
    5865void VolFogEffect::init() {
    59     PRINTF(0)("Initalize VolFogEffect\n");
    60    
    61     fogActivate = false;
     66  PRINTF(0)("Initalize VolFogEffect\n");
     67 
     68  fogColor[0] = 0.6f;
     69  fogColor[1] = 0.3f;
     70  fogColor[2] = 0.0f;
     71  fogColor[3] = 1.0f;
    6272
    63    
     73  fogActivate = false;
    6474}
    6575
    6676
    6777void VolFogEffect::activate() {
    68     PRINTF(0)("Activating VolFogEffect\n");
     78  PRINTF(0)("Activating VolFogEffect\n");
     79 
     80  // Test whether the extension exists
     81  if (!glewIsSupported("GL_EXT_fog_coord"))
     82  {
     83    PRINTF(0)("Can't activate volumetric fog, GL_EXT_fog_coord extension is misssing\n");
     84    return;
     85  }
     86 
     87  fogActivate = true;
    6988}
    7089
    7190void VolFogEffect::deactivate() {
    72     PRINTF(0)("Deactivating VolFogEffect\n");
     91  PRINTF(0)("Deactivating VolFogEffect\n");
     92 
     93  fogActivate = false;
    7394}
    7495
     
    79100void VolFogEffect::draw() const {
    80101
     102  if(!fogActivate)
     103    return;
    81104}
    82105
  • branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.h

    r9935 r9936  
    2424  virtual void activate();
    2525  virtual void deactivate();
     26 
     27  inline  void activateFog()
     28  {
     29    this->activate();
     30  }
     31  inline  void deactivateFog()
     32  {
     33    this->deactivate();
     34  }
    2635
    2736  virtual void draw() const;
Note: See TracChangeset for help on using the changeset viewer.