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 | #include "stdincl.h" |
---|
21 | #include "world_entity.h" |
---|
22 | #include "vector.h" |
---|
23 | #include "objModel.h" |
---|
24 | #include "obb_tree.h" |
---|
25 | |
---|
26 | using namespace std; |
---|
27 | |
---|
28 | |
---|
29 | /** |
---|
30 | * creates an environment |
---|
31 | */ |
---|
32 | Environment::Environment () : WorldEntity() |
---|
33 | { |
---|
34 | this->setClassID(CL_ENVIRONMENT, "Environment"); |
---|
35 | this->model = (Model*)ResourceManager::getInstance()->load("models/ships/bolido.obj", OBJ, RP_CAMPAIGN); |
---|
36 | |
---|
37 | if(this->obbTree == NULL) |
---|
38 | this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount()); |
---|
39 | } |
---|
40 | |
---|
41 | |
---|
42 | /** |
---|
43 | * deletes an environment |
---|
44 | */ |
---|
45 | Environment::~Environment () |
---|
46 | { |
---|
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 | * if a hit occures |
---|
58 | */ |
---|
59 | void Environment::hit (WorldEntity* weapon, Vector* loc) {} |
---|
60 | |
---|
61 | /** |
---|
62 | * destroys an Environment |
---|
63 | */ |
---|
64 | void Environment::destroy () {} |
---|
65 | |
---|
66 | /** |
---|
67 | * a collision with some ship |
---|
68 | */ |
---|
69 | void Environment::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} |
---|
70 | |
---|
71 | /** |
---|
72 | * draws the Environment |
---|
73 | */ |
---|
74 | void Environment::draw () |
---|
75 | { |
---|
76 | //this->getRelCoor().debug(); |
---|
77 | |
---|
78 | glMatrixMode(GL_MODELVIEW); |
---|
79 | glPushMatrix(); |
---|
80 | float matrix[4][4]; |
---|
81 | |
---|
82 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
---|
83 | //rotate |
---|
84 | this->getAbsDir().matrix (matrix); |
---|
85 | glMultMatrixf((float*)matrix); |
---|
86 | |
---|
87 | this->model->draw(); |
---|
88 | |
---|
89 | glPopMatrix(); |
---|
90 | } |
---|
91 | |
---|