Changeset 3953 in orxonox.OLD for orxonox/branches/physics/src/lib
- Timestamp:
- Apr 25, 2005, 9:29:41 AM (20 years ago)
- Location:
- orxonox/branches/physics/src/lib
- Files:
-
- 5 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/lib/graphics/importer/Makefile.am
r3658 r3953 4 4 AM_CXXFLAGS+=-I$(MAINSRCDIR)/story_entities 5 5 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib 6 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/coord 6 7 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data 7 8 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics 8 9 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer 10 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui 9 11 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang 10 12 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/util … … 15 17 AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu 16 18 AM_CXXFLAGS+=-I$(MAINSRCDIR)/ai 19 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util 20 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation 21 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common 17 22 18 23 … … 34 39 $(MAINSRCDIR)/lib/lang/base_object.cc \ 35 40 $(MAINSRCDIR)/lib/math/vector.cc \ 36 $(MAINSRCDIR)/lib/util/resource_manager.cc 41 $(MAINSRCDIR)/util/resource_manager.cc \ 42 $(MAINSRCDIR)/lib/graphics/text_engine.cc \ 43 $(MAINSRCDIR)/lib/coord/p_node.cc \ 44 $(MAINSRCDIR)/lib/coord/null_parent.cc 37 45 38 46 noinst_HEADERS= framework.h \ -
orxonox/branches/physics/src/lib/graphics/importer/Makefile.in
r3789 r3953 57 57 array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \ 58 58 graphics_engine.$(OBJEXT) base_object.$(OBJEXT) \ 59 vector.$(OBJEXT) resource_manager.$(OBJEXT) 59 vector.$(OBJEXT) resource_manager.$(OBJEXT) \ 60 text_engine.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT) 60 61 importer_OBJECTS = $(am_importer_OBJECTS) 61 62 importer_LDADD = $(LDADD) … … 68 69 @AMDEP_TRUE@ ./$(DEPDIR)/graphics_engine.Po \ 69 70 @AMDEP_TRUE@ ./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \ 70 @AMDEP_TRUE@ ./$(DEPDIR)/objModel.Po \ 71 @AMDEP_TRUE@ ./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/objModel.Po \ 72 @AMDEP_TRUE@ ./$(DEPDIR)/p_node.Po \ 71 73 @AMDEP_TRUE@ ./$(DEPDIR)/primitive_model.Po \ 72 74 @AMDEP_TRUE@ ./$(DEPDIR)/resource_manager.Po \ 73 @AMDEP_TRUE@ ./$(DEPDIR)/text ure.Po ./$(DEPDIR)/vector.Po \74 @AMDEP_TRUE@ ./$(DEPDIR)/ windowHandler.Po75 @AMDEP_TRUE@ ./$(DEPDIR)/text_engine.Po ./$(DEPDIR)/texture.Po \ 76 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po 75 77 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 76 78 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 194 196 target_vendor = @target_vendor@ 195 197 MAINSRCDIR = ../../.. 196 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/ data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -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)/ai198 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 -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common 197 199 AM_LDFLAGS = $(MWINDOWS) 198 200 importer_SOURCES = framework.cc \ … … 207 209 $(MAINSRCDIR)/lib/lang/base_object.cc \ 208 210 $(MAINSRCDIR)/lib/math/vector.cc \ 209 $(MAINSRCDIR)/lib/util/resource_manager.cc 211 $(MAINSRCDIR)/util/resource_manager.cc \ 212 $(MAINSRCDIR)/lib/graphics/text_engine.cc \ 213 $(MAINSRCDIR)/lib/coord/p_node.cc \ 214 $(MAINSRCDIR)/lib/coord/null_parent.cc 210 215 211 216 noinst_HEADERS = framework.h \ … … 290 295 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ 291 296 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@ 297 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null_parent.Po@am__quote@ 292 298 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@ 299 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@ 293 300 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@ 294 301 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@ 302 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_engine.Po@am__quote@ 295 303 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 296 304 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ … … 361 369 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vector.obj `if test -f '$(MAINSRCDIR)/lib/math/vector.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/math/vector.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/math/vector.cc'; fi` 362 370 363 resource_manager.o: $(MAINSRCDIR)/ lib/util/resource_manager.cc364 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.o -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.o `test -f '$(MAINSRCDIR)/ lib/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/resource_manager.cc; \371 resource_manager.o: $(MAINSRCDIR)/util/resource_manager.cc 372 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.o -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.o `test -f '$(MAINSRCDIR)/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/util/resource_manager.cc; \ 365 373 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi 366 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/ lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@ 367 375 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@ 368 376 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 369 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f '$(MAINSRCDIR)/ lib/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/resource_manager.cc370 371 resource_manager.obj: $(MAINSRCDIR)/ lib/util/resource_manager.cc372 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.obj -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/ lib/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/resource_manager.cc'; fi`; \377 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f '$(MAINSRCDIR)/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/util/resource_manager.cc 378 379 resource_manager.obj: $(MAINSRCDIR)/util/resource_manager.cc 380 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.obj -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/util/resource_manager.cc'; fi`; \ 373 381 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi 374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/ lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@382 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@ 375 383 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@ 376 384 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 377 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/resource_manager.cc'; fi` 385 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/util/resource_manager.cc'; fi` 386 387 text_engine.o: $(MAINSRCDIR)/lib/graphics/text_engine.cc 388 @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 '$(MAINSRCDIR)/lib/graphics/text_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/text_engine.cc; \ 389 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/text_engine.Tpo" "$(DEPDIR)/text_engine.Po"; else rm -f "$(DEPDIR)/text_engine.Tpo"; exit 1; fi 390 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/graphics/text_engine.cc' object='text_engine.o' libtool=no @AMDEPBACKSLASH@ 391 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/text_engine.Po' tmpdepfile='$(DEPDIR)/text_engine.TPo' @AMDEPBACKSLASH@ 392 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 393 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o text_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/text_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/text_engine.cc 394 395 text_engine.obj: $(MAINSRCDIR)/lib/graphics/text_engine.cc 396 @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 '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/text_engine.cc'; fi`; \ 397 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/text_engine.Tpo" "$(DEPDIR)/text_engine.Po"; else rm -f "$(DEPDIR)/text_engine.Tpo"; exit 1; fi 398 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/graphics/text_engine.cc' object='text_engine.obj' libtool=no @AMDEPBACKSLASH@ 399 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/text_engine.Po' tmpdepfile='$(DEPDIR)/text_engine.TPo' @AMDEPBACKSLASH@ 400 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 401 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o text_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/text_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/text_engine.cc'; fi` 402 403 p_node.o: $(MAINSRCDIR)/lib/coord/p_node.cc 404 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT p_node.o -MD -MP -MF "$(DEPDIR)/p_node.Tpo" -c -o p_node.o `test -f '$(MAINSRCDIR)/lib/coord/p_node.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/p_node.cc; \ 405 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/p_node.Tpo" "$(DEPDIR)/p_node.Po"; else rm -f "$(DEPDIR)/p_node.Tpo"; exit 1; fi 406 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/coord/p_node.cc' object='p_node.o' libtool=no @AMDEPBACKSLASH@ 407 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/p_node.Po' tmpdepfile='$(DEPDIR)/p_node.TPo' @AMDEPBACKSLASH@ 408 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 409 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o p_node.o `test -f '$(MAINSRCDIR)/lib/coord/p_node.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/p_node.cc 410 411 p_node.obj: $(MAINSRCDIR)/lib/coord/p_node.cc 412 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT p_node.obj -MD -MP -MF "$(DEPDIR)/p_node.Tpo" -c -o p_node.obj `if test -f '$(MAINSRCDIR)/lib/coord/p_node.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/p_node.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/p_node.cc'; fi`; \ 413 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/p_node.Tpo" "$(DEPDIR)/p_node.Po"; else rm -f "$(DEPDIR)/p_node.Tpo"; exit 1; fi 414 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/coord/p_node.cc' object='p_node.obj' libtool=no @AMDEPBACKSLASH@ 415 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/p_node.Po' tmpdepfile='$(DEPDIR)/p_node.TPo' @AMDEPBACKSLASH@ 416 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 417 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o p_node.obj `if test -f '$(MAINSRCDIR)/lib/coord/p_node.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/p_node.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/p_node.cc'; fi` 418 419 null_parent.o: $(MAINSRCDIR)/lib/coord/null_parent.cc 420 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT null_parent.o -MD -MP -MF "$(DEPDIR)/null_parent.Tpo" -c -o null_parent.o `test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/null_parent.cc; \ 421 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/null_parent.Tpo" "$(DEPDIR)/null_parent.Po"; else rm -f "$(DEPDIR)/null_parent.Tpo"; exit 1; fi 422 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/coord/null_parent.cc' object='null_parent.o' libtool=no @AMDEPBACKSLASH@ 423 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/null_parent.Po' tmpdepfile='$(DEPDIR)/null_parent.TPo' @AMDEPBACKSLASH@ 424 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 425 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o null_parent.o `test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/coord/null_parent.cc 426 427 null_parent.obj: $(MAINSRCDIR)/lib/coord/null_parent.cc 428 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT null_parent.obj -MD -MP -MF "$(DEPDIR)/null_parent.Tpo" -c -o null_parent.obj `if test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/null_parent.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/null_parent.cc'; fi`; \ 429 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/null_parent.Tpo" "$(DEPDIR)/null_parent.Po"; else rm -f "$(DEPDIR)/null_parent.Tpo"; exit 1; fi 430 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/coord/null_parent.cc' object='null_parent.obj' libtool=no @AMDEPBACKSLASH@ 431 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/null_parent.Po' tmpdepfile='$(DEPDIR)/null_parent.TPo' @AMDEPBACKSLASH@ 432 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 433 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o null_parent.obj `if test -f '$(MAINSRCDIR)/lib/coord/null_parent.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/coord/null_parent.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/coord/null_parent.cc'; fi` 378 434 uninstall-info-am: 379 435 -
orxonox/branches/physics/src/lib/graphics/importer/material.cc
r3803 r3953 34 34 \param mtlName Name of the Material to be added to the Material List 35 35 */ 36 Material::Material (c har* mtlName)36 Material::Material (const char* mtlName) 37 37 { 38 38 PRINTF(4)("initializing new Material.\n"); 39 this->nextMat = NULL; 40 this->name =""; 39 this->name = NULL; 41 40 this->setIllum(3); 42 41 this->setDiffuse(0,0,0); … … 55 54 this->specularTextureSet = false; 56 55 57 if (mtlName) 58 this->setName (mtlName); 59 else 60 this->setName(""); 56 this->setName(mtlName); 61 57 } 62 58 … … 71 67 if (this->diffuseTexture) 72 68 ResourceManager::getInstance()->unload(this->diffuseTexture); 73 if (this->nextMat)74 delete this->nextMat;75 }76 77 /**78 \brief adds a new Material to the List.79 this Function will append a new Material to the end of a Material List.80 \param mtlName The name of the Material to be added.81 */82 Material* Material::addMaterial(char* mtlName)83 {84 PRINTF(4)("adding Material %s.\n", mtlName);85 Material* tmpMat = this;86 while (tmpMat->nextMat != NULL)87 {88 tmpMat = tmpMat->nextMat;89 }90 tmpMat->nextMat = new Material(mtlName);91 return tmpMat->nextMat;92 93 }94 95 /**96 \brief Search for a Material called mtlName97 \param mtlName the Name of the Material to search for98 \returns Material named mtlName if it is found. NULL otherwise.99 */100 Material* Material::search(char* mtlName)101 {102 PRINTF(5)("Searching for material %s", mtlName);103 Material* searcher = this;104 while (searcher != NULL)105 {106 PRINT(5)(".");107 if (!strcmp (searcher->getName(), mtlName))108 {109 PRINT(5)("found.\n");110 return searcher;111 }112 searcher = searcher->nextMat;113 }114 PRINT(2)("material %s not found\n", mtlName);115 return NULL;116 69 } 117 70 … … 168 121 \param mtlName the Name of the Material to be set. 169 122 */ 170 void Material::setName (char* mtlName) 171 { 172 PRINTF(4)("setting Material Name to %s.\n", this->name); 173 this->name = new char [strlen(mtlName)+1]; 174 strcpy(this->name, mtlName); 123 void Material::setName (const char* mtlName) 124 { 125 if (this->name) 126 delete this->name; 127 if (mtlName) 128 { 129 this->name = new char [strlen(mtlName)+1]; 130 strcpy(this->name, mtlName); 131 } 132 else 133 { 134 this->name = new char[2]; 135 strcpy(this->name, ""); 136 } 175 137 } 176 138 -
orxonox/branches/physics/src/lib/graphics/importer/material.h
r3803 r3953 14 14 #endif /* HAVE_CONFIG_H */ 15 15 16 #ifndef NULL 17 #define NULL 0 18 #endif 19 16 20 // FORWARD DEFINITIONS // 17 21 class Texture; … … 22 26 { 23 27 public: 24 Material (char* mtlName = ""); 25 Material* addMaterial(char* mtlName); 28 Material (const char* mtlName = NULL); 26 29 ~Material (); 27 30 28 Material* search(char* mtlName);29 31 bool select (void); 30 32 31 void setName (c har* mtlName);33 void setName (const char* mtlName); 32 34 char* getName (void); 33 35 void setIllum (int illum); … … 70 72 bool specularTextureSet;//!< Chekcs if the specular texture is Set. 71 73 72 Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.73 74 75 74 }; 76 75 #endif -
orxonox/branches/physics/src/lib/graphics/importer/model.cc
r3801 r3953 23 23 #include "array.h" 24 24 #include "vector.h" 25 #include "list.h" 25 26 26 27 using namespace std; 27 28 28 /** 29 \brief Creates a 3D-Model. 30 31 This only initializes a 3D-Model, but does not cleanup the Faces. 32 */ 33 Model::Model(void) 34 { 35 this->initialize(); 36 } 37 29 ////////////////// 30 // DE-CONSTRUCT // 31 ////////////////// 38 32 /** 39 33 \brief Creates a 3D-Model. and assigns it a Name. 40 34 */ 41 Model::Model(char* modelName) 42 { 43 this->initialize(); 35 Model::Model(const char* modelName, MODEL_TYPE type) 36 { 37 PRINTF(4)("new 3D-Model is being created\n"); 38 this->name = NULL; 44 39 this->setName(modelName); 45 } 46 47 /** 48 \brief deletes an Model. 49 50 Looks if any from model allocated space is still in use, and if so deleted it. 51 */ 52 Model::~Model(void) 53 { 54 PRINTF(4)("Deleting Model "); 55 if (this->name) 56 { 57 PRINT(4)("%s\n", this->name); 58 delete []this->name; 59 } 60 else 61 PRINT(4)("\n"); 62 63 PRINTF(4)("Deleting display Lists.\n"); 64 Group* walker = this->firstGroup; 65 while (walker != NULL) 66 { 67 glDeleteLists (walker->listNumber, 1); 68 Group* delWalker = walker; 69 walker = walker->next; 70 delete delWalker; 71 } 72 73 PRINTF(4)("Deleting Materials.\n"); 74 if (this->material) 75 delete this->material; 76 } 77 78 /** 79 \brief Finalizes an Object. This can be done outside of the Class. 80 */ 81 void Model::finalize(void) 82 { 83 this->importToGL (); 84 85 this->cleanup(); 86 87 this->finalized = true; 88 } 89 90 /** 91 \brief Draws the Models of all Groups. 92 It does this by just calling the Lists that must have been created earlier. 93 */ 94 void Model::draw (void) const 95 { 96 PRINTF(4)("drawing the 3D-Models\n"); 97 Group* walker = this->firstGroup; 98 while (walker != NULL) 99 { 100 PRINTF(5)("Drawing model %s\n", walker->name); 101 glCallList (walker->listNumber); 102 walker = walker->next; 103 } 104 } 105 106 /** 107 \brief Draws the Model number groupNumber 108 \param groupNumber The number of the group that will be displayed. 109 110 It does this by just calling the List that must have been created earlier. 111 */ 112 void Model::draw (int groupNumber) const 113 { 114 if (groupNumber >= this->groupCount) 115 { 116 PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount); 117 return; 118 } 119 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 120 Group* walker = this->firstGroup; 121 int counter = 0; 122 while (walker != NULL) 123 { 124 if (counter == groupNumber) 125 { 126 PRINTF(2)("Drawing model number %i named %s\n", counter, walker->name); 127 glCallList (walker->listNumber); 128 return; 129 } 130 ++counter; 131 walker = walker->next; 132 } 133 PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name); 134 return; 135 136 } 137 138 /** 139 \brief Draws the Model with a specific groupName 140 \param groupName The name of the group that will be displayed. 141 142 It does this by just calling the List that must have been created earlier. 143 */ 144 void Model::draw (char* groupName) const 145 { 146 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 147 Group* walker = this->firstGroup; 148 while (walker != NULL) 149 { 150 if (!strcmp(walker->name, groupName)) 151 { 152 PRINTF(4)("Drawing model %s\n", walker->name); 153 glCallList (walker->listNumber); 154 return; 155 } 156 walker = walker->next; 157 } 158 PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name); 159 return; 160 } 161 162 /** 163 \returns Count of the Models in this File 164 */ 165 int Model::getGroupCount (void) const 166 { 167 return this->groupCount; 168 } 169 170 /** 171 \brief initializes the Model. 172 173 This Function initializes all the needed arrays, Lists and clientStates. 174 It also defines default values. 175 */ 176 bool Model::initialize (void) 177 { 178 PRINTF(4)("new 3D-Model is being created\n"); 179 180 this->name = NULL; 40 this->type = type; 41 181 42 this->finalized = false; 182 43 // setting the start group; … … 187 48 this->initGroup (this->currentGroup); 188 49 this->scaleFactor = 1; 189 this->material = new Material();190 50 191 51 this->vertices = new Array(); … … 193 53 this->normals = new Array(); 194 54 195 return true; 196 } 197 55 this->materialList = new tList<Material>; 56 57 if (this->type == MODEL_VERTEX_ARRAY) 58 glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY); 59 } 60 61 /** 62 \brief deletes an Model. 63 64 Looks if any from model allocated space is still in use, and if so deleted it. 65 */ 66 Model::~Model(void) 67 { 68 PRINTF(4)("Deleting Model "); 69 if (this->name) 70 { 71 PRINT(4)("%s\n", this->name); 72 delete []this->name; 73 } 74 else 75 PRINT(4)("\n"); 76 77 PRINTF(5)("Deleting display Lists.\n"); 78 Group* walker = this->firstGroup; 79 while (walker != NULL) 80 { 81 glDeleteLists (walker->listNumber, 1); 82 Group* delWalker = walker; 83 walker = walker->next; 84 delete delWalker; 85 } 86 87 // deleting Arrays 88 this->deleteArrays(); 89 90 // deleting the MaterialList 91 PRINTF(5)("Deleting Materials.\n"); 92 tIterator<Material>* tmpIt = this->materialList->getIterator(); 93 Material* material = tmpIt->nextElement(); 94 while(material) 95 { 96 delete material; 97 material = tmpIt->nextElement(); 98 } 99 delete tmpIt; 100 delete materialList; 101 } 102 103 /** 104 \brief Finalizes an Object. This can be done outside of the Class. 105 */ 106 void Model::finalize(void) 107 { 108 // this creates the display List. 109 this->importToDisplayList(); 110 111 112 // deletes everything we allocated. 113 if (this->type == MODEL_DISPLAY_LIST) 114 this->deleteArrays(); 115 this->cleanup(); 116 117 this->finalized = true; 118 } 119 120 ////////// 121 // DRAW // 122 ////////// 123 /** 124 \brief Draws the Models of all Groups. 125 It does this by just calling the Lists that must have been created earlier. 126 */ 127 void Model::draw (void) const 128 { 129 PRINTF(4)("drawing the 3D-Models\n"); 130 Group* walker = this->firstGroup; 131 while (walker != NULL) 132 { 133 PRINTF(5)("Drawing model %s\n", walker->name); 134 glCallList (walker->listNumber); 135 walker = walker->next; 136 } 137 } 138 139 /** 140 \brief Draws the Model number groupNumber 141 \param groupNumber The number of the group that will be displayed. 142 143 It does this by just calling the List that must have been created earlier. 144 */ 145 void Model::draw (int groupNumber) const 146 { 147 if (groupNumber >= this->groupCount) 148 { 149 PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount); 150 return; 151 } 152 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 153 Group* walker = this->firstGroup; 154 int counter = 0; 155 while (walker != NULL) 156 { 157 if (counter == groupNumber) 158 { 159 PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name); 160 glCallList (walker->listNumber); 161 return; 162 } 163 ++counter; 164 walker = walker->next; 165 } 166 PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name); 167 return; 168 169 } 170 171 /** 172 \brief Draws the Model with a specific groupName 173 \param groupName The name of the group that will be displayed. 174 175 It does this by just calling the List that must have been created earlier. 176 */ 177 void Model::draw (char* groupName) const 178 { 179 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 180 Group* walker = this->firstGroup; 181 while (walker != NULL) 182 { 183 if (!strcmp(walker->name, groupName)) 184 { 185 PRINTF(4)("Drawing model %s\n", walker->name); 186 glCallList (walker->listNumber); 187 return; 188 } 189 walker = walker->next; 190 } 191 PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name); 192 return; 193 } 194 195 /** 196 \returns Count of the Models in this File 197 */ 198 int Model::getGroupCount (void) const 199 { 200 return this->groupCount; 201 } 202 203 ////////// 204 // INIT // 205 ////////// 198 206 /** 199 207 \brief sets a name to the Model … … 204 212 if (this->name) 205 213 delete this->name; 206 this->name = new char[strlen(name)+1]; 207 strcpy(this->name, name); 208 } 214 if (name) 215 { 216 this->name = new char[strlen(name)+1]; 217 strcpy(this->name, name); 218 } 219 else 220 this->name = NULL; 221 } 222 209 223 /** 210 224 \brief initializes a new Group model … … 244 258 245 259 /** 246 \brief finalizes an Model. 247 This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process. 248 */ 249 bool Model::cleanup(void) 250 { 251 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 252 260 \brief deletes all the arrays 261 */ 262 bool Model::deleteArrays(void) 263 { 253 264 if (this->vertices) 254 265 delete this->vertices; … … 257 268 if (this->normals) 258 269 delete this->normals; 259 270 this->vertices = NULL; 271 this->vTexture = NULL; 272 this->normals = NULL; 273 } 274 275 /** 276 \brief finalizes an Model. 277 This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process. 278 */ 279 bool Model::cleanup(void) 280 { 281 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 260 282 this->cleanupGroup(this->firstGroup); 261 283 return true; … … 299 321 delete face->next; 300 322 } 301 302 } 303 323 } 304 324 305 325 /** … … 316 336 } 317 337 338 ////////// 339 // MESH // 340 ////////// 341 /** 342 \brief adds a new Material to the Material List 343 \param material the Material to add 344 \returns the added material 345 346 !! beware the Material will be deleted when the Model gets deleted 347 */ 348 Material* Model::addMaterial(Material* material) 349 { 350 this->materialList->add(material); 351 return material; 352 } 353 354 /** 355 \brief adds a new Material to the Material List 356 \param material the name of the Material to add 357 \returns the added material 358 */ 359 Material* Model::addMaterial(const char* materialName) 360 { 361 362 Material* newMat = new Material(); 363 newMat->setName(materialName); 364 365 // adding material to the List of materials 366 this->materialList->add(newMat); 367 return newMat; 368 } 369 370 /** 371 \brief finds a Material by its name and returns it 372 \param materialName the Name of the material to search for. 373 \returns the Material if found, NULL otherwise 374 */ 375 Material* Model::findMaterialByName(const char* materialName) 376 { 377 tIterator<Material>* tmpIt = this->materialList->getIterator(); 378 Material* material = tmpIt->nextElement(); 379 while(material) 380 { 381 if (!strcmp(material->getName(), materialName)) 382 { 383 delete tmpIt; 384 return material; 385 } 386 material = tmpIt->nextElement(); 387 } 388 delete tmpIt; 389 return NULL; 390 } 391 318 392 /** 319 393 \brief parses a group String … … 323 397 With it you should be able to import .obj-files with more than one Models inside. 324 398 */ 325 bool Model::addGroup (c har* groupString)399 bool Model::addGroup (const char* groupString) 326 400 { 327 401 PRINTF(5)("Read Group: %s.\n", groupString); … … 339 413 } 340 414 ++this->groupCount; 341 342 415 } 343 416 … … 348 421 If a vertex line is found this function will inject it into the vertex-Array 349 422 */ 350 bool Model::addVertex (c har* vertexString)423 bool Model::addVertex (const char* vertexString) 351 424 { 352 425 float subbuffer1; … … 366 439 367 440 */ 368 bool Model::addVertex( const float x, const float y, constfloat z)441 bool Model::addVertex(float x, float y, float z) 369 442 { 370 443 PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z); … … 374 447 375 448 /** 449 \brief parses a vertexNormal-String 450 \param normalString The String that will be parsed. 451 452 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 453 */ 454 bool Model::addVertexNormal (const char* normalString) 455 { 456 float subbuffer1; 457 float subbuffer2; 458 float subbuffer3; 459 sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 460 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3); 461 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3); 462 return true; 463 } 464 465 /** 466 \brief adds a VertexNormal. 467 \param x The x coordinate of the Normal. 468 \param y The y coordinate of the Normal. 469 \param z The z coordinate of the Normal. 470 471 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 472 */ 473 bool Model::addVertexNormal(float x, float y, float z) 474 { 475 PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z); 476 this->normals->addEntry(x, y, z); 477 } 478 479 /** 480 \brief parses a vertexTextureCoordinate-String 481 \param vTextureString The String that will be parsed. 482 483 If a vertexTextureCoordinate line is found, 484 this function will inject it into the vertexTexture-Array 485 */ 486 bool Model::addVertexTexture (const char* vTextureString) 487 { 488 float subbuffer1; 489 float subbuffer2; 490 sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2); 491 PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2); 492 this->vTexture->addEntry(subbuffer1); 493 this->vTexture->addEntry(subbuffer2); 494 return true; 495 } 496 497 /** 498 \brief adds a Texture Coordinate 499 \param u The u coordinate of the TextureCoordinate. 500 \param v The y coordinate of the TextureCoordinate. 501 502 If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array 503 */ 504 bool Model::addVertexTexture(float u, float v) 505 { 506 PRINTF(5)("found vertex-Texture %f, %f\n", u, v); 507 this->vTexture->addEntry(u); 508 this->vTexture->addEntry(v); 509 } 510 511 /** 376 512 \brief parses a face-string 377 513 \param faceString The String that will be parsed. … … 379 515 If a face line is found this function will add it to the glList. 380 516 */ 381 bool Model::addFace (c har* faceString)517 bool Model::addFace (const char* faceString) 382 518 { 383 519 if (this->currentGroup->faceCount >0) … … 441 577 \param type 0: vertex only, 1: vertex and normal, 2: vertex and Texture, 3 vertex, normal and texture 442 578 */ 443 bool Model::addFace( const float faceElemCount, inttype, ...)579 bool Model::addFace(int faceElemCount, VERTEX_FORMAT type, ...) 444 580 { 445 581 if (this->currentGroup->faceCount > 0) … … 472 608 473 609 /** 474 \brief parses a vertexNormal-String475 \param normalString The String that will be parsed.476 477 If a vertexNormal line is found this function will inject it into the vertexNormal-Array478 */479 bool Model::addVertexNormal (char* normalString)480 {481 float subbuffer1;482 float subbuffer2;483 float subbuffer3;484 sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);485 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);486 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);487 return true;488 }489 490 /**491 \brief adds a VertexNormal.492 \param x The x coordinate of the Normal.493 \param y The y coordinate of the Normal.494 \param z The z coordinate of the Normal.495 496 If a vertexNormal line is found this function will inject it into the vertexNormal-Array497 */498 bool Model::addVertexNormal(const float x, const float y, const float z)499 {500 PRINTF(3)("found vertex-Normal %f, %f, %f\n", x, y, z);501 this->normals->addEntry(x, y, z);502 }503 504 /**505 \brief parses a vertexTextureCoordinate-String506 \param vTextureString The String that will be parsed.507 508 If a vertexTextureCoordinate line is found,509 this function will inject it into the vertexTexture-Array510 */511 bool Model::addVertexTexture (char* vTextureString)512 {513 float subbuffer1;514 float subbuffer2;515 sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);516 PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);517 this->vTexture->addEntry(subbuffer1);518 this->vTexture->addEntry(subbuffer2);519 return true;520 }521 522 /**523 \brief adds a Texture Coordinate524 \param u The u coordinate of the TextureCoordinate.525 \param v The y coordinate of the TextureCoordinate.526 527 If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array528 */529 bool Model::addVertexTexture(const float u, const float v)530 {531 PRINTF(3)("found vertex-Texture %f, %f\n", u, v);532 this->vTexture->addEntry(u);533 this->vTexture->addEntry(v);534 }535 536 /**537 610 \brief Function that selects a material, if changed in the obj file. 538 611 \param matString the Material that will be set. 539 612 */ 540 bool Model::addUseMtl (char* matString) 541 { 542 /* 543 if (!this->mtlFileName) 544 { 545 PRINTF(4)("Not using new defined material, because no mtlFile found yet\n"); 546 return false; 547 } 548 */ 613 bool Model::setMaterial(const char* matString) 614 { 549 615 if (this->currentGroup->faceCount > 0) 550 616 this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face; 551 617 this->initFace (this->currentGroup->currentFace); 552 618 553 this->currentGroup->currentFace->material = material->search(matString);619 this->currentGroup->currentFace->material = this->findMaterialByName(matString); 554 620 555 621 if (this->currentGroup->faceCount == 0) … … 561 627 \param mtl the Material that will be set. 562 628 */ 563 bool Model:: addUseMtl(Material* mtl)629 bool Model::setMaterial(Material* mtl) 564 630 { 565 631 if (this->currentGroup->faceCount > 0) … … 574 640 575 641 /** 642 \brief A routine that is able to create normals. 643 644 The algorithm does the following: 645 1. It calculates creates Vectors for each normale, and sets them to zero. 646 2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements 647 3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal. 648 4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array. 649 */ 650 bool Model::buildVertexNormals () 651 { 652 PRINTF(4)("Normals are being calculated.\n"); 653 654 Vector* normArray = new Vector [vertices->getCount()/3]; 655 for (int i=0; i<vertices->getCount()/3;i++) 656 normArray[i] = Vector(.0,.0,.0); 657 658 int firstTouch; 659 int secondTouch; 660 Vector prevV; 661 Vector nextV; 662 Vector curV; 663 664 Group* tmpGroup = firstGroup; 665 while (tmpGroup) 666 { 667 Face* tmpFace = tmpGroup->firstFace; 668 while (tmpFace) 669 { 670 if (tmpFace->firstElem) 671 { 672 FaceElement* firstElem = tmpFace->firstElem; 673 FaceElement* prevElem; 674 FaceElement* curElem = firstElem; 675 FaceElement* nextElem; 676 FaceElement* lastElem; 677 // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop. 678 while (curElem) 679 { 680 prevElem = curElem; 681 curElem = curElem->next; 682 } 683 lastElem = prevElem; 684 685 curElem = firstElem; 686 for (int j=0; j<tmpFace->vertexCount; j++) 687 { 688 if (!(nextElem = curElem->next)) 689 nextElem = firstElem; 690 curElem->normalNumber = curElem->vertexNumber; 691 692 curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]); 693 prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV; 694 nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV; 695 normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV); 696 697 prevElem = curElem; 698 curElem = curElem->next; 699 } 700 } 701 tmpFace = tmpFace->next; 702 } 703 tmpGroup = tmpGroup->next; 704 } 705 706 for (int i=0; i<vertices->getCount()/3;i++) 707 { 708 normArray[i].normalize(); 709 PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z); 710 711 this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z); 712 713 } 714 delete []normArray; 715 } 716 717 //////////// 718 // openGL // 719 //////////// 720 /** 576 721 \brief reads and includes the Faces/Materials into the openGL state Machine 577 722 */ 578 bool Model::importToGL (void) 579 { 580 723 bool Model::importToDisplayList(void) 724 { 581 725 // finalize the Arrays 582 726 this->vertices->finalizeArray(); … … 667 811 668 812 /** 813 \brief reads and includes the Faces/Materials into the openGL state Machine 814 */ 815 bool Model::importToVertexArray(void) 816 { 817 // finalize the Arrays 818 this->vertices->finalizeArray(); 819 this->vTexture->finalizeArray(); 820 if (normals->getCount() == 0) // vertices-Array must be built for this 821 this->buildVertexNormals(); 822 this->normals->finalizeArray(); 823 824 this->currentGroup = this->firstGroup; 825 glVertexPointer(3, GL_FLOAT, 0, this->vertices->getArray()); 826 glNormalPointer(3, 0, this->normals->getArray()); 827 glTexCoordPointer(2, GL_FLOAT, 0, this->vTexture->getArray()); 828 829 } 830 831 832 833 /** 669 834 \brief Adds a Face-element (one vertex of a face) with all its information. 670 835 \param elem The FaceElement to add to the OpenGL-environment. … … 688 853 689 854 } 690 691 /**692 \brief A routine that is able to create normals.693 694 The algorithm does the following:695 1. It calculates creates Vectors for each normale, and sets them to zero.696 2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements697 3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.698 4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.699 */700 bool Model::buildVertexNormals ()701 {702 703 PRINTF(4)("Normals are being calculated.\n");704 705 Vector* normArray = new Vector [vertices->getCount()/3];706 for (int i=0; i<vertices->getCount()/3;i++)707 normArray[i] = Vector(.0,.0,.0);708 709 int firstTouch;710 int secondTouch;711 Vector prevV;712 Vector nextV;713 Vector curV;714 715 Group* tmpGroup = firstGroup;716 while (tmpGroup)717 {718 Face* tmpFace = tmpGroup->firstFace;719 while (tmpFace)720 {721 if (tmpFace->firstElem)722 {723 FaceElement* firstElem = tmpFace->firstElem;724 FaceElement* prevElem;725 FaceElement* curElem = firstElem;726 FaceElement* nextElem;727 FaceElement* lastElem;728 // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.729 while (curElem)730 {731 prevElem = curElem;732 curElem = curElem->next;733 }734 lastElem = prevElem;735 736 curElem = firstElem;737 for (int j=0; j<tmpFace->vertexCount; j++)738 {739 if (!(nextElem = curElem->next))740 nextElem = firstElem;741 curElem->normalNumber = curElem->vertexNumber;742 743 curV = Vector (vertices->getArray()[curElem->vertexNumber*3], vertices->getArray()[curElem->vertexNumber*3+1], vertices->getArray()[curElem->vertexNumber*3+2]);744 prevV = Vector (vertices->getArray()[prevElem->vertexNumber*3], vertices->getArray()[prevElem->vertexNumber*3+1], vertices->getArray()[prevElem->vertexNumber*3+2]) - curV;745 nextV = Vector (vertices->getArray()[nextElem->vertexNumber*3], vertices->getArray()[nextElem->vertexNumber*3+1], vertices->getArray()[nextElem->vertexNumber*3+2]) - curV;746 normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);747 748 prevElem = curElem;749 curElem = curElem->next;750 }751 }752 tmpFace = tmpFace->next;753 }754 tmpGroup = tmpGroup->next;755 }756 757 for (int i=0; i<vertices->getCount()/3;i++)758 {759 normArray[i].normalize();760 PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);761 762 this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);763 764 }765 delete []normArray;766 767 }768 769 855 770 856 /** … … 833 919 */ 834 920 835 this->addFace (4, 3, 1,1,1, 2,2,2, 4,4,3, 3,3,4);836 this->addFace (4, 3, 3,3,5, 4,4,6, 6,6,7, 5,5,8);837 this->addFace (4, 3, 5,5,9, 6,6,10, 8,8,11, 7,7,12);838 this->addFace (4, 3, 7,7,13, 8,8,14, 2,10,15, 1,9,16);839 this->addFace (4, 3, 2,2,17, 8,11,18, 6,12,19, 4,4,20);840 this->addFace (4, 3, 7,13,21, 1,1,22, 3,3,23, 5,14,24);841 842 } 921 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,1, 2,2,2, 4,4,3, 3,3,4); 922 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,3,5, 4,4,6, 6,6,7, 5,5,8); 923 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,5,9, 6,6,10, 8,8,11, 7,7,12); 924 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,7,13, 8,8,14, 2,10,15, 1,9,16); 925 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,17, 8,11,18, 6,12,19, 4,4,20); 926 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,13,21, 1,1,22, 3,3,23, 5,14,24); 927 928 } -
orxonox/branches/physics/src/lib/graphics/importer/model.h
r3801 r3953 8 8 9 9 #include "material.h" 10 #include "glincl.h" 10 11 11 12 // FORWARD DEFINITION // 12 13 class Array; 13 14 class Vector; 15 template<class T> class tList; 14 16 15 using namespace std; 17 //! an enumerator fot the different Model Types. 18 /** 19 MODEL_DISPLAY_LIST means, that a DisplayList will be built out of the model. This model will be STATIC, meaning it cannot be changed after initialisation. 20 MODEL_VERTEX_ARRAY means, that a VertexArray will be built out of the model. This moel will be DYNAMIX, meaning that one can change the properties from outside of the model. 21 */ 22 typedef enum MODEL_TYPE {MODEL_DISPLAY_LIST, 23 MODEL_VERTEX_ARRAY}; 24 16 25 17 26 // definition of different modes for setting up Faces … … 19 28 #define NORMAL 1 //!< If Faces are created WITH Normals (otherwise autocalculate) 20 29 #define TEXCOORD 2 //!< If Faces are created WITH TextureCoordinate 30 //! an enumerator for VERTEX_FORMAT 31 typedef enum VERTEX_FORMAT {VERTEX_ONLY = VERTEX, 32 VERTEX_NORMAL = NORMAL, 33 VERTEX_TEXCOORD = TEXCOORD, 34 VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD}; 21 35 22 36 //! Class that handles 3D-Models. it can also read them in and display them. 23 37 class Model 24 38 { 25 public: 26 Model(void); 27 Model(char* modelName); 28 virtual ~Model(void); 29 30 void setName(const char* name); 31 32 void draw(void) const; 33 void draw(int groupNumber) const; 34 void draw(char* groupName) const; 35 int getGroupCount() const; 36 37 protected: 38 char* name; //!< This is the name of the Model. 39 bool finalized; //!< Sets the Object to be finalized. 40 39 private: 40 ///////////// 41 // structs // 42 ///////////// 41 43 //! This is the placeholder of one Vertex beloning to a Face. 42 44 struct FaceElement … … 64 66 char* name; //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function. 65 67 66 unsigned int listNumber;//!< The number of the GL-List this Group gets. 68 GLubyte* indices; //!< The indices of the Groups. Needed for vertex-arrays 69 GLuint listNumber; //!< The number of the GL-List this Group gets. 67 70 Face* firstFace; //!< The first Face in this group. 68 71 Face* currentFace; //!< The current Face in this Group (the one we are currently working with.) … … 73 76 }; 74 77 78 char* name; //!< This is the name of the Model. 79 MODEL_TYPE type; 80 bool finalized; //!< Sets the Object to be finalized. 75 81 76 82 Array* vertices; //!< The Array that handles the Vertices. … … 79 85 Array* vTexture; //!< The Array that handles the VertexTextureCoordinates. 80 86 81 82 87 Group* firstGroup; //!< The first of all groups. 83 88 Group* currentGroup; //!< The currentGroup. this is the one we will work with. 84 89 int groupCount; //!< The Count of Groups. 85 90 86 Material* material; //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..)87 float scaleFactor; //!< The Factor with which the Model should be scaled. \todo maybe one wants to scale the Model after Initialisation91 tList<Material>* materialList; 92 88 93 89 bool initialize(void);90 94 bool initGroup(Group* group); 91 95 bool initFace (Face* face); 96 97 bool buildVertexNormals(void); 98 99 bool importToDisplayList(void); 100 bool addGLElement(FaceElement* elem); 101 102 bool importToVertexArray(void); 103 104 bool deleteArrays(void); 92 105 bool cleanup(void); 93 106 bool cleanupGroup(Group* group); … … 95 108 bool cleanupFaceElement(FaceElement* faceElem); 96 109 97 public:98 bool addGroup(char* groupString);99 bool addVertex(char* vertexString);100 bool addVertex(const float x, const float y, const float z);101 bool addFace(char* faceString);102 bool addFace(const float faceElemCount, int type, ...);103 bool addVertexNormal(char* normalString);104 bool addVertexNormal(const float x, const float y, const float z);105 bool addVertexTexture(char* vTextureString);106 bool addVertexTexture(const float u, const float v);107 bool addUseMtl(char* mtlString);108 bool addUseMtl(Material* mtl);109 void finalize(void);110 110 111 111 protected: 112 bool importToGL(void); 113 bool addGLElement(FaceElement* elem); 112 float scaleFactor; //!< The Factor with which the Model should be scaled. \todo maybe one wants to scale the Model after Initialisation 114 113 115 bool buildVertexNormals(void);114 Material* findMaterialByName(const char* materialName); 116 115 117 116 void cubeModel(void); 117 118 public: 119 Model(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST); 120 virtual ~Model(void); 121 122 void setName(const char* name); 123 inline const char* getName() {return this->name;} 124 125 void draw(void) const; 126 void draw(int groupNumber) const; 127 void draw(char* groupName) const; 128 int getGroupCount() const; 129 130 Material* addMaterial(Material* material); 131 Material* addMaterial(const char* materialName); 132 133 bool addGroup(const char* groupString); 134 bool addVertex(const char* vertexString); 135 bool addVertex(float x, float y, float z); 136 bool addFace(const char* faceString); 137 bool addFace(int faceElemCount, VERTEX_FORMAT type, ...); 138 bool addVertexNormal(const char* normalString); 139 bool addVertexNormal(float x, float y, float z); 140 bool addVertexTexture(const char* vTextureString); 141 bool addVertexTexture(float u, float v); 142 bool setMaterial(const char* mtlString); 143 bool setMaterial(Material* mtl); 144 void finalize(void); 118 145 }; 119 146 -
orxonox/branches/physics/src/lib/graphics/importer/objModel.cc
r3658 r3953 18 18 #include "objModel.h" 19 19 20 #include <fstream> 20 #include <stdio.h> 21 #include <string.h> 22 #include <stdlib.h> 23 24 #define PARSELINELENGTH 8192 21 25 22 26 #include "debug.h" 27 #include "compiler.h" 23 28 24 29 /** … … 27 32 \param scaling The factor that the model will be scaled with. 28 33 */ 29 OBJModel::OBJModel(c har* fileName, float scaling)34 OBJModel::OBJModel(const char* fileName, float scaling) : Model(fileName) 30 35 { 31 36 this->initializeOBJ(); … … 34 39 this->importFile (fileName); 35 40 36 this->importToGL (); 37 38 this->cleanup(); 41 this->finalize(); 39 42 } 40 43 … … 63 66 this->objFileName = NULL; 64 67 this->mtlFileName = NULL; 65 66 this->initialize();67 68 } 68 69 … … 71 72 \param fileName The file to import 72 73 */ 73 bool OBJModel::importFile (c har* fileName)74 bool OBJModel::importFile (const char* fileName) 74 75 { 75 76 PRINTF(4)("preparing to read in file: %s\n", fileName); … … 83 84 char pathSplitter='/'; 84 85 #endif /* __WIN32__ */ 85 char* tmpName = fileName; 86 char* tmpName; 87 strcpy(tmpName, fileName); 86 88 if (tmpName[0] == pathSplitter) 87 89 tmpName++; … … 100 102 101 103 this->setName(name); 102 if (this->material) 103 this->material->addTexturePath(this->objPath); 104 104 105 this->objFileName = new char[strlen(name)+1]; 105 106 strcpy (this->objFileName, name); … … 120 121 strcat(fileName, this->objFileName); 121 122 122 ifstream* OBJ_FILE = new ifstream(fileName); 123 if (OBJ_FILE->fail()) 124 { 125 PRINTF(1)("unable to open .OBJ file: %s\n Loading cube-Model instead.\n", fileName); 126 cubeModel(); 127 OBJ_FILE->close(); 128 delete []fileName; 129 delete OBJ_FILE; 123 FILE* stream; 124 if( (stream = fopen (fileName, "r")) == NULL) 125 { 126 printf("IniParser could not open %s\n", fileName); 130 127 return false; 131 128 } 132 PRINTF(4)("Reading from opened file %s\n", fileName); 133 char Buffer[10000]; 134 while(!OBJ_FILE->eof()) 135 { 136 OBJ_FILE->getline(Buffer, 10000); 137 PRINTF(5)("Read input line: %s\n", Buffer); 129 130 char buffer[PARSELINELENGTH]; 131 while(fgets(buffer, PARSELINELENGTH, stream)) 132 { 133 // line termiated with \0 not \n 134 if (buffer[strlen(buffer)-1] == '\n') 135 buffer[strlen(buffer)-1] = '\0'; 136 137 // case vertice 138 if (!strncmp(buffer, "v ", 2)) 139 { 140 this->addVertex(buffer+2); 141 } 142 143 // case face 144 else if (!strncmp(buffer, "f ", 2)) 145 { 146 this->addFace (buffer+2); 147 } 138 148 139 140 // case vertice 141 if (!strncmp(Buffer, "v ", 2)) 142 { 143 this->addVertex(Buffer+2); 144 } 145 146 // case face 147 else if (!strncmp(Buffer, "f ", 2)) 148 { 149 this->addFace (Buffer+2); 150 } 151 152 else if (!strncmp(Buffer, "mtllib ", 7)) 153 { 154 this->readMtlLib (Buffer+7); 155 } 156 157 else if (!strncmp(Buffer, "usemtl ", 7)) 158 { 159 this->addUseMtl (Buffer+7); 149 else if (!strncmp(buffer, "mtllib ", 7)) 150 { 151 this->readMtlLib (buffer+7); 152 } 153 154 else if (!strncmp(buffer, "usemtl ", 7)) 155 { 156 this->setMaterial (buffer+7); 160 157 } 161 158 162 159 // case VertexNormal 163 else if (!strncmp( Buffer, "vn ", 3))164 { 165 this->addVertexNormal( Buffer+3);160 else if (!strncmp(buffer, "vn ", 3)) 161 { 162 this->addVertexNormal(buffer+3); 166 163 } 167 164 168 165 // case VertexTextureCoordinate 169 else if (!strncmp( Buffer, "vt ", 3))170 { 171 this->addVertexTexture( Buffer+3);166 else if (!strncmp(buffer, "vt ", 3)) 167 { 168 this->addVertexTexture(buffer+3); 172 169 } 173 170 // case group 174 else if (!strncmp(Buffer, "g ", 2)) 175 { 176 this->addGroup (Buffer+2); 177 } 178 else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented 179 { 180 PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer); 181 } 182 } 183 OBJ_FILE->close(); 184 delete OBJ_FILE; 171 else if (!strncmp(buffer, "g ", 2)) 172 { 173 this->addGroup (buffer+2); 174 } 175 else if (!strncmp(buffer, "s ", 2)) //! \todo smoothing groups have to be implemented 176 { 177 PRINTF(2)("smoothing groups not supportet yet. line: %s\n", buffer); 178 } 179 } 180 fclose (stream); 185 181 delete []fileName; 186 182 return true; … … 196 192 197 193 */ 198 bool OBJModel::readMtlLib (c har* mtlFile)194 bool OBJModel::readMtlLib (const char* mtlFile) 199 195 { 200 196 this->mtlFileName = new char [strlen(mtlFile)+1]; … … 205 201 206 202 207 PRINTF(4)("Opening mtlFile: %s\n", fileName); 208 209 ifstream* MTL_FILE = new ifstream (fileName); 210 if (MTL_FILE->fail()) 211 { 212 PRINTF(2)("unable to open file: %s\n", fileName); 213 MTL_FILE->close(); 214 delete []fileName; 215 delete MTL_FILE; 203 FILE* stream; 204 if( (stream = fopen (fileName, "r")) == NULL) 205 { 206 printf("IniParser could not open %s\n", fileName); 216 207 return false; 217 208 } 218 char Buffer[500]; 219 Material* tmpMat = material; 220 while(!MTL_FILE->eof()) 221 { 222 MTL_FILE->getline(Buffer, 500); 223 PRINTF(5)("found line in mtlFile: %s\n", Buffer); 209 210 char buffer[PARSELINELENGTH]; 211 Material* tmpMat = NULL; 212 213 while(fgets(buffer, PARSELINELENGTH, stream)) 214 { 215 PRINTF(5)("found line in mtlFile: %s\n", buffer); 216 217 // line termiated with \0 not \n 218 if (buffer[strlen(buffer)-1] == '\n') 219 buffer[strlen(buffer)-1] = '\0'; 220 221 // create new Material 222 if (!strncmp(buffer, "newmtl ", 7)) 223 { 224 tmpMat = this->addMaterial(buffer+7);//tmpMat->addMaterial(buffer+7); 225 } 226 // setting a illumMode 227 else if (!strncmp(buffer, "illum ", 6)) 228 { 229 if (likely(tmpMat != NULL)) 230 tmpMat->setIllum(buffer+6); 231 232 } 233 // setting Diffuse Color 234 else if (!strncmp(buffer, "Kd ", 3)) 235 { 236 if (likely(tmpMat != NULL)) 237 tmpMat->setDiffuse(buffer+3); 238 } 239 // setting Ambient Color 240 else if (!strncmp(buffer, "Ka ", 3)) 241 { 242 if (likely(tmpMat != NULL)) 243 tmpMat->setAmbient(buffer+3); 244 } 245 // setting Specular Color 246 else if (!strncmp(buffer, "Ks ", 3)) 247 { 248 if (likely(tmpMat != NULL)) 249 tmpMat->setSpecular(buffer+3); 250 } 251 // setting The Specular Shininess 252 else if (!strncmp(buffer, "Ns ", 3)) 253 { 254 if (likely(tmpMat != NULL)) 255 tmpMat->setShininess(buffer+3); 256 } 257 // setting up transparency 258 else if (!strncmp(buffer, "d ", 2)) 259 { 260 if (likely(tmpMat != NULL)) 261 tmpMat->setTransparency(buffer+2); 262 } 263 else if (!strncmp(buffer, "Tf ", 3)) 264 { 265 if (likely(tmpMat != NULL)) 266 tmpMat->setTransparency(buffer+3); 267 } 224 268 225 226 // create new Material 227 if (!strncmp(Buffer, "newmtl ", 7)) 228 { 229 tmpMat = tmpMat->addMaterial(Buffer+7); 230 // PRINTF(2)("%s, %p\n", tmpMat->getName(), tmpMat); 231 } 232 // setting a illumMode 233 else if (!strncmp(Buffer, "illum ", 6)) 234 { 235 tmpMat->setIllum(Buffer+6); 236 237 } 238 // setting Diffuse Color 239 else if (!strncmp(Buffer, "Kd ", 3)) 240 { 241 tmpMat->setDiffuse(Buffer+3); 242 } 243 // setting Ambient Color 244 else if (!strncmp(Buffer, "Ka ", 3)) 245 { 246 tmpMat->setAmbient(Buffer+3); 247 } 248 // setting Specular Color 249 else if (!strncmp(Buffer, "Ks ", 3)) 250 { 251 tmpMat->setSpecular(Buffer+3); 252 } 253 // setting The Specular Shininess 254 else if (!strncmp(Buffer, "Ns ", 3)) 255 { 256 tmpMat->setShininess(Buffer+3); 257 } 258 // setting up transparency 259 else if (!strncmp(Buffer, "d ", 2)) 260 { 261 tmpMat->setTransparency(Buffer+2); 262 } 263 else if (!strncmp(Buffer, "Tf ", 3)) 264 { 265 tmpMat->setTransparency(Buffer+3); 266 } 267 268 else if (!strncmp(Buffer, "map_Kd ", 7)) 269 { 270 tmpMat->setDiffuseMap(Buffer+7); 271 } 272 else if (!strncmp(Buffer, "map_Ka ", 7)) 273 { 274 tmpMat->setAmbientMap(Buffer+7); 275 } 276 else if (!strncmp(Buffer, "map_Ks ", 7)) 277 { 278 tmpMat->setSpecularMap(Buffer+7); 279 } 280 else if (!strncmp(Buffer, "bump ", 5)) 281 { 282 tmpMat->setBump(Buffer+7); 269 else if (!strncmp(buffer, "map_Kd ", 7)) 270 { 271 if (likely(tmpMat != NULL)) 272 tmpMat->setDiffuseMap(buffer+7); 273 } 274 else if (!strncmp(buffer, "map_Ka ", 7)) 275 { 276 if (likely(tmpMat != NULL)) 277 tmpMat->setAmbientMap(buffer+7); 278 } 279 else if (!strncmp(buffer, "map_Ks ", 7)) 280 { 281 if (likely(tmpMat != NULL)) 282 tmpMat->setSpecularMap(buffer+7); 283 } 284 else if (!strncmp(buffer, "bump ", 5)) 285 { 286 if (likely(tmpMat != NULL)) 287 tmpMat->setBump(buffer+7); 283 288 } 284 289 285 290 286 291 } 287 MTL_FILE->close();292 fclose(stream); 288 293 delete []fileName; 289 delete MTL_FILE;290 294 return true; 291 295 } -
orxonox/branches/physics/src/lib/graphics/importer/objModel.h
r3655 r3953 13 13 { 14 14 public: 15 OBJModel(c har* fileName, float scaling = 1.0);15 OBJModel(const char* fileName, float scaling = 1.0); 16 16 virtual ~OBJModel(); 17 17 void initializeOBJ(void); … … 24 24 25 25 ///// readin ///// 26 bool importFile (c har* fileName);26 bool importFile (const char* fileName); 27 27 bool readFromObjFile (void); 28 bool readMtlLib (c har* matFile);28 bool readMtlLib (const char* matFile); 29 29 }; 30 30 -
orxonox/branches/physics/src/lib/graphics/importer/primitive_model.cc
r3684 r3953 33 33 PrimitiveModel::PrimitiveModel(PRIMITIVE type, float size, unsigned int detail) 34 34 { 35 this->initialize();36 37 35 switch (type) 38 36 { … … 54 52 break; 55 53 } 56 this->importToGL (); 57 58 this->cleanup(); 54 this->finalize(); 59 55 } 60 56 … … 123 119 { 124 120 v1 = vertexCount+1; 125 this->addFace(3, TEXCOORD, v1, v1, v3, v3, v4, v4);121 this->addFace(3, VERTEX_TEXCOORD, v1, v1, v3, v3, v4, v4); 126 122 } 127 123 else if (j == detail) 128 124 { 129 125 v3 = vertexCount+2; 130 this->addFace(3, TEXCOORD, v1, v1, v2, v2, v3, v3);126 this->addFace(3, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3); 131 127 } 132 128 else 133 this->addFace(4, TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);129 this->addFace(4, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4); 134 130 } 135 131 } … … 163 159 p1 = 2*i+1; 164 160 p2 = 2*i+2; 165 if (i <= detail);166 161 p3 = 2*i+4; 167 162 p4 = 2*i+3; 168 163 // something is wrong here 169 this->addFace(4, 0, p1, p2, p3, p4); 170 this->addFace(3, 0, p4, p1, 2*detail+1); 171 this->addFace(3, 0, p2, p3, 2*detail+2); 172 } 173 addFace(4,0, 2*detail-1, 2*detail, 2, 1); 174 this->addFace(3, VERTEX, 1, 2*detail-1, 2*detail+1); 175 this->addFace(3, VERTEX, 2*detail, 2, 2*detail+2); 164 this->addFace(4, VERTEX_ONLY, p1, p2, p3, p4); 165 this->addFace(3, VERTEX_ONLY, p4, p1, 2*detail+1); 166 this->addFace(3, VERTEX_ONLY, p2, p3, 2*detail+2); 167 } 168 // caps 169 this->addFace(4, VERTEX_ONLY, 2*detail-1, 2*detail, 2, 1); 170 this->addFace(3, VERTEX_ONLY, 1, 2*detail-1, 2*detail+1); 171 this->addFace(3, VERTEX_ONLY, 2*detail, 2, 2*detail+2); 176 172 } 177 173 … … 207 203 else 208 204 v2 = i+4; 209 this->addFace(3, VERTEX , 1, v1, v2);210 this->addFace(3, VERTEX , 2, v1, v2);205 this->addFace(3, VERTEX_ONLY, 1, v1, v2); 206 this->addFace(3, VERTEX_ONLY, 2, v1, v2); 211 207 } 212 208 } … … 238 234 v3 = (i+1)*detail + (j+1); 239 235 v4 = i*detail + (j+1); 240 this->addFace(4, TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4);236 this->addFace(4, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4); 241 237 } 242 238 } -
orxonox/branches/physics/src/lib/graphics/importer/texture.cc
r3863 r3953 23 23 \brief Constructor for a Texture 24 24 */ 25 Texture::Texture(void)26 {27 this->pImage = new Image;28 this->pImage->data = NULL;29 this->map = NULL;30 this->texture = 0;31 }32 33 /**34 \brief Constructor for a Texture35 */36 25 Texture::Texture(const char* imageName) 37 26 { 38 this->pImage = new Image;39 this->pImage->data = NULL;40 this->map = NULL;41 27 this->texture = 0; 42 this->loadImage(imageName); 28 if (imageName) 29 this->loadImage(imageName); 43 30 } 44 31 … … 50 37 Texture::~Texture(void) 51 38 { 52 if (this->pImage->data)53 delete []this->pImage->data;54 delete pImage;55 39 if (this->texture) 56 40 glDeleteTextures(1, &this->texture); … … 73 57 /** 74 58 \brief Loads a Texture to the openGL-environment. 75 \param pImage The Image to load to openGL 59 \param surface the Image to load to openGL 60 \returns The ID of the texture. 76 61 */ 77 bool Texture::loadTexToGL (Image* pImage)62 GLuint Texture::loadTexToGL (SDL_Surface* surface) 78 63 { 79 64 if (GraphicsEngine::texturesEnabled) 80 65 { 81 66 PRINTF(4)("Loading texture to OpenGL-Environment.\n"); 82 glGenTextures(1, &this->texture); 83 glBindTexture(GL_TEXTURE_2D, this->texture); 84 /* not Working, and not needed. 85 glTexImage2D( GL_TEXTURE_2D, 0, 3, width, 86 height, 0, GL_BGR, 87 GL_UNSIGNED_BYTE, map->pixels ); 88 */ 89 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data); 67 68 GLuint texture; 69 int w, h; 70 SDL_Surface *image; 71 SDL_Rect area; 72 Uint32 saved_flags; 73 Uint8 saved_alpha; 90 74 91 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); 92 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR); 75 w = surface->w; 76 h = surface->h; 77 78 image = SDL_CreateRGBSurface(SDL_SWSURFACE, 79 w, h, 80 32, 81 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 82 0x000000FF, 83 0x0000FF00, 84 0x00FF0000, 85 0xFF000000 86 #else 87 0xFF000000, 88 0x00FF0000, 89 0x0000FF00, 90 0x000000FF 91 #endif 92 ); 93 if ( image == NULL ) { 94 return 0; 95 } 96 97 /* Save the alpha blending attributes */ 98 saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); 99 saved_alpha = surface->format->alpha; 100 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 101 SDL_SetAlpha(surface, 0, 0); 102 } 103 104 /* Copy the surface into the GL texture image */ 105 area.x = 0; 106 area.y = 0; 107 area.w = surface->w; 108 area.h = surface->h; 109 SDL_BlitSurface(surface, &area, image, &area); 110 111 /* Restore the alpha blending attributes */ 112 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 113 SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha); 114 } 115 116 /* Create an OpenGL texture for the image */ 117 glGenTextures(1, &texture); 118 glBindTexture(GL_TEXTURE_2D, texture); 119 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 120 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 121 /* glTexImage2D(GL_TEXTURE_2D, 122 0, 123 GL_RGBA, 124 w, h, 125 0, 126 GL_RGBA, 127 GL_UNSIGNED_BYTE, 128 image->pixels); 129 */ 130 gluBuild2DMipmaps(GL_TEXTURE_2D, 131 3, 132 w, 133 h, 134 GL_RGBA, 135 GL_UNSIGNED_BYTE, 136 image->pixels); 137 138 SDL_FreeSurface(image); /* No longer needed */ 139 140 return texture; 93 141 } 94 142 } … … 104 152 if (imageName) 105 153 { 106 this->map=IMG_Load(imageName); 107 if(!map) 154 SDL_Surface* tmpSurf; 155 if (this->texture) 156 glDeleteTextures(1, &this->texture); 157 // load the new Image to memory 158 tmpSurf = IMG_Load(imageName); 159 if(!tmpSurf) 108 160 { 109 161 PRINTF(1)("IMG_Load: %s\n", IMG_GetError()); 110 162 return false; 111 163 } 112 pImage->height = map->h;113 pImage->width = map->w;114 pImage->data = (GLubyte*)map->pixels;115 pImage->bpp = map->format->BytesPerPixel;116 if (pImage->bpp == 3)117 pImage->format = GL_RGB;118 else if (pImage->bpp == 4)119 {120 pImage->format = GL_RGBA;121 SDL_SetAlpha(this->map, 0, 0);122 }123 164 124 if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb"))) 125 for (int i=0;i<map->h * map->w *3;i+=3) 126 { 127 GLuint temp = pImage->data[i]; 128 pImage->data[i] = pImage->data[i+2]; 129 pImage->data[i+2] = temp; 130 } 131 /* this is the real swapping algorithm */ 132 for( int i = 0 ; i < (pImage->height / 2) ; ++i ) 133 for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp ) 134 for(int k = 0; k < pImage->bpp; ++k) 135 swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]); 165 GLubyte* pixels = (GLubyte*)tmpSurf->pixels; 136 166 137 this->loadTexToGL (this->pImage); 138 SDL_FreeSurface(map); 139 pImage->data = NULL; 167 /* this swaps the Mapping so lowel left will be upper left */ 168 for( int i = 0 ; i < (tmpSurf->h / 2) ; ++i ) 169 for( int j = 0 ; j < tmpSurf->w * tmpSurf->format->BytesPerPixel; j += tmpSurf->format->BytesPerPixel ) 170 for(int k = 0; k < tmpSurf->format->BytesPerPixel; ++k) 171 swap( pixels[(i * tmpSurf->w * tmpSurf->format->BytesPerPixel) + j + k], 172 pixels[ ( (tmpSurf->h - i - 1) * tmpSurf->w * tmpSurf->format->BytesPerPixel) + j + k]); 173 174 PRINTF(3)("loading Image %s\n", imageName); 175 if (tmpSurf) 176 this->texture = loadTexToGL(tmpSurf); 177 178 179 SDL_FreeSurface(tmpSurf); 180 return true; 140 181 } 141 182 else -
orxonox/branches/physics/src/lib/graphics/importer/texture.h
r3863 r3953 20 20 { 21 21 private: 22 //! Struct to handle Infos about an Image23 struct Image24 {25 int rowSpan; //!< The count of the rows this Image has.26 GLuint width; //!< The width of the Image.27 GLuint height; //!< The height of the Image.28 GLuint bpp; //!< BytesPerPixel29 GLenum format; //!< The Format of the PixelData30 GLuint type; //!< Type of the Image.31 GLubyte *data; //!< The Image Data comes here! DANGER: uncompressed data.32 };33 Image* pImage; //!< The data of an Image34 22 GLuint texture; //!< The Texture-ID of opengl from this Texture. 35 SDL_Surface* map; //!< The map SDL initializes for this element.36 23 char* searchTextureInPaths(const char* texName) const; 37 24 void swap(unsigned char &a, unsigned char &b); 38 25 public: 39 Texture(void); 40 Texture(const char* imageName); 26 Texture(const char* imageName = NULL); 41 27 ~Texture(void); 28 42 29 /** \returns The textureID of this texture. */ 43 30 inline GLuint getTexture(void) {return this->texture;} 44 bool loadTexToGL (Image* pImage);31 GLuint loadTexToGL (SDL_Surface* surface); 45 32 46 33 bool loadImage(const char* imageName); -
orxonox/branches/physics/src/lib/graphics/text_engine.cc
r3845 r3953 36 36 #include "vector.h" 37 37 #include "debug.h" 38 38 #include "list.h" 39 39 40 40 ////////////
Note: See TracChangeset
for help on using the changeset viewer.