[1853] | 1 | /* |
---|
| 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. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[3761] | 12 | main-programmer: ... |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3761] | 16 | #include "proto_world_entity.h" |
---|
| 17 | #include "glincl.h" |
---|
[3608] | 18 | #include "stdincl.h" |
---|
[3761] | 19 | #include "vector.h" |
---|
[3677] | 20 | #include "model.h" |
---|
[1853] | 21 | |
---|
[1856] | 22 | using namespace std; |
---|
[1853] | 23 | |
---|
[3245] | 24 | /** |
---|
| 25 | \brief standard constructor |
---|
[3559] | 26 | |
---|
[3245] | 27 | */ |
---|
[3761] | 28 | ProtoWorldEntity::ProtoWorldEntity () |
---|
[3365] | 29 | { |
---|
[4483] | 30 | this->init(); |
---|
[3365] | 31 | } |
---|
[1853] | 32 | |
---|
[3564] | 33 | /** |
---|
[4483] | 34 | \brief constructs and loads a ProtoWorldEntity from a XML-element |
---|
| 35 | \param root the XML-element to load from |
---|
| 36 | */ |
---|
| 37 | ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root) |
---|
| 38 | { |
---|
| 39 | this->init(); |
---|
| 40 | this->loadParams(root); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | /** |
---|
[3761] | 45 | \brief standard deconstructor |
---|
[3566] | 46 | */ |
---|
[3761] | 47 | ProtoWorldEntity::~ProtoWorldEntity () |
---|
[3566] | 48 | { |
---|
| 49 | |
---|
| 50 | } |
---|
| 51 | |
---|
[3762] | 52 | /** |
---|
[4483] | 53 | \brief initializes the ProtoWorldEntity |
---|
| 54 | */ |
---|
| 55 | void ProtoWorldEntity::init(void) |
---|
| 56 | { |
---|
| 57 | ... |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | \brief loads a ProtoWorldEntity from a XML-element |
---|
| 62 | \param root the XML-element to load from |
---|
| 63 | */ |
---|
| 64 | void ProtoWorldEntity::loadParams(const TiXmlElement* root) |
---|
| 65 | { |
---|
| 66 | static_cast<WorldEntity*>(this)->loadParam(root); |
---|
| 67 | |
---|
| 68 | ... |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /** |
---|
[3762] | 73 | \brief advances the ProtoWorldEntity about time seconds |
---|
| 74 | \param time the Time to step |
---|
| 75 | */ |
---|
| 76 | ProtoWorldEntity::tick(float time) |
---|
| 77 | { |
---|
[1853] | 78 | |
---|
[3762] | 79 | } |
---|
| 80 | |
---|
[3245] | 81 | /** |
---|
[4483] | 82 | \brief draws this worldEntity |
---|
[3245] | 83 | */ |
---|
[3761] | 84 | void ProtoWorldEntity::draw () |
---|
[3559] | 85 | { |
---|
| 86 | glMatrixMode(GL_MODELVIEW); |
---|
| 87 | glPushMatrix(); |
---|
| 88 | float matrix[4][4]; |
---|
| 89 | |
---|
| 90 | /* translate */ |
---|
| 91 | glTranslatef (this->getAbsCoor ().x, |
---|
| 92 | this->getAbsCoor ().y, |
---|
| 93 | this->getAbsCoor ().z); |
---|
| 94 | /* rotate */ |
---|
[3761] | 95 | this->getAbsDir().matrix(matrix); |
---|
[3559] | 96 | glMultMatrixf((float*)matrix); |
---|
| 97 | |
---|
[3761] | 98 | if (model) |
---|
[3566] | 99 | model->draw(); |
---|
[3559] | 100 | glPopMatrix(); |
---|
| 101 | } |
---|