[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" |
---|
[2816] | 20 | #include "stdincl.h" |
---|
| 21 | #include "world_entity.h" |
---|
| 22 | #include "vector.h" |
---|
[3484] | 23 | #include "objModel.h" |
---|
[4682] | 24 | #include "obb_tree.h" |
---|
[1883] | 25 | |
---|
| 26 | using namespace std; |
---|
| 27 | |
---|
| 28 | |
---|
[4490] | 29 | /** |
---|
| 30 | \brief creates an environment |
---|
| 31 | */ |
---|
[2816] | 32 | Environment::Environment () : WorldEntity() |
---|
[1883] | 33 | { |
---|
[4597] | 34 | this->setClassID(CL_ENVIRONMENT, "Environment"); |
---|
[4710] | 35 | this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj"/*"worlds/vulcania.obj"*/, OBJ, RP_CAMPAIGN); |
---|
[4682] | 36 | |
---|
[4724] | 37 | this->obbTree = new OBBTree(15, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount()); |
---|
[1883] | 38 | } |
---|
| 39 | |
---|
| 40 | |
---|
[4490] | 41 | /** |
---|
| 42 | \brief deletes an environment |
---|
| 43 | */ |
---|
[4597] | 44 | Environment::~Environment () |
---|
[3365] | 45 | { |
---|
[3566] | 46 | |
---|
[3365] | 47 | } |
---|
[1883] | 48 | |
---|
[4490] | 49 | /** |
---|
| 50 | \brief ticks the environment |
---|
| 51 | \param time the time about which to tick |
---|
| 52 | */ |
---|
[2816] | 53 | void Environment::tick (float time) {} |
---|
[1883] | 54 | |
---|
[4490] | 55 | /** |
---|
| 56 | \brief if a hit occures |
---|
| 57 | */ |
---|
[3578] | 58 | void Environment::hit (WorldEntity* weapon, Vector* loc) {} |
---|
[2816] | 59 | |
---|
[4490] | 60 | /** |
---|
| 61 | \brief destroys an Environment |
---|
| 62 | */ |
---|
[2816] | 63 | void Environment::destroy () {} |
---|
| 64 | |
---|
[4490] | 65 | /** |
---|
| 66 | \brief a collision with some ship |
---|
| 67 | */ |
---|
[2816] | 68 | void Environment::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} |
---|
| 69 | |
---|
[4490] | 70 | /** |
---|
| 71 | \brief draws the Environment |
---|
| 72 | */ |
---|
[4597] | 73 | void Environment::draw () |
---|
[2816] | 74 | { |
---|
[3986] | 75 | //this->getRelCoor().debug(); |
---|
[3964] | 76 | |
---|
[2816] | 77 | glMatrixMode(GL_MODELVIEW); |
---|
[3526] | 78 | glPushMatrix(); |
---|
[2816] | 79 | float matrix[4][4]; |
---|
[4597] | 80 | |
---|
[3365] | 81 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
---|
| 82 | //rotate |
---|
[3433] | 83 | this->getAbsDir().matrix (matrix); |
---|
[3365] | 84 | glMultMatrixf((float*)matrix); |
---|
[4597] | 85 | |
---|
[3365] | 86 | this->model->draw(); |
---|
[3526] | 87 | |
---|
| 88 | glPopMatrix(); |
---|
[2816] | 89 | } |
---|
| 90 | |
---|