Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6485 was 6310, checked in by bensch, 19 years ago

orxonox/trunk: merged the VertexArrayModel from heightmap and added some simple importer facility.

File size: 2.1 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
[4343]22#include "objModel.h"
[6222]23#include "md2Model.h"
[4343]24#include "primitive_model.h"
25#include <stdlib.h>
[4333]26
[6310]27#include "vertex_array_model.h"
28
[4649]29#include "resource_manager.h"
[4343]30
31Model* obj;
32
33void Framework::moduleInit(int argc, char** argv)
[4333]34{
[4649]35  ResourceManager::getInstance()->addImageDir("./");
36
[4653]37  for (int i = 0; i < argc; i++)
38  {
39    printf("%s\n", argv[i]);
40  }
41  ResourceManager::getInstance()->addImageDir("");
42
43
[4343]44  if (argc>=3)
[6222]45  {
46    if( strstr(argv[1], ".obj") != NULL)
47      obj = new OBJModel (argv[1], atof(argv[2]));
48    else if( strstr(argv[1], ".md2") != NULL)
49    {
50      obj = new MD2Model(argv[1], argv[2]);
51      ((MD2Model*)obj)->tick(0.1f);
52    }
53  }
[4343]54  else if (argc>=2)
[6222]55  {
56    if( strstr(argv[1], ".obj") != NULL)
57      obj = new OBJModel(argv[1]);
58    else if( strstr(argv[1], ".md2") != NULL) {
59      obj = new MD2Model(argv[1], "fake_texture.bad");
60      obj = new MD2Model(argv[1], argv[2]);
61      ((MD2Model*)obj)->tick(0.1f);
62    }
63  }
[4554]64  else
[4492]65    obj = new PrimitiveModel(PRIM_CYLINDER);
[4333]66
[6310]67  obj = new VertexArrayModel(*obj);
68
[4653]69  ResourceManager::getInstance()->debug();
70
[4343]71  LightManager* lightMan = LightManager::getInstance();
72  lightMan->setAmbientColor(.1,.1,.1);
[4741]73  (new Light())->setAbsCoor(5.0, 10.0, 40.0);
74  (new Light())->setAbsCoor(-10, -20, -100);
[4333]75}
76
[4334]77void Framework::moduleEventHandler(SDL_Event* event)
78{
79  switch (event->type)
80    {
81    case SDL_KEYDOWN:
82      switch (event->key.keysym.sym)
[4554]83        {
84        case SDLK_i:
85          break;
86        }
[4334]87    }
[4333]88}
89
90void Framework::moduleTick(float dt)
91{
[4554]92
[4333]93}
94
[4349]95void Framework::moduleDraw(void) const
[4334]96{
[4343]97  obj->draw();
98
99  LightManager::getInstance()->draw();
[4334]100}
[4333]101
[4334]102
[4333]103void Framework::moduleHelp(void) const
104{
[4554]105
[4333]106}
Note: See TracBrowser for help on using the repository browser.