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_entity.h" |
---|
26 | #include "debug.h" |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | #include "state.h" |
---|
32 | |
---|
33 | |
---|
34 | |
---|
35 | #include "class_id_DEPRECATED.h" |
---|
36 | ObjectListDefinition(TestEntity); |
---|
37 | CREATE_FACTORY(TestEntity); |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | /** |
---|
42 | * |
---|
43 | */ |
---|
44 | TestEntity::TestEntity () |
---|
45 | { |
---|
46 | this->init(); |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | /** |
---|
51 | * |
---|
52 | */ |
---|
53 | TestEntity::TestEntity(const TiXmlElement* root) |
---|
54 | { |
---|
55 | this->init(); |
---|
56 | |
---|
57 | if( root != NULL) |
---|
58 | this->loadParams(root); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | /** |
---|
63 | * |
---|
64 | */ |
---|
65 | TestEntity::~TestEntity () |
---|
66 | {} |
---|
67 | |
---|
68 | |
---|
69 | /** |
---|
70 | * |
---|
71 | */ |
---|
72 | void TestEntity::init() |
---|
73 | { |
---|
74 | this->rtri = 0; |
---|
75 | |
---|
76 | this->registerObject(this, TestEntity::_objectList); |
---|
77 | this->toList(OM_GROUP_01); |
---|
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 TestEntity::loadParams(const TiXmlElement* root) |
---|
86 | { |
---|
87 | WorldEntity::loadParams(root); |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | /** |
---|
93 | * |
---|
94 | */ |
---|
95 | void TestEntity::tick (float time) |
---|
96 | { |
---|
97 | this->rtri += 2.0f; |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | /** |
---|
103 | * |
---|
104 | */ |
---|
105 | void TestEntity::draw() const |
---|
106 | { |
---|
107 | glPushMatrix(); |
---|
108 | glPushAttrib(GL_ENABLE_BIT); |
---|
109 | |
---|
110 | glMatrixMode(GL_MODELVIEW); |
---|
111 | glDisable(GL_LIGHTING); |
---|
112 | //glDisable(GL_BLEND); |
---|
113 | /* Move the object */ |
---|
114 | glTranslatef(-1200.0f, 300.0f, 700.0f); |
---|
115 | glRotatef(rtri, 0.0f, 1.0f, 0.0f); |
---|
116 | /* Rotate The Triangle On The Y axis */ |
---|
117 | |
---|
118 | /* Drawing the Triangles4 */ |
---|
119 | glBegin(GL_TRIANGLES); /* Drawing Using Triangles */ |
---|
120 | glColor3f( 20, 0.0f, 0.0f); /* Red */ |
---|
121 | glVertex3f( 0.0f, 20, 0.0f); /* Top Of Triangle (Front) */ |
---|
122 | glColor3f( 0.0f, 20, 0.0f); /* Green */ |
---|
123 | glVertex3f(-20, -20, 20); /* Left Of Triangle (Front) */ |
---|
124 | glColor3f( 0.0f, 0.0f, 20); /* Blue */ |
---|
125 | glVertex3f( 20, -20, 20); /* Right Of Triangle (Front) */ |
---|
126 | |
---|
127 | glColor3f( 20, 0.0f, 0.0f); /* Red */ |
---|
128 | glVertex3f( 0.0f, 20, 0.0f); /* Top Of Triangle (Right) */ |
---|
129 | glColor3f( 0.0f, 0.0f, 20); /* Blue */ |
---|
130 | glVertex3f( 20, -20, 20); /* Left Of Triangle (Right) */ |
---|
131 | glColor3f( 0.0f, 20, 0.0f); /* Green */ |
---|
132 | glVertex3f( 20, -20, -20); /* Right Of Triangle (Right) */ |
---|
133 | |
---|
134 | glColor3f( 20, 0.0f, 0.0f); /* Red */ |
---|
135 | glVertex3f( 0.0f, 20, 0.0f); /* Top Of Triangle (Back) */ |
---|
136 | glColor3f( 0.0f, 20, 0.0f); /* Green */ |
---|
137 | glVertex3f( 20, -20, -20); /* Left Of Triangle (Back) */ |
---|
138 | glColor3f( 0.0f, 0.0f, 20); /* Blue */ |
---|
139 | glVertex3f(-20, -20, -20); /* Right Of Triangle (Back) */ |
---|
140 | |
---|
141 | glColor3f( 20, 0.0f, 0.0f); /* Red */ |
---|
142 | glVertex3f( 0.0f, 20, 0.0f); /* Top Of Triangle (Left) */ |
---|
143 | glColor3f( 0.0f, 0.0f, 20); /* Blue */ |
---|
144 | glVertex3f(-20, -20, -20); /* Left Of Triangle (Left) */ |
---|
145 | glColor3f( 0.0f, 20, 0.0f); /* Green */ |
---|
146 | glVertex3f(-20, -20, 20); /* Right Of Triangle (Left) */ |
---|
147 | glEnd(); /* Finished Drawing The Triangles */ |
---|
148 | |
---|
149 | glPopAttrib(); |
---|
150 | glPopMatrix(); |
---|
151 | } |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | |
---|