Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10464 in orxonox.OLD for trunk


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

more on scrolling stuff

Location:
trunk/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/cameraman.h

    r10441 r10464  
    5353    float getCurrCameraCoorY();
    5454    float getCurrCameraCoorZ();
     55    const Camera* getCurrentCam() { return this->currentCam; }
    5556    bool cameraIsInVector(Camera* camera);
    5657
  • 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
  • trunk/src/world_entities/scrolling_screen.h

    r10460 r10464  
    1919  virtual ~ScrollingScreen();
    2020
     21  typedef enum ScScMode
     22  {
     23     SCSC_FULL  = 0,
     24     SCSC_VIEW
     25  };
     26
    2127  void init();
    2228  virtual void loadParams(const TiXmlElement* root);
     
    3440
    3541  virtual void draw() const;
     42  void drawFull() const;
     43  void drawView() const;
     44
    3645
    3746private:
     
    4958  float           ySize;
    5059
     60  int             mode;
    5161
    5262};
Note: See TracChangeset for help on using the changeset viewer.