Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6508 in orxonox.OLD for branches


Ignore:
Timestamp:
Jan 16, 2006, 12:23:49 AM (19 years ago)
Author:
hdavid
Message:
 
Location:
branches/avi_play/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/world_entities/movie_entity.cc

    r6507 r6508  
    3535  this->setClassID(CL_MOVIE_ENTITY, "MovieEntity");
    3636
    37   media_container = new MediaContainer("/home/david/Desktop/Crash.mpg");
     37  media_container = new MediaContainer();
    3838
    3939  this->material = new Material;
    4040  this->material->setDiffuseMap("maps/radialTransparency.png");
     41
     42  axis = 0;
     43  rotation = 0;
     44  height = 20;
     45  width = 20;
    4146
    4247  this->toList(OM_COMMON);
     
    6166{
    6267  static_cast<WorldEntity*>(this)->loadParams(root);
     68
     69  LoadParam(root, "name", this, MovieEntity, loadMovie);
     70  LoadParam(root, "axis", this, MovieEntity, setAxis);
     71  LoadParam(root, "rotation", this, MovieEntity, setRotation);
     72  LoadParam(root, "size", this, MovieEntity, setSize);
    6373}
    6474
    6575void MovieEntity::loadMovie(const char* filename)
    6676{
     77  media_container->loadMedia(filename);
     78}
    6779
     80void MovieEntity::setAxis(float axis)
     81{
     82  this->axis = axis;
     83}
     84
     85// Seconds for one loop
     86void MovieEntity::setRotation(float rotation)
     87{
     88  this->rotation = rotation;
     89}
     90
     91void MovieEntity::setSize(float width, float height)
     92{
     93  this->width = width;
     94  this->height = height;
    6895}
    6996
     
    88115    }
    89116  }
     117
     118  if(rotation != 0)
     119    axis = (int)(axis + (time * 360/rotation))%360;
    90120}
    91121
     
    103133                this->getAbsCoor ().y,
    104134                this->getAbsCoor ().z);
    105 
     135  glRotatef(axis, 0.0f, 1.0f, 0.0f);
     136//PRINTF(0)("axis: %f\n", axis);
    106137  this->material->select();
    107138  glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
    108139
    109140  glBegin(GL_QUADS);
    110     // Front Face
    111     glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f,  1.0f);  // Bottom Left Of The Texture and Quad
    112     glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f,  1.0f);  // Bottom Right Of The Texture and Quad
    113     glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);  // Top Right Of The Texture and Quad
    114     glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);  // Top Left Of The Texture and Quad
     141    glTexCoord2f(1.0f, 1.0f); glVertex3f(-width/2, -height/2,  0.0f);
     142    glTexCoord2f(0.0f, 1.0f); glVertex3f( width/2, -height/2,  0.0f);
     143    glTexCoord2f(0.0f, 0.0f); glVertex3f( width/2,  height/2,  0.0f);
     144    glTexCoord2f(1.0f, 0.0f); glVertex3f(-width/2,  height/2,  0.0f);
    115145  glEnd();
    116146
  • branches/avi_play/src/world_entities/movie_entity.h

    r6507 r6508  
    2323    float fps;
    2424
     25    float axis;
     26    float rotation;
     27    float height;
     28    float width;
     29
    2530  public:
    2631    MovieEntity (const TiXmlElement* root = NULL);
     
    2934    virtual void draw () const;
    3035    virtual void tick (float time);
     36
    3137    void loadParams(const TiXmlElement* root);
     38
    3239    void loadMovie(const char* filename);
     40    void setAxis(float axis);
     41    void setRotation(float rotation);
     42    void setSize(float width, float height);
    3343
    3444};
Note: See TracChangeset for help on using the changeset viewer.