Changeset 10464 in orxonox.OLD for trunk/src/world_entities/scrolling_screen.cc
- Timestamp:
- Jan 28, 2007, 10:07:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/scrolling_screen.cc
r10460 r10464 23 23 #include "material.h" 24 24 #include "state.h" 25 // #include "camera.h" 25 #include "cameraman.h" 26 #include "camera.h" 26 27 27 28 ObjectListDefinition(ScrollingScreen); … … 73 74 this->transparency = 1.0; 74 75 this->offset = 0.0; 76 77 this->mode = SCSC_VIEW; 75 78 } 76 79 … … 112 115 113 116 void ScrollingScreen::draw() const 117 { 118 119 if( this->mode == SCSC_FULL) 120 this->drawFull(); 121 else 122 this->drawView(); 123 } 124 125 void ScrollingScreen::drawFull() const 114 126 { 115 127 glPushAttrib(GL_ENABLE_BIT); … … 129 141 this->material->select(); 130 142 131 float resize = (1. - (this->viewHeight + this->offset));132 if( resize > 0.)133 resize = 0.;134 135 136 float texRes = 1- resize;137 138 143 139 144 glBegin(GL_QUADS); … … 161 166 } 162 167 168 void ScrollingScreen::drawView() const 169 { 170 glPushAttrib(GL_ENABLE_BIT); 171 glDisable(GL_LIGHTING); 172 glDisable(GL_FOG); 173 glEnable(GL_BLEND); 174 175 glMatrixMode(GL_MODELVIEW); 176 glPushMatrix(); 177 /* translate */ 178 glTranslatef (this->getAbsCoor ().x, 179 this->getAbsCoor ().y, 180 this->getAbsCoor ().z); 181 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 182 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 183 184 this->material->select(); 185 186 float resize = (1. - (this->viewHeight + this->offset)); 187 188 float view = this->ySize * this->ratio; 189 190 glBegin(GL_QUADS); 191 192 // unten links 193 glTexCoord2f(0., 1.); 194 glVertex3f(0., -view*0.5, -this->ySize*0.5); 195 196 // unten rechts 197 glTexCoord2f(ratio, 1.); 198 glVertex3f(0., -view*0.5, this->ySize*0.5); 199 200 // oben rechts 201 glTexCoord2f(ratio, 0.); 202 glVertex3f(0., view*0.5, this->ySize*0.5); 203 204 // oben links 205 glTexCoord2f(0., 0.); 206 glVertex3f(0., view*0.5, -this->ySize*0.5); 207 208 glEnd(); 209 210 glPopAttrib(); 211 glPopMatrix(); 212 } 213 214 163 215 /** 164 216 * … … 166 218 void ScrollingScreen::tick (float time) 167 219 { 168 if( State::getCameraNode() != NULL && State::getCameraTargetNode() != NULL) 169 {170 PNode* cam = State::getCameraNode();171 PNode* tar = State::getCameraTargetNode();220 221 CameraMan* cm = State::getCameraman(); 222 const Camera* cam = cm->getCurrentCam(); 223 PNode* tar = cam->getTargetNode(); 172 224 173 225 Vector dir = tar->getAbsCoor() - cam->getAbsCoor(); 174 dir .normalize();226 dir = dir.getNormalized(); 175 227 176 228 float offset = 4.; … … 197 249 // } 198 250 199 } 251 200 252 } 201 253
Note: See TracChangeset
for help on using the changeset viewer.