Changeset 3953 in orxonox.OLD for orxonox/branches/physics/src
- Timestamp:
- Apr 25, 2005, 9:29:41 AM (20 years ago)
- Location:
- orxonox/branches/physics/src
- Files:
-
- 1 added
- 16 deleted
- 24 edited
- 17 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/Makefile.am
r3863 r3953 17 17 AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu 18 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 19 22 20 23 … … 30 33 command_node.cc \ 31 34 keynames.cc \ 32 camera.cc \35 world_entities/camera.cc \ 33 36 track_manager.cc \ 34 37 track_node.cc \ 35 animation.cc \36 animation3d.cc \37 animation_player.cc \38 util/animation/animation.cc \ 39 util/animation/animation3d.cc \ 40 util/animation/animation_player.cc \ 38 41 garbage_collector.cc \ 39 42 story_entities/story_entity.cc \ … … 69 72 lib/lang/base_object.cc \ 70 73 lib/util/ini_parser.cc \ 71 lib/util/list.cc \72 lib/util/resource_manager.cc \74 util/common/list.cc \ 75 util/resource_manager.cc \ 73 76 lib/math/vector.cc \ 74 77 lib/math/curve.cc \ … … 79 82 track_manager.h \ 80 83 ability.h \ 81 camera.h \84 world_entities/camera.h \ 82 85 keynames.h \ 83 86 command_node.h \ … … 85 88 track_manager.h \ 86 89 track_node.h \ 87 animation.h \88 t_animation.h \89 animation3d.h \90 animation_player.h \90 util/animation/animation.h \ 91 util/animation/t_animation.h \ 92 util/animation/animation3d.h \ 93 util/animation/animation_player.h \ 91 94 garbage_collector.h \ 92 95 story_entities/story_entity.h \ … … 125 128 lib/lang/base_entity.h \ 126 129 lib/lang/base_object.h \ 127 lib/util/list.h \128 lib/util/list_template.h \129 lib/util/resource_manager.h \130 util/common/list.h \ 131 util/common/list_template.h \ 132 util/resource_manager.h \ 130 133 lib/util/ini_parser.h \ 131 134 lib/math/vector.h \ -
orxonox/branches/physics/src/Makefile.in
r3863 r3953 237 237 target_vendor = @target_vendor@ 238 238 MAINSRCDIR = . 239 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 239 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 240 240 AM_LDFLAGS = $(MWINDOWS) 241 241 orxonox_SOURCES = orxonox.cc \ … … 243 243 command_node.cc \ 244 244 keynames.cc \ 245 camera.cc \245 world_entities/camera.cc \ 246 246 track_manager.cc \ 247 247 track_node.cc \ 248 animation.cc \249 animation3d.cc \250 animation_player.cc \248 util/animation/animation.cc \ 249 util/animation/animation3d.cc \ 250 util/animation/animation_player.cc \ 251 251 garbage_collector.cc \ 252 252 story_entities/story_entity.cc \ … … 282 282 lib/lang/base_object.cc \ 283 283 lib/util/ini_parser.cc \ 284 lib/util/list.cc \285 lib/util/resource_manager.cc \284 util/common/list.cc \ 285 util/resource_manager.cc \ 286 286 lib/math/vector.cc \ 287 287 lib/math/curve.cc \ … … 292 292 track_manager.h \ 293 293 ability.h \ 294 camera.h \294 world_entities/camera.h \ 295 295 keynames.h \ 296 296 command_node.h \ … … 298 298 track_manager.h \ 299 299 track_node.h \ 300 animation.h \301 t_animation.h \302 animation3d.h \303 animation_player.h \300 util/animation/animation.h \ 301 util/animation/t_animation.h \ 302 util/animation/animation3d.h \ 303 util/animation/animation_player.h \ 304 304 garbage_collector.h \ 305 305 story_entities/story_entity.h \ … … 338 338 lib/lang/base_entity.h \ 339 339 lib/lang/base_object.h \ 340 lib/util/list.h \341 lib/util/list_template.h \342 lib/util/resource_manager.h \340 util/common/list.h \ 341 util/common/list_template.h \ 342 util/resource_manager.h \ 343 343 lib/util/ini_parser.h \ 344 344 lib/math/vector.h \ … … 490 490 @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 491 491 492 camera.o: world_entities/camera.cc 493 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.o -MD -MP -MF "$(DEPDIR)/camera.Tpo" -c -o camera.o `test -f 'world_entities/camera.cc' || echo '$(srcdir)/'`world_entities/camera.cc; \ 494 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/camera.Tpo" "$(DEPDIR)/camera.Po"; else rm -f "$(DEPDIR)/camera.Tpo"; exit 1; fi 495 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='world_entities/camera.cc' object='camera.o' libtool=no @AMDEPBACKSLASH@ 496 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/camera.Po' tmpdepfile='$(DEPDIR)/camera.TPo' @AMDEPBACKSLASH@ 497 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 498 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera.o `test -f 'world_entities/camera.cc' || echo '$(srcdir)/'`world_entities/camera.cc 499 500 camera.obj: world_entities/camera.cc 501 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.obj -MD -MP -MF "$(DEPDIR)/camera.Tpo" -c -o camera.obj `if test -f 'world_entities/camera.cc'; then $(CYGPATH_W) 'world_entities/camera.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/camera.cc'; fi`; \ 502 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/camera.Tpo" "$(DEPDIR)/camera.Po"; else rm -f "$(DEPDIR)/camera.Tpo"; exit 1; fi 503 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='world_entities/camera.cc' object='camera.obj' libtool=no @AMDEPBACKSLASH@ 504 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/camera.Po' tmpdepfile='$(DEPDIR)/camera.TPo' @AMDEPBACKSLASH@ 505 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 506 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera.obj `if test -f 'world_entities/camera.cc'; then $(CYGPATH_W) 'world_entities/camera.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/camera.cc'; fi` 507 508 animation.o: util/animation/animation.cc 509 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation.o -MD -MP -MF "$(DEPDIR)/animation.Tpo" -c -o animation.o `test -f 'util/animation/animation.cc' || echo '$(srcdir)/'`util/animation/animation.cc; \ 510 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/animation.Tpo" "$(DEPDIR)/animation.Po"; else rm -f "$(DEPDIR)/animation.Tpo"; exit 1; fi 511 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/animation/animation.cc' object='animation.o' libtool=no @AMDEPBACKSLASH@ 512 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/animation.Po' tmpdepfile='$(DEPDIR)/animation.TPo' @AMDEPBACKSLASH@ 513 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 514 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation.o `test -f 'util/animation/animation.cc' || echo '$(srcdir)/'`util/animation/animation.cc 515 516 animation.obj: util/animation/animation.cc 517 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation.obj -MD -MP -MF "$(DEPDIR)/animation.Tpo" -c -o animation.obj `if test -f 'util/animation/animation.cc'; then $(CYGPATH_W) 'util/animation/animation.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation.cc'; fi`; \ 518 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/animation.Tpo" "$(DEPDIR)/animation.Po"; else rm -f "$(DEPDIR)/animation.Tpo"; exit 1; fi 519 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/animation/animation.cc' object='animation.obj' libtool=no @AMDEPBACKSLASH@ 520 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/animation.Po' tmpdepfile='$(DEPDIR)/animation.TPo' @AMDEPBACKSLASH@ 521 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 522 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation.obj `if test -f 'util/animation/animation.cc'; then $(CYGPATH_W) 'util/animation/animation.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation.cc'; fi` 523 524 animation3d.o: util/animation/animation3d.cc 525 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation3d.o -MD -MP -MF "$(DEPDIR)/animation3d.Tpo" -c -o animation3d.o `test -f 'util/animation/animation3d.cc' || echo '$(srcdir)/'`util/animation/animation3d.cc; \ 526 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/animation3d.Tpo" "$(DEPDIR)/animation3d.Po"; else rm -f "$(DEPDIR)/animation3d.Tpo"; exit 1; fi 527 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/animation/animation3d.cc' object='animation3d.o' libtool=no @AMDEPBACKSLASH@ 528 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/animation3d.Po' tmpdepfile='$(DEPDIR)/animation3d.TPo' @AMDEPBACKSLASH@ 529 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 530 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation3d.o `test -f 'util/animation/animation3d.cc' || echo '$(srcdir)/'`util/animation/animation3d.cc 531 532 animation3d.obj: util/animation/animation3d.cc 533 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation3d.obj -MD -MP -MF "$(DEPDIR)/animation3d.Tpo" -c -o animation3d.obj `if test -f 'util/animation/animation3d.cc'; then $(CYGPATH_W) 'util/animation/animation3d.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation3d.cc'; fi`; \ 534 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/animation3d.Tpo" "$(DEPDIR)/animation3d.Po"; else rm -f "$(DEPDIR)/animation3d.Tpo"; exit 1; fi 535 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/animation/animation3d.cc' object='animation3d.obj' libtool=no @AMDEPBACKSLASH@ 536 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/animation3d.Po' tmpdepfile='$(DEPDIR)/animation3d.TPo' @AMDEPBACKSLASH@ 537 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 538 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation3d.obj `if test -f 'util/animation/animation3d.cc'; then $(CYGPATH_W) 'util/animation/animation3d.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation3d.cc'; fi` 539 540 animation_player.o: util/animation/animation_player.cc 541 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_player.o -MD -MP -MF "$(DEPDIR)/animation_player.Tpo" -c -o animation_player.o `test -f 'util/animation/animation_player.cc' || echo '$(srcdir)/'`util/animation/animation_player.cc; \ 542 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/animation_player.Tpo" "$(DEPDIR)/animation_player.Po"; else rm -f "$(DEPDIR)/animation_player.Tpo"; exit 1; fi 543 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/animation/animation_player.cc' object='animation_player.o' libtool=no @AMDEPBACKSLASH@ 544 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/animation_player.Po' tmpdepfile='$(DEPDIR)/animation_player.TPo' @AMDEPBACKSLASH@ 545 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 546 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_player.o `test -f 'util/animation/animation_player.cc' || echo '$(srcdir)/'`util/animation/animation_player.cc 547 548 animation_player.obj: util/animation/animation_player.cc 549 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT animation_player.obj -MD -MP -MF "$(DEPDIR)/animation_player.Tpo" -c -o animation_player.obj `if test -f 'util/animation/animation_player.cc'; then $(CYGPATH_W) 'util/animation/animation_player.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation_player.cc'; fi`; \ 550 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/animation_player.Tpo" "$(DEPDIR)/animation_player.Po"; else rm -f "$(DEPDIR)/animation_player.Tpo"; exit 1; fi 551 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/animation/animation_player.cc' object='animation_player.obj' libtool=no @AMDEPBACKSLASH@ 552 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/animation_player.Po' tmpdepfile='$(DEPDIR)/animation_player.TPo' @AMDEPBACKSLASH@ 553 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 554 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o animation_player.obj `if test -f 'util/animation/animation_player.cc'; then $(CYGPATH_W) 'util/animation/animation_player.cc'; else $(CYGPATH_W) '$(srcdir)/util/animation/animation_player.cc'; fi` 555 492 556 story_entity.o: story_entities/story_entity.cc 493 557 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT story_entity.o -MD -MP -MF "$(DEPDIR)/story_entity.Tpo" -c -o story_entity.o `test -f 'story_entities/story_entity.cc' || echo '$(srcdir)/'`story_entities/story_entity.cc; \ … … 1002 1066 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ini_parser.obj `if test -f 'lib/util/ini_parser.cc'; then $(CYGPATH_W) 'lib/util/ini_parser.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/ini_parser.cc'; fi` 1003 1067 1004 list.o: lib/util/list.cc1005 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.o `test -f ' lib/util/list.cc' || echo '$(srcdir)/'`lib/util/list.cc; \1068 list.o: util/common/list.cc 1069 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.o `test -f 'util/common/list.cc' || echo '$(srcdir)/'`util/common/list.cc; \ 1006 1070 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/list.Tpo" "$(DEPDIR)/list.Po"; else rm -f "$(DEPDIR)/list.Tpo"; exit 1; fi 1007 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source=' lib/util/list.cc' object='list.o' libtool=no @AMDEPBACKSLASH@1071 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/common/list.cc' object='list.o' libtool=no @AMDEPBACKSLASH@ 1008 1072 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/list.Po' tmpdepfile='$(DEPDIR)/list.TPo' @AMDEPBACKSLASH@ 1009 1073 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1010 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.o `test -f ' lib/util/list.cc' || echo '$(srcdir)/'`lib/util/list.cc1011 1012 list.obj: lib/util/list.cc1013 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.obj `if test -f ' lib/util/list.cc'; then $(CYGPATH_W) 'lib/util/list.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/list.cc'; fi`; \1074 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.o `test -f 'util/common/list.cc' || echo '$(srcdir)/'`util/common/list.cc 1075 1076 list.obj: util/common/list.cc 1077 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF "$(DEPDIR)/list.Tpo" -c -o list.obj `if test -f 'util/common/list.cc'; then $(CYGPATH_W) 'util/common/list.cc'; else $(CYGPATH_W) '$(srcdir)/util/common/list.cc'; fi`; \ 1014 1078 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/list.Tpo" "$(DEPDIR)/list.Po"; else rm -f "$(DEPDIR)/list.Tpo"; exit 1; fi 1015 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source=' lib/util/list.cc' object='list.obj' libtool=no @AMDEPBACKSLASH@1079 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/common/list.cc' object='list.obj' libtool=no @AMDEPBACKSLASH@ 1016 1080 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/list.Po' tmpdepfile='$(DEPDIR)/list.TPo' @AMDEPBACKSLASH@ 1017 1081 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1018 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f ' lib/util/list.cc'; then $(CYGPATH_W) 'lib/util/list.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/list.cc'; fi`1019 1020 resource_manager.o: lib/util/resource_manager.cc1021 @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 ' lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc; \1082 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f 'util/common/list.cc'; then $(CYGPATH_W) 'util/common/list.cc'; else $(CYGPATH_W) '$(srcdir)/util/common/list.cc'; fi` 1083 1084 resource_manager.o: util/resource_manager.cc 1085 @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 'util/resource_manager.cc' || echo '$(srcdir)/'`util/resource_manager.cc; \ 1022 1086 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi 1023 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source=' lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@1087 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@ 1024 1088 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@ 1025 1089 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1026 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f ' lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc1027 1028 resource_manager.obj: lib/util/resource_manager.cc1029 @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 ' lib/util/resource_manager.cc'; then $(CYGPATH_W) 'lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/resource_manager.cc'; fi`; \1090 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f 'util/resource_manager.cc' || echo '$(srcdir)/'`util/resource_manager.cc 1091 1092 resource_manager.obj: util/resource_manager.cc 1093 @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 'util/resource_manager.cc'; then $(CYGPATH_W) 'util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/util/resource_manager.cc'; fi`; \ 1030 1094 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi 1031 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source=' lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@1095 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@ 1032 1096 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@ 1033 1097 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1034 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f ' lib/util/resource_manager.cc'; then $(CYGPATH_W) 'lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/resource_manager.cc'; fi`1098 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f 'util/resource_manager.cc'; then $(CYGPATH_W) 'util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/util/resource_manager.cc'; fi` 1035 1099 1036 1100 vector.o: lib/math/vector.cc … … 1204 1268 1205 1269 distdir: $(DISTFILES) 1206 $(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_entities1270 $(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)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities 1207 1271 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 1208 1272 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ -
orxonox/branches/physics/src/defs/debug.h
r3863 r3953 68 68 #define DEBUG_MODULE_LIGHT 0 69 69 #define DEBUG_MODULE_PLAYER 1 70 #define DEBUG_MODULE_WEAPON 3 70 71 #define DEBUG_MODULE_MATH 0 71 #define DEBUG_MODULE_FONT 472 #define DEBUG_MODULE_ANIM 372 #define DEBUG_MODULE_FONT 1 73 #define DEBUG_MODULE_ANIM 1 73 74 74 75 #define DEBUG_MODULE_NULL_PARENT 0 -
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 //////////// -
orxonox/branches/physics/src/story_entities/world.cc
r3866 r3953 367 367 trackManager->condition(2, LEFTRIGHT, this->localPlayer); 368 368 this->glmis->step(); 369 370 369 break; 371 370 } -
orxonox/branches/physics/src/track_manager.cc
r3849 r3953 111 111 } 112 112 // if not found 113 else 114 return NULL; 113 return NULL; 115 114 } 116 115 … … 141 140 } 142 141 // if not found 143 else 144 return NULL; 142 return NULL; 145 143 } 146 144 … … 762 760 { 763 761 TrackElement* tmpTrackElem; 762 TrackElement* tmpJoinElem; 764 763 for (int i = 0; i < count; i++) 765 764 if (!this->firstTrackElem->findByID(trackIDs[i])) … … 793 792 for (int i = 0; i < count; i++) 794 793 { 795 TrackElement* tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]); 796 if (tmpJoinElem->childCount == 0 797 && tmpJoinElem->endTime > tmpLatestTime) 798 tmpLatestTime = tmpJoinElem->endTime; 794 if(tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i])) 795 { 796 if (tmpJoinElem->childCount == 0 797 && tmpJoinElem->endTime > tmpLatestTime) 798 tmpLatestTime = tmpJoinElem->endTime; 799 } 799 800 } 800 801 // time the main Join. … … 804 805 for (int i = 1; i < count; i++) 805 806 { 806 TrackElement* tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]); 807 if (tmpJoinElem->childCount > 0) 808 printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!"); 809 else 810 { 811 this->addPoint(tmpc2Point, tmpJoinElem); 812 this->addPoint(tmpTangentPoint, tmpJoinElem); 813 this->addPoint(tmpEndPoint, tmpJoinElem); 814 // time all other Joins 815 tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime; 816 817 //Copying Joint-Info 818 tmpJoinElem->children = firstJoint->children; 819 tmpJoinElem->childCount = firstJoint->childCount; 820 tmpJoinElem->isSavePoint = firstJoint->isSavePoint; 821 tmpJoinElem->isFork = firstJoint->isFork; 822 823 tmpJoinElem->isJoined = true; 807 if( tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i])) 808 { 809 if (tmpJoinElem->childCount > 0) 810 printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!"); 811 else 812 { 813 this->addPoint(tmpc2Point, tmpJoinElem); 814 this->addPoint(tmpTangentPoint, tmpJoinElem); 815 this->addPoint(tmpEndPoint, tmpJoinElem); 816 // time all other Joins 817 tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime; 818 819 //Copying Joint-Info 820 tmpJoinElem->children = firstJoint->children; 821 tmpJoinElem->childCount = firstJoint->childCount; 822 tmpJoinElem->isSavePoint = firstJoint->isSavePoint; 823 tmpJoinElem->isFork = firstJoint->isFork; 824 825 tmpJoinElem->isJoined = true; 826 } 824 827 } 825 828 } -
orxonox/branches/physics/src/world_entities/player.cc
r3811 r3953 38 38 Player::Player() : WorldEntity() 39 39 { 40 this->weapons = new tList<Weapon>();41 this->activeWeapon = NULL;42 40 /* 43 41 this is the debug player - actualy we would have to make a new … … 46 44 */ 47 45 this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 48 //this->model = (Model*)ResourceManager::getInstance()->load("models/weapon_packet.obj", OBJ, RP_CAMPAIGN);49 46 travelSpeed = 15.0; 50 47 velocity = new Vector(); 51 48 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 52 49 bFire = false; 50 this->bWeaponChange = false; 53 51 acceleration = 10.0; 54 52 //weapons: 55 Weapon* wpRight = new TestGun(this, new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0); 56 Weapon* wpLeft = new TestGun(this, new Vector(-2.6, 0.1, -3.0), new Quaternion(), 1); 57 this->weapons->add(wpRight); 58 this->activeWeapon = wpRight; 59 this->activeWeaponL = wpLeft; 53 this->weaponMan = new WeaponManager(); 54 Weapon* wpRight = new TestGun(this,Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 55 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 56 57 this->weaponMan->addWeapon(wpRight, W_CONFIG0); 58 this->weaponMan->addWeapon(wpLeft, W_CONFIG1); 59 this->weaponMan->addWeapon(wpRight, W_CONFIG2); 60 this->weaponMan->addWeapon(wpLeft, W_CONFIG2); 61 60 62 } 61 63 … … 69 71 this only frees the memory allocated to save the list. 70 72 */ 71 delete this->weapon s;73 delete this->weaponMan; 72 74 } 73 75 … … 79 81 void Player::addWeapon(Weapon* weapon) 80 82 { 81 this->weapon s->add(weapon);83 this->weaponMan->addWeapon(weapon); 82 84 } 83 85 … … 89 91 void Player::removeWeapon(Weapon* weapon) 90 92 { 91 this->weapon s->remove(weapon);93 this->weaponMan->removeWeapon(weapon); 92 94 } 93 95 … … 151 153 glPopMatrix(); 152 154 153 this->activeWeapon->draw(); 154 this->activeWeaponL->draw(); 155 this->weaponMan->draw(); 155 156 } 156 157 … … 163 164 { 164 165 /* link tick to weapon */ 165 this->activeWeapon->tick(time); 166 this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE 166 //this->activeWeapon->tick(time); 167 //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE 168 this->weaponMan->tick(time); 167 169 // player controlled movement 168 170 this->move(time); … … 180 182 Vector accel(0.0, 0.0, 0.0); 181 183 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 182 183 184 /* calculate the direction in which the craft is heading */ 184 185 Vector direction (1.0, 0.0, 0.0); … … 210 211 if( this->bFire) 211 212 { 212 //if(this->activeWeapon != NULL) 213 this->activeWeapon->fire(); 214 //FIX THIS FIX FIIIIIIIIIIIX 215 this->activeWeaponL->fire(); 213 this->weaponMan->fire(); 216 214 } 217 if( this->bWeaponChange && this->weapons->getSize() > 1)215 if( this->bWeaponChange) 218 216 { 219 PRINTF(1)("changing the weapon of the player: deactivate old, activate new\n"); 220 this->activeWeapon->deactivate(); 221 //this->weapons->enumerate(); FIX: strang weapon change... 222 this->activeWeapon = this->weapons->nextElement(this->activeWeapon); 223 this->activeWeapon->activate(); 217 this->weaponMan->nextWeaponConf(); 218 this->bWeaponChange = false; 224 219 } 225 220 } … … 240 235 if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp; 241 236 if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp; 242 if( !strcmp( cmd->cmd, "mode")) this->bWeaponChange = !cmd->bUp;243 } 237 if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange; 238 } -
orxonox/branches/physics/src/world_entities/player.h
r3755 r3953 11 11 template<class T> class tList; 12 12 class Weapon; 13 class WeaponManager; 13 14 class Vector; 14 15 class World; … … 49 50 Weapon* activeWeapon; //!< the weapon that is currenty activated 50 51 Weapon* activeWeaponL; //temporary -- FIX THIS 52 WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping 51 53 52 54 World* myWorld; //!< reference to the world object -
orxonox/branches/physics/src/world_entities/skybox.cc
r3807 r3953 187 187 model->addVertexNormal (-1.0, 0.0, 0.0); 188 188 189 model-> addUseMtl(material[0]);190 model->addFace (4, 3, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top191 model-> addUseMtl(material[1]);192 model->addFace (4, 3, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom193 model-> addUseMtl(material[2]);194 model->addFace (4, 3, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left195 model-> addUseMtl(material[3]);196 model->addFace (4, 3, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right197 model-> addUseMtl(material[4]);198 model->addFace (4, 3, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front199 model-> addUseMtl(material[5]);200 model->addFace (4, 3, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back189 model->setMaterial(material[0]); 190 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top 191 model->setMaterial(material[1]); 192 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom 193 model->setMaterial(material[2]); 194 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left 195 model->setMaterial(material[3]); 196 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right 197 model->setMaterial(material[4]); 198 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front 199 model->setMaterial(material[5]); 200 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back 201 201 202 202 model->finalize(); -
orxonox/branches/physics/src/world_entities/test_gun.cc
r3855 r3953 40 40 creates a new weapon 41 41 */ 42 TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion*direction, int leftRight)42 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 43 43 : Weapon (parent, coordinate, direction) 44 44 { … … 47 47 this->leftRight = leftRight; 48 48 49 if( this->leftRight == 0) 50 this->projOffset = new Vector(1.0, 0.0, -0.35); 51 else if( this->leftRight == 1) 52 this->projOffset = new Vector(1.0, 0.0, 0.5); 49 this->objectComponent1 = new PNode(); 50 this->animation1 = new Animation3D(this->objectComponent1); 51 parent->addChild(this->objectComponent1, PNODE_ALL); 53 52 53 this->animation1->setInfinity(ANIM_INF_CONSTANT); 54 // ANIM_LINEAR was ANIM_NEG_EXP 55 if( this->leftRight == W_LEFT) 56 { 57 this->projectileOffset = Vector(1.0, 0.0, -0.35); 54 58 55 this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 56 this->animation = new Animation3D(dummy1); 59 this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 60 this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR); 61 this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 62 } 63 else if( this->leftRight == W_RIGHT) 64 { 65 this->projectileOffset = Vector(1.0, 0.0, 0.5); 57 66 58 parent->addChild(this->dummy1, PNODE_ALL); 59 60 this->animation->setInfinity(ANIM_INF_CONSTANT); 61 // ANIM_LINEAR was ANIM_NEG_EXP 62 if( this->leftRight == 0) 63 { 64 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 65 this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR); 66 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 67 this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 68 this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR); 69 this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 67 70 } 68 else if( this->leftRight == 1)69 {70 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);71 this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);72 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);73 }74 /*75 if( this->leftRight == 0)76 {77 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.0, ANIM_NEG_EXP);78 this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.1, ANIM_NEG_EXP);79 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.5, ANIM_NEG_EXP);80 }81 else if( this->leftRight == 1)82 {83 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.0, ANIM_NEG_EXP);84 this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.1, ANIM_NEG_EXP);85 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.5, ANIM_NEG_EXP);86 }87 */88 71 } 89 72 … … 127 110 void TestGun::fire() 128 111 { 129 if( this->localTime < this->idleTime)112 if( !this->hasWeaponIdleTimeElapsed()) 130 113 { 131 114 this->weaponIdle(); 132 115 return; 133 116 } 117 134 118 Projectile* pj = new TestBullet(this); 135 136 pj->setAbsCoor(this->getAbsCoor() + *this->projOffset); 119 pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset); 137 120 pj->setAbsDir(this->getAbsDir()); 138 139 121 pj->setFlightDirection(this->getAbsDir()); 140 122 pj->setSpeed(this->getSpeed()); 141 142 123 this->worldEntities->add(pj); 143 124 this->localTime = 0; 144 125 145 this->animation ->replay();126 this->animation1->replay(); 146 127 } 147 128 … … 190 171 void TestGun::draw () 191 172 { 192 193 /* draw gun body 1 */ 173 /* draw gun body */ 194 174 glMatrixMode(GL_MODELVIEW); 195 175 glPushMatrix(); 196 176 float matrix[4][4]; 197 198 if( this->leftRight == 0) 199 { 200 glTranslatef (this->getAbsCoor ().x, 201 this->getAbsCoor ().y, 202 this->getAbsCoor ().z); 203 204 this->getAbsDir ().matrix (matrix); 205 glMultMatrixf((float*)matrix); 206 this->model->draw(1); 207 } 208 else if( this->leftRight == 1) 209 { 210 glTranslatef (this->getAbsCoor ().x, 211 this->getAbsCoor ().y, 212 this->getAbsCoor ().z); 213 214 this->getAbsDir ().matrix (matrix); 215 glMultMatrixf((float*)matrix); 216 glScalef(1.0, 1.0, -1.0); 217 this->model->draw(1); 218 } 219 177 glTranslatef (this->getAbsCoor ().x, 178 this->getAbsCoor ().y, 179 this->getAbsCoor ().z); 180 this->getAbsDir ().matrix (matrix); 181 glMultMatrixf((float*)matrix); 182 if( this->leftRight == W_RIGHT) 183 glScalef(1.0, 1.0, -1.0); 184 this->model->draw(1); 220 185 glPopMatrix(); 221 186 222 223 /* draw gun coil 1 */ 187 /* draw objectComponent1: gun coil - animated stuff */ 224 188 glMatrixMode(GL_MODELVIEW); 225 189 glPushMatrix(); 226 227 glTranslatef (this->dummy1->getAbsCoor ().x, 228 this->dummy1->getAbsCoor ().y, 229 this->dummy1->getAbsCoor ().z); 230 231 this->dummy1->getAbsDir ().matrix (matrix); 190 glTranslatef (this->objectComponent1->getAbsCoor ().x, 191 this->objectComponent1->getAbsCoor ().y, 192 this->objectComponent1->getAbsCoor ().z); 193 this->objectComponent1->getAbsDir ().matrix (matrix); 232 194 glMultMatrixf((float*)matrix); 233 195 this->model->draw(0); -
orxonox/branches/physics/src/world_entities/test_gun.h
r3855 r3953 37 37 38 38 public: 39 TestGun (PNode* parent, Vector* coordinate, Quaternion*direction, int leftRight);39 TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight); 40 40 virtual ~TestGun (); 41 41 … … 51 51 virtual void draw(void); 52 52 53 private: 54 Animation3D* animation; 55 Vector* projOffset; 56 WorldEntity* dummy1; 57 int leftRight; // this will become an enum 53 54 58 55 59 56 }; -
orxonox/branches/physics/src/world_entities/weapon.cc
r3862 r3953 16 16 */ 17 17 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 18 19 19 20 #include "weapon.h" … … 30 31 31 32 33 /** 34 \brief this initializes the weaponManager for a given nnumber of weapon slots 35 \param number of weapon slots of the model/ship <= 8 (limitied) 36 */ 32 37 WeaponManager::WeaponManager(int nrOfSlots) 33 38 { 39 for(int i = 0; i < W_MAX_CONFIGS; ++i) 40 { 41 this->configs[i].bUsed = false; 42 for(int j = 0; j < W_MAX_SLOTS; ++j) 43 this->configs[i].slots[j] = NULL; 44 } 34 45 this->nrOfSlots = nrOfSlots; 35 this->nrOfConfigs = 1; 36 37 for(int i = 0; i < W_MAX_CONFS; ++i) 38 this->configs[i] = NULL; 39 this->currentConfig = new weaponConfig; 40 this->configs[0] = this->currentConfig; 41 } 46 this->currConfID = W_CONFIG0; 47 } 48 42 49 43 50 WeaponManager::~WeaponManager() 44 51 { 45 46 } 47 48 void WeaponManager::addWeapon(Weapon* weapon, slotID slot, configID config) 49 { 50 if(this->configs[config] == NULL) 51 PRINTF(0)(""); 52 // this->configs[(int)config]-> 53 } 54 55 void WeaponManager::addWeaponConfig(weaponConfig* config) 56 {} 57 52 /* 53 i dont have to delete the weapons itself, because they are 54 worldentities and therefore in the entities list of the world. 55 world will clean them up for me 56 */ 57 for(int i = 0; i < W_MAX_CONFIGS; ++i) 58 { 59 this->configs[i].bUsed = false; 60 for(int j = 0; j < W_MAX_SLOTS; ++j) 61 this->configs[i].slots[j] = NULL; 62 } 63 } 64 65 66 /** 67 \brief adds a weapon to the selected weaponconfiguration into the selected slot 68 \param the weapon to add 69 \param an identifier for the slot: number between 0..7 if not specified: slotID=next free slot 70 \param an identifier for the weapon configuration, number between 0..3 71 72 if you add explicitly a weapon at config:n, slot:m, the weapon placed at this location will be 73 replaced by the weapon specified. if you use the W_FREE_SLOT, the manager will look for a free 74 slot in this weaponconfiguration. if there is non, the weapon won't be added and there will be 75 a error message. 76 */ 77 void WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID) 78 { 79 if( slotID == W_FREE_SLOT) 80 { 81 int freeSlot = this->getNextFreeSlot( configID); 82 if( freeSlot < 0 || freeSlot >= this->nrOfSlots) 83 { 84 PRINTF(0)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n"); 85 return; 86 } 87 PRINTF(3)("Added new Weapon to Config:%i/Slot:%i\n", configID, freeSlot); 88 this->configs[configID].bUsed = true; 89 this->configs[configID].slots[freeSlot] = weapon; 90 return; 91 } 92 this->configs[configID].bUsed = true; 93 this->configs[configID].slots[slotID] = weapon; 94 PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID); 95 } 96 97 98 void WeaponManager::removeWeapon(Weapon* weapon, int configID) 99 { 100 /* empty */ 101 } 102 103 104 /** 105 \brief changes to the next weapon configuration 106 107 if there are multiple weapon configurations defined by the manager, use this to switch between them 108 this function will deactivate the weapons first, change the config and reactivate them later 109 */ 58 110 void WeaponManager::nextWeaponConf() 59 {} 60 61 void WeaponManager::prevWeaponConf() 62 {} 63 64 65 void WeaponManager::selectConfig(configID config) 66 { 67 if( this->configs[(int)config] != NULL) 68 this->currentConfig = this->configs[(int)config]; 69 else 70 PRINTF(0)("There is no weapon config defined with the number W_CONF%i", (int)config); 71 } 111 { 112 PRINTF(4)("Changing weapon configuration: from %i\n", this->currConfID); 113 114 Weapon* w; 115 for(int i = 0; i < W_MAX_SLOTS; ++i) 116 { 117 w = this->configs[this->currConfID].slots[i]; 118 if( w != NULL) w->deactivate(); 119 } 120 int i; 121 for(i = this->currConfID + 1; i < W_MAX_CONFIGS && !this->configs[i].bUsed; ++i); 122 if( i == W_MAX_CONFIGS) this->currConfID = W_CONFIG0; 123 else this->currConfID = i; 124 PRINTF(4)("\tto %i\n", this->currConfID); 125 126 for(int i = 0; i < W_MAX_SLOTS; ++i) 127 { 128 w = this->configs[this->currConfID].slots[i]; 129 if( w != NULL) w->activate(); 130 } 131 } 132 133 134 135 /** 136 \brief triggers fire of all weapons in the current weaponconfig 137 */ 138 void WeaponManager::fire() 139 { 140 Weapon* firingWeapon; 141 for(int i = 0; i < W_MAX_SLOTS; ++i) 142 { 143 firingWeapon = this->configs[this->currConfID].slots[i]; 144 if( firingWeapon != NULL) firingWeapon->fire(); 145 } 146 } 147 148 149 /** 150 \brief triggers tick of all weapons in the current weaponconfig 151 \param second passed since last tick 152 */ 153 void WeaponManager::tick(float sec) 154 { 155 Weapon* w; 156 for(int i = 0; i < W_MAX_SLOTS; ++i) 157 { 158 w = this->configs[this->currConfID].slots[i]; 159 if( w != NULL) w->tick(sec); 160 } 161 } 162 163 164 /** 165 \brief triggers draw of all weapons in the current weaponconfig 166 */ 167 void WeaponManager::draw() 168 { 169 Weapon* w; 170 for(int i = 0; i < W_MAX_SLOTS; ++i) 171 { 172 w = this->configs[this->currConfID].slots[i]; 173 if( w != NULL) w->draw(); 174 } 175 } 176 177 178 /** 179 \brief private gets the next free slot in a certain weaponconfig 180 \param the selected weaponconfig 181 */ 182 int WeaponManager::getNextFreeSlot(int configID) 183 { 184 for( int i = 0; i < W_MAX_SLOTS; ++i) 185 { 186 if( this->configs[configID].slots[i] == NULL) 187 return i; 188 } 189 return -1; 190 } 191 192 193 72 194 73 195 … … 78 200 creates a new weapon 79 201 */ 80 Weapon::Weapon (PNode* parent, Vector* coordinate, Quaternion*direction)202 Weapon::Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction) 81 203 : WorldEntity() 82 204 { 83 205 parent->addChild(this, PNODE_ALL); 84 this->setRelCoor( *coordinate);85 this->setRelDir( *direction);206 this->setRelCoor(coordinate); 207 this->setRelDir(direction); 86 208 WorldInterface* wi = WorldInterface::getInstance(); 87 209 this->worldEntities = wi->getEntityList(); 210 211 this->objectComponent1 = NULL; 212 this->objectComponent2 = NULL; 213 this->objectComponent3 = NULL; 214 215 this->animation1 = NULL; 216 this->animation2 = NULL; 217 this->animation3 = NULL; 88 218 } 89 219 … … 95 225 { 96 226 // model will be deleted from WorldEntity-destructor 227 //this->worldEntities = NULL; 228 229 /* dont delete objectComponentsX here, they will be killed when the pnodes are cleaned out */ 230 231 /* all animations are deleted via the animation player*/ 97 232 } 98 233 … … 190 325 {} 191 326 192 /** 193 \brief sets a weapon idle time 194 \param idle time in ms 195 196 a weapon idle time is the time spend after a shoot until the weapon can 197 shoot again 198 */ 199 void Weapon::setWeaponIdleTime(float time) 200 { 201 this->idleTime = time; 202 } 203 204 /** 205 \brief gets the weapon idle time 206 \returns idle time in ms 207 208 a weapon idle time is the time spend after a shoot until the weapon can 209 shoot again 210 */ 211 float Weapon::getWeaponIdleTime(void) 212 { 213 return this->idleTime; 214 } 215 216 /** 217 \brief checks if the idle time is elapsed 218 \return true if time is elapsed 219 220 a weapon idle time is the time spend after a shoot until the weapon can 221 shoot again 222 */ 223 bool Weapon::hasWeaponIdleTimeElapsed(void) 224 { 225 return (this->localTime>this->idleTime)?true:false; 226 } 227 228 229 /** 230 \brief fires the weapon 231 232 this is called from the player.cc, when fire-button is been pushed 233 */ 234 void Weapon::fire() 235 {} 327 328 329 236 330 237 331 -
orxonox/branches/physics/src/world_entities/weapon.h
r3862 r3953 34 34 35 35 #define W_MAX_SLOTS 8 36 #define W_MAX_CONF S 436 #define W_MAX_CONFIGS 4 37 37 38 38 class Projectile; 39 39 class Weapon; 40 class Animation3D; 40 41 41 42 typedef enum { … … 48 49 } weaponSoundType; 49 50 51 50 52 //! this is an identifier for the slot. there are up to 8 weapon slots -> this means there can't be more than 8 weapons at the same time 51 typedef enum slotID {W_SLOT0=0, W_SLOT1, W_SLOT2, W_SLOT3, 52 W_SLOT4, W_SLOT5, W_SLOT6, W_SLOT7}; 53 #define W_SLOT0 0 54 #define W_SLOT1 1 55 #define W_SLOT2 2 56 #define W_SLOT3 3 57 #define W_SLOT4 4 58 #define W_SLOT5 5 59 #define W_SLOT6 6 60 #define W_SLOT7 7 61 #define W_FREE_SLOT 99 62 53 63 54 64 //! this is an identifier for the weapon config 55 typedef enum configID {W_CONFIG0=0, W_CONFIG1, 56 W_CONFIG2, W_CONFIG3}; 65 #define W_CONFIG0 0 66 #define W_CONFIG1 1 67 #define W_CONFIG2 2 68 #define W_CONFIG3 3 69 70 //! a weapon can be left or right sided 71 #define W_LEFT 0 72 #define W_RIGHT 1 57 73 58 74 //! this is a weapon Configuration: it has up to 8 slots 59 75 typedef struct weaponConfig { 60 Weapon* slot1; //<! standard right side weapon 61 Weapon* slot2; //<! standard left side weapon 62 Weapon* slot3; //<! custom 63 Weapon* slot4; //<! custom 64 Weapon* slot5; //<! custom 65 Weapon* slot6; //<! custom 66 Weapon* slot7; //<! custom 67 Weapon* slot8; //<! custom 76 bool bUsed; //<! is set to true, if this configuration is 77 Weapon* slots[8]; 68 78 }; 69 79 … … 74 84 ~WeaponManager(); 75 85 76 void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0); 77 void addWeaponConfig(weaponConfig* config); 86 void addWeapon(Weapon* weapon, int configID = W_CONFIG0, int slotID = W_FREE_SLOT); 87 void removeWeapon(Weapon* weapon, int configID = W_CONFIG0); 88 void nextWeaponConf(); 78 89 79 void nextWeaponConf();80 void prevWeaponConf();81 void selectConfig(configID config);90 void fire(); 91 void tick(float sec); 92 void draw(); 82 93 83 94 private: 84 int nrOfConfigs; //<! number of configurations defined85 95 int nrOfSlots; //<! number of weapon slots a ship has 86 weaponConfig* currentConfig; //<! the currently selected config 87 weaponConfig* configs[4]; //<! a list of four configurations 96 int currConfID; //<! the currently selected config 97 weaponConfig configs[4]; //<! a list of four configurations 98 99 int getNextFreeSlot(int configID); 88 100 }; 89 101 … … 93 105 94 106 public: 95 Weapon (PNode* parent, Vector* coordinate, Quaternion*direction);107 Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction); 96 108 virtual ~Weapon (); 97 109 … … 107 119 bool isActive(void); 108 120 109 void setWeaponIdleTime(float time);110 float getWeaponIdleTime(void);111 bool hasWeaponIdleTimeElapsed(void);112 121 122 /** 123 \brief sets a weapon idle time 124 \param idle time in ms 125 126 a weapon idle time is the time spend after a shoot until the weapon can 127 shoot again 128 */ 129 inline void setWeaponIdleTime(float time) { this->idleTime = time; } 130 /** 131 \brief gets the weapon idle time 132 \returns idle time in ms 133 134 a weapon idle time is the time spend after a shoot until the weapon can 135 shoot again 136 */ 137 inline float getWeaponIdleTime(void) const { return this->idleTime;} 138 /** 139 \brief checks if the idle time is elapsed 140 \return true if time is elapsed 141 142 a weapon idle time is the time spend after a shoot until the weapon can 143 shoot again 144 */ 145 inline bool hasWeaponIdleTimeElapsed(void) const { return (this->localTime>this->idleTime)?true:false; } 146 147 /** 148 \brief fires the weapon 149 150 this is called from the player.cc, when fire-button is been pushed 151 */ 113 152 virtual void fire(void) = 0; 114 153 virtual void hit (WorldEntity* weapon, Vector* loc); … … 121 160 protected: 122 161 tList<WorldEntity>* worldEntities; 123 float localTime; 124 float idleTime; 125 float slowDownFactor; 162 float localTime; //<! this is the local time. important for shooting attributes like frequency 163 float idleTime; //<! the time a weapon needs before it can shoot again. eg. shooting frequency or actication/deactivateion delay 164 float slowDownFactor; //<! if the shooting frequency is a linear function of time... 165 166 PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation 167 PNode* objectComponent2; 168 PNode* objectComponent3; 169 170 Animation3D* animation1; 171 Animation3D* animation2; 172 Animation3D* animation3; 173 174 Vector projectileOffset; 175 int leftRight; // this will become an enum 126 176 127 177 private: 128 bool enabled; 129 Projectile* projectile; 178 bool enabled; //<! states if the weapon is enabled or not 179 Projectile* projectile; //<! the projectile used for this weapon 130 180 //WeaponSound sound; 131 181 };
Note: See TracChangeset
for help on using the changeset viewer.