[10453] | 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 | #include "scrolling_screen.h" |
---|
| 18 | |
---|
| 19 | #include "util/loading/factory.h" |
---|
| 20 | #include "util/loading/load_param.h" |
---|
| 21 | |
---|
| 22 | #include "debug.h" |
---|
| 23 | #include "material.h" |
---|
| 24 | #include "state.h" |
---|
| 25 | // #include "camera.h" |
---|
| 26 | |
---|
| 27 | ObjectListDefinition(ScrollingScreen); |
---|
| 28 | CREATE_FACTORY(ScrollingScreen); |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | /** |
---|
| 33 | * |
---|
| 34 | */ |
---|
| 35 | ScrollingScreen::ScrollingScreen() |
---|
| 36 | { |
---|
| 37 | this->init(); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | /** |
---|
| 42 | * |
---|
| 43 | */ |
---|
| 44 | ScrollingScreen::ScrollingScreen(const TiXmlElement* root) |
---|
| 45 | { |
---|
| 46 | this->init(); |
---|
| 47 | |
---|
| 48 | if( root != NULL) |
---|
| 49 | this->loadParams(root); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * |
---|
| 55 | */ |
---|
| 56 | ScrollingScreen::~ScrollingScreen() |
---|
| 57 | {} |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * |
---|
| 62 | */ |
---|
| 63 | void ScrollingScreen::init() |
---|
| 64 | { |
---|
| 65 | this->registerObject(this, ScrollingScreen::_objectList); |
---|
| 66 | this->toList(OM_COMMON); |
---|
| 67 | |
---|
| 68 | this->material = new Material(); |
---|
| 69 | this->material->setDiffuse(0,0,0); |
---|
| 70 | this->material->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
---|
| 71 | |
---|
| 72 | this->isTransparent = false; |
---|
| 73 | this->transparency = 1.0; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * loads the Settings of a MD2Creature from an XML-element. |
---|
| 79 | * @param root the XML-element to load the MD2Creature's properties from |
---|
| 80 | */ |
---|
| 81 | void ScrollingScreen::loadParams(const TiXmlElement* root) |
---|
| 82 | { |
---|
| 83 | WorldEntity::loadParams(root); |
---|
| 84 | |
---|
| 85 | LoadParam(root, "setSpeed", this, ScrollingScreen, setSpeed); |
---|
| 86 | |
---|
| 87 | LoadParam(root, "setHeight", this, ScrollingScreen, setViewHeight); |
---|
| 88 | |
---|
| 89 | LoadParam(root, "setSize", this, ScrollingScreen, setSize); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | void ScrollingScreen::draw() const |
---|
| 96 | { |
---|
| 97 | glPushAttrib(GL_ENABLE_BIT); |
---|
| 98 | glDisable(GL_LIGHTING); |
---|
| 99 | glEnable(GL_BLEND); // Turn Blending On |
---|
| 100 | |
---|
| 101 | glMatrixMode(GL_MODELVIEW); |
---|
| 102 | glPushMatrix(); |
---|
| 103 | /* translate */ |
---|
| 104 | glTranslatef (this->getAbsCoor ().x, |
---|
| 105 | this->getAbsCoor ().y, |
---|
| 106 | this->getAbsCoor ().z); |
---|
| 107 | Vector tmpRot = this->getAbsDir().getSpacialAxis(); |
---|
| 108 | glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); |
---|
| 109 | |
---|
| 110 | this->material->select(); |
---|
| 111 | |
---|
| 112 | glBegin(GL_QUADS); |
---|
| 113 | |
---|
| 114 | glTexCoord2f(0., 0.); |
---|
| 115 | glVertex3f(0., -this->xSize, -this->ySize); |
---|
| 116 | |
---|
| 117 | // glTexCoord2f(); |
---|
| 118 | glVertex3f(0., -this->xSize, -this->ySize); |
---|
| 119 | |
---|
| 120 | // glTexCoord2f(); |
---|
| 121 | glVertex3f(0., -this->xSize, -this->ySize); |
---|
| 122 | |
---|
| 123 | // glTexCoord2f(); |
---|
| 124 | glVertex3f(0., -this->xSize, -this->ySize); |
---|
| 125 | |
---|
| 126 | glEnd(); |
---|
| 127 | |
---|
| 128 | glPopMatrix(); |
---|
| 129 | glPopAttrib(); |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | /** |
---|
| 133 | * |
---|
| 134 | */ |
---|
| 135 | void ScrollingScreen::tick (float time) |
---|
| 136 | { |
---|
| 137 | |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | void ScrollingScreen::fadeIn(float speed) |
---|
| 141 | { |
---|
| 142 | |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | void ScrollingScreen::fadeOut(float speed) |
---|
| 146 | { |
---|
| 147 | |
---|
| 148 | } |
---|