Changeset 9006 in orxonox.OLD for trunk/src/world_entities/skydome.cc
- Timestamp:
- Jul 2, 2006, 2:11:59 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/skydome.cc
r8793 r9006 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler … … 43 43 { 44 44 PRINTF(0)("Skydome init\n"); 45 45 46 46 this->setClassID(CL_SKYDOME, "Skydome"); 47 47 this->toList(OM_BACKGROUND); 48 this->toReflectionList(); 48 this->toReflectionList(); 49 49 50 activateDome = false; 51 50 52 } 51 53 … … 57 59 { 58 60 PRINTF(0)("Deleting Skydome\n"); 59 61 60 62 if (glIsTexture(texture)) 61 63 glDeleteTextures(1, &texture); … … 74 76 75 77 78 void Skydome::activate() 79 { 80 this->activateDome = true; 81 } 82 83 void Skydome::deactivate() 84 { 85 this->activateDome = false; 86 } 87 88 76 89 void Skydome::draw() const 77 90 { 91 if(!activateDome) 92 return; 93 78 94 glPushAttrib(GL_ENABLE_BIT); 79 95 … … 88 104 glPushMatrix(); 89 105 glTranslatef(0.0f,pRadius,0.0f); 90 106 91 107 92 108 glBegin(GL_TRIANGLES); … … 113 129 { 114 130 PRINTF(0)("Generating a sky plane"); 115 131 116 132 // Make sure our vertex array is clear 117 if (planeVertices) 133 if (planeVertices) 118 134 { 119 135 delete planeVertices; … … 130 146 // Set the number of divisions into a valid range 131 147 int divs = divisions; 132 if (divisions < 1) 148 if (divisions < 1) 133 149 divs = 1; 134 150 135 if (divisions > 256) 136 divs = 256; 151 if (divisions > 256) 152 divs = 256; 137 153 138 154 pRadius = planetRadius; … … 152 168 float delta = plane_size/(float)divs; 153 169 float tex_delta = 2.0f/(float)divs; 154 170 155 171 // Variables we'll use during the dome's generation 156 172 float x_dist = 0.0f; … … 193 209 int startvert = (i*(divs+1) + j); 194 210 195 211 // tri 1 196 212 indices[index++] = startvert; 197 213 indices[index++] = startvert+1; … … 203 219 indices[index++] = startvert+divs+1; 204 220 } 205 } 206 } 221 } 222 }
Note: See TracChangeset
for help on using the changeset viewer.