/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific main-programmer: Filip Gospodinov co-programmer: */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY #include "executor/executor.h" #include "util/loading/factory.h" #include "util/loading/load_param.h" #include "blackscreen.h" #include "debug.h" #include "material.h" #include "state.h" #include "class_id_DEPRECATED.h" ObjectListDefinition(blackscreen); CREATE_FACTORY(blackscreen); /** * */ blackscreen::blackscreen () { this->init(); } /** * */ blackscreen::blackscreen(const TiXmlElement* root) { this->init(); if( root != NULL) this->loadParams(root); } /** * */ blackscreen::~blackscreen () {} /** * */ void blackscreen::init() { this->registerObject(this, blackscreen::_objectList); this->toList(OM_GROUP_00); this->material = new Material(); this->material->setIllum(3); this->material->setDiffuse(0,0,0); this->material->setSpecular(0.0,0.0,0.0); this->material->setAmbient(0, 0, 0); i=0.5; state=0; fadeSpeed=1; } /** * loads the Settings of a MD2Creature from an XML-element. * @param root the XML-element to load the MD2Creature's properties from */ void blackscreen::loadParams(const TiXmlElement* root) { WorldEntity::loadParams(root); } void blackscreen::draw() const { // if(!mediaLoaded) // false; glPushAttrib(GL_ENABLE_BIT); glDisable(GL_LIGHTING); // glDisable(GL_BLEND); // // glEnable(GL_TEXTURE_2D); // glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter)); glPushMatrix(); /* glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); glRotatef(axis, 0.0f, 1.0f, 0.0f);*/ //PRINTF(0)("axis: %f\n", axis); glEnable(GL_BLEND); // Turn Blending On // // Coord schould depend on CameraTarget // // // glColor4f(0, 0, 0, i); /*this->material->select(); glBegin(GL_QUADS); glVertex3f(State::getCameraNode()->getAbsCoorX()+3,State::getCameraNode()->getAbsCoorY() -100.0f, State::getCameraNode()->getAbsCoorZ()-100.0f); glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()-100.0f, State::getCameraNode()->getAbsCoorZ()+100.0f); glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY() +100.0f, State::getCameraNode()->getAbsCoorZ()+100.0f); glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()+100.0f, State::getCameraNode()->getAbsCoorZ()-100.0f); */ glBegin(GL_QUADS); glVertex3f(0,-100.0f,-100.0f); glVertex3f(0,-100.0f,+100.0f); glVertex3f(0,+100.0f,+100.0f); glVertex3f(0,+100.0f,-100.0f); glEnd(); glPopMatrix(); glPopAttrib(); } /** * */ void blackscreen::tick (float time) { /*if (state == true) fadeOut(); else fadeIn();*/ } void blackscreen::fadeIn() { if (i>0) i=i-0.005*fadeSpeed; } void blackscreen::fadeOut() { if (i<=1) i=i+0.005*fadeSpeed; } void blackscreen::toggleFade () { state=!state; } void blackscreen::changeFadeSpeed(float newSpeed) { fadeSpeed=newSpeed; }