/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: David Hasenfratz co-programmer: */ /* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_MEDIA module For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput */ #define DEBUG_MODULE_MEDIA /* include your own header */ #include "movie_player.h" /* header for debug output */ #include "debug.h" /** * Default constructor */ MoviePlayer::MoviePlayer(const char* filename) { media_container = new MediaContainer(filename); this->init(); } MoviePlayer::MoviePlayer() { media_container = new MediaContainer(); this->init(); } /** * Default destructor */ MoviePlayer::~MoviePlayer() { delete media_container; } void MoviePlayer::init() { status = STOP; material = new Material; material->setDiffuseMap("maps/radialTransparency.png"); model = new PrimitiveModel(PRIM_PLANE, 10.0); LightManager* lightMan = LightManager::getInstance(); lightMan->setAmbientColor(.1,.1,.1); (new Light())->setAbsCoor(5.0, 10.0, 40.0); (new Light())->setAbsCoor(-10, -20, -100); } void MoviePlayer::loadMovie(const char* filename) { media_container->loadMedia(filename); } void MoviePlayer::printInformation() { media_container->printMediaInformation(); } void MoviePlayer::start(unsigned int start_frame) { if(start_frame < 2) texture = media_container->getFrame(2); else texture = media_container->getFrame(start_frame); status = PLAY; } void MoviePlayer::resume() { if(status == STOP) texture = media_container->getFrame(2); status = PLAY; } void MoviePlayer::pause() { if(status != STOP) status = PAUSE; } void MoviePlayer::stop() { status = STOP; texture = NULL; } void MoviePlayer::tick(float time) { if(status == PLAY) { texture = media_container->getNextFrame(); if(texture == NULL) status = STOP; } } const void MoviePlayer::draw() { material->select(); glBindTexture(GL_TEXTURE_2D, texture); model->draw(); LightManager::getInstance()->draw(); } void MoviePlayer::setSpeed(float speed) { this->speed = speed; } float MoviePlayer::getSpeed() { return this->speed; } const MP_STATUS MoviePlayer::getStatus() { return this->status; }