Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7532 in orxonox.OLD


Ignore:
Timestamp:
May 4, 2006, 1:58:22 PM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: basic volumetric cube

Location:
branches/atmospheric_engine/src/lib/graphics/effects
Files:
2 edited

Legend:

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

    r7519 r7532  
    7575    PRINTF(4)("element is: %s\n", element->Value());
    7676    Factory::fabricate(element);
    77    
     77
    7878    BaseObject* bo = Factory::fabricate(element);
    7979    if( bo == NULL)
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc

    r7530 r7532  
    2222#include "shell_command.h"
    2323
    24 /*#define NUM_PANELS 6;
    25 
    26 typedef struct
    27 {
    28         float x;
    29         float y;
    30         float z;
    31 } world_vector;
    32 
    33 world_vector vertices[NUM_PANELS*4] = {
    34         {-50.0, -60.0, 0.0},{50.0, -60.0, 0.0},{50.0, 0.0, 0.0},{-50.0, 0.0, 0.0},
    35         {-50.0, -60.0, 60.0},{-50.0, -60.0, 0.0},{-50.0, 0.0, 0.0},{-50.0, 0.0, 60.0},
    36         {-50.0, -60.0, 20.0},{-50.0, -60.0, 60.0},{-50.0, 0.0, 60.0},{-50.0, 0.0, 20.0},
    37         {50.0, -60.0, 0.0},{50.0, -60.0, 60.0},{50.0, 0.0, 60.0},{50.0, 0.0, 0.0},
    38         {50.0, -60.0, 60.0},{50.0, -60.0, 20.0},{50.0, 0.0, 20.0},{50.0, 0.0, 60.0},
    39         {-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 };*/
    41 
    4224using namespace std;
    4325
     
    5032  if (root != NULL)
    5133    this->loadParams(root);
    52  
     34
    5335  this->activate();
    5436}
     
    5941  this->deactivate();
    6042}
    61 
    6243
    6344void VolFogEffect::loadParams(const TiXmlElement* root)
     
    7960  PRINTF(0)("Initalize VolFogEffect\n");
    8061};
    81 
    8262
    8363
     
    11191void VolFogEffect::draw() const
    11292{
     93        // PRINTF(0)("DRAW VolFogEffect\n");
    11394
    114         /*int v;                // store of next vertex ref
    115         int ref;
     95        glDepthMask(GL_TRUE);
     96        glEnable(GL_BLEND);
     97        glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
     98        // glDisable(GL_TEXTURE_2D);
     99        // draw the fog panels
     100       
     101        glBegin(GL_QUADS);
    116102
    117         PRINTF(0)("DRAW VolFogEffect\n");
     103        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     104        glVertex3f( 10.0f,-10.0f, 10.0f);       // Top Right Of The Quad (Bottom)
     105        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     106        glVertex3f(-10.0f,-10.0f, 10.0f);       // Top Left Of The Quad (Bottom)
     107        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     108        glVertex3f(-10.0f,-10.0f,-10.0f);       // Bottom Left Of The Quad (Bottom)
     109        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     110        glVertex3f( 10.0f,-10.0f,-10.0f);       // Bottom Right Of The Quad (Bottom)
     111       
     112        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     113        glVertex3f( 10.0f, 10.0f, 10.0f);       // Top Right Of The Quad (Front)
     114        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     115        glVertex3f(-10.0f, 10.0f, 10.0f);       // Top Left Of The Quad (Front)
     116        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     117        glVertex3f(-10.0f,-10.0f, 10.0f);       // Bottom Left Of The Quad (Front)
     118        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     119        glVertex3f( 10.0f,-10.0f, 10.0f);       // Bottom Right Of The Quad (Front)
     120       
     121        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     122        glVertex3f( 10.0f,-10.0f,-10.0f);       // Top Right Of The Quad (Back)
     123        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     124        glVertex3f(-10.0f,-10.0f,-10.0f);       // Top Left Of The Quad (Back)
     125        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     126        glVertex3f(-10.0f, 10.0f,-10.0f);       // Bottom Left Of The Quad (Back)
     127        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     128        glVertex3f( 10.0f, 10.0f,-10.0f);       // Bottom Right Of The Quad (Back)
     129       
     130        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     131        glVertex3f(-10.0f, 10.0f, 10.0f);       // Top Right Of The Quad (Left)
     132        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     133        glVertex3f(-10.0f, 10.0f,-10.0f);       // Top Left Of The Quad (Left)
     134        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     135        glVertex3f(-10.0f,-10.0f,-10.0f);       // Bottom Left Of The Quad (Left)
     136        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     137        glVertex3f(-10.0f,-10.0f, 10.0f);       // Bottom Right Of The Quad (Left)
     138       
     139        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     140        glVertex3f( 10.0f, 10.0f,-10.0f);       // Top Right Of The Quad (Right)
     141        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - 10.0f)) / (10.0 - 0.0));
     142        glVertex3f( 10.0f, 10.0f, 10.0f);       // Top Left Of The Quad (Right)
     143        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     144        glVertex3f( 10.0f,-10.0f, 10.0f);       // Bottom Left Of The Quad (Right)
     145        glColor4f(0.6, 0.2, 0.0, (10.0 - (0.0 - -10.0f)) / (10.0 - 0.0));
     146        glVertex3f( 10.0f,-10.0f,-10.0f);       // Bottom Right Of The Quad (Right)
    118147
    119         for (ref=0; ref<NUM_PANELS; ref++) {
     148        glEnd();
    120149
    121                 // disable writes to z buffer (if fog area)
    122                 glDepthMask(GL_FALSE);
    123        
    124                 // restore z buffer writes, set blend params & disable texturing
     150        // restore rendering state
    125151
    126                 glDepthMask(GL_TRUE);
    127                 glEnable(GL_BLEND);
    128                 glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
    129                 glDisable(GL_TEXTURE_2D);
     152        // glEnable(GL_TEXTURE_2D);
     153        glDisable(GL_BLEND);
    130154
    131                 // draw the fog panel
    132 
    133                 v = ref * 4;
    134                 glBegin(GL_QUADS);
    135                 //this->setFogColor(v);
    136                 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++;
    137                 //this->setFogColor(v);
    138                 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++;
    139                 //this->setFogColor(v);
    140                 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++;
    141                 //this->setFogColor(v);
    142                 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z);
    143                 glEnd();
    144 
    145                 // restore rendering state
    146 
    147                 glEnable(GL_TEXTURE_2D);
    148                 glDisable(GL_BLEND);
    149         }*/     
    150155}
    151156
Note: See TracChangeset for help on using the changeset viewer.