Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

hm…..

File size: 3.3 KB
RevLine 
[10207]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"
[10210]25#include "class_id_DEPRECATED.h"
[10218]26
[10207]27ObjectListDefinition(blackscreen);
28CREATE_FACTORY(blackscreen);
29
30
[10212]31
[10207]32/**
33 *
34 */
35blackscreen::blackscreen ()
36{
37  this->init();
[10215]38
[10218]39
[10207]40}
41
42
43/**
44 *
45 */
46blackscreen::blackscreen(const TiXmlElement* root)
47{
48  this->init();
49
50  if( root != NULL)
51    this->loadParams(root);
[10254]52
[10207]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);
[10254]73  this->material->setDiffuse(0,0,0);
[10207]74  this->material->setSpecular(0.0,0.0,0.0);
[10254]75  this->material->setAmbient(0, 0, 0);
[10220]76
[10254]77  i=0.5;
78  state=0;
79  fadeSpeed=1;
80
[10207]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
[10236]113//
114//  Coord schould depend on CameraTarget
115//
116//
117//
[10207]118
119glColor4f(0, 0, 0, i);
[10238]120/*this->material->select();
[10207]121  glBegin(GL_QUADS);
[10220]122  glVertex3f(State::getCameraNode()->getAbsCoorX()+3,State::getCameraNode()->getAbsCoorY() -100.0f,
[10218]123             State::getCameraNode()->getAbsCoorZ()-100.0f);
[10220]124  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()-100.0f,
[10218]125             State::getCameraNode()->getAbsCoorZ()+100.0f);
[10220]126  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY() +100.0f,
[10218]127             State::getCameraNode()->getAbsCoorZ()+100.0f);
[10220]128  glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()+100.0f,
[10218]129             State::getCameraNode()->getAbsCoorZ()-100.0f);
[10238]130*/
[10207]131
[10238]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);
[10207]137
[10238]138
139
[10207]140  glEnd();
141
[10218]142  glPopMatrix();
143  glPopAttrib();
[10207]144}
145
146/**
147 *
148 */
149void blackscreen::tick (float time)
150{
[10254]151/*if (state == true)
152  fadeOut();
153else
154  fadeIn();*/
[10207]155}
156
[10254]157void blackscreen::fadeIn()
158{
159  if (i>0)
160    i=i-0.005*fadeSpeed;
161}
[10207]162
[10254]163void blackscreen::fadeOut()
[10207]164{
[10254]165  if (i<=1)
166    i=i+0.005*fadeSpeed;
[10207]167}
[10254]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.