Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc @ 9938

Last change on this file since 9938 was 9938, checked in by hdavid, 17 years ago

branches/volumetric_fog:new try

File size: 1.9 KB
Line 
1/*
2  orxonox - the future of 3D-vertical-scrollers
3
4  Copyright (C) 2006 orx
5
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10
11### File Specific:
12  main-programmer: hdavid
13*/
14
15#include "volfog_effect.h"
16
17#include "util/loading/load_param.h"
18#include "util/loading/factory.h"
19
20#include "p_node.h"
21#include "state.h"
22#include "shell_command.h"
23
24#include "glincl.h"
25#include "debug.h"
26
27
28
29#define GLX_GLXEXT_PROTOTYPES
30
31#include "class_id_DEPRECATED.h"
32ObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT);
33CREATE_FACTORY(VolFogEffect);
34
35SHELL_COMMAND(activate, VolFogEffect, activateFog);
36SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog);
37
38
39VolFogEffect::VolFogEffect(const TiXmlElement* root) {
40  this->registerObject(this, VolFogEffect::_objectList);
41
42  if (root != NULL)
43      this->loadParams(root);
44
45  // Initialize Effect
46  this->init();
47
48  // Activate Effect
49  if(fogActivate)
50    this->activate();
51}
52
53
54VolFogEffect::~VolFogEffect() {
55  if(fogActivate)
56    this->deactivate();
57}
58
59void VolFogEffect::loadParams(const TiXmlElement* root) {
60  WeatherEffect::loadParams(root);
61}
62
63void VolFogEffect::init() {
64  PRINTF(0)("Initalize VolFogEffect\n");
65
66  fogActivate = false;
67}
68
69
70void VolFogEffect::activate() {
71  PRINTF(0)("Activating VolFogEffect\n");
72 
73  // Test whether the extension exists
74  if (!glewIsSupported("GL_EXT_fog_coord"))
75  {
76    PRINTF(0)("Can't activate volumetric fog, GL_EXT_fog_coord extension is misssing\n");
77    return;
78  }
79
80  fogActivate = true;
81}
82
83void VolFogEffect::deactivate() {
84  PRINTF(0)("Deactivating VolFogEffect\n");
85 
86  fogActivate = false;
87}
88
89
90/**
91* draws the effect
92*/
93void VolFogEffect::draw() const {
94
95  if(!fogActivate)
96    return;
97}
98
99
100/**
101* ticks the effect if there is any time dependancy
102*/
103void VolFogEffect::tick(float dt) {}
Note: See TracBrowser for help on using the repository browser.