Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/lib/graphics/importer/movie_player.cc @ 6319

Last change on this file since 6319 was 6319, checked in by stefalie, 18 years ago

branches\avi_play: few other details…

File size: 2.4 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: David Hasenfratz
13   co-programmer:
14*/
15
16
17
18/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_MEDIA module
19   For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
20*/
21#define DEBUG_MODULE_MEDIA
22
23
24/* include your own header */
25#include "movie_player.h"
26
27/* header for debug output */
28#include "debug.h"
29
30
31/**
32 * Default constructor
33 */
34MoviePlayer::MoviePlayer(const char* filename)
35{
36  media_container = new MediaContainer(filename);
37
38  this->init();
39}
40
41MoviePlayer::MoviePlayer()
42{
43  media_container = new MediaContainer();
44
45  this->init();
46}
47
48/**
49 * Default destructor
50 */
51MoviePlayer::~MoviePlayer()
52{
53  delete media_container;
54}
55
56void 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);
71}
72
73void MoviePlayer::loadMovie(const char* filename)
74{
75  media_container->loadMedia(filename);
76}
77
78void MoviePlayer::printInformation()
79{
80  media_container->printMediaInformation();
81}
82
83void MoviePlayer::start(unsigned int start_frame)
84{
85  if(status == STOP)
86    //that'd probably do its job if getFrame worked
87    texture = media_container->getFrame(3);
88  status = PLAY;
89}
90
91void MoviePlayer::resume()
92{
93  if(status != STOP)
94    status = PLAY;
95}
96
97void MoviePlayer::pause()
98{
99  status = PAUSE;
100}
101
102void MoviePlayer::stop()
103{
104  status = STOP;
105}
106
107void MoviePlayer::tick(float time)
108{
109  if(status == PLAY)
110    texture = media_container->getNextFrame();
111}
112
113const void MoviePlayer::draw()
114{
115  material->select();
116  glBindTexture(GL_TEXTURE_2D, texture);
117  model->draw();
118
119  LightManager::getInstance()->draw();
120}
121
122void MoviePlayer::setSpeed(float speed)
123{
124  this->speed = speed;
125}
126
127float MoviePlayer::getSpeed()
128{
129  return this->speed;
130}
131
132const MP_STATUS MoviePlayer::getStatus()
133{
134  return this->status;
135}
Note: See TracBrowser for help on using the repository browser.