Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/subprojects/importer/multitex.cc @ 6094

Last change on this file since 6094 was 6094, checked in by hdavid, 18 years ago

branches\avi_play: MediaContainer::getNextFrame() try to create a texture from a frame ←- DOES NOT WORK YET, added new function TextureSequence::addFrame(GLuint texture)

File size: 2.5 KB
RevLine 
[4554]1/*
[4333]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: Benjamin Grauer
13   co-programmer: ...
14
15   this file extends the framework file, so it renders what i want.
16*/
17
18#include "framework.h"
19
[4343]20#include "light.h"
[4333]21
[5865]22#include "texture_sequence.h"
23#include "material.h"
24
[4343]25#include "objModel.h"
[5865]26
[4343]27#include "primitive_model.h"
28#include <stdlib.h>
[4333]29
[4649]30#include "resource_manager.h"
[6094]31#include "media_container.h"
[4343]32
33Model* obj;
[5865]34TextureSequence* seq;
35Texture* test;
[5866]36Material* testMat;
[6094]37MediaContainer* movie;
[5866]38
[5865]39float counter = 0;
[4343]40
[5866]41
[4343]42void Framework::moduleInit(int argc, char** argv)
[4333]43{
[6094]44  movie = new MediaContainer("/home/david/Desktop/Face2.avi");
45
46  // print information about the media file
47  movie->printMediaInformation();
48
[4649]49  ResourceManager::getInstance()->addImageDir("./");
50
[5866]51  testMat = new Material;
52
[5865]53  seq = new TextureSequence();
54  for (int i = 1; i < argc; i++)
[4653]55  {
[5865]56    seq->addFrame(argv[i]);
[4653]57    printf("%s\n", argv[i]);
58  }
[6094]59
60        // add one frame from the movie
61        seq->addFrame(movie->getNextFrame());
62
[5865]63  test = new Texture(argv[1]);
[5866]64  testMat->setDiffuseMap(argv[1]);
[5865]65
[4653]66  ResourceManager::getInstance()->addImageDir("");
67
68
[6003]69  obj = new PrimitiveModel(PRIM_PLANE, 10.0);
[4333]70
[4653]71  ResourceManager::getInstance()->debug();
72
[4343]73  LightManager* lightMan = LightManager::getInstance();
74  lightMan->setAmbientColor(.1,.1,.1);
[4741]75  (new Light())->setAbsCoor(5.0, 10.0, 40.0);
76  (new Light())->setAbsCoor(-10, -20, -100);
[4333]77}
78
[4334]79void Framework::moduleEventHandler(SDL_Event* event)
80{
81  switch (event->type)
82    {
83    case SDL_KEYDOWN:
84      switch (event->key.keysym.sym)
[4554]85        {
[6003]86        case SDLK_1:
[6013]87          obj = new PrimitiveModel(PRIM_CUBE, 10.0);
[4554]88          break;
[6068]89        case SDLK_2:
[6013]90          obj = new PrimitiveModel(PRIM_SPHERE, 10.0);
[6003]91          break;
[6013]92        case SDLK_3:
93          obj = new PrimitiveModel(PRIM_PLANE, 10.0);
[6003]94          break;
[4554]95        }
[4334]96    }
[4333]97}
98
99void Framework::moduleTick(float dt)
100{
[5865]101  counter+=dt;
[4554]102
[5865]103  seq->gotoFrame((unsigned int)counter);
104  if ((unsigned int)counter > seq->getFrameCount())
105    counter = 0;
[4333]106}
107
[4349]108void Framework::moduleDraw(void) const
[4334]109{
[5866]110  testMat->select();
[5865]111  glBindTexture(GL_TEXTURE_2D, seq->getTexture());
[4343]112  obj->draw();
113
114  LightManager::getInstance()->draw();
[4334]115}
[4333]116
[4334]117
[4333]118void Framework::moduleHelp(void) const
119{
[4554]120
[4333]121}
Note: See TracBrowser for help on using the repository browser.