Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6600 in orxonox.OLD for trunk/src/lib/graphics/importer


Ignore:
Timestamp:
Jan 18, 2006, 5:25:48 PM (19 years ago)
Author:
bensch
Message:

TRUNK: merged the avi_play branche again

Location:
trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

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

    r6532 r6600  
    4949MoviePlayer::~MoviePlayer()
    5050{
    51   delete material;
    52   delete model;
     51  //delete material;
     52  //delete model;
    5353
    5454  if (glIsTexture(texture))
     
    8181  loading = false;
    8282
    83   material = new Material;
     83  /*material = new Material;
    8484  material->setDiffuseMap("maps/radialTransparency.png");
    8585
     
    9090  (new Light())->setAbsCoor(5.0, 10.0, 40.0);
    9191  (new Light())->setAbsCoor(-10, -20, -100);
     92  */
    9293}
    9394
     
    195196      // Free the packet that was allocated by av_read_frame
    196197      av_free_packet(&packet);
    197      
     198
    198199      // Did we get a video frame?
    199200      if(frame_finished)
     
    248249void MoviePlayer::skipFrame(int frames)
    249250{
    250  
     251
    251252  while(frames != 0)
    252253  {
     
    259260      avcodec_decode_video(codec_context, frame, &frame_finished,
    260261                            packet.data, packet.size);
    261        
     262
    262263      // Did we get a video frame?
    263264      if(frame_finished)
     
    269270    av_free_packet(&packet);
    270271  }
    271  
     272
    272273  this->getNextFrame();
    273274
     
    307308      return false;
    308309    }
    309    
     310
    310311    // go from the keyframe to the exact position
    311312    codec_context->hurry_up = 1;
     
    327328    } while(1);
    328329    codec_context->hurry_up = 0;
    329  
     330
    330331    this->frame_number = frames;
    331332  }
    332  
     333
    333334  return true;
    334335}
     
    343344    status = PLAY;
    344345    timer = 0;
    345  
     346
    346347    this->gotoFrame(start_frame);
    347  
     348
    348349    PRINTF(0)("start\n");
    349350  }
     
    380381  {
    381382    timer += dt;
    382     actual_frame = timer * fps + start_frame;
     383    actual_frame = (int)(timer * fps + start_frame);
    383384    if(actual_frame != frame_number)
    384385    {
     
    387388      else
    388389        this->skipFrame(actual_frame - frame_number - 1);
    389     }   
     390    }
    390391    //PRINTF(0)("frame_number: %i\n", frame_number);
    391392  }
    392393}
    393394
    394 const void MoviePlayer::draw()
     395/*const void MoviePlayer::draw()
    395396{
    396397  material->select();
     
    399400
    400401  LightManager::getInstance()->draw();
     402}*/
     403
     404GLuint MoviePlayer::getTexture()
     405{
     406  return this->texture;
    401407}
    402408
  • trunk/src/lib/graphics/importer/movie_player.h

    r6532 r6600  
    1818#include "glincl.h"
    1919
    20 #include "light.h"
     20//#include "light.h"
    2121#include "texture.h"
    22 #include "material.h"
    23 #include "primitive_model.h"
     22//#include "material.h"
     23//#include "primitive_model.h"
    2424
    2525// include base_object.h since all classes are derived from this one
     
    2929typedef enum MP_STATUS {
    3030  PLAY,
    31         PAUSE,
    32         STOP
     31        PAUSE,
     32        STOP
    3333};
    3434
     
    3838private:
    3939
    40   Model* model;
    41   Material* material;
     40  //Model* model;
     41  //Material* material;
    4242
    4343  AVFormatContext* format_context;
     
    5454  int video_stream;
    5555
    56   MP_STATUS status;     
     56  MP_STATUS status;
    5757  float timer;
    5858  int start_frame;
     
    6161  float fps;
    6262  int duration;
    63   bool loading; 
     63  bool loading;
    6464
    6565public:
     
    7171  bool loadMovie(const char* filename);
    7272
    73         void start(float start_time);
    74         void resume();
    75         void pause();
    76         void stop();
     73        void start(float start_time);
     74        void resume();
     75        void pause();
     76        void stop();
    7777
    78         void tick(float dt);
    79         const void draw();
     78        void tick(float dt);
     79        //const void draw();
     80        GLuint getTexture();
    8081
    81         void setFPS(float fps);
    82         float getFPS();
    83         const MP_STATUS getStatus();
     82        void setFPS(float fps);
     83        float getFPS();
     84        const MP_STATUS getStatus();
    8485  void printInformation();
    8586
    8687private:
    87  
     88
    8889  void init();
    8990  void getNextFrame();
Note: See TracChangeset for help on using the changeset viewer.