Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3393 in orxonox.OLD


Ignore:
Timestamp:
Feb 2, 2005, 3:57:06 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/nico: lighting enabled, and working again

Location:
orxonox/branches/nico/src/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico/src/importer/heightMapViewer.cc

    r3390 r3393  
    3737bool HeightMapViewer::init(char* fileName)
    3838{
    39         cout << "HeightMapViewer init()" << endl;
     39        cout << "HeightMapViewer init()" << endl;
    4040       
    4141#ifdef FULLSCREEN
     
    5757        terrain.createDisplayLists(128, 128, 1);
    5858       
     59        this->initLighting();
     60        SDL_EnableKeyRepeat(50,10);
    5961        return true;
    6062}
     63
     64bool HeightMapViewer::initLighting(void)
     65{
     66  /*  glEnable(GL_LIGHTING);
     67  glEnable(GL_DEPTH_TEST);
     68
     69  GLfloat whiteLight[] = {.2, .2, .2, 1.0};
     70  GLfloat light0Position[] = {10.0, 10.0, 10.0, 0.0};
     71  GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0};
     72
     73  glEnable(GL_LIGHT0);
     74  glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
     75  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
     76  glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
     77 
     78        GLfloat klotz_Ka[]  = {0.2,0.2,0.2,1.0};
     79        GLfloat klotz_Kd[]  = {0.3,1.0,0.3,1.0};
     80        GLfloat klotz_Ks[]  = {0.8,0.8,0.8,1.0};
     81        GLfloat klotz_Ke[]  = {0.0,0.0,0.0,1.0};
     82        GLfloat klotz_Se    = 20;
     83        glMaterialfv(GL_FRONT,GL_AMBIENT,klotz_Ka);
     84        glMaterialfv(GL_FRONT,GL_DIFFUSE,klotz_Kd);
     85  */
     86
     87        glShadeModel(GL_FLAT); // Enable Smooth Shading
     88       
     89        glClearColor(0.445f, 0.726f, 1.00f, 0.0f); // Blue Background
     90       
     91        glClearDepth(1.0f);  // Depth Buffer Setup
     92        glEnable(GL_DEPTH_TEST); // Enables Depth Testing
     93        glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
     94
     95        glEnable(GL_CULL_FACE); // don't draw back faces
     96       
     97        glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);  // Really Nice Perspective Calculations
     98
     99
     100        // fog behaves strange
     101        //glEnable(GL_FOG);
     102        GLfloat fog_color[4] = {0.7,0.7,0.7,1.0};
     103        glFogfv(GL_FOG_COLOR,fog_color);
     104        glFogf(GL_FOG_START, 0.0);
     105        glFogf(GL_FOG_END, 100.0);
     106        glFogi(GL_FOG_MODE,GL_LINEAR);
     107
     108
     109        glEnable(GL_NORMALIZE);
     110       
     111        // LIGHT SETTINGS
     112        glEnable(GL_LIGHTING);
     113        glEnable(GL_LIGHT0);
     114       
     115        // global parameters
     116        GLfloat global_Ka[]  = {0.25,0.25,0.25,1.0};
     117       
     118        // light0 parameters
     119        GLfloat light0_pos[] = {0.0,100.0,0.0,0.0};
     120        GLfloat light0_Ka[]  = {0.0,0.0,0.0,1.0};
     121        GLfloat light0_Kd[]  = {0.6,0.6,0.6,1.0};
     122        GLfloat light0_Ks[]  = {0.8,0.8,0.8,1.0};
     123       
     124        // klotz default parameters
     125        GLfloat klotz_Ka[]  = {0.2,0.2,0.2,1.0};
     126        GLfloat klotz_Kd[]  = {0.3,1.0,0.3,1.0};
     127        GLfloat klotz_Ks[]  = {0.8,0.8,0.8,1.0};
     128        GLfloat klotz_Ke[]  = {0.0,0.0,0.0,1.0};
     129        GLfloat klotz_Se    = 20;
     130       
     131        // set light0 options
     132        glLightfv(GL_LIGHT0,GL_POSITION,light0_pos);
     133        glLightfv(GL_LIGHT0,GL_AMBIENT,light0_Ka);
     134        glLightfv(GL_LIGHT0,GL_DIFFUSE,light0_Kd);
     135        glLightfv(GL_LIGHT0,GL_SPECULAR,light0_Ks);
     136
     137        // MATERIAL SETTINGS
     138        glMaterialfv(GL_FRONT,GL_AMBIENT,klotz_Ka);
     139        glMaterialfv(GL_FRONT,GL_DIFFUSE,klotz_Kd);
     140        //glMaterialfv(GL_FRONT,GL_SPECULAR,klotz_Ks);
     141        //glMaterialfv(GL_FRONT,GL_EMISSION,klotz_Ke);
     142        //glMaterialf(GL_FRONT,GL_SHININESS,klotz_Se);
     143
     144
     145}
     146
    61147
    62148bool HeightMapViewer::run()
     
    87173                                                sightDirection = rotator.apply(sightDirection);
    88174
    89                                         #ifdef FULLSCREEN
    90175                                                rotator = Quaternion(angleY,perpendicular(sightDirection));
    91                                         #else
    92                                                 rotator = Quaternion(-angleY,perpendicular(sightDirection));
    93                                         #endif
    94176                                               
    95177                                                sightDirection = rotator.apply(sightDirection);
  • orxonox/branches/nico/src/importer/heightMapViewer.h

    r3390 r3393  
    3434       
    3535        bool init(char* fileName);
     36        bool initLighting(void);
    3637        bool run();
    3738
Note: See TracChangeset for help on using the changeset viewer.