Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 28, 2007, 7:01:41 PM (17 years ago)
Author:
patrick
Message:

scroller und debug

File:
1 edited

Legend:

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

    r10453 r10455  
    8888
    8989  LoadParam(root, "setSize", this, ScrollingScreen, setSize);
     90
     91  LoadParam(root, "texture", this, ScrollingScreen, setTexture);
     92}
     93
     94
     95
     96
     97/**
     98 * sets the texture
     99 * @param texture name of tex
     100 */
     101void ScrollingScreen::setTexture(const std::string& texture)
     102{
     103  this->material->setDiffuseMap( texture);
    90104}
    91105
     
    113127
    114128  glTexCoord2f(0., 0.);
    115   glVertex3f(0., -this->xSize, -this->ySize);
     129  glVertex3f(0., -this->xSize*0.5, -this->ySize*0.5);
    116130
    117 //   glTexCoord2f();
    118   glVertex3f(0., -this->xSize, -this->ySize);
     131  glTexCoord2f(0., 1.);
     132  glVertex3f(0., -this->xSize*0.5, this->ySize*0.5);
    119133
    120 //   glTexCoord2f();
    121   glVertex3f(0., -this->xSize, -this->ySize);
     134  glTexCoord2f(1., 1.);
     135  glVertex3f(0., this->xSize*0.5, this->ySize*0.5);
    122136
    123 //   glTexCoord2f();
    124   glVertex3f(0., -this->xSize, -this->ySize);
     137  glTexCoord2f(1., 0.);
     138  glVertex3f(0., this->xSize*0.5, -this->ySize*0.5);
    125139
    126140  glEnd();
     
    135149void ScrollingScreen::tick (float time)
    136150{
     151  if( State::getCameraNode() != NULL && State::getCameraTargetNode() != NULL)
     152  {
     153    PNode* cam = State::getCameraNode();
     154    PNode* tar = State::getCameraTargetNode();
    137155
     156    Vector dir = tar->getAbsCoor() - cam->getAbsCoor();
     157    dir.normalize();
     158
     159    float offset = 4.;
     160
     161    this->setAbsCoor( cam->getAbsCoor() + dir * offset);
     162
     163
     164
     165
     166//     if( this->getParent() != cam)
     167//     {
     168//       this->setParent( cam);
     169//       this->setRelCoor( 4.0, 0., 0.);
     170//       this->setRelDir();
     171//     }
     172
     173  }
    138174}
    139175
Note: See TracChangeset for help on using the changeset viewer.