Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/subprojects/importer/multitex.cc @ 6175

Last change on this file since 6175 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
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
[5866]58  obj = new PrimitiveModel(PRIM_SPHERE, 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        {
75        case SDLK_i:
76          break;
77        }
[4334]78    }
[4333]79}
80
81void Framework::moduleTick(float dt)
82{
[5865]83  counter+=dt;
[4554]84
[5865]85  seq->gotoFrame((unsigned int)counter);
86  if ((unsigned int)counter > seq->getFrameCount())
87    counter = 0;
[4333]88}
89
[4349]90void Framework::moduleDraw(void) const
[4334]91{
[5866]92  testMat->select();
[5865]93  glBindTexture(GL_TEXTURE_2D, seq->getTexture());
[4343]94  obj->draw();
95
96  LightManager::getInstance()->draw();
[4334]97}
[4333]98
[4334]99
[4333]100void Framework::moduleHelp(void) const
101{
[4554]102
[4333]103}
Note: See TracBrowser for help on using the repository browser.