[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] | 27 | ObjectListDefinition(blackscreen); |
---|
| 28 | CREATE_FACTORY(blackscreen); |
---|
| 29 | |
---|
| 30 | |
---|
[10212] | 31 | |
---|
[10207] | 32 | /** |
---|
| 33 | * |
---|
| 34 | */ |
---|
| 35 | blackscreen::blackscreen () |
---|
| 36 | { |
---|
| 37 | this->init(); |
---|
[10215] | 38 | |
---|
[10218] | 39 | |
---|
[10207] | 40 | } |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | /** |
---|
| 44 | * |
---|
| 45 | */ |
---|
| 46 | blackscreen::blackscreen(const TiXmlElement* root) |
---|
| 47 | { |
---|
| 48 | this->init(); |
---|
| 49 | |
---|
| 50 | if( root != NULL) |
---|
| 51 | this->loadParams(root); |
---|
[10218] | 52 | i=0; |
---|
[10220] | 53 | state=0; |
---|
[10207] | 54 | } |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * |
---|
| 59 | */ |
---|
| 60 | blackscreen::~blackscreen () |
---|
| 61 | {} |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * |
---|
| 66 | */ |
---|
| 67 | void blackscreen::init() |
---|
| 68 | { |
---|
| 69 | this->registerObject(this, blackscreen::_objectList); |
---|
| 70 | this->toList(OM_GROUP_00); |
---|
| 71 | |
---|
| 72 | this->material = new Material(); |
---|
| 73 | this->material->setIllum(3); |
---|
| 74 | this->material->setDiffuse(1.0,1.0,1.0); |
---|
| 75 | this->material->setSpecular(0.0,0.0,0.0); |
---|
| 76 | this->material->setAmbient(1.0, 1.0, 1.0); |
---|
[10220] | 77 | |
---|
[10207] | 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | /** |
---|
| 82 | * loads the Settings of a MD2Creature from an XML-element. |
---|
| 83 | * @param root the XML-element to load the MD2Creature's properties from |
---|
| 84 | */ |
---|
| 85 | void blackscreen::loadParams(const TiXmlElement* root) |
---|
| 86 | { |
---|
| 87 | WorldEntity::loadParams(root); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | void blackscreen::draw() const |
---|
| 91 | { |
---|
| 92 | // if(!mediaLoaded) |
---|
| 93 | // false; |
---|
| 94 | |
---|
| 95 | glPushAttrib(GL_ENABLE_BIT); |
---|
| 96 | glDisable(GL_LIGHTING); |
---|
| 97 | // glDisable(GL_BLEND); |
---|
| 98 | // |
---|
| 99 | // glEnable(GL_TEXTURE_2D); |
---|
| 100 | // glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter)); |
---|
| 101 | |
---|
| 102 | glPushMatrix(); |
---|
| 103 | /* glTranslatef (this->getAbsCoor ().x, |
---|
| 104 | this->getAbsCoor ().y, |
---|
| 105 | this->getAbsCoor ().z); |
---|
| 106 | glRotatef(axis, 0.0f, 1.0f, 0.0f);*/ |
---|
| 107 | //PRINTF(0)("axis: %f\n", axis); |
---|
| 108 | glEnable(GL_BLEND); // Turn Blending On |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | glColor4f(0, 0, 0, i); |
---|
[10220] | 113 | this->material->select(); |
---|
[10207] | 114 | glBegin(GL_QUADS); |
---|
[10220] | 115 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3,State::getCameraNode()->getAbsCoorY() -100.0f, |
---|
[10218] | 116 | State::getCameraNode()->getAbsCoorZ()-100.0f); |
---|
[10220] | 117 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()-100.0f, |
---|
[10218] | 118 | State::getCameraNode()->getAbsCoorZ()+100.0f); |
---|
[10220] | 119 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY() +100.0f, |
---|
[10218] | 120 | State::getCameraNode()->getAbsCoorZ()+100.0f); |
---|
[10220] | 121 | glVertex3f(State::getCameraNode()->getAbsCoorX()+3, State::getCameraNode()->getAbsCoorY()+100.0f, |
---|
[10218] | 122 | State::getCameraNode()->getAbsCoorZ()-100.0f); |
---|
[10207] | 123 | |
---|
| 124 | |
---|
| 125 | glEnd(); |
---|
| 126 | |
---|
[10218] | 127 | glPopMatrix(); |
---|
| 128 | glPopAttrib(); |
---|
[10207] | 129 | } |
---|
| 130 | |
---|
| 131 | /** |
---|
| 132 | * |
---|
| 133 | */ |
---|
| 134 | void blackscreen::tick (float time) |
---|
| 135 | { |
---|
| 136 | if (state==0 && i==1) |
---|
| 137 | i=0; |
---|
| 138 | if (state==1 && i<=1) |
---|
| 139 | i=i+0.005; |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | void blackscreen::changeState (bool sta) |
---|
| 144 | { |
---|
| 145 | state=sta; |
---|
| 146 | } |
---|