Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/preferences/src/subprojects/importer/multitex.cc @ 6461

Last change on this file since 6461 was 5866, checked in by bensch, 19 years ago

orxonox/trunk: multi-texture work perfectly, try building src/subprojects/importer/multitex
and
execute
./multitex [fileName[ fileName [fileName […]]]]

File size: 2.0 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: 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
20#include "light.h"
21
22#include "texture_sequence.h"
23#include "material.h"
24
25#include "objModel.h"
26
27#include "primitive_model.h"
28#include <stdlib.h>
29
30#include "resource_manager.h"
31
32Model* obj;
33TextureSequence* seq;
34Texture* test;
35Material* testMat;
36
37float counter = 0;
38
39
40void Framework::moduleInit(int argc, char** argv)
41{
42  ResourceManager::getInstance()->addImageDir("./");
43
44  testMat = new Material;
45
46  seq = new TextureSequence();
47  for (int i = 1; i < argc; i++)
48  {
49    seq->addFrame(argv[i]);
50    printf("%s\n", argv[i]);
51  }
52  test = new Texture(argv[1]);
53  testMat->setDiffuseMap(argv[1]);
54
55  ResourceManager::getInstance()->addImageDir("");
56
57
58  obj = new PrimitiveModel(PRIM_SPHERE, 10.0);
59
60  ResourceManager::getInstance()->debug();
61
62  LightManager* lightMan = LightManager::getInstance();
63  lightMan->setAmbientColor(.1,.1,.1);
64  (new Light())->setAbsCoor(5.0, 10.0, 40.0);
65  (new Light())->setAbsCoor(-10, -20, -100);
66}
67
68void Framework::moduleEventHandler(SDL_Event* event)
69{
70  switch (event->type)
71    {
72    case SDL_KEYDOWN:
73      switch (event->key.keysym.sym)
74        {
75        case SDLK_i:
76          break;
77        }
78    }
79}
80
81void Framework::moduleTick(float dt)
82{
83  counter+=dt;
84
85  seq->gotoFrame((unsigned int)counter);
86  if ((unsigned int)counter > seq->getFrameCount())
87    counter = 0;
88}
89
90void Framework::moduleDraw(void) const
91{
92  testMat->select();
93  glBindTexture(GL_TEXTURE_2D, seq->getTexture());
94  obj->draw();
95
96  LightManager::getInstance()->draw();
97}
98
99
100void Framework::moduleHelp(void) const
101{
102
103}
Note: See TracBrowser for help on using the repository browser.