[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" |
---|
| 23 | #include "primitive_model.h" |
---|
| 24 | #include <stdlib.h> |
---|
[4333] | 25 | |
---|
[4649] | 26 | #include "resource_manager.h" |
---|
[4343] | 27 | |
---|
| 28 | Model* obj; |
---|
| 29 | |
---|
| 30 | void Framework::moduleInit(int argc, char** argv) |
---|
[4333] | 31 | { |
---|
[4649] | 32 | ResourceManager::getInstance()->addImageDir("./"); |
---|
| 33 | |
---|
[4653] | 34 | for (int i = 0; i < argc; i++) |
---|
| 35 | { |
---|
| 36 | printf("%s\n", argv[i]); |
---|
| 37 | } |
---|
| 38 | ResourceManager::getInstance()->addImageDir(""); |
---|
| 39 | |
---|
| 40 | |
---|
[4343] | 41 | if (argc>=3) |
---|
| 42 | obj = new OBJModel (argv[1], atof(argv[2])); |
---|
| 43 | else if (argc>=2) |
---|
| 44 | obj = new OBJModel(argv[1]); |
---|
[4554] | 45 | else |
---|
[4492] | 46 | obj = new PrimitiveModel(PRIM_CYLINDER); |
---|
[4333] | 47 | |
---|
[4653] | 48 | ResourceManager::getInstance()->debug(); |
---|
| 49 | |
---|
[4343] | 50 | LightManager* lightMan = LightManager::getInstance(); |
---|
| 51 | lightMan->setAmbientColor(.1,.1,.1); |
---|
| 52 | lightMan->addLight(); |
---|
| 53 | // lightMan->setAttenuation(1.0, .01, 0.0); |
---|
| 54 | // lightMan->setDiffuseColor(1,1,1); |
---|
| 55 | // lightMan->addLight(1); |
---|
| 56 | // lightMan->setPosition(20, 10, -20); |
---|
| 57 | // lightMan->setDiffuseColor(0,0,0); |
---|
| 58 | // lightMan->debug(); |
---|
| 59 | lightMan->setPosition(5.0, 10.0, 40.0); |
---|
| 60 | lightMan->addLight(); |
---|
| 61 | lightMan->setPosition(-10, -20, -100); |
---|
[4333] | 62 | } |
---|
| 63 | |
---|
[4334] | 64 | void Framework::moduleEventHandler(SDL_Event* event) |
---|
| 65 | { |
---|
| 66 | switch (event->type) |
---|
| 67 | { |
---|
| 68 | case SDL_KEYDOWN: |
---|
| 69 | switch (event->key.keysym.sym) |
---|
[4554] | 70 | { |
---|
| 71 | case SDLK_i: |
---|
| 72 | break; |
---|
| 73 | } |
---|
[4334] | 74 | } |
---|
[4333] | 75 | } |
---|
| 76 | |
---|
| 77 | void Framework::moduleTick(float dt) |
---|
| 78 | { |
---|
[4554] | 79 | |
---|
[4333] | 80 | } |
---|
| 81 | |
---|
[4349] | 82 | void Framework::moduleDraw(void) const |
---|
[4334] | 83 | { |
---|
[4343] | 84 | obj->draw(); |
---|
| 85 | |
---|
| 86 | LightManager::getInstance()->draw(); |
---|
[4334] | 87 | } |
---|
[4333] | 88 | |
---|
[4334] | 89 | |
---|
[4333] | 90 | void Framework::moduleHelp(void) const |
---|
| 91 | { |
---|
[4554] | 92 | |
---|
[4333] | 93 | } |
---|