Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6600 in orxonox.OLD for trunk/src


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
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r6532 r6600  
    154154  CL_MULTI_PLAYER_WORLD         =    0x00000107,
    155155  CL_MULTI_PLAYER_WORLD_DATA    =    0x00000108,
     156  CL_MOVIE_LOADER               =    0x00000109,
    156157
    157158  // WorldEntities (range from 0x00000200 to 0x000004ff)
  • 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();
  • trunk/src/story_entities/Makefile.am

    r6432 r6600  
    1111                story_entities/single_player_world_data.cc \
    1212                story_entities/multi_player_world.cc \
    13                 story_entities/multi_player_world_data.cc
     13                story_entities/multi_player_world_data.cc \
     14                story_entities/movie_loader.cc
    1415
    1516StoryEntities_HEADERS_ = \
     
    2324                story_entities/single_player_world_data.h \
    2425                story_entities/multi_player_world.h \
    25                 story_entities/multi_player_world_data.h
     26                story_entities/multi_player_world_data.h \
     27                story_entities/movie_loader.h
  • trunk/src/world_entities/movie_entity.cc

    r6532 r6600  
    1919#include "load_param.h"
    2020#include "factory.h"
    21 #include "material.h"
    2221
    2322#include "network_game_manager.h"
     
    3635
    3736  media_container = new MediaContainer();
    38 
    39   this->material = new Material;
    40   this->material->setDiffuseMap("maps/radialTransparency.png");
    4137
    4238  axis = 0;
     
    5955MovieEntity::~MovieEntity ()
    6056{
    61   delete this->material;
    6257  delete this->media_container;
    6358}
     
    139134  glDisable(GL_LIGHTING);
    140135
    141   this->material->select();
     136  glEnable(GL_TEXTURE_2D);
    142137  glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
     138
     139  glColor3f(1.0, 1.0, 1.0);
    143140
    144141  glBegin(GL_QUADS);
  • trunk/src/world_entities/movie_entity.h

    r6532 r6600  
    1111
    1212class MediaContainer;
    13 class Material;
    1413
    1514class MovieEntity : public WorldEntity
     
    1716  private:
    1817    MediaContainer* media_container;
    19     Material* material;
    2018
    2119    int counter;
Note: See TracChangeset for help on using the changeset viewer.