Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10460 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jan 28, 2007, 9:26:08 PM (17 years ago)
Author:
patrick
Message:

some texture attributes, camera target fix

Location:
trunk/src/world_entities
Files:
3 edited

Legend:

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

    r10458 r10460  
    2424#include "track/track.h"
    2525#include "script_class.h"
     26#include "state.h"
    2627
    2728
     
    100101  //add to track
    101102  if(this->entityTrack)
    102   {
    103103    this->setParent(this->entityTrack->getTrackNode());
    104     this->setRelCoor(0,0,0);
    105   }
    106104}
    107105
     
    112110void Camera::lookAt(PNode* target)
    113111{
     112  State::setCamera(this, dynamic_cast<CameraTarget*>(target));
    114113  this->target->setParentSoft(target,0.2);
    115114}
  • trunk/src/world_entities/scrolling_screen.cc

    r10457 r10460  
    102102void ScrollingScreen::setTexture(const std::string& texture)
    103103{
    104   this->material->setDiffuseMap( texture);
     104  this->material->setDiffuseMap(texture);
     105
     106  Texture t = this->material->diffuseTexture();
     107  this->ratio = t.getWidth() / t.getHeight();
    105108}
    106109
     
    126129  this->material->select();
    127130
    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;
     131  float resize = (1. - (this->viewHeight + this->offset));
     132  if( resize > 0.)
     133    resize = 0.;
     134
     135
     136  float texRes = 1- resize;
    134137
    135138
    136139  glBegin(GL_QUADS);
    137140
    138     glTexCoord2f(this->offset, 0.);
     141    // unten links
     142    glTexCoord2f(0., 1.);
    139143    glVertex3f(0., -this->xSize*0.5, -this->ySize*0.5);
    140144
    141     glTexCoord2f(this->offset, 1.);
     145    // unten rechts
     146    glTexCoord2f(1., 1.);
    142147    glVertex3f(0., -this->xSize*0.5, this->ySize*0.5);
    143148
    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);
     149    // oben rechts
     150    glTexCoord2f(1., 0.);
     151    glVertex3f(0., this->xSize*0.5, this->ySize*0.5);
     152
     153    // oben links
     154    glTexCoord2f(0., 0.);
     155    glVertex3f(0., this->xSize*0.5, -this->ySize*0.5);
    149156
    150157  glEnd();
     
    173180
    174181    Vector ddir = dir.cross( cam->getAbsDirV());
    175     Quaternion q(ddir, cam->getAbsDirV());
     182    Quaternion q(ddir, cam->getAbsDirY());
    176183    this->setAbsDir( q);
    177184
  • trunk/src/world_entities/scrolling_screen.h

    r10457 r10460  
    4444  float           viewHeight;
    4545  float           offset;
     46  float           ratio;
    4647
    4748  float           xSize;
Note: See TracChangeset for help on using the changeset viewer.