Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7530 in orxonox.OLD


Ignore:
Timestamp:
May 4, 2006, 12:31:54 AM (18 years ago)
Author:
hdavid
Message:

branches/atmospheric_engine: ticking and drawing from the AtmosphericEngine works

Location:
branches/atmospheric_engine/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc

    r7523 r7530  
    2222#include "shell_command.h"
    2323
    24 #define NUM_PANELS 6    /* number of panels in scene */
     24/*#define NUM_PANELS 6;
    2525
    2626typedef struct
     
    2929        float y;
    3030        float z;
    31 } world_vector;         /* vertex data */
     31} world_vector;
    3232
    3333world_vector vertices[NUM_PANELS*4] = {
     
    3838        {50.0, -60.0, 60.0},{50.0, -60.0, 20.0},{50.0, 0.0, 20.0},{50.0, 0.0, 60.0},
    3939        {-50.0, -60.0, 60.0},{50.0, -60.0, 60.0},{50.0, -60.0, 0.0},{-50.0, -60.0, 0.0}
    40 };
     40};*/
    4141
    4242using namespace std;
     
    6565  WeatherEffect::loadParams(root);
    6666
    67   LoadParam(root, "fog-altitude", this, VolFogEffect, setFogAltitude);
    68   LoadParam(root, "fog-color", this, VolFogEffect, startFogColor);
     67  //LoadParam(root, "fog-altitude", this, VolFogEffect, setFogAltitude);
     68  //LoadParam(root, "fog-color", this, VolFogEffect, startFogColor);
     69  LoadParam(root, "test", this, VolFogEffect, test);
    6970}
    7071
     72void VolFogEffect::test(int t)
     73{
     74  PRINTF(0)("Test: %i\n", t);
     75}
    7176
    7277bool VolFogEffect::init()
     
    7984bool VolFogEffect::activate()
    8085{
    81   PRINTF(0)( "Enabling Volumetric Fog Effect, altitude: %i, color %f, %f, %f\n", this->fogAltitude, this->colorVector.x, this->colorVector.y, this->colorVector.z);
     86  //PRINTF(0)( "Enabling Volumetric Fog Effect, altitude: %i, color %f, %f, %f\n", this->fogAltitude, this->colorVector.x, this->colorVector.y, this->colorVector.z);
    8287
     88  PRINTF(0)("Activate VolFogEffect\n");
    8389}
    8490
     
    8894}
    8995
    90 
     96/*
    9197void VolFogEffect::setFogColor(int v)
    9298{
    93         float z;        /* distance of vertex from edge of fog volume */
    94         float f;        /* fog factor */
     99        float z;       
     100        float f;       
    95101
    96102        z = 0.0 - vertices[v].y;
    97         f = (60.0 - z) / (60.0 - 0.0);  /* linear fog: f = (end - z)/(end - start) */
     103        f = (60.0 - z) / (60.0 - 0.0); 
    98104        glColor4f(this->colorVector.x, this->colorVector.y, this->colorVector.z, f);
    99105}
    100 
    101 // int v;               /* store of next vertex ref */
     106*/
    102107
    103108/**
     
    106111void VolFogEffect::draw() const
    107112{
    108         int v;          /* store of next vertex ref */
     113
     114        /*int v;                // store of next vertex ref
    109115        int ref;
    110116
     
    113119        for (ref=0; ref<NUM_PANELS; ref++) {
    114120
    115                 /* disable writes to z buffer (if fog area) */
     121                // disable writes to z buffer (if fog area)
    116122                glDepthMask(GL_FALSE);
    117123       
    118                 /* restore z buffer writes, set blend params & disable texturing */
     124                // restore z buffer writes, set blend params & disable texturing
    119125
    120126                glDepthMask(GL_TRUE);
     
    123129                glDisable(GL_TEXTURE_2D);
    124130
    125                 /* draw the fog panel */
     131                // draw the fog panel
    126132
    127133                v = ref * 4;
     
    137143                glEnd();
    138144
    139                 /* restore rendering state */
     145                // restore rendering state
    140146
    141147                glEnable(GL_TEXTURE_2D);
    142148                glDisable(GL_BLEND);
    143         }
    144 
    145        
     149        }*/     
    146150}
    147151
     
    153157void VolFogEffect::tick(float dt)       
    154158{
    155   PRINTF(0)("TICK VolFogEffect\n");
    156159}
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h

    r7523 r7530  
    2626    virtual void tick(float dt);
    2727
    28     inline void startFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
    29     inline void setFogAltitude(float altitude) { this->fogAltitude = altitude; }
    30 
     28    //inline void startFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
     29    //inline void setFogAltitude(float altitude) { this->fogAltitude = altitude; }
     30    void test(int t);
    3131
    3232  private:
    33     void setFogColor(int v);
    34     GLfloat                 fogAltitude;
    35     Vector                  colorVector;
     33    //void setFogColor(int v);
     34    //GLfloat                 fogAltitude;
     35    //Vector                  colorVector;
    3636};
    3737
  • branches/atmospheric_engine/src/story_entities/game_world.cc

    r7374 r7530  
    4242
    4343#include "graphics_engine.h"
     44#include "effects/atmospheric_engine.h"
    4445#include "event_handler.h"
    4546#include "sound_engine.h"
     
    376377
    377378    GraphicsEngine::getInstance()->tick(this->dtS);
     379    AtmosphericEngine::getInstance()->tick(this->dtS);
    378380
    379381    if( likely(this->dataTank->gameRule != NULL))
     
    452454  GraphicsEngine* engine = GraphicsEngine::getInstance();
    453455
     456  AtmosphericEngine::getInstance()->draw();
     457
    454458  // set camera
    455459  this->dataTank->localCamera->apply ();
Note: See TracChangeset for help on using the changeset viewer.