Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10460 in orxonox.OLD for trunk/src


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

some texture attributes, camera target fix

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/texture.h

    r9882 r10460  
    5555  static GLuint loadTexToGL (const SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
    5656
     57  float getHeight() { return this->data->getHeight(); }
     58  float getWidth() { return this->data->getWidth(); }
     59
    5760protected:
    5861  bool setSurface(SDL_Surface* newSurface) { return this->data->setSurface(newSurface); };
  • trunk/src/lib/graphics/importer/texture_data.cc

    r8363 r10460  
    2121#include "compiler.h"
    2222
    23 #include "sdlincl.h"
    2423
    2524/**
     
    3130  this->texture = 0;
    3231  this->image = NULL;
     32  this->height = 0.;
     33  this->width = 0.;
    3334}
    3435
     
    5657bool TextureData::loadSurface(SDL_Surface* surface, GLenum target)
    5758{
     59  if( surface != NULL)
     60  {
     61    this->height = surface->h;
     62    this->width = surface->w;
     63  }
     64
    5865  if (Texture::getTextureEnableState())
    5966  {
  • trunk/src/lib/graphics/importer/texture_data.h

    r9869 r10460  
    1111#include "glincl.h"
    1212#include "count_pointer.h"
     13#include "sdlincl.h"
     14
    1315
    1416/* Forward Declaration */
     
    3840    bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; return this->bAlpha; };
    3941    bool setTexture(GLuint texture);
     42    float getHeight() { return this->height;}
     43    float getWidth() { return this->width; }
    4044
    4145  private:
     46    float            height;             //!< height of tex
     47    float            width;              //!< width of tex
    4248    GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
    4349    bool             bAlpha;             //!< if the texture has an alpha channel.
  • 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.