Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

branches/avi_play: some init stuff

File size: 2.2 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"
[4343]31
32Model* obj;
[5865]33TextureSequence* seq;
34Texture* test;
[5866]35Material* testMat;
36
[5865]37float counter = 0;
[4343]38
[5866]39
[4343]40void Framework::moduleInit(int argc, char** argv)
[4333]41{
[4649]42  ResourceManager::getInstance()->addImageDir("./");
43
[5866]44  testMat = new Material;
45
[5865]46  seq = new TextureSequence();
47  for (int i = 1; i < argc; i++)
[4653]48  {
[5865]49    seq->addFrame(argv[i]);
[4653]50    printf("%s\n", argv[i]);
51  }
[5865]52  test = new Texture(argv[1]);
[5866]53  testMat->setDiffuseMap(argv[1]);
[5865]54
[4653]55  ResourceManager::getInstance()->addImageDir("");
56
57
[6003]58  obj = new PrimitiveModel(PRIM_PLANE, 10.0);
[4333]59
[4653]60  ResourceManager::getInstance()->debug();
61
[4343]62  LightManager* lightMan = LightManager::getInstance();
63  lightMan->setAmbientColor(.1,.1,.1);
[4741]64  (new Light())->setAbsCoor(5.0, 10.0, 40.0);
65  (new Light())->setAbsCoor(-10, -20, -100);
[4333]66}
67
[4334]68void Framework::moduleEventHandler(SDL_Event* event)
69{
70  switch (event->type)
71    {
72    case SDL_KEYDOWN:
73      switch (event->key.keysym.sym)
[4554]74        {
[6003]75        case SDLK_1:
76                                        obj = new PrimitiveModel(PRIM_CUBE, 10.0);
[4554]77          break;
[6003]78                                case SDLK_2:
79                                        obj = new PrimitiveModel(PRIM_SPHERE, 10.0);
80          break;
81                                case SDLK_3:
82                                        obj = new PrimitiveModel(PRIM_PLANE, 10.0);
83          break;
[4554]84        }
[4334]85    }
[4333]86}
87
88void Framework::moduleTick(float dt)
89{
[5865]90  counter+=dt;
[4554]91
[5865]92  seq->gotoFrame((unsigned int)counter);
93  if ((unsigned int)counter > seq->getFrameCount())
94    counter = 0;
[4333]95}
96
[4349]97void Framework::moduleDraw(void) const
[4334]98{
[5866]99  testMat->select();
[5865]100  glBindTexture(GL_TEXTURE_2D, seq->getTexture());
[4343]101  obj->draw();
102
103  LightManager::getInstance()->draw();
[4334]104}
[4333]105
[4334]106
[4333]107void Framework::moduleHelp(void) const
108{
[4554]109
[4333]110}
Note: See TracBrowser for help on using the repository browser.