Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc @ 4635

Last change on this file since 4635 was 4635, checked in by patrick, 20 years ago

orxonox/trunk: implemented an elegant draw function to display the tree in different ways

File size: 2.3 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 "fields.h"
21#include "stdlibincl.h"
22#include "light.h"
23
24#include "cd_engine.h"
25#include "bv_tree.h"
26
27#include "md2Model.h"
28
29MD2Model* model;
30
31void Framework::moduleInit(int argc, char** argv)
32{
33  CDEngine::getInstance();
34  //CDEngine::getInstance()->debug();
35
36  model = new MD2Model("models/tris.md2", "models/tris.pcx");
37  model->tick(0.1f);
38
39//   int const length = 6;
40//   sVec3D* vertList = new sVec3D[length];
41//   sVec3D data[length]  = {{5.0, 0.0, 0.0},{2.0, 0.0, 5.0},{14.0, 0.0, 0.0}, {5.0, 0.0, 1.0}, {12.0, 0.0, 8.0}, {3.0, 5.0, 4.9}};
42//
43//   for(int i = 0; i < length; ++i)
44//   {
45//     vertList[i][0] = data[i][0];
46//     vertList[i][1] = data[i][1];
47//     vertList[i][2] = data[i][2];
48//   }
49
50  CDEngine::getInstance()->debugSpawnTree(3, model->data->pVertices, model->data->numVertices);
51
52
53  LightManager* lightMan = LightManager::getInstance();
54  lightMan->setAmbientColor(.1,.1,.1);
55  lightMan->addLight();
56  lightMan->addLight();
57  lightMan->setPosition(10, 20, 100);
58}
59
60
61void Framework::moduleEventHandler(SDL_Event* event)
62{
63  switch (event->type)
64  {
65    case SDL_KEYDOWN:
66      switch (event->key.keysym.sym)
67      {
68        case SDLK_i:
69          break;
70        case SDLK_1:
71          printf("alsjdf;lajsfd;lajsdf\n");
72          break;
73      }
74  }
75}
76
77
78void Framework::moduleTick(float dt)
79{
80}
81
82
83void Framework::moduleDraw() const
84{
85  CDEngine::getInstance()->drawBV(2, DRAW_MODEL);
86
87  LightManager::getInstance()->draw();
88
89  //model->draw();
90}
91
92
93void Framework::moduleHelp(void) const
94{
95  PRINT(0)("\n");
96  PRINT(0)("i - print debug information of Collision-detection\n");
97  PRINT(0)("\n");
98}
99
100
101void Framework::moduleInitGui(int argc, char** argv)
102{
103  Window* guiMainWindow = NULL;
104
105  initGUI(0, NULL);
106
107  guiMainWindow = new Window("Collision_detection");
108  {
109    //all the Widgets you need
110  }
111  Window::mainWindow->showall();
112  Window::mainWindow->setSize(300, 500);
113}
Note: See TracBrowser for help on using the repository browser.