Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/camera/src/world_entities/blackscreen.cc @ 10338

Last change on this file since 10338 was 10338, checked in by gfilip, 17 years ago

so many updates

File size: 3.7 KB
Line 
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
27ObjectListDefinition(blackscreen);
28CREATE_FACTORY(blackscreen);
29
30
31
32/**
33 *
34 */
35blackscreen::blackscreen()
36{
37  this->init();
38
39
40}
41
42
43/**
44 *
45 */
46blackscreen::blackscreen(const TiXmlElement* root)
47{
48  this->init();
49
50  if( root != NULL)
51    this->loadParams(root);
52
53}
54
55
56/**
57 *
58 */
59blackscreen::~blackscreen()
60{}
61
62
63/**
64 *
65 */
66void blackscreen::init()
67{
68  this->registerObject(this, blackscreen::_objectList);
69  this->toList(OM_GROUP_00);
70
71  this->material = new Material();
72 // this->material->setIllum(3);
73 // this->material->setTransparency(0.6);
74  //this->material->setDiffuse(0,0,0);
75  //this->material->setBlendFuncS("GL_SORCE_APLHA", "GL_ZERO");
76 // this->material->setSpecular(0.0,0.0,0.0);
77 // this->material->setAmbient(1, 1, 1);
78
79  i=1;
80  state=0;
81  fadeSpeed=1;
82
83}
84
85
86/**
87 * loads the Settings of a MD2Creature from an XML-element.
88 * @param root the XML-element to load the MD2Creature's properties from
89 */
90void blackscreen::loadParams(const TiXmlElement* root)
91{
92  WorldEntity::loadParams(root);
93}
94
95void blackscreen::draw() const
96{
97//   if(!mediaLoaded)
98//     false;
99
100  glPushAttrib(GL_ENABLE_BIT);
101  glDisable(GL_LIGHTING);
102//   glDisable(GL_BLEND);
103//
104//   glEnable(GL_TEXTURE_2D);
105//   glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
106
107  glPushMatrix();
108 /* glTranslatef (this->getAbsCoor ().x,
109                this->getAbsCoor ().y,
110                this->getAbsCoor ().z);
111  glRotatef(axis, 0.0f, 1.0f, 0.0f);*/
112//PRINTF(0)("axis: %f\n", axis);
113glEnable(GL_BLEND);     // Turn Blending On
114
115//
116//  Coord schould depend on CameraTarget
117//
118//
119//
120
121//glColor4f(0, 0, 0, i);
122
123this->material->setTransparency(i);
124this->material->select();
125
126  glBegin(GL_QUADS);
127  glVertex3f(State::getCameraNode()->getAbsCoorX()+3,State::getCameraNode()->getAbsCoorY() -100.0f,
128             State::getCameraNode()->getAbsCoorZ()-100.0f);
129  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()-100.0f,
130             State::getCameraNode()->getAbsCoorZ()+100.0f);
131  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY() +100.0f,
132             State::getCameraNode()->getAbsCoorZ()+100.0f);
133  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()+100.0f,
134             State::getCameraNode()->getAbsCoorZ()-100.0f);
135
136
137/* glBegin(GL_QUADS);
138glVertex3f(0,-100.0f,-100.0f);
139glVertex3f(0,-100.0f,+100.0f);
140glVertex3f(0,+100.0f,+100.0f);
141glVertex3f(0,+100.0f,-100.0f);
142*/
143
144
145  glEnd();
146
147  glPopMatrix();
148  glPopAttrib();
149}
150
151/**
152 *
153 */
154void blackscreen::tick (float time)
155{
156if (state == true)
157  fadeOut();
158else
159  fadeIn();
160}
161
162void blackscreen::fadeIn()
163{
164  if (i>0)
165    i=i-0.005*fadeSpeed;
166}
167
168void blackscreen::fadeOut()
169{
170  if (i<=1)
171    i=i+0.005*fadeSpeed;
172}
173
174void  blackscreen::toggleFade ()
175{
176
177    this->state= !this->state;
178}
179
180void blackscreen::changeFadeSpeed(float newSpeed)
181{
182  fadeSpeed=newSpeed;
183}
184
185bool blackscreen::isBlack()
186{
187if (i==1)
188  return 1;
189else
190  return 0;
191}
192
193bool blackscreen::isTrans()
194{
195  if (i==0)
196    return 1;
197  else
198    return 0;
199}
Note: See TracBrowser for help on using the repository browser.