Changeset 3393 in orxonox.OLD for orxonox/branches/nico
- Timestamp:
- Feb 2, 2005, 3:57:06 PM (20 years ago)
- Location:
- orxonox/branches/nico/src/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/nico/src/importer/heightMapViewer.cc
r3390 r3393 37 37 bool HeightMapViewer::init(char* fileName) 38 38 { 39 39 cout << "HeightMapViewer init()" << endl; 40 40 41 41 #ifdef FULLSCREEN … … 57 57 terrain.createDisplayLists(128, 128, 1); 58 58 59 this->initLighting(); 60 SDL_EnableKeyRepeat(50,10); 59 61 return true; 60 62 } 63 64 bool 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 61 147 62 148 bool HeightMapViewer::run() … … 87 173 sightDirection = rotator.apply(sightDirection); 88 174 89 #ifdef FULLSCREEN90 175 rotator = Quaternion(angleY,perpendicular(sightDirection)); 91 #else92 rotator = Quaternion(-angleY,perpendicular(sightDirection));93 #endif94 176 95 177 sightDirection = rotator.apply(sightDirection); -
orxonox/branches/nico/src/importer/heightMapViewer.h
r3390 r3393 34 34 35 35 bool init(char* fileName); 36 bool initLighting(void); 36 37 bool run(); 37 38
Note: See TracChangeset
for help on using the changeset viewer.