source:
orxonox.OLD/trunk/src/world_entities/environment.cc
@
5280
Last change on this file since 5280 was 5256, checked in by bensch, 19 years ago | |
---|---|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[1883] | 1 | |
2 | ||
[4597] | 3 | /* |
[1883] | 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 | ||
[2036] | 13 | ### File Specific |
14 | main-programmer: Patrick Boenzli | |
[4597] | 15 | co-programmer: |
[1883] | 16 | */ |
17 | ||
18 | ||
19 | #include "environment.h" | |
[5143] | 20 | |
21 | #include "resource_manager.h" | |
22 | ||
[2816] | 23 | #include "vector.h" |
[3484] | 24 | #include "objModel.h" |
[4682] | 25 | #include "obb_tree.h" |
[1883] | 26 | |
27 | using namespace std; | |
28 | ||
29 | ||
[4490] | 30 | /** |
[4836] | 31 | * creates an environment |
[4490] | 32 | */ |
[2816] | 33 | Environment::Environment () : WorldEntity() |
[1883] | 34 | { |
[4597] | 35 | this->setClassID(CL_ENVIRONMENT, "Environment"); |
[5033] | 36 | this->model = (Model*)ResourceManager::getInstance()->load("models/ships/bolido.obj", OBJ, RP_CAMPAIGN); |
[4682] | 37 | |
[5256] | 38 | if(this->obbTree == NULL) |
39 | this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount()); | |
[1883] | 40 | } |
41 | ||
42 | ||
[4490] | 43 | /** |
[4836] | 44 | * deletes an environment |
[4490] | 45 | */ |
[4597] | 46 | Environment::~Environment () |
[5047] | 47 | {} |
[3566] | 48 | |
[1883] | 49 | |
[4490] | 50 | /** |
[4836] | 51 | * ticks the environment |
52 | * @param time the time about which to tick | |
[4490] | 53 | */ |
[2816] | 54 | void Environment::tick (float time) {} |
[1883] | 55 | |
[2816] | 56 | |
[4490] | 57 | /** |
[4836] | 58 | * draws the Environment |
[4490] | 59 | */ |
[4597] | 60 | void Environment::draw () |
[2816] | 61 | { |
62 | glMatrixMode(GL_MODELVIEW); | |
[3526] | 63 | glPushMatrix(); |
[2816] | 64 | float matrix[4][4]; |
[4597] | 65 | |
[3365] | 66 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
67 | //rotate | |
[3433] | 68 | this->getAbsDir().matrix (matrix); |
[3365] | 69 | glMultMatrixf((float*)matrix); |
[4597] | 70 | |
[3365] | 71 | this->model->draw(); |
[3526] | 72 | |
73 | glPopMatrix(); | |
[2816] | 74 | } |
75 |
Note: See TracBrowser
for help on using the repository browser.