Changeset 6290 in orxonox.OLD for branches/avi_play/src/lib/graphics/importer/movie_player.cc
- Timestamp:
- Dec 26, 2005, 12:59:35 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.