Line | |
---|
1 | |
---|
2 | |
---|
3 | /* |
---|
4 | orxonox - the future of 3D-vertical-scrollers |
---|
5 | |
---|
6 | Copyright (C) 2004 orx |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2, or (at your option) |
---|
11 | any later version. |
---|
12 | |
---|
13 | ### File Specific |
---|
14 | main-programmer: Patrick Boenzli |
---|
15 | co-programmer: |
---|
16 | */ |
---|
17 | |
---|
18 | |
---|
19 | #include "environment.h" |
---|
20 | |
---|
21 | #include "resource_manager.h" |
---|
22 | |
---|
23 | #include "vector.h" |
---|
24 | #include "objModel.h" |
---|
25 | #include "obb_tree.h" |
---|
26 | |
---|
27 | using namespace std; |
---|
28 | |
---|
29 | |
---|
30 | /** |
---|
31 | * creates an environment |
---|
32 | */ |
---|
33 | Environment::Environment () : WorldEntity() |
---|
34 | { |
---|
35 | this->setClassID(CL_ENVIRONMENT, "Environment"); |
---|
36 | this->model = (Model*)ResourceManager::getInstance()->load("models/ships/bolido.obj", OBJ, RP_CAMPAIGN); |
---|
37 | |
---|
38 | if(this->obbTree == NULL) |
---|
39 | this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount()); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | * deletes an environment |
---|
45 | */ |
---|
46 | Environment::~Environment () |
---|
47 | {} |
---|
48 | |
---|
49 | |
---|
50 | /** |
---|
51 | * ticks the environment |
---|
52 | * @param time the time about which to tick |
---|
53 | */ |
---|
54 | void Environment::tick (float time) {} |
---|
55 | |
---|
56 | |
---|
57 | /** |
---|
58 | * draws the Environment |
---|
59 | */ |
---|
60 | void Environment::draw () |
---|
61 | { |
---|
62 | glMatrixMode(GL_MODELVIEW); |
---|
63 | glPushMatrix(); |
---|
64 | float matrix[4][4]; |
---|
65 | |
---|
66 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
---|
67 | //rotate |
---|
68 | this->getAbsDir().matrix (matrix); |
---|
69 | glMultMatrixf((float*)matrix); |
---|
70 | |
---|
71 | this->model->draw(); |
---|
72 | |
---|
73 | glPopMatrix(); |
---|
74 | } |
---|
75 | |
---|
Note: See
TracBrowser
for help on using the repository browser.