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. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: ... |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #include "proto_world_entity.h" |
---|
17 | #include "glincl.h" |
---|
18 | #include "stdincl.h" |
---|
19 | #include "vector.h" |
---|
20 | #include "model.h" |
---|
21 | |
---|
22 | using namespace std; |
---|
23 | |
---|
24 | /** |
---|
25 | \brief standard constructor |
---|
26 | |
---|
27 | */ |
---|
28 | ProtoWorldEntity::ProtoWorldEntity () |
---|
29 | { |
---|
30 | this->init(); |
---|
31 | } |
---|
32 | |
---|
33 | /** |
---|
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 | /** |
---|
45 | \brief standard deconstructor |
---|
46 | */ |
---|
47 | ProtoWorldEntity::~ProtoWorldEntity () |
---|
48 | { |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | /** |
---|
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 | /** |
---|
73 | \brief advances the ProtoWorldEntity about time seconds |
---|
74 | \param time the Time to step |
---|
75 | */ |
---|
76 | ProtoWorldEntity::tick(float time) |
---|
77 | { |
---|
78 | |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | \brief draws this worldEntity |
---|
83 | */ |
---|
84 | void ProtoWorldEntity::draw () |
---|
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 */ |
---|
95 | this->getAbsDir().matrix(matrix); |
---|
96 | glMultMatrixf((float*)matrix); |
---|
97 | |
---|
98 | if (model) |
---|
99 | model->draw(); |
---|
100 | glPopMatrix(); |
---|
101 | } |
---|