Changeset 10457 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 28, 2007, 7:55:30 PM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/scrolling_screen.cc
r10456 r10457 67 67 68 68 this->material = new Material(); 69 this->material->setDiffuse( 0,0,0);69 this->material->setDiffuse(1,1,1); 70 70 this->material->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 71 71 72 72 this->isTransparent = false; 73 73 this->transparency = 1.0; 74 this->offset = 0.0; 74 75 } 75 76 … … 111 112 glPushAttrib(GL_ENABLE_BIT); 112 113 glDisable(GL_LIGHTING); 113 glEnable(GL_BLEND); // Turn Blending On 114 glDisable(GL_FOG); 115 glEnable(GL_BLEND); 114 116 115 117 glMatrixMode(GL_MODELVIEW); … … 124 126 this->material->select(); 125 127 128 float resize = -(1. - (this->viewHeight + this->offset)); 129 if( resize < 0.) 130 resize = 1.; 131 else resize = 1 - resize; 132 133 float texRes = 1 - resize; 134 135 126 136 glBegin(GL_QUADS); 127 137 128 glTexCoord2f(0., 0.);129 glVertex3f(0., -this->xSize*0.5, -this->ySize*0.5);130 131 glTexCoord2f(0., 1.);132 glVertex3f(0., -this->xSize*0.5, this->ySize*0.5);133 134 glTexCoord2f(1., 1.);135 glVertex3f(0., this->xSize*0.5, this->ySize*0.5);136 137 glTexCoord2f(1., 0.);138 glVertex3f(0., this->xSize*0.5, -this->ySize*0.5);138 glTexCoord2f(this->offset, 0.); 139 glVertex3f(0., -this->xSize*0.5, -this->ySize*0.5); 140 141 glTexCoord2f(this->offset, 1.); 142 glVertex3f(0., -this->xSize*0.5, this->ySize*0.5); 143 144 glTexCoord2f(this->offset + this->viewHeight - texRes, 1.); 145 glVertex3f(0., this->xSize*0.5 - (resize*this->xSize*0.5), this->ySize*0.5); 146 147 glTexCoord2f(this->offset + this->viewHeight - texRes, 0.); 148 glVertex3f(0., this->xSize*0.5 - (resize*this->xSize*0.5), -this->ySize*0.5); 139 149 140 150 glEnd(); 141 151 152 glPopAttrib(); 142 153 glPopMatrix(); 143 glPopAttrib();144 154 } 145 155 … … 165 175 Quaternion q(ddir, cam->getAbsDirV()); 166 176 this->setAbsDir( q); 177 178 // scroll the texture 179 this->offset += time * this->scrollingSpeed; 180 if( this->offset > 1.|| this->offset < -1.) 181 this->offset = 0.; 182 183 /* PRINTF(0)("offset %f, offset: %f\n", this->offset, time * this->scrollingSpeed);*/ 167 184 168 185 // if( this->getParent() != cam) -
trunk/src/world_entities/scrolling_screen.h
r10455 r10457 43 43 float scrollingSpeed; 44 44 float viewHeight; 45 float offset; 45 46 46 47 float xSize;
Note: See TracChangeset
for help on using the changeset viewer.