Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9935 in orxonox.OLD for branches/volumetric_fog/src


Ignore:
Timestamp:
Nov 16, 2006, 1:11:25 PM (18 years ago)
Author:
hdavid
Message:

branches/volumetric_gof: empty base files

Location:
branches/volumetric_fog/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/volumetric_fog/src/lib/graphics/graphics_engine.cc

    r9876 r9935  
    173173  return this->initVideo(x.getInt(), y.getInt(), 16);
    174174
    175   //   GraphicsEffect* fe = new FogEffect(NULL);
    176   //   this->loadGraphicsEffect(fe);
    177   //   fe->activate();
    178   //   PRINTF(0)("--------------------------------------------------------------\n");
    179 
    180   //LenseFlare* ge = new LenseFlare();
    181   //this->loadGraphicsEffect(ge);
    182 
    183   //ge->addFlare("pictures/lense_flare/sun.png"); //sun
    184   //ge->addFlare("pictures/lense_flare/lens2.png"); //first halo
    185   //ge->addFlare("pictures/lense_flare/lens1.png"); //small birst
    186   //ge->addFlare("pictures/lense_flare/lens3.png"); //second halo
    187   //ge->addFlare("pictures/lense_flare/lens4.png");
    188   //ge->addFlare("pictures/lense_flare/lens1.png");
    189   //ge->addFlare("pictures/lense_flare/lens3.png");
    190 
    191   //ge->activate();
    192175}
    193176
  • branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc

    r9869 r9935  
    22  orxonox - the future of 3D-vertical-scrollers
    33
    4   Copyright (C) 2004 orx
     4  Copyright (C) 2006 orx
    55
    66  This program is free software; you can redistribute it and/or modify
     
    1010
    1111### File Specific:
    12   main-programmer: hdavid, amaechler
     12  main-programmer: hdavid
    1313*/
    1414
     
    2222
    2323#include "glincl.h"
    24 //#include "shell_command.h"
    2524#include "debug.h"
    2625
    2726
    2827#define GLX_GLXEXT_PROTOTYPES
    29 //#include <GL/glx.h>
    30 // #include <GL/glut.h>
    31 
    32 //#include <GL/glext.h> //OpenGL Extensions
    33 //#include <GL/glxext.h> // GLX Extensions
    34 
    35 #ifndef GL_EXT_fog_coord
    36 #define GL_EXT_fog_coord 1
    37 typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
    38 typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
    39 typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
    40 typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
    41 typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
    42 #endif
    43 
    44 PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = 0;
    45 PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT = 0;
    46 PFNGLFOGCOORDDEXTPROC glFogCoorddEXT = 0;
    47 PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = 0;
    48 PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = 0;
    49 
    5028
    5129#include "class_id_DEPRECATED.h"
    5230ObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT);
    5331CREATE_FACTORY(VolFogEffect);
     32
     33
    5434
    5535VolFogEffect::VolFogEffect(const TiXmlElement* root) {
     
    6343
    6444    // Activate Effect
    65     this->activate();
     45    if(fogActivate)
     46      this->activate();
    6647}
    6748
     
    7657
    7758void VolFogEffect::init() {
    78     PRINTF(3)("Initalize VolFogEffect\n");
     59    PRINTF(0)("Initalize VolFogEffect\n");
     60   
     61    fogActivate = false;
    7962
    80     // set fog mode
    81     GLenum fogMode  = GL_EXP;
    82 
    83     // set fog density
    84     float  fogDensity  = 0.001f;
    85 
    86     // set fog near & far distance
    87     float fogStart = 0.0f;
    88     float fogEnd   = 1000.0f;
    89 
    90     // Set fog color
    91     float fogColor[4] = {0.6f,0.58f,0.79f,0.0f};
    92 
    93 
    94     /*    glFogCoordfEXT       = (PFNGLFOGCOORDFEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfEXT");
    95     glFogCoordfvEXT      = (PFNGLFOGCOORDFVEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfvEXT");
    96     glFogCoorddEXT       = (PFNGLFOGCOORDDEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoorddEXT");
    97     glFogCoorddvEXT      = (PFNGLFOGCOORDDVEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoorddvEXT");
    98     glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordPointerEXT");
    99     */
    100     // set the fog attributes
    101     glFogf (GL_FOG_START,  fogStart);
    102     glFogf (GL_FOG_END,    fogEnd);
    103     glFogfv(GL_FOG_COLOR,  fogColor);
    104     glFogi (GL_FOG_MODE,   fogMode);
    105     glFogf (GL_FOG_DENSITY,fogDensity);
    106     glFogi (GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE_EXT);
    107 
    108     // enable the fog
    109     glEnable(GL_FOG);
    110 
    111     if (glewInit() == GLEW_OK)
    112         PRINTF(4)("glewInit OK\n");
    113     else
    114         PRINTF(4)("glewInit failed\n");
    115 
    116     if (glewGetExtension("GL_EXT_fog_coord"))
    117         PRINTF(4)("GL_EXT_fog_coord extension found\n");
     63   
    11864}
    11965
    12066
    12167void VolFogEffect::activate() {
    122     PRINTF(3)("Activating VolFogEffect\n");
     68    PRINTF(0)("Activating VolFogEffect\n");
    12369}
    12470
    12571void VolFogEffect::deactivate() {
    126     PRINTF(3)("Deactivating VolFogEffect\n");
    127 
    128     glDisable(GL_FOG);
     72    PRINTF(0)("Deactivating VolFogEffect\n");
    12973}
    13074
    13175
    13276/**
    133 * draws the effect, if needed
     77* draws the effect
    13478*/
    13579void VolFogEffect::draw() const {
    136     glPushAttrib(GL_ENABLE_BIT);
    137     glClearColor(fogColor[0],fogColor[1],fogColor[2],0.0f);
    138     glShadeModel(GL_SMOOTH);
    139     glEnable(GL_DEPTH_TEST);
    140     glEnable(GL_CULL_FACE);
    141     glCullFace(GL_BACK);
    142 
    143     /* clear all pixels in colour buffer */
    144     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    145 
    146     /* Enable blending */
    147     //glEnable(GL_BLEND);
    148     //glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
    149 
    150     int i;
    151     glLoadIdentity();
    152 
    153 
    154     glBegin( GL_LINES );
    155     glNormal3f(0,1,0);
    156     for(i=-20;i<=20;i+=2) {
    157         float fog_c;
    158         float diff[3];
    159 
    160         diff[0] = State::getCameraNode()->getAbsCoor().x - i;
    161         diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
    162         diff[1] = State::getCameraNode()->getAbsCoor().y;
    163         fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
    164         glFogCoordfEXT(fog_c*2);
    165         glVertex3f(i,0,-20);
    166 
    167         diff[0] = State::getCameraNode()->getAbsCoor().x - i;
    168         diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
    169         diff[1] = State::getCameraNode()->getAbsCoor().y;
    170         fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
    171         glFogCoordfEXT(fog_c*2);
    172         glVertex3f(i,0,20);
    173 
    174         diff[0] = State::getCameraNode()->getAbsCoor().x - i;
    175         diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
    176         diff[1] = State::getCameraNode()->getAbsCoor().y;
    177         fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
    178         glFogCoordfEXT(fog_c*2);
    179         glVertex3f(-20,0,i);
    180 
    181         diff[0] = State::getCameraNode()->getAbsCoor().x - i;
    182         diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
    183         diff[1] = State::getCameraNode()->getAbsCoor().y;
    184         fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
    185         glFogCoordfEXT(fog_c*2);
    186         glVertex3f(20,0,i);
    187     }
    188     glEnd();
    189 
    190     glPopAttrib();
    19180
    19281}
  • branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.h

    r9869 r9935  
    3030private:
    3131  GLfloat fogColor[4];
     32  bool    fogActivate;
    3233
    3334};
Note: See TracChangeset for help on using the changeset viewer.