Changeset 6290 in orxonox.OLD for branches/avi_play/src
- Timestamp:
- Dec 26, 2005, 12:59:35 AM (19 years ago)
- Location:
- branches/avi_play/src
- Files:
-
- 7 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, -
branches/avi_play/src/subprojects/importer/movie_player_test.cc
r6289 r6290 16 16 */ 17 17 18 #include "framework.h"19 20 #include "light.h"21 22 #include "texture_sequence.h"23 #include "material.h"24 25 #include "objModel.h"26 27 #include "primitive_model.h"28 18 #include <stdlib.h> 29 19 30 #include " resource_manager.h"31 #include "movie_player.h" ;20 #include "framework.h" 21 #include "movie_player.h" 32 22 33 23 MoviePlayer* movie_player; … … 38 28 39 29 movie_player->printInformation(); 40 41 30 } 42 31 … … 48 37 void Framework::moduleTick(float dt) 49 38 { 50 39 movie_player->tick(dt); 51 40 } 52 41 53 42 void Framework::moduleDraw(void) const 54 43 { 55 44 movie_player->draw(); 56 45 } 57 46 -
branches/avi_play/src/subprojects/importer/multitex.cc
r6289 r6290 26 26 #include <stdlib.h> 27 27 28 #include "resource_manager.h"29 28 #include "media_container.h" 30 29 31 30 Model* obj; 32 31 TextureSequence* seq; 33 Texture* test;34 32 Material* testMat; 35 33 MediaContainer* movie; … … 59 57 movie->printMediaInformation(); 60 58 61 ResourceManager::getInstance()->addImageDir("./");62 63 59 testMat = new Material; 64 60 … … 71 67 seq->addFrameList(movie->getFrameList()); 72 68 73 test = new Texture();74 69 testMat->setDiffuseMap("maps/radialTransparency.png"); 75 70 76 ResourceManager::getInstance()->addImageDir("");77 78 79 71 obj = new PrimitiveModel(PRIM_PLANE, 10.0); 80 81 ResourceManager::getInstance()->debug();82 72 83 73 LightManager* lightMan = LightManager::getInstance();
Note: See TracChangeset
for help on using the changeset viewer.