[4679] | 1 | /* |
---|
[4245] | 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 |
---|
[9927] | 12 | main-programmer: |
---|
[4679] | 13 | co-programmer: |
---|
[4245] | 14 | */ |
---|
[5357] | 15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
[4245] | 16 | |
---|
| 17 | |
---|
[6222] | 18 | #include "executor/executor.h" |
---|
[7193] | 19 | #include "util/loading/factory.h" |
---|
| 20 | #include "util/loading/load_param.h" |
---|
[6222] | 21 | |
---|
[7488] | 22 | |
---|
[4245] | 23 | #include "test_entity.h" |
---|
[9869] | 24 | #include "debug.h" |
---|
[8490] | 25 | |
---|
| 26 | |
---|
[10065] | 27 | #include "material.h" |
---|
[9927] | 28 | |
---|
[5087] | 29 | #include "state.h" |
---|
[4245] | 30 | |
---|
| 31 | |
---|
| 32 | |
---|
[9869] | 33 | #include "class_id_DEPRECATED.h" |
---|
| 34 | ObjectListDefinition(TestEntity); |
---|
| 35 | CREATE_FACTORY(TestEntity); |
---|
[9406] | 36 | |
---|
[10018] | 37 | float i=0; |
---|
| 38 | bool state=1; |
---|
[6222] | 39 | |
---|
[9927] | 40 | /** |
---|
| 41 | * |
---|
| 42 | */ |
---|
[4762] | 43 | TestEntity::TestEntity () |
---|
[4679] | 44 | { |
---|
[6222] | 45 | this->init(); |
---|
| 46 | } |
---|
[4245] | 47 | |
---|
[4714] | 48 | |
---|
[9927] | 49 | /** |
---|
| 50 | * |
---|
| 51 | */ |
---|
[6222] | 52 | TestEntity::TestEntity(const TiXmlElement* root) |
---|
| 53 | { |
---|
| 54 | this->init(); |
---|
[9927] | 55 | |
---|
| 56 | if( root != NULL) |
---|
[6222] | 57 | this->loadParams(root); |
---|
[4245] | 58 | } |
---|
| 59 | |
---|
| 60 | |
---|
[9927] | 61 | /** |
---|
| 62 | * |
---|
| 63 | */ |
---|
[4679] | 64 | TestEntity::~TestEntity () |
---|
[6222] | 65 | {} |
---|
| 66 | |
---|
| 67 | |
---|
[9927] | 68 | /** |
---|
| 69 | * |
---|
| 70 | */ |
---|
[6222] | 71 | void TestEntity::init() |
---|
[4462] | 72 | { |
---|
[9869] | 73 | this->registerObject(this, TestEntity::_objectList); |
---|
[7078] | 74 | this->toList(OM_GROUP_00); |
---|
[10065] | 75 | |
---|
[10212] | 76 | /*this->material = new Material(); |
---|
[10065] | 77 | this->material->setIllum(3); |
---|
| 78 | this->material->setDiffuse(1.0,1.0,1.0); |
---|
| 79 | this->material->setSpecular(0.0,0.0,0.0); |
---|
| 80 | this->material->setAmbient(1.0, 1.0, 1.0); |
---|
[10212] | 81 | this->material->setDiffuseMap("maps/TE2.tga");*/ |
---|
[4462] | 82 | } |
---|
[4245] | 83 | |
---|
[9927] | 84 | |
---|
[6222] | 85 | /** |
---|
| 86 | * loads the Settings of a MD2Creature from an XML-element. |
---|
| 87 | * @param root the XML-element to load the MD2Creature's properties from |
---|
| 88 | */ |
---|
| 89 | void TestEntity::loadParams(const TiXmlElement* root) |
---|
| 90 | { |
---|
[6512] | 91 | WorldEntity::loadParams(root); |
---|
[6222] | 92 | } |
---|
| 93 | |
---|
[10018] | 94 | void TestEntity::draw() const |
---|
| 95 | { |
---|
| 96 | // if(!mediaLoaded) |
---|
| 97 | // false; |
---|
[6222] | 98 | |
---|
[10212] | 99 | // glPushAttrib(GL_ENABLE_BIT); |
---|
| 100 | // glDisable(GL_LIGHTING); |
---|
[10018] | 101 | // glDisable(GL_BLEND); |
---|
[10065] | 102 | // |
---|
[10018] | 103 | // glEnable(GL_TEXTURE_2D); |
---|
| 104 | // glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter)); |
---|
[4488] | 105 | |
---|
[10212] | 106 | // glPushMatrix(); |
---|
[10018] | 107 | /* glTranslatef (this->getAbsCoor ().x, |
---|
| 108 | this->getAbsCoor ().y, |
---|
| 109 | this->getAbsCoor ().z); |
---|
| 110 | glRotatef(axis, 0.0f, 1.0f, 0.0f);*/ |
---|
| 111 | //PRINTF(0)("axis: %f\n", axis); |
---|
[10212] | 112 | //glEnable(GL_BLEND); // Turn Blending On |
---|
[6222] | 113 | |
---|
[9927] | 114 | |
---|
[10065] | 115 | |
---|
[10212] | 116 | //glColor4f(0, 0, 0, i); |
---|
[10018] | 117 | |
---|
[10212] | 118 | // glBegin(GL_QUADS); |
---|
| 119 | // glVertex3f(-1.0f, -100.0f, -100.0f); |
---|
[10018] | 120 | // glTexCoord2f(1.0f, 1.0f); |
---|
[10212] | 121 | // glVertex3f(-1.0f, -100.0f, 100.0f); |
---|
[10018] | 122 | // glTexCoord2f(0.0f, 1.0f); |
---|
[10212] | 123 | // glVertex3f(-1.0f, 100.0f, 100.0f); |
---|
[10018] | 124 | // glTexCoord2f(0.0f, 0.0f); |
---|
[10212] | 125 | // glVertex3f(-1.0f, 100.0f, -100.0f); |
---|
[10018] | 126 | // glTexCoord2f(1.0f, 0.0f); |
---|
| 127 | |
---|
[10212] | 128 | // glEnd(); |
---|
[10018] | 129 | |
---|
[10212] | 130 | // glPopMatrix(); |
---|
| 131 | // glPopAttrib(); |
---|
[4245] | 132 | } |
---|
| 133 | |
---|
[9927] | 134 | /** |
---|
| 135 | * |
---|
| 136 | */ |
---|
[10018] | 137 | void TestEntity::tick (float time) |
---|
[7071] | 138 | { |
---|
[10212] | 139 | // if (state==0 && i==1) |
---|
| 140 | // i=0; |
---|
| 141 | // if (state==1 && i<=1) |
---|
| 142 | // i=i+0.005; |
---|
[10065] | 143 | } |
---|
[7488] | 144 | |
---|
[5087] | 145 | |
---|
[10065] | 146 | void TestEntity::changeState (bool sta) |
---|
| 147 | { |
---|
| 148 | state=sta; |
---|
[10018] | 149 | } |
---|