Changeset 3790 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 13, 2005, 12:33:07 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 1 deleted
- 16 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/Makefile.am
r3761 r3790 7 7 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data 8 8 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics 9 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/font10 9 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer 11 10 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui … … 34 33 track_manager.cc \ 35 34 track_node.cc \ 35 animation.cc \ 36 36 simple_animation.cc \ 37 37 garbage_collector.cc \ … … 57 57 lib/graphics/graphics_engine.cc \ 58 58 lib/graphics/light.cc \ 59 lib/graphics/ font/fontset.cc \59 lib/graphics/text_engine.cc \ 60 60 lib/graphics/importer/array.cc \ 61 61 lib/graphics/importer/objModel.cc \ … … 83 83 track_manager.h \ 84 84 track_node.h \ 85 animation.h \ 85 86 simple_animation.h \ 86 87 garbage_collector.h \ … … 114 115 lib/graphics/graphics_engine.h \ 115 116 lib/graphics/light.h \ 116 lib/graphics/ font/fontset.h \117 lib/graphics/text_engine.h \ 117 118 lib/data/data_tank.h \ 118 119 lib/lang/base_entity.h \ -
orxonox/trunk/src/Makefile.in
r3789 r3790 56 56 command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \ 57 57 track_manager.$(OBJEXT) track_node.$(OBJEXT) \ 58 simple_animation.$(OBJEXT) garbage_collector.$(OBJEXT) \59 story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \60 world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \61 skysphere.$(OBJEXT) terrain.$(OBJEXT) weapon.$(OBJEXT) \62 projectile.$(OBJEXT) satellite.$(OBJEXT) \63 character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \64 test_ bullet.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \65 null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \58 animation.$(OBJEXT) simple_animation.$(OBJEXT) \ 59 garbage_collector.$(OBJEXT) story_entity.$(OBJEXT) \ 60 campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \ 61 player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \ 62 terrain.$(OBJEXT) weapon.$(OBJEXT) projectile.$(OBJEXT) \ 63 satellite.$(OBJEXT) character_attributes.$(OBJEXT) \ 64 test_gun.$(OBJEXT) test_bullet.$(OBJEXT) ai.$(OBJEXT) \ 65 p_node.$(OBJEXT) null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \ 66 66 data_tank.$(OBJEXT) graphics_engine.$(OBJEXT) light.$(OBJEXT) \ 67 fontset.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \67 text_engine.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \ 68 68 primitive_model.$(OBJEXT) model.$(OBJEXT) material.$(OBJEXT) \ 69 69 texture.$(OBJEXT) base_entity.$(OBJEXT) base_object.$(OBJEXT) \ … … 75 75 depcomp = $(SHELL) $(top_srcdir)/depcomp 76 76 am__depfiles_maybe = depfiles 77 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ai.Po ./$(DEPDIR)/a rray.Po \78 @AMDEP_TRUE@ ./$(DEPDIR)/ base_entity.Po \77 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ai.Po ./$(DEPDIR)/animation.Po \ 78 @AMDEP_TRUE@ ./$(DEPDIR)/array.Po ./$(DEPDIR)/base_entity.Po \ 79 79 @AMDEP_TRUE@ ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \ 80 80 @AMDEP_TRUE@ ./$(DEPDIR)/campaign.Po \ … … 82 82 @AMDEP_TRUE@ ./$(DEPDIR)/command_node.Po ./$(DEPDIR)/curve.Po \ 83 83 @AMDEP_TRUE@ ./$(DEPDIR)/data_tank.Po \ 84 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po ./$(DEPDIR)/fontset.Po\84 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po \ 85 85 @AMDEP_TRUE@ ./$(DEPDIR)/game_loader.Po \ 86 86 @AMDEP_TRUE@ ./$(DEPDIR)/garbage_collector.Po \ … … 102 102 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/terrain.Po \ 103 103 @AMDEP_TRUE@ ./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \ 104 @AMDEP_TRUE@ ./$(DEPDIR)/text ure.Po \104 @AMDEP_TRUE@ ./$(DEPDIR)/text_engine.Po ./$(DEPDIR)/texture.Po \ 105 105 @AMDEP_TRUE@ ./$(DEPDIR)/track_manager.Po \ 106 106 @AMDEP_TRUE@ ./$(DEPDIR)/track_node.Po ./$(DEPDIR)/vector.Po \ … … 235 235 target_vendor = @target_vendor@ 236 236 MAINSRCDIR = . 237 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/ font -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai237 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai 238 238 AM_LDFLAGS = $(MWINDOWS) 239 239 orxonox_SOURCES = orxonox.cc \ … … 244 244 track_manager.cc \ 245 245 track_node.cc \ 246 animation.cc \ 246 247 simple_animation.cc \ 247 248 garbage_collector.cc \ … … 267 268 lib/graphics/graphics_engine.cc \ 268 269 lib/graphics/light.cc \ 269 lib/graphics/ font/fontset.cc \270 lib/graphics/text_engine.cc \ 270 271 lib/graphics/importer/array.cc \ 271 272 lib/graphics/importer/objModel.cc \ … … 293 294 track_manager.h \ 294 295 track_node.h \ 296 animation.h \ 295 297 simple_animation.h \ 296 298 garbage_collector.h \ … … 324 326 lib/graphics/graphics_engine.h \ 325 327 lib/graphics/light.h \ 326 lib/graphics/ font/fontset.h \328 lib/graphics/text_engine.h \ 327 329 lib/data/data_tank.h \ 328 330 lib/lang/base_entity.h \ … … 416 418 417 419 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Po@am__quote@ 420 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation.Po@am__quote@ 418 421 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 419 422 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@ … … 426 429 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@ 427 430 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@ 428 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontset.Po@am__quote@429 431 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@ 430 432 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbage_collector.Po@am__quote@ … … 453 455 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bullet.Po@am__quote@ 454 456 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gun.Po@am__quote@ 457 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_engine.Po@am__quote@ 455 458 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 456 459 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_manager.Po@am__quote@ … … 813 816 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o light.obj `if test -f 'lib/graphics/light.cc'; then $(CYGPATH_W) 'lib/graphics/light.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/light.cc'; fi` 814 817 815 fontset.o: lib/graphics/font/fontset.cc816 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fontset.o -MD -MP -MF "$(DEPDIR)/fontset.Tpo" -c -o fontset.o `test -f 'lib/graphics/font/fontset.cc' || echo '$(srcdir)/'`lib/graphics/font/fontset.cc; \817 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ fontset.Tpo" "$(DEPDIR)/fontset.Po"; else rm -f "$(DEPDIR)/fontset.Tpo"; exit 1; fi818 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/ font/fontset.cc' object='fontset.o' libtool=no @AMDEPBACKSLASH@819 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/ fontset.Po' tmpdepfile='$(DEPDIR)/fontset.TPo' @AMDEPBACKSLASH@820 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 821 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fontset.o `test -f 'lib/graphics/font/fontset.cc' || echo '$(srcdir)/'`lib/graphics/font/fontset.cc822 823 fontset.obj: lib/graphics/font/fontset.cc824 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fontset.obj -MD -MP -MF "$(DEPDIR)/fontset.Tpo" -c -o fontset.obj `if test -f 'lib/graphics/font/fontset.cc'; then $(CYGPATH_W) 'lib/graphics/font/fontset.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/font/fontset.cc'; fi`; \825 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ fontset.Tpo" "$(DEPDIR)/fontset.Po"; else rm -f "$(DEPDIR)/fontset.Tpo"; exit 1; fi826 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/ font/fontset.cc' object='fontset.obj' libtool=no @AMDEPBACKSLASH@827 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/ fontset.Po' tmpdepfile='$(DEPDIR)/fontset.TPo' @AMDEPBACKSLASH@828 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 829 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fontset.obj `if test -f 'lib/graphics/font/fontset.cc'; then $(CYGPATH_W) 'lib/graphics/font/fontset.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/font/fontset.cc'; fi`818 text_engine.o: lib/graphics/text_engine.cc 819 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT text_engine.o -MD -MP -MF "$(DEPDIR)/text_engine.Tpo" -c -o text_engine.o `test -f 'lib/graphics/text_engine.cc' || echo '$(srcdir)/'`lib/graphics/text_engine.cc; \ 820 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/text_engine.Tpo" "$(DEPDIR)/text_engine.Po"; else rm -f "$(DEPDIR)/text_engine.Tpo"; exit 1; fi 821 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/text_engine.cc' object='text_engine.o' libtool=no @AMDEPBACKSLASH@ 822 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/text_engine.Po' tmpdepfile='$(DEPDIR)/text_engine.TPo' @AMDEPBACKSLASH@ 823 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 824 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o text_engine.o `test -f 'lib/graphics/text_engine.cc' || echo '$(srcdir)/'`lib/graphics/text_engine.cc 825 826 text_engine.obj: lib/graphics/text_engine.cc 827 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT text_engine.obj -MD -MP -MF "$(DEPDIR)/text_engine.Tpo" -c -o text_engine.obj `if test -f 'lib/graphics/text_engine.cc'; then $(CYGPATH_W) 'lib/graphics/text_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/text_engine.cc'; fi`; \ 828 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/text_engine.Tpo" "$(DEPDIR)/text_engine.Po"; else rm -f "$(DEPDIR)/text_engine.Tpo"; exit 1; fi 829 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/text_engine.cc' object='text_engine.obj' libtool=no @AMDEPBACKSLASH@ 830 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/text_engine.Po' tmpdepfile='$(DEPDIR)/text_engine.TPo' @AMDEPBACKSLASH@ 831 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 832 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o text_engine.obj `if test -f 'lib/graphics/text_engine.cc'; then $(CYGPATH_W) 'lib/graphics/text_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/text_engine.cc'; fi` 830 833 831 834 array.o: lib/graphics/importer/array.cc … … 1175 1178 1176 1179 distdir: $(DISTFILES) 1177 $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/ graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/world_entities1180 $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/world_entities 1178 1181 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 1179 1182 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ -
orxonox/trunk/src/defs/debug.h
r3752 r3790 71 71 #define DEBUG_MODULE_PLAYER 1 72 72 #define DEBUG_MODULE_MATH 0 73 #define DEBUG_MODULE_FONT 4 73 74 74 75 #define DEBUG_MODULE_NULL_PARENT 0 -
orxonox/trunk/src/defs/glincl.h
r3492 r3790 9 9 #define _GLINCL_H 10 10 11 #include <SDL.h> 12 11 13 #ifndef __APPLE__ 12 #include <SDL/SDL.h>13 14 #include <GL/gl.h> 14 15 #include <GL/glu.h> 15 16 #else 16 #include <SDL.h>17 17 #include <OpenGL/gl.h> 18 18 #include <OpenGL/glu.h> -
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r3622 r3790 167 167 168 168 169 /** 170 \brief entering 2D Mode 171 172 this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else 173 */ 174 void GraphicsEngine::enter2DMode(void) 175 { 176 SDL_Surface *screen = SDL_GetVideoSurface(); 177 178 /* Note, there may be other things you need to change, 179 depending on how you have your OpenGL state set up. 180 */ 181 glPushAttrib(GL_ENABLE_BIT); 182 glDisable(GL_DEPTH_TEST); 183 glDisable(GL_CULL_FACE); 184 glDisable(GL_LIGHTING); // will be set back when leaving 2D-mode 185 glEnable(GL_TEXTURE_2D); 186 187 /* This allows alpha blending of 2D textures with the scene */ 188 glEnable(GL_BLEND); 189 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 190 191 glViewport(0, 0, screen->w, screen->h); 192 193 glMatrixMode(GL_PROJECTION); 194 glPushMatrix(); 195 glLoadIdentity(); 196 197 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0); 198 199 glMatrixMode(GL_MODELVIEW); 200 glPushMatrix(); 201 glLoadIdentity(); 202 203 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 204 } 205 206 /** 207 \brief leaves the 2DMode again also \see Font::enter2DMode(void) 208 */ 209 void GraphicsEngine::leave2DMode(void) 210 { 211 glMatrixMode(GL_MODELVIEW); 212 glPopMatrix(); 213 214 glMatrixMode(GL_PROJECTION); 215 glPopMatrix(); 216 217 glPopAttrib(); 218 } 169 219 170 220 -
orxonox/trunk/src/lib/graphics/graphics_engine.h
r3619 r3790 26 26 int setGLattribs(void); 27 27 int setResolution(int width, int height, int bpp); 28 /** \returns the x resolution */ 29 inline int getResolutionX(void) {return this->resolutionX;} 30 /** \returns the y resolution */ 31 inline int getResolutionY(void) {return this->resolutionY;} 32 /** \returns the Bits Per Pixel */ 33 inline int getbbp(void) {return this->bitsPerPixel;} 28 34 int resolutionChanged(SDL_ResizeEvent* resizeInfo); 29 35 void listModes(void); 30 36 31 37 static bool texturesEnabled; 38 39 static void enter2DMode(void); 40 static void leave2DMode(void); 32 41 33 42 private: -
orxonox/trunk/src/lib/graphics/importer/material.cc
r3672 r3790 30 30 using namespace std; 31 31 32 33 /**34 \brief creates a default Material with no Name35 normally you call this to create a material List (for an obj-file) and then append with addMaterial()36 */37 Material::Material()38 {39 this->init();40 41 this->setName ("");42 }43 44 32 /** 45 33 \brief creates a Material. … … 48 36 Material::Material (char* mtlName) 49 37 { 50 this->init(); 51 52 this->setName (mtlName); 38 PRINTF(4)("initializing new Material.\n"); 39 this->nextMat = NULL; 40 this->name =""; 41 this->setIllum(3); 42 this->setDiffuse(0,0,0); 43 this->setAmbient(0,0,0); 44 this->setSpecular(.5,.5,.5); 45 this->setShininess(2.0); 46 this->setTransparency(1.0); 47 48 49 this->diffuseTexture = NULL; 50 this->ambientTexture = NULL; 51 this->specularTexture = NULL; 52 53 this->diffuseTextureSet = false; 54 this->ambientTextureSet = false; 55 this->specularTextureSet = false; 56 57 if (mtlName) 58 this->setName (mtlName); 59 else 60 this->setName(""); 53 61 } 54 62 … … 86 94 87 95 /** 88 \brief initializes a new Material with its default Values89 */90 void Material::init(void)91 {92 PRINTF(4)("initializing new Material.\n");93 this->nextMat = NULL;94 this->name ="";95 this->setIllum(3);96 this->setDiffuse(0,0,0);97 this->setAmbient(0,0,0);98 this->setSpecular(.5,.5,.5);99 this->setShininess(2.0);100 this->setTransparency(0.0);101 102 103 this->diffuseTexture = NULL;104 this->ambientTexture = NULL;105 this->specularTexture = NULL;106 107 this->diffuseTextureSet = false;108 this->ambientTextureSet = false;109 this->specularTextureSet = false;110 }111 112 /**113 96 \brief Search for a Material called mtlName 114 97 \param mtlName the Name of the Material to search for … … 151 134 glMaterialf(GL_FRONT, GL_SHININESS, this->shininess); 152 135 136 // setting the transparency 137 if (this->transparency == 1.0) 138 { 139 glDisable(GL_BLEND); 140 } 141 else 142 { 143 glEnable(GL_BLEND); 144 glColor4f(1.0f, 1.0f, 1.0f, this->transparency); 145 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 146 } 147 153 148 // setting illumination Model 154 149 if (this->illumModel == 1) //! \todo make this work, if no vertex-normals are read. -
orxonox/trunk/src/lib/graphics/importer/material.h
r3590 r3790 22 22 { 23 23 public: 24 Material (); 25 Material (char* mtlName); 24 Material (char* mtlName = ""); 26 25 Material* addMaterial(char* mtlName); 27 26 ~Material (); 28 void init(void);29 27 30 28 Material* search(char* mtlName); -
orxonox/trunk/src/lib/graphics/importer/texture.cc
r3660 r3790 98 98 } 99 99 100 #ifdef HAVE_SDL_ SDL_IMAGE_H100 #ifdef HAVE_SDL_IMAGE_H 101 101 bool Texture::loadImage(const char* imageName) 102 102 { … … 118 118 pImage->format = GL_RGB; 119 119 else if (pImage->bpp == 4) 120 pImage->format = GL_RGBA; 121 120 { 121 pImage->format = GL_RGBA; 122 SDL_SetAlpha(this->map, 0, 0); 123 } 124 122 125 if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb"))) 123 126 for (int i=0;i<map->h * map->w *3;i+=3) … … 146 149 147 150 148 #else /* HAVE_SDL_ SDL_IMAGE_H */151 #else /* HAVE_SDL_IMAGE_H */ 149 152 /** 150 153 \brief Makes the Programm ready to Read-in a texture-File … … 832 835 833 836 } 834 #endif /* HAVE_SDL_ SDL_IMAGE_H */837 #endif /* HAVE_SDL_IMAGE_H */ -
orxonox/trunk/src/lib/graphics/importer/texture.h
r3660 r3790 14 14 #include "debug.h" 15 15 16 #ifdef HAVE_SDL_ SDL_IMAGE_H17 #include <SDL /SDL_image.h>16 #ifdef HAVE_SDL_IMAGE_H 17 #include <SDL_image.h> 18 18 #else 19 19 // IMAGE LIBS // … … 26 26 #include <png.h> 27 27 #endif /* HAVE_PNG_H */ 28 #endif /* HAVE_SDL_ SDL_IMAGE_H */28 #endif /* HAVE_SDL_IMAGE_H */ 29 29 30 30 //! A Class, that reads in Textures from different fileformats. … … 57 57 58 58 bool loadImage(const char* imageName); 59 #ifndef HAVE_SDL_ SDL_IMAGE_H59 #ifndef HAVE_SDL_IMAGE_H 60 60 61 61 bool loadBMP (char* bmpName); … … 74 74 75 75 }; 76 77 78 79 76 #endif /* _TEXTURE_H */ -
orxonox/trunk/src/lib/util/list.h
r3669 r3790 107 107 void destroy(); 108 108 T* firstElement(); 109 T* lastElement(); 109 110 bool isEmpty(); 110 111 int getSize(); … … 217 218 } 218 219 220 template<class T> 221 T* tList<T>::lastElement() 222 { 223 return this->last->curr; 224 } 225 219 226 220 227 template<class T> -
orxonox/trunk/src/lib/util/resource_manager.cc
r3677 r3790 22 22 #include "primitive_model.h" 23 23 #include "texture.h" 24 #include "text_engine.h" 24 25 25 26 #include "list.h" … … 141 142 \returns a pointer to a desired Resource. 142 143 */ 143 void* ResourceManager::load(const char* fileName, ResourcePriority prio )144 void* ResourceManager::load(const char* fileName, ResourcePriority prio, void* param1, void* param2, void* param3) 144 145 { 145 146 ResourceType tmpType; … … 158 159 !strcmp(fileName, "cone")) 159 160 tmpType = PRIM; 161 else if (!strncmp(fileName+(strlen(fileName)-4), ".ttf", 4)) 162 tmpType = TTF; 160 163 else 161 164 tmpType = IMAGE; 162 165 163 return this->load(fileName, tmpType, prio );166 return this->load(fileName, tmpType, prio, param1, param2, param3); 164 167 } 165 168 … … 171 174 \returns a pointer to a desired Resource. 172 175 */ 173 void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio )176 void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio, void* param1, void* param2, void* param3) 174 177 { 175 178 // searching if the resource was loaded before. 176 Resource* tmpResource = this->locateResourceBy Name(fileName);179 Resource* tmpResource = this->locateResourceByInfo(fileName, type, param1, param2,param3); 177 180 if (tmpResource) // if the resource was not loaded before. 178 181 { … … 201 204 { 202 205 case OBJ: 206 if (param1) 207 tmpResource->modelSize = *(float*)param1; 208 else 209 tmpResource->modelSize = 1.0; 210 203 211 if(isFile(fullName)) 204 tmpResource->pointer = new OBJModel(fullName );212 tmpResource->pointer = new OBJModel(fullName, tmpResource->modelSize); 205 213 else 206 214 { 207 215 PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName); 208 tmpResource->pointer = ResourceManager::load("cube", PRIM );216 tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, &tmpResource->modelSize); 209 217 } 210 218 break; 211 219 case PRIM: 220 if (param1) 221 tmpResource->modelSize = *(float*)param1; 222 else 223 tmpResource->modelSize = 1.0; 224 212 225 if (!strcmp(tmpResource->name, "cube")) 213 tmpResource->pointer = new PrimitiveModel(CUBE );226 tmpResource->pointer = new PrimitiveModel(CUBE, tmpResource->modelSize); 214 227 else if (!strcmp(tmpResource->name, "sphere")) 215 tmpResource->pointer = new PrimitiveModel(SPHERE );228 tmpResource->pointer = new PrimitiveModel(SPHERE, tmpResource->modelSize); 216 229 else if (!strcmp(tmpResource->name, "plane")) 217 tmpResource->pointer = new PrimitiveModel(PLANE );230 tmpResource->pointer = new PrimitiveModel(PLANE, tmpResource->modelSize); 218 231 else if (!strcmp(tmpResource->name, "cylinder")) 219 tmpResource->pointer = new PrimitiveModel(CYLINDER );232 tmpResource->pointer = new PrimitiveModel(CYLINDER, tmpResource->modelSize); 220 233 else if (!strcmp(tmpResource->name, "cone")) 221 tmpResource->pointer = new PrimitiveModel(CONE); 234 tmpResource->pointer = new PrimitiveModel(CONE, tmpResource->modelSize); 235 break; 236 case TTF: 237 if (param1) 238 tmpResource->ttfSize = *(int*)param1; 239 else 240 tmpResource->ttfSize = FONT_DEFAULT_SIZE; 241 if (param2) 242 { 243 Vector* tmpVec = (Vector*)param2; 244 tmpResource->ttfColorR = (int)tmpVec->x; 245 tmpResource->ttfColorG = (int)tmpVec->y; 246 tmpResource->ttfColorB = (int)tmpVec->z; 247 } 248 else 249 { 250 tmpResource->ttfColorR = FONT_DEFAULT_COLOR_R; 251 tmpResource->ttfColorG = FONT_DEFAULT_COLOR_G; 252 tmpResource->ttfColorB = FONT_DEFAULT_COLOR_B; 253 } 254 255 if(isFile(fullName)) 256 tmpResource->pointer = new Font(fullName, 257 tmpResource->ttfSize, 258 tmpResource->ttfColorR, 259 tmpResource->ttfColorG, 260 tmpResource->ttfColorB); 261 else 262 PRINTF(2)("Sorry, %s does not exist. Not loading Font\n", fullName); 222 263 break; 223 264 case IMAGE: … … 259 300 delete []fullName; 260 301 } 261 262 return tmpResource->pointer; 302 if (tmpResource->pointer) 303 return tmpResource->pointer; 304 else 305 { 306 PRINTF(2)("Resource %s could not be loaded\n", fileName); 307 delete tmpResource; 308 return NULL; 309 } 263 310 } 264 311 … … 299 346 case IMAGE: 300 347 delete (Texture*)resource->pointer; 348 break; 349 case TTF: 350 delete (Font*)resource->pointer; 301 351 break; 302 352 default: … … 342 392 343 393 /** 344 \brief Searches for a Resource by Name394 \brief Searches for a Resource by some information 345 395 \param fileName The name to look for 346 396 \returns a Pointer to the Resource if found, NULL otherwise. 347 397 */ 348 Resource* ResourceManager::locateResourceBy Name(const char* fileName)398 Resource* ResourceManager::locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3) 349 399 { 350 400 // Resource* enumRes = resourceList->enumerate(); … … 353 403 while (enumRes) 354 404 { 355 if (!strcmp(fileName, enumRes->name)) 356 { 357 delete iterator; 358 return enumRes; 405 if (enumRes->type == type && !strcmp(fileName, enumRes->name)) 406 { 407 bool match = false; 408 bool subMatch = false; 409 switch (type) 410 { 411 case PRIM: 412 case OBJ: 413 if (!param1) 414 { 415 if (enumRes->modelSize == 1.0) 416 match = true; 417 } 418 else if (enumRes->modelSize == *(float*)param1) 419 match = true; 420 break; 421 case TTF: 422 if (!param1) 423 { 424 if (enumRes->ttfSize == FONT_DEFAULT_SIZE) 425 subMatch = true; 426 } 427 else if (enumRes->modelSize =- *(int*)param1) 428 subMatch = true; 429 if(subMatch) 430 { 431 Vector* tmpVec = (Vector*)param2; 432 if (!param2) 433 { 434 if(enumRes->ttfColorR == FONT_DEFAULT_COLOR_R && 435 enumRes->ttfColorG == FONT_DEFAULT_COLOR_G && 436 enumRes->ttfColorB == FONT_DEFAULT_COLOR_B ) 437 match = true; 438 } 439 else if (enumRes->ttfColorR == (int)tmpVec->x && 440 enumRes->ttfColorG == (int)tmpVec->y && 441 enumRes->ttfColorB == (int)tmpVec->z ) 442 match = true; 443 } 444 445 break; 446 default: 447 match = true; 448 break; 449 } 450 if (match) 451 { 452 delete iterator; 453 return enumRes; 454 } 359 455 } 360 456 enumRes = iterator->nextElement(); … … 396 492 struct stat status; 397 493 stat(directoryName, &status); 398 if (status.st_mode & (S_IFDIR | S_IFLNK)) 494 if (status.st_mode & (S_IFDIR 495 #ifndef __WIN32__ 496 | S_IFLNK 497 #endif 498 )) 399 499 return true; 400 500 else … … 411 511 struct stat status; 412 512 stat(fileName, &status); 413 if (status.st_mode & (S_IFREG | S_IFLNK)) 513 if (status.st_mode & (S_IFREG 514 #ifndef __WIN32__ 515 | S_IFLNK 516 #endif 517 )) 414 518 return true; 415 519 else -
orxonox/trunk/src/lib/util/resource_manager.h
r3676 r3790 19 19 20 20 //! An eumerator for different fileTypes the resourceManager supports \todo WAV, MP3, OGG support 21 enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, IMAGE};21 enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, TTF, IMAGE}; 22 22 //! An enumerator for different UNLOAD-types. 23 23 /** … … 33 33 { 34 34 void* pointer; //!< Pointer to the Resource. 35 int count; //!< How many times this Resource has been loaded. 35 36 36 37 char* name; //!< Name of the Resource. 37 38 ResourceType type; //!< ResourceType of this Resource. 38 39 ResourcePriority prio; //!< The Priority of this resource. (This will only be increased) 39 int count; //!< How many times this Resource has been loaded. 40 41 // more specific 42 float modelSize; 43 unsigned int ttfSize; 44 unsigned char ttfColorR; 45 unsigned char ttfColorG; 46 unsigned char ttfColorB; 40 47 }; 41 48 … … 49 56 50 57 It does it by looking, if a desired file has already been loaded. 58 59 \todo loading also dependant by parameters. 51 60 */ 52 61 class ResourceManager : public BaseObject … … 58 67 bool setDataDir(char* dataDir); 59 68 bool addImageDir(char* imageDir); 60 void* load(const char* fileName, ResourcePriority prio = RP_NO); 61 void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO); 69 void* load(const char* fileName, ResourcePriority prio = RP_NO, 70 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); 71 void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO, 72 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); 62 73 bool unload(void* pointer, ResourcePriority prio = RP_NO); 63 74 bool unload(Resource* resource, ResourcePriority = RP_NO); … … 74 85 75 86 76 Resource* locateResourceBy Name(const char* fileName);87 Resource* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3); 77 88 Resource* locateResourceByPointer(const void* pointer); 78 89 -
orxonox/trunk/src/orxonox.cc
r3779 r3790 33 33 #include "graphics_engine.h" 34 34 #include "resource_manager.h" 35 #include "text_engine.h" 35 36 36 37 #include <string.h> … … 58 59 delete GraphicsEngine::getInstance(); // deleting the Graphics 59 60 delete ResourceManager::getInstance(); // deletes the Resource Manager 61 delete TextEngine::getInstance(); 60 62 } 61 63 … … 167 169 resourceManager->setDataDir("../data/"); 168 170 return 0; 171 PRINT(3)("initializing TextEngine\n"); 172 TextEngine::getInstance(); 169 173 } 170 174 -
orxonox/trunk/src/story_entities/world.cc
r3763 r3790 33 33 #include "terrain.h" 34 34 #include "light.h" 35 #include "text_engine.h" 35 36 36 37 #include "track_manager.h" … … 40 41 #include "command_node.h" 41 42 #include "glmenu_imagescreen.h" 42 #include "fontset.h"43 43 #include "list.h" 44 44 … … 157 157 delete this->lightMan; 158 158 delete this->trackManager; 159 TextEngine::getInstance()->flush(); 159 160 160 161 delete this->simpleAnimation; 161 162 //delete garbagecollecor 162 163 //delete animator 164 165 163 166 } 164 167 … … 207 210 { 208 211 // initializing Font 209 testFont = new FontSet();210 testFont->buildFont("../data/pictures/font.tga");211 212 this->glmis->step(); 212 213 213 // initializing the TrackManager 214 214 trackManager = TrackManager::getInstance(); … … 309 309 this->spawn (this->localPlayer); 310 310 /*monitor progress*/ 311 //this->glmis->step(); 311 //this->glmis->step(); 312 312 this->glmis->step(); 313 313 … … 363 363 this->glmis->step(); 364 364 365 this->testText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0); 366 testText->setText("TEXT rocks"); 367 testText->setBlending(1.0); 368 testText->setBindNode(tn); 369 370 /* 371 tmpAnim = new Animation<Text>(testText, &Text::setBlending); 372 tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 373 tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR); 374 tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 375 tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR); 376 tmpAnim->setInfinity(ANIM_INF_CONSTANT, ANIM_INF_REWIND); 377 */ 365 378 break; 366 379 } … … 553 566 glNewList (objectList, GL_COMPILE); 554 567 555 trackManager->drawGraph(.01);568 // trackManager->drawGraph(.01); 556 569 trackManager->debug(2); 557 570 glEndList(); … … 740 753 glCallList (objectList); 741 754 742 testFont->printText(0, 0, 1, "orxonox_" PACKAGE_VERSION); 743 755 TextEngine::getInstance()->draw(); 744 756 lightMan->draw(); // must be at the end of the drawing procedure, otherwise Light cannot be handled as PNodes // 745 757 } … … 892 904 { 893 905 float fps = 1000/dt; 894 PRINTF(3)("fps = %f\n", fps); 906 907 // temporary, only for showing how fast the text-engine is 908 char tmpChar[20]; 909 sprintf(tmpChar, "fps: %4.0f", fps); 895 910 } 896 911 else … … 924 939 this->garbageCollector->tick(seconds); 925 940 this->simpleAnimation->tick(seconds); 941 926 942 } 927 943 this->lastFrame = currentFrame; -
orxonox/trunk/src/story_entities/world.h
r3727 r3790 21 21 class Skysphere; 22 22 class LightManager; 23 class FontSet;24 23 class Terrain; 25 24 class GarbageCollector; 26 25 class SimpleAnimation; 26 27 class Text; 27 28 28 29 //! The game world Interface … … 96 97 bool bPause; //!< pause mode 97 98 98 FontSet* testFont; //!< A test Font. \todo fix this, so it is for real.99 99 GLMenuImageScreen* glmis; //!< The Level-Loader Display 100 101 Text* testText; //!< A text to Test the TextEngine; 100 102 101 103 char* worldName; //!< The name of this World
Note: See TracChangeset
for help on using the changeset viewer.