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 | #include "material.h" |
---|
32 | |
---|
33 | |
---|
34 | #include "state.h" |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | #include "class_id_DEPRECATED.h" |
---|
39 | ObjectListDefinition(TestEntity2); |
---|
40 | CREATE_FACTORY(TestEntity2); |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | /** |
---|
45 | * |
---|
46 | */ |
---|
47 | TestEntity2::TestEntity2() |
---|
48 | { |
---|
49 | this->init(); |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | /** |
---|
54 | * |
---|
55 | */ |
---|
56 | TestEntity2::TestEntity2(const TiXmlElement* root) |
---|
57 | { |
---|
58 | this->init(); |
---|
59 | |
---|
60 | if( root != NULL) |
---|
61 | this->loadParams(root); |
---|
62 | } |
---|
63 | |
---|
64 | |
---|
65 | /** |
---|
66 | * |
---|
67 | */ |
---|
68 | TestEntity2::~TestEntity2 () |
---|
69 | {} |
---|
70 | |
---|
71 | |
---|
72 | /** |
---|
73 | * |
---|
74 | */ |
---|
75 | void TestEntity2::init() |
---|
76 | { |
---|
77 | this->registerObject(this, TestEntity2::_objectList); |
---|
78 | this->toList(OM_GROUP_00); |
---|
79 | |
---|
80 | this->material = new Material(); |
---|
81 | this->material->setIllum(3); |
---|
82 | this->material->setDiffuse(0.0,0.0,0.0); |
---|
83 | this->material->setSpecular(0.0,0.0,0.0); |
---|
84 | this->material->setAmbient(1.0, 0.0, 1.0); |
---|
85 | |
---|
86 | // this->material->setDiffuseMap("maps/"); |
---|
87 | } |
---|
88 | |
---|
89 | |
---|
90 | /** |
---|
91 | * loads the Settings of a MD2Creature from an XML-element. |
---|
92 | * @param root the XML-element to load the MD2Creature's properties from |
---|
93 | */ |
---|
94 | void TestEntity2::loadParams(const TiXmlElement* root) |
---|
95 | { |
---|
96 | WorldEntity::loadParams(root); |
---|
97 | } |
---|
98 | |
---|
99 | void TestEntity2::draw() const |
---|
100 | { |
---|
101 | |
---|
102 | |
---|
103 | glPushMatrix(); |
---|
104 | glMatrixMode(GL_MODELVIEW); |
---|
105 | |
---|
106 | |
---|
107 | /* translate */ |
---|
108 | glTranslatef (this->getAbsCoor ().x, |
---|
109 | this->getAbsCoor ().y, |
---|
110 | this->getAbsCoor ().z); |
---|
111 | Vector tmpRot = this->getAbsDir().getSpacialAxis(); |
---|
112 | glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); |
---|
113 | |
---|
114 | //PRINTF(0)("axis: %f\n", axis); |
---|
115 | |
---|
116 | <<<<<<< .mine |
---|
117 | glColor3f(1.0, 0.0, 0.0); |
---|
118 | ======= |
---|
119 | this->material->select(); |
---|
120 | >>>>>>> .r9974 |
---|
121 | |
---|
122 | glColor3f(0.0, 1.0, 0.0); |
---|
123 | |
---|
124 | glBegin(GL_QUADS); |
---|
125 | <<<<<<< .mine |
---|
126 | glVertex3f( 0.0f, 10.0f, 0.0f); |
---|
127 | //glNormal3f(0.0, 1.0, 0.0); |
---|
128 | ======= |
---|
129 | glVertex3f( 0.0f, -10.0f, 0.0f); |
---|
130 | glNormal3f(1.0, 0.0, 0.0); |
---|
131 | >>>>>>> .r9974 |
---|
132 | // glTexCoord2f(1.0f, 1.0f); |
---|
133 | <<<<<<< .mine |
---|
134 | glVertex3f( 0.0f, 10.0f , 10.0f); |
---|
135 | //glNormal3f(0.0, 1.0, 0.0); |
---|
136 | ======= |
---|
137 | glVertex3f( 0.0f, -10.0f , 20.0f); |
---|
138 | glNormal3f(1.0, 0.0, 0.0); |
---|
139 | >>>>>>> .r9974 |
---|
140 | |
---|
141 | // glTexCoord2f(0.0f, 1.0f); |
---|
142 | <<<<<<< .mine |
---|
143 | glVertex3f( 0.0f, 0.0f , 10.0f ); |
---|
144 | //glNormal3f(0.0, 1.0, 0.0); |
---|
145 | ======= |
---|
146 | glVertex3f( 0.0, 10.0f , 20.0f ); |
---|
147 | glNormal3f(1.0, 0.0, 0.0); |
---|
148 | >>>>>>> .r9974 |
---|
149 | |
---|
150 | // glTexCoord2f(0.0f, 0.0f); |
---|
151 | <<<<<<< .mine |
---|
152 | glVertex3f( 0.0f, 0.0f, 0.0f ); |
---|
153 | //glNormal3f(1.0, 0.0, 0.0); |
---|
154 | ======= |
---|
155 | glVertex3f( 0.0, 10.0f, 0.0f ); |
---|
156 | glNormal3f(1.0, 0.0, 0.0); |
---|
157 | >>>>>>> .r9974 |
---|
158 | |
---|
159 | // glTexCoord2f(1.0f, 0.0f); |
---|
160 | <<<<<<< .mine |
---|
161 | ======= |
---|
162 | |
---|
163 | >>>>>>> .r9974 |
---|
164 | glEnd(); |
---|
165 | |
---|
166 | glPopMatrix(); |
---|
167 | // glPopAttrib(); |
---|
168 | } |
---|
169 | |
---|
170 | /** |
---|
171 | * |
---|
172 | */ |
---|
173 | void TestEntity2::tick (float time) |
---|
174 | { |
---|
175 | Player* p = State::getPlayer(); |
---|
176 | Playable* pl = p->getPlayable(); |
---|
177 | |
---|
178 | this->setParent(pl); |
---|
179 | } |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | |
---|
184 | |
---|
185 | |
---|