Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

all working

File size: 3.4 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->setDiffuse(0,0,0);
74  this->material->setSpecular(0.0,0.0,0.0);
75 // this->material->setAmbient(0, 0, 0);
76
77  i=1;
78  state=0;
79  fadeSpeed=1;
80
81}
82
83
84/**
85 * loads the Settings of a MD2Creature from an XML-element.
86 * @param root the XML-element to load the MD2Creature's properties from
87 */
88void blackscreen::loadParams(const TiXmlElement* root)
89{
90  WorldEntity::loadParams(root);
91}
92
93void blackscreen::draw() const
94{
95//   if(!mediaLoaded)
96//     false;
97
98  glPushAttrib(GL_ENABLE_BIT);
99  glDisable(GL_LIGHTING);
100//   glDisable(GL_BLEND);
101//
102//   glEnable(GL_TEXTURE_2D);
103//   glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
104
105  glPushMatrix();
106 /* glTranslatef (this->getAbsCoor ().x,
107                this->getAbsCoor ().y,
108                this->getAbsCoor ().z);
109  glRotatef(axis, 0.0f, 1.0f, 0.0f);*/
110//PRINTF(0)("axis: %f\n", axis);
111glEnable(GL_BLEND);     // Turn Blending On
112
113//
114//  Coord schould depend on CameraTarget
115//
116//
117//
118
119glColor4f(0, 0, 0, i);
120this->material->select();
121this->material->setTransparency(i);
122  glBegin(GL_QUADS);
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  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
132
133/* glBegin(GL_QUADS);
134glVertex3f(0,-100.0f,-100.0f);
135glVertex3f(0,-100.0f,+100.0f);
136glVertex3f(0,+100.0f,+100.0f);
137glVertex3f(0,+100.0f,-100.0f);
138*/
139
140
141  glEnd();
142
143  glPopMatrix();
144  glPopAttrib();
145}
146
147/**
148 *
149 */
150void blackscreen::tick (float time)
151{
152if (state == true)
153  fadeOut();
154else
155  fadeIn();
156}
157
158void blackscreen::fadeIn()
159{
160  if (i>0)
161    i=i-0.005*fadeSpeed;
162}
163
164void blackscreen::fadeOut()
165{
166  if (i<=1)
167    i=i+0.005*fadeSpeed;
168}
169
170void  blackscreen::toggleFade ()
171{
172
173    this->state= !this->state;
174}
175
176void blackscreen::changeFadeSpeed(float newSpeed)
177{
178  fadeSpeed=newSpeed;
179}
180
Note: See TracBrowser for help on using the repository browser.