Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10304 was 10254, checked in by gfilip, 18 years ago

hm…..

File size: 3.3 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=0.5;
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);
120/*this->material->select();
121  glBegin(GL_QUADS);
122  glVertex3f(State::getCameraNode()->getAbsCoorX()+3,State::getCameraNode()->getAbsCoorY() -100.0f,
123             State::getCameraNode()->getAbsCoorZ()-100.0f);
124  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()-100.0f,
125             State::getCameraNode()->getAbsCoorZ()+100.0f);
126  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY() +100.0f,
127             State::getCameraNode()->getAbsCoorZ()+100.0f);
128  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()+100.0f,
129             State::getCameraNode()->getAbsCoorZ()-100.0f);
130*/
131
132 glBegin(GL_QUADS);
133glVertex3f(0,-100.0f,-100.0f);
134glVertex3f(0,-100.0f,+100.0f);
135glVertex3f(0,+100.0f,+100.0f);
136glVertex3f(0,+100.0f,-100.0f);
137
138
139
140  glEnd();
141
142  glPopMatrix();
143  glPopAttrib();
144}
145
146/**
147 *
148 */
149void blackscreen::tick (float time)
150{
151/*if (state == true)
152  fadeOut();
153else
154  fadeIn();*/
155}
156
157void blackscreen::fadeIn()
158{
159  if (i>0)
160    i=i-0.005*fadeSpeed;
161}
162
163void blackscreen::fadeOut()
164{
165  if (i<=1)
166    i=i+0.005*fadeSpeed;
167}
168
169void  blackscreen::toggleFade ()
170{
171  state=!state;
172}
173
174void blackscreen::changeFadeSpeed(float newSpeed)
175{
176  fadeSpeed=newSpeed;
177}
178
Note: See TracBrowser for help on using the repository browser.