Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/christmas_branche/src/subprojects/importer/importer.cc @ 6184

Last change on this file since 6184 was 6184, checked in by patrick, 18 years ago

christmas: importer now supports also md2 models

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