Changeset 6815 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jan 28, 2006, 5:11:51 PM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 6 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/Makefile.am
r6753 r6815 9 9 render2D/render_2d.cc \ 10 10 render2D/element_2d.cc \ 11 render2D/billboard.cc \ 11 12 text_engine/text_engine.cc \ 12 13 text_engine/text.cc \ 13 14 text_engine/font.cc \ 14 15 effects/graphics_effect.cc \ 15 effects/fog_effect.cc 16 effects/fog_effect.cc \ 17 effects/lense_flare.cc 18 16 19 17 20 noinst_HEADERS = graphics_engine.h \ … … 20 23 render2D/render_2d.h \ 21 24 render2D/element_2d.h \ 25 render2D/billboard.h \ 22 26 text_engine/text_engine.h \ 23 27 text_engine/text.h \ 24 28 text_engine/font.h \ 25 29 effects/graphics_effect.h \ 26 effects/fog_effect.h 30 effects/fog_effect.h \ 31 effects/lense_flare.h 27 32 28 33 -
trunk/src/lib/graphics/effects/fog_effect.cc
r6772 r6815 62 62 void FogEffect::loadParams(const TiXmlElement* root) 63 63 { 64 printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.loadParms\n\n"); 64 65 GraphicsEffect::loadParams(root); 65 66 66 LoadParam(root, "fog- effect", this, FogEffect, setFogMode)67 LoadParam(root, "fog-mode", this, FogEffect, setFogMode) 67 68 .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}"); 68 69 … … 87 88 bool FogEffect::activate() 88 89 { 90 printf("fog==============================================>>>>>>>>>>>>>>>>>>>>>>>>...\n\n"); 89 91 PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity, 90 92 this->fogStart, this->fogEnd); … … 92 94 glEnable(GL_FOG); 93 95 { 94 GLfloat fogColor[4] = {0. 5, 0.5, 0.5, 1.0};96 GLfloat fogColor[4] = {0.6, 0.6, 0.6, 1.0}; 95 97 96 98 glFogi(GL_FOG_MODE, this->fogMode); -
trunk/src/lib/graphics/effects/graphics_effect.cc
r6772 r6815 72 72 bool GraphicsEffect::init() 73 73 {} 74 75 76 77 /** 78 * draws the effect, if needed 79 */ 80 void GraphicsEffect::draw() const 81 {} 82 83 84 85 /** 86 * ticks the effect if there is any time dependancy 87 */ 88 void GraphicsEffect::tick(float dt) 89 {} -
trunk/src/lib/graphics/effects/graphics_effect.h
r6772 r6815 25 25 virtual bool deactivate() = 0; 26 26 27 inline bool isActivated() { return this->bActivated; } 27 virtual void draw() const; 28 virtual void tick(float dt); 29 30 inline bool isActivated() const { return this->bActivated; } 28 31 29 32 -
trunk/src/lib/graphics/graphics_engine.cc
r6780 r6815 41 41 #include "shell_command.h" 42 42 43 44 #include "parser/tinyxml/tinyxml.h" 45 #include "load_param.h" 46 #include "factory.h" 47 43 48 #ifdef __WIN32__ 44 49 #include "class_list.h" … … 113 118 GraphicsEngine::singletonRef = NULL; 114 119 } 120 121 122 /** 123 * loads the GraphicsEngine Specific Parameters. 124 * @param root: the XML-Element to load the Data From 125 */ 126 void GraphicsEngine::loadParams(const TiXmlElement* root) 127 { 128 LoadParamXML(root, "load-effect", this, GraphicsEngine, loadGraphicsEffectXML) 129 .describe("loads a graphics effect"); 130 } 131 115 132 116 133 /** … … 150 167 this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16); 151 168 152 GraphicsEffect* fe = new FogEffect(NULL);153 this->loadGraphicsEffect(fe);154 fe->activate();155 PRINTF(0)("--------------------------------------------------------------\n");169 // GraphicsEffect* fe = new FogEffect(NULL); 170 // this->loadGraphicsEffect(fe); 171 // fe->activate(); 172 // PRINTF(0)("--------------------------------------------------------------\n"); 156 173 } 157 174 … … 571 588 #endif /* NO_TEXT */ 572 589 573 574 } 590 } 591 575 592 Render2D::getInstance()->tick(dt); 593 594 // tick the graphics effects 595 list<GraphicsEffect*>::iterator it; 596 for (it = this->graphicsEffects.begin(); it != this->graphicsEffects.end(); it++) 597 (*it)->tick(dt); 576 598 } 577 599 … … 587 609 Render2D::getInstance()->draw(E2D_LAYER_ALL); 588 610 Shader::restoreShader(); 611 612 //draw the graphics 613 list<GraphicsEffect*>::const_iterator it; 614 for (it = this->graphicsEffects.begin(); it != this->graphicsEffects.end(); it++) 615 (*it)->draw(); 589 616 } 590 617 … … 661 688 662 689 /** 690 * @param root The XML-element to load GraphicsEffects from 691 */ 692 void GraphicsEngine::loadGraphicsEffectXML(const TiXmlElement* root) 693 { 694 const TiXmlElement* element = root->FirstChildElement(); 695 696 while (element != NULL) 697 { 698 Factory::fabricate(element); 699 700 element = element->NextSiblingElement(); 701 } 702 } 703 704 705 /** 663 706 * loads a GraphicsEffect into the engine 664 707 * @param effect the GraphicsEffect to add -
trunk/src/lib/graphics/graphics_engine.h
r6753 r6815 23 23 class WorldEntity; 24 24 class GraphicsEffect; 25 class TiXmlElement; 25 26 26 27 //! class to handle graphics … … 34 35 /** @returns a Pointer to the only object of this Class */ 35 36 inline static GraphicsEngine* getInstance() { if (!GraphicsEngine::singletonRef) GraphicsEngine::singletonRef = new GraphicsEngine(); return GraphicsEngine::singletonRef; }; 37 38 virtual void loadParams(const TiXmlElement* root); 36 39 37 40 int init(); … … 83 86 void process(const Event &event); 84 87 88 void loadGraphicsEffectXML(const TiXmlElement* root); 85 89 bool loadGraphicsEffect(GraphicsEffect* effect); 86 90 bool unloadGraphicsEffect(GraphicsEffect* effect);
Note: See TracChangeset
for help on using the changeset viewer.