Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 28, 2007, 10:07:20 PM (17 years ago)
Author:
patrick
Message:

more on scrolling stuff

File:
1 edited

Legend:

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

    r10460 r10464  
    2323#include "material.h"
    2424#include "state.h"
    25 // #include "camera.h"
     25#include "cameraman.h"
     26#include "camera.h"
    2627
    2728ObjectListDefinition(ScrollingScreen);
     
    7374  this->transparency = 1.0;
    7475  this->offset = 0.0;
     76
     77  this->mode = SCSC_VIEW;
    7578}
    7679
     
    112115
    113116void ScrollingScreen::draw() const
     117{
     118
     119  if( this->mode == SCSC_FULL)
     120    this->drawFull();
     121  else
     122    this->drawView();
     123}
     124
     125void ScrollingScreen::drawFull() const
    114126{
    115127  glPushAttrib(GL_ENABLE_BIT);
     
    129141  this->material->select();
    130142
    131   float resize = (1. - (this->viewHeight + this->offset));
    132   if( resize > 0.)
    133     resize = 0.;
    134 
    135 
    136   float texRes = 1- resize;
    137 
    138143
    139144  glBegin(GL_QUADS);
     
    161166}
    162167
     168void 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
    163215/**
    164216 *
     
    166218void ScrollingScreen::tick (float time)
    167219{
    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();
    172224
    173225    Vector dir = tar->getAbsCoor() - cam->getAbsCoor();
    174     dir.normalize();
     226    dir = dir.getNormalized();
    175227
    176228    float offset = 4.;
     
    197249//     }
    198250
    199   }
     251
    200252}
    201253
Note: See TracChangeset for help on using the changeset viewer.