Changeset 6532 in orxonox.OLD for trunk/src/subprojects/importer
- Timestamp:
- Jan 18, 2006, 1:20:02 PM (19 years ago)
- Location:
- trunk/src/subprojects/importer
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/subprojects/importer/Makefile.am
r6310 r6532 7 7 8 8 bin_PROGRAMS = importer \ 9 multitex 9 multitex \ 10 movie_player_test 10 11 11 12 importer_LDADD = $(MAINSRCDIR)/lib/event/libORXevent.a \ … … 63 64 $(MAINSRCDIR)/lib/util/executor/executor.cc \ 64 65 $(MAINSRCDIR)/util/loading/factory.cc 66 67 movie_player_test_LDADD = $(MAINSRCDIR)/lib/event/libORXevent.a \ 68 $(MAINSRCDIR)/lib/parser/tinyxml/libtinyxml.a \ 69 $(MAINSRCDIR)/lib/graphics/libORXgraphics.a \ 70 $(MAINSRCDIR)/lib/shell/libORXshell.a \ 71 $(MAINSRCDIR)/lib/sound/libORXsound.a \ 72 $(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a 73 74 movie_player_test_SOURCES= ../framework.cc \ 75 movie_player_test.cc \ 76 $(MAINSRCDIR)/util/state.cc \ 77 $(MAINSRCDIR)/world_entities/camera.cc \ 78 $(MAINSRCDIR)/lib/lang/base_object.cc \ 79 $(MAINSRCDIR)/lib/lang/class_list.cc \ 80 $(MAINSRCDIR)/lib/math/vector.cc \ 81 $(MAINSRCDIR)/util/loading/resource_manager.cc \ 82 $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \ 83 $(MAINSRCDIR)/lib/coord/p_node.cc \ 84 $(MAINSRCDIR)/lib/coord/null_parent.cc \ 85 $(MAINSRCDIR)/util/loading/load_param.cc \ 86 $(MAINSRCDIR)/util/loading/load_param_description.cc \ 87 $(MAINSRCDIR)/lib/util/helper_functions.cc \ 88 $(MAINSRCDIR)/lib/util/substring.cc \ 89 $(MAINSRCDIR)/lib/util/color.cc \ 90 $(MAINSRCDIR)/lib/util/multi_type.cc \ 91 $(MAINSRCDIR)/lib/util/executor/executor.cc \ 92 $(MAINSRCDIR)/util/loading/factory.cc -
trunk/src/subprojects/importer/multitex.cc
r5866 r6532 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.