Changeset 6290 in orxonox.OLD for branches/avi_play/src/lib/graphics/importer
- Timestamp:
- Dec 26, 2005, 12:59:35 AM (19 years ago)
- Location:
- branches/avi_play/src/lib/graphics/importer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/lib/graphics/importer/media_container.cc
r6289 r6290 34 34 MediaContainer::MediaContainer(const char* filename) 35 35 { 36 /* set the class id for the base object */ 37 this->setClassID(CL_MEDIA_CONTAINER, "MediaContainer"); 38 39 /* register all formats and codecs */ 40 av_register_all(); 41 42 fps = 0; 36 this->init(); 43 37 44 38 if (filename != NULL) … … 48 42 MediaContainer::MediaContainer() 49 43 { 50 /* set the class id for the base object */ 51 this->setClassID(CL_MEDIA_CONTAINER, "MediaContainer"); 52 53 /* register all formats and codecs */ 54 av_register_all(); 55 56 fps = 0; 44 this->init(); 57 45 } 58 46 … … 83 71 av_close_input_file(format_context); 84 72 73 } 74 75 void MediaContainer::init() 76 { 77 /* set the class id for the base object */ 78 this->setClassID(CL_MEDIA_CONTAINER, "MediaContainer"); 79 80 /* register all formats and codecs */ 81 av_register_all(); 82 83 fps = 0; 85 84 } 86 85 -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6289 r6290 53 53 ~MediaContainer(); 54 54 55 void init(); 55 56 SDL_Surface* getFrame(int frame_number); 56 57 SDL_Surface* getNextFrame(); -
branches/avi_play/src/lib/graphics/importer/movie_player.cc
r6289 r6290 35 35 { 36 36 media_container = new MediaContainer(filename); 37 38 this->init(); 37 39 } 38 40 … … 40 42 { 41 43 media_container = new MediaContainer(); 44 45 this->init(); 42 46 } 43 47 … … 47 51 MoviePlayer::~MoviePlayer() 48 52 { 53 delete media_container; 54 } 49 55 56 void 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); 50 71 } 51 72 … … 62 83 void MoviePlayer::start(unsigned int start_frame) 63 84 { 64 85 status = PLAY; 65 86 } 66 87 67 88 void MoviePlayer::resume() 68 89 { 69 90 status = PLAY; 70 91 } 71 92 72 93 void MoviePlayer::pause() 73 94 { 74 95 status = PAUSE; 75 96 } 76 97 77 98 void MoviePlayer::stop() 78 99 { 79 100 status = STOP; 80 101 } 81 102 82 103 void MoviePlayer::tick(float time) 83 104 { 105 surface = media_container->getNextFrame(); 84 106 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 } 85 118 } 86 119 87 120 const void MoviePlayer::draw() 88 121 { 122 material->select(); 123 glBindTexture(GL_TEXTURE_2D, texture); 124 model->draw(); 89 125 126 LightManager::getInstance()->draw(); 90 127 } 91 128 … … 97 134 float MoviePlayer::getSpeed() 98 135 { 99 136 return speed; 100 137 } 101 138 102 139 const MP_STATUS MoviePlayer::getStatus() 103 140 { 104 141 return status; 105 142 } -
branches/avi_play/src/lib/graphics/importer/movie_player.h
r6289 r6290 10 10 #include "glincl.h" 11 11 #include "sdlincl.h" 12 12 13 #include "media_container.h" 14 #include "light.h" 15 #include "texture.h" 16 #include "material.h" 17 #include "primitive_model.h" 13 18 14 19 /* include base_object.h since all classes are derived from this one */ … … 19 24 20 25 class MediaContainer; 26 class Model; 27 class Material; 28 class Texture; 21 29 22 30 /* The state of the MoviePlayer */ … … 27 35 }; 28 36 29 30 31 37 class MoviePlayer : public BaseObject 32 38 { … … 34 40 private: 35 41 36 MediaContainer* media_container; 42 MediaContainer* media_container; 43 Model* model; 44 Material* material; 45 Texture* tex; 46 47 SDL_Surface* surface; 48 GLuint texture; 49 50 MP_STATUS status; 51 float speed; 37 52 38 53 public: … … 42 57 ~MoviePlayer(); 43 58 59 void init(); 44 60 void loadMovie(const char* filename); 45 61 -
branches/avi_play/src/lib/graphics/importer/texture.cc
r5924 r6290 196 196 0xFF000000 197 197 #else 198 198 0xFF000000, 199 199 0x00FF0000, 200 200 0x0000FF00,
Note: See TracChangeset
for help on using the changeset viewer.