Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9936 was 9936, checked in by hdavid, 18 years ago

branches/volumetric_fog

File size: 2.2 KB
RevLine 
[7504]1/*
[8495]2  orxonox - the future of 3D-vertical-scrollers
[7504]3
[9935]4  Copyright (C) 2006 orx
[7504]5
[8495]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.
[7504]10
11### File Specific:
[9935]12  main-programmer: hdavid
[7504]13*/
14
15#include "volfog_effect.h"
16
17#include "util/loading/load_param.h"
18#include "util/loading/factory.h"
19
[7760]20#include "p_node.h"
21#include "state.h"
[9936]22#include "shell_command.h"
[7760]23
[8495]24#include "glincl.h"
[9727]25#include "debug.h"
[7504]26
[7759]27#define GLX_GLXEXT_PROTOTYPES
28
[9716]29#include "class_id_DEPRECATED.h"
[9715]30ObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT);
[9709]31CREATE_FACTORY(VolFogEffect);
[7504]32
[9936]33SHELL_COMMAND(activate, VolFogEffect, activateFog);
34SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog);
[9935]35
36
[9936]37typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);    // Declare Function Prototype
38PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL;          // Our glFogCoordfEXT Function
39
40
[8495]41VolFogEffect::VolFogEffect(const TiXmlElement* root) {
[9686]42  this->registerObject(this, VolFogEffect::_objectList);
[7504]43
[9936]44  if (root != NULL)
45      this->loadParams(root);
[7532]46
[9936]47  // Initialize Effect
48  this->init();
[7546]49
[9936]50  // Activate Effect
51  if(fogActivate)
52    this->activate();
[7504]53}
54
55
[8495]56VolFogEffect::~VolFogEffect() {
[9936]57  if(fogActivate)
[8495]58    this->deactivate();
[7504]59}
60
[8495]61void VolFogEffect::loadParams(const TiXmlElement* root) {
[9936]62  WeatherEffect::loadParams(root);
[7504]63}
64
[8495]65void VolFogEffect::init() {
[9936]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;
[7504]72
[9936]73  fogActivate = false;
[7546]74}
75
76
[8495]77void VolFogEffect::activate() {
[9936]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;
[7504]88}
89
[8495]90void VolFogEffect::deactivate() {
[9936]91  PRINTF(0)("Deactivating VolFogEffect\n");
92 
93  fogActivate = false;
[7504]94}
95
[7520]96
[7516]97/**
[9935]98* draws the effect
[7652]99*/
[8495]100void VolFogEffect::draw() const {
[7760]101
[9936]102  if(!fogActivate)
103    return;
[7557]104}
[7546]105
106
[7516]107/**
[7652]108* ticks the effect if there is any time dependancy
109*/
[8495]110void VolFogEffect::tick(float dt) {}
Note: See TracBrowser for help on using the repository browser.