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: Filip Gospodinov |
---|
13 | co-programmer: |
---|
14 | */ |
---|
15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
16 | |
---|
17 | |
---|
18 | #include "executor/executor.h" |
---|
19 | #include "util/loading/factory.h" |
---|
20 | #include "util/loading/load_param.h" |
---|
21 | #include "blackscreen.h" |
---|
22 | #include "debug.h" |
---|
23 | #include "material.h" |
---|
24 | #include "state.h" |
---|
25 | #include "class_id_DEPRECATED.h" |
---|
26 | |
---|
27 | ObjectListDefinition(blackscreen); |
---|
28 | CREATE_FACTORY(blackscreen); |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | /** |
---|
33 | * |
---|
34 | */ |
---|
35 | blackscreen::blackscreen () |
---|
36 | { |
---|
37 | this->init(); |
---|
38 | |
---|
39 | |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | * |
---|
45 | */ |
---|
46 | blackscreen::blackscreen(const TiXmlElement* root) |
---|
47 | { |
---|
48 | this->init(); |
---|
49 | |
---|
50 | if( root != NULL) |
---|
51 | this->loadParams(root); |
---|
52 | i=0.5; |
---|
53 | state=0; |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | /** |
---|
58 | * |
---|
59 | */ |
---|
60 | blackscreen::~blackscreen () |
---|
61 | {} |
---|
62 | |
---|
63 | |
---|
64 | /** |
---|
65 | * |
---|
66 | */ |
---|
67 | void blackscreen::init() |
---|
68 | { |
---|
69 | this->registerObject(this, blackscreen::_objectList); |
---|
70 | this->toList(OM_GROUP_00); |
---|
71 | |
---|
72 | this->material = new Material(); |
---|
73 | this->material->setIllum(3); |
---|
74 | this->material->setDiffuse(1.0,1.0,1.0); |
---|
75 | this->material->setSpecular(0.0,0.0,0.0); |
---|
76 | this->material->setAmbient(1.0, 1.0, 1.0); |
---|
77 | |
---|
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 blackscreen::loadParams(const TiXmlElement* root) |
---|
86 | { |
---|
87 | WorldEntity::loadParams(root); |
---|
88 | } |
---|
89 | |
---|
90 | void blackscreen::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 | glPushMatrix(); |
---|
103 | /* glTranslatef (this->getAbsCoor ().x, |
---|
104 | this->getAbsCoor ().y, |
---|
105 | this->getAbsCoor ().z); |
---|
106 | glRotatef(axis, 0.0f, 1.0f, 0.0f);*/ |
---|
107 | //PRINTF(0)("axis: %f\n", axis); |
---|
108 | glEnable(GL_BLEND); // Turn Blending On |
---|
109 | |
---|
110 | // |
---|
111 | // Coord schould depend on CameraTarget |
---|
112 | // |
---|
113 | // |
---|
114 | // |
---|
115 | |
---|
116 | glColor4f(0, 0, 0, i); |
---|
117 | /*this->material->select(); |
---|
118 | glBegin(GL_QUADS); |
---|
119 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3,State::getCameraNode()->getAbsCoorY() -100.0f, |
---|
120 | State::getCameraNode()->getAbsCoorZ()-100.0f); |
---|
121 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()-100.0f, |
---|
122 | State::getCameraNode()->getAbsCoorZ()+100.0f); |
---|
123 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY() +100.0f, |
---|
124 | State::getCameraNode()->getAbsCoorZ()+100.0f); |
---|
125 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()+100.0f, |
---|
126 | State::getCameraNode()->getAbsCoorZ()-100.0f); |
---|
127 | */ |
---|
128 | |
---|
129 | glBegin(GL_QUADS); |
---|
130 | glVertex3f(0,-100.0f,-100.0f); |
---|
131 | glVertex3f(0,-100.0f,+100.0f); |
---|
132 | glVertex3f(0,+100.0f,+100.0f); |
---|
133 | glVertex3f(0,+100.0f,-100.0f); |
---|
134 | |
---|
135 | |
---|
136 | |
---|
137 | glEnd(); |
---|
138 | |
---|
139 | glPopMatrix(); |
---|
140 | glPopAttrib(); |
---|
141 | } |
---|
142 | |
---|
143 | /** |
---|
144 | * |
---|
145 | */ |
---|
146 | void blackscreen::tick (float time) |
---|
147 | { |
---|
148 | if (state==0 && i==1) |
---|
149 | i=0; |
---|
150 | if (state==1 && i<=1) |
---|
151 | i=i+0.005; |
---|
152 | } |
---|
153 | |
---|
154 | |
---|
155 | void blackscreen::changeState (bool sta) |
---|
156 | { |
---|
157 | state=sta; |
---|
158 | } |
---|