Changeset 6486 in orxonox.OLD for branches/avi_play_merge/src/subprojects/importer/multitex.cc
- Timestamp:
- Jan 11, 2006, 4:01:06 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play_merge/src/subprojects/importer/multitex.cc
r5866 r6486 10 10 11 11 ### File Specific: 12 main-programmer: Benjamin Grauer12 main-programmer: David Hasenfratz 13 13 co-programmer: ... 14 14 … … 20 20 #include "light.h" 21 21 22 #include "texture_sequence.h"23 22 #include "material.h" 24 25 #include "objModel.h"26 27 23 #include "primitive_model.h" 28 24 #include <stdlib.h> 29 25 30 #include " resource_manager.h"26 #include "media_container.h" 31 27 32 28 Model* obj; 33 TextureSequence* seq;34 Texture* test;35 29 Material* testMat; 30 MediaContainer* media_container; 36 31 37 float counter = 0; 32 int counter = 0; 33 float timer = 0; 34 float fps; 38 35 39 36 40 37 void Framework::moduleInit(int argc, char** argv) 41 38 { 42 ResourceManager::getInstance()->addImageDir("./"); 39 if( argc <= 1) 40 { 41 printf("Wrong arguments try following notations:\n"); 42 printf("./multitex [media_file]\n"); 43 exit(0); 44 } 45 46 media_container = new MediaContainer(argv[1]); 43 47 44 48 testMat = new Material; 45 46 seq = new TextureSequence(); 47 for (int i = 1; i < argc; i++) 48 { 49 seq->addFrame(argv[i]); 50 printf("%s\n", argv[i]); 51 } 52 test = new Texture(argv[1]); 53 testMat->setDiffuseMap(argv[1]); 54 55 ResourceManager::getInstance()->addImageDir(""); 56 57 58 obj = new PrimitiveModel(PRIM_SPHERE, 10.0); 59 60 ResourceManager::getInstance()->debug(); 49 testMat->setDiffuseMap("maps/radialTransparency.png"); 50 obj = new PrimitiveModel(PRIM_PLANE, 10.0); 61 51 62 52 LightManager* lightMan = LightManager::getInstance(); … … 64 54 (new Light())->setAbsCoor(5.0, 10.0, 40.0); 65 55 (new Light())->setAbsCoor(-10, -20, -100); 56 57 fps = media_container->getFPS(); 66 58 } 67 59 … … 73 65 switch (event->key.keysym.sym) 74 66 { 75 case SDLK_i: 67 case SDLK_1: 68 obj = new PrimitiveModel(PRIM_CUBE, 10.0); 69 break; 70 case SDLK_2: 71 obj = new PrimitiveModel(PRIM_SPHERE, 10.0); 72 break; 73 case SDLK_3: 74 obj = new PrimitiveModel(PRIM_PLANE, 10.0); 75 break; 76 // increase fps 77 case SDLK_9: 78 fps++; 79 PRINTF(0)("fps: %0.2f\n", fps); 80 break; 81 // decrease fps 82 case SDLK_8: 83 if(fps > 0) 84 fps--; 85 PRINTF(0)("fps: %0.2f\n", fps); 76 86 break; 77 87 } … … 81 91 void Framework::moduleTick(float dt) 82 92 { 83 counter+=dt;93 timer += dt; 84 94 85 seq->gotoFrame((unsigned int)counter); 86 if ((unsigned int)counter > seq->getFrameCount()) 87 counter = 0; 95 if(counter != fps * timer) 96 { 97 counter = fps * timer; 98 99 if (counter >= media_container->getFrameCount()) 100 { 101 timer = 0; 102 counter = 0; 103 } 104 } 88 105 } 89 106 … … 91 108 { 92 109 testMat->select(); 93 glBindTexture(GL_TEXTURE_2D, seq->getTexture());110 glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter)); 94 111 obj->draw(); 95 112 … … 97 114 } 98 115 99 100 116 void Framework::moduleHelp(void) const 101 117 {
Note: See TracChangeset
for help on using the changeset viewer.