1 | |
---|
2 | |
---|
3 | /* |
---|
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 | |
---|
13 | ### File Specific |
---|
14 | main-programmer: |
---|
15 | co-programmer: |
---|
16 | */ |
---|
17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
18 | |
---|
19 | |
---|
20 | #include "executor/executor.h" |
---|
21 | #include "util/loading/factory.h" |
---|
22 | #include "util/loading/load_param.h" |
---|
23 | |
---|
24 | |
---|
25 | #include "test_entity2.h" |
---|
26 | #include "debug.h" |
---|
27 | |
---|
28 | #include "state.h" |
---|
29 | #include "player.h" |
---|
30 | #include "playable.h" |
---|
31 | |
---|
32 | |
---|
33 | #include "state.h" |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | #include "class_id_DEPRECATED.h" |
---|
38 | ObjectListDefinition(TestEntity2); |
---|
39 | CREATE_FACTORY(TestEntity2); |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | * |
---|
45 | */ |
---|
46 | TestEntity2::TestEntity2() |
---|
47 | { |
---|
48 | this->init(); |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | /** |
---|
53 | * |
---|
54 | */ |
---|
55 | TestEntity2::TestEntity2(const TiXmlElement* root) |
---|
56 | { |
---|
57 | this->init(); |
---|
58 | |
---|
59 | if( root != NULL) |
---|
60 | this->loadParams(root); |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | /** |
---|
65 | * |
---|
66 | */ |
---|
67 | TestEntity2::~TestEntity2 () |
---|
68 | {} |
---|
69 | |
---|
70 | |
---|
71 | /** |
---|
72 | * |
---|
73 | */ |
---|
74 | void TestEntity2::init() |
---|
75 | { |
---|
76 | this->registerObject(this, TestEntity2::_objectList); |
---|
77 | this->toList(OM_GROUP_00); |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | /** |
---|
82 | * loads the Settings of a MD2Creature from an XML-element. |
---|
83 | * @param root the XML-element to load the MD2Creature's properties from |
---|
84 | */ |
---|
85 | void TestEntity2::loadParams(const TiXmlElement* root) |
---|
86 | { |
---|
87 | WorldEntity::loadParams(root); |
---|
88 | } |
---|
89 | |
---|
90 | void TestEntity2::draw() const |
---|
91 | { |
---|
92 | // if(!mediaLoaded) |
---|
93 | // false; |
---|
94 | |
---|
95 | // glPushAttrib(GL_ENABLE_BIT); |
---|
96 | // glDisable(GL_LIGHTING); |
---|
97 | // glDisable(GL_BLEND); |
---|
98 | // |
---|
99 | // glEnable(GL_TEXTURE_2D); |
---|
100 | // glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter)); |
---|
101 | |
---|
102 | glMatrixMode(GL_MODELVIEW); |
---|
103 | glPushMatrix(); |
---|
104 | |
---|
105 | /* translate */ |
---|
106 | glTranslatef (this->getAbsCoor ().x, |
---|
107 | this->getAbsCoor ().y, |
---|
108 | this->getAbsCoor ().z); |
---|
109 | Vector tmpRot = this->getAbsDir().getSpacialAxis(); |
---|
110 | glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); |
---|
111 | |
---|
112 | //PRINTF(0)("axis: %f\n", axis); |
---|
113 | |
---|
114 | glColor3f(1.0, 0, 0); |
---|
115 | |
---|
116 | glBegin(GL_QUADS); |
---|
117 | glVertex3f( 0.0f, -10.0f, 0.0f); |
---|
118 | glNormal3f(0.0, 1.0, 0.0); |
---|
119 | // glTexCoord2f(1.0f, 1.0f); |
---|
120 | glVertex3f( 0.0f, -10.0f , 20.0f); |
---|
121 | glNormal3f(0.0, 1.0, 0.0); |
---|
122 | |
---|
123 | // glTexCoord2f(0.0f, 1.0f); |
---|
124 | glVertex3f( 0, 10.0f , 20.0f ); |
---|
125 | glNormal3f(0.0, 1.0, 0.0); |
---|
126 | |
---|
127 | // glTexCoord2f(0.0f, 0.0f); |
---|
128 | glVertex3f( 0, 10.0f, 0.0f ); |
---|
129 | glNormal3f(0.0, 1.0, 0.0); |
---|
130 | |
---|
131 | // glTexCoord2f(1.0f, 0.0f); |
---|
132 | |
---|
133 | glEnd(); |
---|
134 | |
---|
135 | glPopMatrix(); |
---|
136 | // glPopAttrib(); |
---|
137 | } |
---|
138 | |
---|
139 | /** |
---|
140 | * |
---|
141 | */ |
---|
142 | void TestEntity2::tick (float time) |
---|
143 | { |
---|
144 | Player* p = State::getPlayer(); |
---|
145 | Playable* pl = p->getPlayable(); |
---|
146 | |
---|
147 | this->setParent(pl); |
---|
148 | } |
---|
149 | |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | |
---|
154 | |
---|