Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 26, 2005, 12:59:35 AM (18 years ago)
Author:
hdavid
Message:

branches\avi_play: work on the movie_player

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/lib/graphics/importer/movie_player.cc

    r6289 r6290  
    3535{
    3636  media_container = new MediaContainer(filename);
     37
     38  this->init();
    3739}
    3840
     
    4042{
    4143  media_container = new MediaContainer();
     44
     45  this->init();
    4246}
    4347
     
    4751MoviePlayer::~MoviePlayer()
    4852{
     53  delete media_container;
     54}
    4955
     56void MoviePlayer::init()
     57{
     58  status = STOP;
     59
     60  tex = new Texture();
     61  material = new Material;
     62
     63  material->setDiffuseMap("maps/radialTransparency.png");
     64
     65  model = new PrimitiveModel(PRIM_PLANE, 10.0);
     66
     67  LightManager* lightMan = LightManager::getInstance();
     68  lightMan->setAmbientColor(.1,.1,.1);
     69  (new Light())->setAbsCoor(5.0, 10.0, 40.0);
     70  (new Light())->setAbsCoor(-10, -20, -100);
    5071}
    5172
     
    6283void MoviePlayer::start(unsigned int start_frame)
    6384{
    64 
     85  status = PLAY;
    6586}
    6687
    6788void MoviePlayer::resume()
    6889{
    69 
     90  status = PLAY;
    7091}
    7192
    7293void MoviePlayer::pause()
    7394{
    74 
     95  status = PAUSE;
    7596}
    7697
    7798void MoviePlayer::stop()
    7899{
    79 
     100  status = STOP;
    80101}
    81102
    82103void MoviePlayer::tick(float time)
    83104{
     105  surface = media_container->getNextFrame();
    84106
     107  if(surface == NULL)
     108    texture = NULL;
     109  else
     110  {
     111    bool hasAlpha;
     112    SDL_Surface* newSurf = tex->prepareSurface(surface, hasAlpha);
     113    if (newSurf != NULL)
     114      texture = Texture::loadTexToGL(newSurf);
     115    else
     116      texture = NULL;
     117  }
    85118}
    86119
    87120const void MoviePlayer::draw()
    88121{
     122  material->select();
     123  glBindTexture(GL_TEXTURE_2D, texture);
     124  model->draw();
    89125
     126  LightManager::getInstance()->draw();
    90127}
    91128
     
    97134float MoviePlayer::getSpeed()
    98135{
    99 
     136  return speed;
    100137}
    101138
    102139const MP_STATUS MoviePlayer::getStatus()
    103140{
    104 
     141  return status;
    105142}
Note: See TracChangeset for help on using the changeset viewer.