Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10457 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 28, 2007, 7:55:30 PM (18 years ago)
Author:
patrick
Message:

almost done scrolling

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/scrolling_screen.cc

    r10456 r10457  
    6767
    6868  this->material = new Material();
    69   this->material->setDiffuse(0,0,0);
     69  this->material->setDiffuse(1,1,1);
    7070  this->material->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    7171
    7272  this->isTransparent = false;
    7373  this->transparency = 1.0;
     74  this->offset = 0.0;
    7475}
    7576
     
    111112  glPushAttrib(GL_ENABLE_BIT);
    112113  glDisable(GL_LIGHTING);
    113   glEnable(GL_BLEND);   // Turn Blending On
     114  glDisable(GL_FOG);
     115  glEnable(GL_BLEND);
    114116
    115117  glMatrixMode(GL_MODELVIEW);
     
    124126  this->material->select();
    125127
     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
    126136  glBegin(GL_QUADS);
    127137
    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);
    139149
    140150  glEnd();
    141151
     152  glPopAttrib();
    142153  glPopMatrix();
    143   glPopAttrib();
    144154}
    145155
     
    165175    Quaternion q(ddir, cam->getAbsDirV());
    166176    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);*/
    167184
    168185//     if( this->getParent() != cam)
  • trunk/src/world_entities/scrolling_screen.h

    r10455 r10457  
    4343  float           scrollingSpeed;
    4444  float           viewHeight;
     45  float           offset;
    4546
    4647  float           xSize;
Note: See TracChangeset for help on using the changeset viewer.