[4597] | 1 | /* |
---|
[1883] | 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 | |
---|
[2036] | 11 | ### File Specific |
---|
| 12 | main-programmer: Patrick Boenzli |
---|
[4597] | 13 | co-programmer: |
---|
[1883] | 14 | */ |
---|
[5357] | 15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
[1883] | 16 | |
---|
| 17 | |
---|
[5486] | 18 | #include "collision_test_entity.h" |
---|
[5143] | 19 | |
---|
| 20 | #include "resource_manager.h" |
---|
| 21 | |
---|
[2816] | 22 | #include "vector.h" |
---|
[3484] | 23 | #include "objModel.h" |
---|
[4682] | 24 | #include "obb_tree.h" |
---|
[5361] | 25 | #include "factory.h" |
---|
[1883] | 26 | |
---|
| 27 | using namespace std; |
---|
[5750] | 28 | CREATE_FACTORY(CollisionTestEntity, CL_ENVIRONMENT); |
---|
[1883] | 29 | |
---|
[4490] | 30 | /** |
---|
[4836] | 31 | * creates an environment |
---|
[4490] | 32 | */ |
---|
[5486] | 33 | CollisionTestEntity::CollisionTestEntity () : WorldEntity() |
---|
[1883] | 34 | { |
---|
[5361] | 35 | this->init(); |
---|
[5687] | 36 | this->loadModel("models/ships/reaplow.obj"); |
---|
| 37 | // this->loadModel("models/ships/figther.obj"); |
---|
[4682] | 38 | |
---|
[5487] | 39 | this->buildObbTree(10); |
---|
[1883] | 40 | } |
---|
| 41 | |
---|
[5361] | 42 | /** |
---|
| 43 | * create an environment out of a XML-element |
---|
[5486] | 44 | * @param root the XML-element to load the CollisionTestEntity from |
---|
[5361] | 45 | */ |
---|
[5486] | 46 | CollisionTestEntity::CollisionTestEntity(const TiXmlElement* root) |
---|
[5361] | 47 | { |
---|
| 48 | this->init(); |
---|
| 49 | if (root != NULL) |
---|
| 50 | this->loadParams(root); |
---|
| 51 | } |
---|
[1883] | 52 | |
---|
[4490] | 53 | /** |
---|
[4836] | 54 | * deletes an environment |
---|
[4490] | 55 | */ |
---|
[5486] | 56 | CollisionTestEntity::~CollisionTestEntity () |
---|
[5047] | 57 | {} |
---|
[3566] | 58 | |
---|
[5361] | 59 | /** |
---|
[5486] | 60 | * initialize an CollisionTestEntity |
---|
[5361] | 61 | */ |
---|
[5486] | 62 | void CollisionTestEntity::init() |
---|
[5361] | 63 | { |
---|
[5486] | 64 | this->setClassID(CL_ENVIRONMENT, "CollisionTestEntity"); |
---|
[5361] | 65 | } |
---|
[1883] | 66 | |
---|
[4490] | 67 | /** |
---|
[5486] | 68 | * loads the Settings of an CollisionTestEntity from an XML-element. |
---|
[5361] | 69 | * @param root the XML-element to load the ELements properties from |
---|
| 70 | */ |
---|
[5486] | 71 | void CollisionTestEntity::loadParams(const TiXmlElement* root) |
---|
[5361] | 72 | { |
---|
| 73 | static_cast<WorldEntity*>(this)->loadParams(root); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | /** |
---|
[4836] | 78 | * ticks the environment |
---|
| 79 | * @param time the time about which to tick |
---|
[4490] | 80 | */ |
---|
[5486] | 81 | void CollisionTestEntity::tick (float time) {} |
---|
[1883] | 82 | |
---|
[2816] | 83 | |
---|
[4490] | 84 | /** |
---|
[5486] | 85 | * draws the CollisionTestEntity |
---|
[4490] | 86 | */ |
---|
[5486] | 87 | void CollisionTestEntity::draw () |
---|
[2816] | 88 | { |
---|
| 89 | glMatrixMode(GL_MODELVIEW); |
---|
[3526] | 90 | glPushMatrix(); |
---|
[2816] | 91 | float matrix[4][4]; |
---|
[4597] | 92 | |
---|
[3365] | 93 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
---|
| 94 | //rotate |
---|
[3433] | 95 | this->getAbsDir().matrix (matrix); |
---|
[3365] | 96 | glMultMatrixf((float*)matrix); |
---|
[4597] | 97 | |
---|
[3365] | 98 | this->model->draw(); |
---|
[3526] | 99 | |
---|
| 100 | glPopMatrix(); |
---|
[2816] | 101 | } |
---|
| 102 | |
---|