Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6772 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 26, 2006, 2:44:26 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the branche network back
merged with command
svn merge https://svn.orxonox.net/orxonox/branches/network . -r6755:HEAD

absolutely no conficts

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r6731 r6772  
    7474  CL_STORY_ENTITY               =    0x02000000,
    7575
     76  CL_PHYSICS_INTERFACE          =    0x04000000,
     77
     78  CL_EVENT_LISTENER             =    0x08000000,
     79
     80  CL_ELEMENT_2D                 =    0x10000000,
     81
     82  CL_SYNCHRONIZEABLE            =    0x20000000,
     83
     84  CL_WORLD_ENTITY               =    0x40000000,
     85
    7686  CL_GAME_WORLD                 =    0x50000000,
    7787  CL_GAME_WORLD_DATA            =    0x60000000,
    7888
    79   CL_PHYSICS_INTERFACE          =    0x04000000,
    80 
    81   CL_EVENT_LISTENER             =    0x08000000,
    82 
    83   CL_ELEMENT_2D                 =    0x10000000,
    84 
    85   CL_SYNCHRONIZEABLE            =    0x20000000,
    86 
    87   CL_WORLD_ENTITY               =    0x40000000,
     89  CL_GRAPHICS_EFFECT            =    0x70000000,
     90
    8891
    8992  // subsuper-classes derivations taken : 1, 2, 3, 5, a, b, c.     << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken
     
    258261  CL_ENVIRONMENT                =    0x00000821,
    259262  CL_SHADER                     =    0x00000822,
     263  CL_FOG_EFFECT                 =    0x70000001,
     264
    260265  // GL-GUI
    261266  CL_GLGUI_WIDGET               =    0x00500000,
  • trunk/src/lib/graphics/effects/fog_effect.cc

    r6752 r6772  
    2222#include "factory.h"
    2323
     24#include "glincl.h"
     25
     26
    2427
    2528using namespace std;
    2629
    27 CREATE_FACTORY(FogEffect, CL_LIGHT);
     30CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
    2831
    2932
     
    3538 FogEffect::FogEffect(const TiXmlElement* root)
    3639{
     40
     41  this->fogMode = GL_EXP2;
     42  this->fogDensity = 0.001f;
     43  this->fogStart = 10.0f;
     44  this->fogEnd = 1000.0f;
     45
    3746
    3847  if (root != NULL)
     
    5564  GraphicsEffect::loadParams(root);
    5665
    57 //   LoadParam(root, "diffuse-color", this, FogEffect, setDiffuseColor)
    58 //       .describe("sets the diffuse color of the FogEffect (red [0-1], green [0-1], blue [0-1])");
     66   LoadParam(root, "fog-effect", this, FogEffect, setFogMode)
     67       .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}");
     68
     69   LoadParam(root, "fog-density", this, FogEffect, setFogDensity)
     70       .describe("sets the the fog density of the exponentionl functions");
     71
     72   LoadParam(root, "fog-range", this, FogEffect, setFogRange)
     73       .describe("sets the the range of the linear functions");
    5974}
    6075
     
    7287bool FogEffect::activate()
    7388{
    74 /*  glEnable(GL_FOG);
     89  PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity,
     90             this->fogStart, this->fogEnd);
     91
     92  glEnable(GL_FOG);
    7593  {
    76     GLfloat fogColor[4] = {0.5, 0.5, 1.0};
     94    GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0};
    7795
    78     GLint fogMode = GL_EXP;
    79     glFogi(GL_FOG_MODE, fogMode);
     96    glFogi(GL_FOG_MODE, this->fogMode);
    8097    glFogfv(GL_FOG_COLOR, fogColor);
    81     gfFogf(GL_FOG_DENSITY, 0.35f);
     98    glFogf(GL_FOG_DENSITY, this->fogDensity);
     99    glHint(GL_FOG_HINT, GL_DONT_CARE);
     100    glFogf(GL_FOG_START, this->fogStart);
     101    glFogf(GL_FOG_END, this->fogEnd);
    82102
    83 
    84   }*/
     103    //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE);
     104  }
     105  glClearColor(0.5, 0.5, 0.5, 1.0);
    85106}
    86107
     
    90111 */
    91112bool FogEffect::deactivate()
    92 {}
     113{
     114  glDisable(GL_FOG);
     115}
     116
     117
     118/**
     119 * converts a gl mode char to a GLint
     120 * @param mode the mode character
     121 */
     122GLint FogEffect::charToFogMode(const char* mode)
     123{
     124  if( !strcmp( "GL_LINEAR", mode))
     125    return GL_LINEAR;
     126  else if( !strcmp("GL_EXP", mode))
     127    return GL_EXP;
     128  else if(!strcmp("GL_EXP2", mode) )
     129    return GL_EXP2;
     130  else
     131    return -1;
     132}
     133
  • trunk/src/lib/graphics/effects/fog_effect.h

    r6741 r6772  
    2424    virtual bool activate();
    2525    virtual bool deactivate();
     26
     27    void setFogMode(const char* mode) { this->fogMode = this->charToFogMode(mode); }
     28    void setFogDensity(float density) { this->fogDensity = density; }
     29    void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
     30
     31
     32  private:
     33    GLint charToFogMode(const char* mode);
     34
     35
     36  private:
     37    GLint                   fogMode;
     38    GLfloat                 fogDensity;
     39    GLfloat                 fogStart;
     40    GLfloat                 fogEnd;
    2641};
    2742
  • trunk/src/lib/graphics/effects/graphics_effect.cc

    r6741 r6772  
    1313### File Specific:
    1414   main-programmer: Patrick Boenzli
    15    co-programmer: ...
    1615*/
    1716
     
    2120#include "graphics_effect.h"
    2221
     22#include "graphics_engine.h"
    2323#include "load_param.h"
    2424
     
    3535GraphicsEffect::GraphicsEffect(const TiXmlElement* root)
    3636{
     37  this->bActivated = false;
     38
     39  this->bActivated = GraphicsEngine::getInstance()->loadGraphicsEffect(this);
    3740
    3841  if (root != NULL)
     
    4548 */
    4649GraphicsEffect::~GraphicsEffect()
    47 {}
     50{
     51  if( this->bActivated)
     52    GraphicsEngine::getInstance()->unloadGraphicsEffect(this);
     53}
    4854
    4955
  • trunk/src/lib/graphics/effects/graphics_effect.h

    r6741 r6772  
    2424    virtual bool activate() = 0;
    2525    virtual bool deactivate() = 0;
     26
     27    inline bool isActivated() { return this->bActivated; }
     28
     29
     30  protected:
     31    bool              bActivated;
    2632};
    2733
  • trunk/src/lib/graphics/graphics_engine.cc

    r6753 r6772  
    3737
    3838#include "effects/graphics_effect.h"
     39#include "effects/fog_effect.h"
    3940
    4041#include "shell_command.h"
     
    148149
    149150  this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
     151
     152  GraphicsEffect* fe = new FogEffect(NULL);
     153  this->loadGraphicsEffect(fe);
     154  fe->activate();
     155  PRINTF(0)("--------------------------------------------------------------\n");
    150156}
    151157
  • trunk/src/world_entities/camera.cc

    r6426 r6772  
    178178/**
    179179 *  initialize rendering perspective according to this camera
    180 
    181    This is called immediately before the rendering cycle starts, it sets all global
    182    rendering options as well as the GL_PROJECTION matrix according to the camera.
    183 */
     180 *
     181 * This is called immediately before the rendering cycle starts, it sets all global
     182 * rendering options as well as the GL_PROJECTION matrix according to the camera.
     183 */
    184184void Camera::apply ()
    185185{
     
    193193                 this->nearClip,
    194194                 this->farClip);
    195 
    196195  // speed-up feature
    197196  Vector cameraPosition = this->getAbsCoor();
    198197  Vector targetPosition = this->target->getAbsCoor();
    199198  Vector up = this->getAbsDirV();
    200   Vector delay = Vector(0,0,0);
    201   if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity())/25;
     199  Vector delay = Vector(0, 0, 0);
     200  if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity()) / 25.0f;
    202201
    203202  // Setting the Camera Eye, lookAt and up Vectors
     
    206205            up.x, up.y, up.z);
    207206
    208   // switching back to Modeling Matrix
    209207  glMatrixMode (GL_MODELVIEW);
    210   //  this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));
     208  glLoadIdentity();
    211209}
    212210
  • trunk/src/world_entities/skybox.cc

    r6695 r6772  
    225225  glDisable(GL_LIGHTING);
    226226
     227  glPushAttrib(GL_ENABLE_BIT);
     228  glDisable(GL_FOG);
     229
    227230  WorldEntity::draw();
    228231
     232  glPopAttrib();
    229233  glPopAttrib();
    230234
Note: See TracChangeset for help on using the changeset viewer.