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