Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3953 in orxonox.OLD


Ignore:
Timestamp:
Apr 25, 2005, 9:29:41 AM (19 years ago)
Author:
patrick
Message:

orxonox/branches/physics: merged with trunk - with command svn merge -r 3866:HEAD

Location:
orxonox/branches/physics
Files:
1 added
16 deleted
26 edited
17 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/configure

    r3866 r3953  
    58275827 osX="yes"
    58285828
    5829  CPPFLAGS="-I/sw/include $CPPFLAGS"
     5829 CPPFLAGS="-I/sw/include -I/sw/include/SDL $CPPFLAGS"
    58305830# checking gl header
    58315831
  • orxonox/branches/physics/configure.ac

    r3866 r3953  
    381381 osX="yes"
    382382
    383  CPPFLAGS="-I/sw/include $CPPFLAGS"
     383 CPPFLAGS="-I/sw/include -I/sw/include/SDL $CPPFLAGS"
    384384# checking gl header
    385385   AC_CHECK_HEADERS([OpenGL/gl.h] ,,
  • orxonox/branches/physics/src/Makefile.am

    r3863 r3953  
    1717AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu
    1818AM_CXXFLAGS+=-I$(MAINSRCDIR)/ai
     19AM_CXXFLAGS+=-I$(MAINSRCDIR)/util
     20AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
     21AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
    1922
    2023
     
    3033                 command_node.cc \
    3134                 keynames.cc \
    32                  camera.cc \
     35                 world_entities/camera.cc \
    3336                 track_manager.cc \
    3437                 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 \
    3841                 garbage_collector.cc \
    3942                 story_entities/story_entity.cc \
     
    6972                 lib/lang/base_object.cc \
    7073                 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 \
    7376                 lib/math/vector.cc \
    7477                 lib/math/curve.cc \
     
    7982                 track_manager.h \
    8083                 ability.h \
    81                  camera.h \
     84                 world_entities/camera.h \
    8285                 keynames.h \
    8386                 command_node.h \
     
    8588                 track_manager.h \
    8689                 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 \
    9194                 garbage_collector.h \
    9295                 story_entities/story_entity.h \
     
    125128                 lib/lang/base_entity.h \
    126129                 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 \
    130133                 lib/util/ini_parser.h \
    131134                 lib/math/vector.h \
  • orxonox/branches/physics/src/Makefile.in

    r3863 r3953  
    237237target_vendor = @target_vendor@
    238238MAINSRCDIR = .
    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
     239AM_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
    240240AM_LDFLAGS = $(MWINDOWS)
    241241orxonox_SOURCES = orxonox.cc \
     
    243243                 command_node.cc \
    244244                 keynames.cc \
    245                  camera.cc \
     245                 world_entities/camera.cc \
    246246                 track_manager.cc \
    247247                 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 \
    251251                 garbage_collector.cc \
    252252                 story_entities/story_entity.cc \
     
    282282                 lib/lang/base_object.cc \
    283283                 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 \
    286286                 lib/math/vector.cc \
    287287                 lib/math/curve.cc \
     
    292292                 track_manager.h \
    293293                 ability.h \
    294                  camera.h \
     294                 world_entities/camera.h \
    295295                 keynames.h \
    296296                 command_node.h \
     
    298298                 track_manager.h \
    299299                 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 \
    304304                 garbage_collector.h \
    305305                 story_entities/story_entity.h \
     
    338338                 lib/lang/base_entity.h \
    339339                 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 \
    343343                 lib/util/ini_parser.h \
    344344                 lib/math/vector.h \
     
    490490@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    491491
     492camera.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
     500camera.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
     508animation.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
     516animation.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
     524animation3d.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
     532animation3d.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
     540animation_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
     548animation_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
    492556story_entity.o: story_entities/story_entity.cc
    493557@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; \
     
    10021066@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`
    10031067
    1004 list.o: lib/util/list.cc
    1005 @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; \
     1068list.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; \
    10061070@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@
    10081072@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/list.Po' tmpdepfile='$(DEPDIR)/list.TPo' @AMDEPBACKSLASH@
    10091073@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.cc
    1011 
    1012 list.obj: lib/util/list.cc
    1013 @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
     1076list.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`; \
    10141078@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@
    10161080@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/list.Po' tmpdepfile='$(DEPDIR)/list.TPo' @AMDEPBACKSLASH@
    10171081@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.cc
    1021 @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
     1084resource_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; \
    10221086@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@
    10241088@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
    10251089@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.cc
    1027 
    1028 resource_manager.obj: lib/util/resource_manager.cc
    1029 @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
     1092resource_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`; \
    10301094@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@
    10321096@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
    10331097@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`
    10351099
    10361100vector.o: lib/math/vector.cc
     
    12041268
    12051269distdir: $(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_entities
     1270        $(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
    12071271        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
    12081272        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
  • orxonox/branches/physics/src/defs/debug.h

    r3863 r3953  
    6868#define DEBUG_MODULE_LIGHT              0
    6969#define DEBUG_MODULE_PLAYER             1
     70#define DEBUG_MODULE_WEAPON             3
    7071#define DEBUG_MODULE_MATH               0
    71 #define DEBUG_MODULE_FONT               4
    72 #define DEBUG_MODULE_ANIM               3
     72#define DEBUG_MODULE_FONT               1
     73#define DEBUG_MODULE_ANIM               1
    7374
    7475#define DEBUG_MODULE_NULL_PARENT        0
  • orxonox/branches/physics/src/lib/graphics/importer/Makefile.am

    r3658 r3953  
    44AM_CXXFLAGS+=-I$(MAINSRCDIR)/story_entities
    55AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
     6AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/coord
    67AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data
    78AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
    89AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
     10AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui
    911AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang
    1012AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/util
     
    1517AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu
    1618AM_CXXFLAGS+=-I$(MAINSRCDIR)/ai
     19AM_CXXFLAGS+=-I$(MAINSRCDIR)/util
     20AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
     21AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
    1722
    1823
     
    3439                  $(MAINSRCDIR)/lib/lang/base_object.cc \
    3540                  $(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
    3745
    3846noinst_HEADERS= framework.h \
  • orxonox/branches/physics/src/lib/graphics/importer/Makefile.in

    r3789 r3953  
    5757        array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
    5858        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)
    6061importer_OBJECTS = $(am_importer_OBJECTS)
    6162importer_LDADD = $(LDADD)
     
    6869@AMDEP_TRUE@    ./$(DEPDIR)/graphics_engine.Po \
    6970@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 \
    7173@AMDEP_TRUE@    ./$(DEPDIR)/primitive_model.Po \
    7274@AMDEP_TRUE@    ./$(DEPDIR)/resource_manager.Po \
    73 @AMDEP_TRUE@    ./$(DEPDIR)/texture.Po ./$(DEPDIR)/vector.Po \
    74 @AMDEP_TRUE@    ./$(DEPDIR)/windowHandler.Po
     75@AMDEP_TRUE@    ./$(DEPDIR)/text_engine.Po ./$(DEPDIR)/texture.Po \
     76@AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po
    7577CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    7678        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     
    194196target_vendor = @target_vendor@
    195197MAINSRCDIR = ../../..
    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)/ai
     198AM_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
    197199AM_LDFLAGS = $(MWINDOWS)
    198200importer_SOURCES = framework.cc \
     
    207209                  $(MAINSRCDIR)/lib/lang/base_object.cc \
    208210                  $(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
    210215
    211216noinst_HEADERS = framework.h \
     
    290295@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
    291296@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
     297@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null_parent.Po@am__quote@
    292298@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
     299@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
    293300@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@
    294301@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@
    295303@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    296304@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
     
    361369@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`
    362370
    363 resource_manager.o: $(MAINSRCDIR)/lib/util/resource_manager.cc
    364 @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; \
     371resource_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; \
    365373@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@
    367375@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
    368376@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.cc
    370 
    371 resource_manager.obj: $(MAINSRCDIR)/lib/util/resource_manager.cc
    372 @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
     379resource_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`; \
    373381@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@
    375383@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
    376384@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
     387text_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
     395text_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
     403p_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
     411p_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
     419null_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
     427null_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`
    378434uninstall-info-am:
    379435
  • orxonox/branches/physics/src/lib/graphics/importer/material.cc

    r3803 r3953  
    3434   \param mtlName Name of the Material to be added to the Material List
    3535*/
    36 Material::Material (char* mtlName)
     36Material::Material (const char* mtlName)
    3737{
    3838   PRINTF(4)("initializing new Material.\n");
    39   this->nextMat = NULL;
    40   this->name ="";
     39  this->name = NULL;
    4140  this->setIllum(3);
    4241  this->setDiffuse(0,0,0);
     
    5554  this->specularTextureSet = false;
    5655
    57   if (mtlName)
    58     this->setName (mtlName);
    59   else
    60     this->setName("");
     56  this->setName(mtlName);
    6157}
    6258
     
    7167  if (this->diffuseTexture)
    7268    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 mtlName
    97    \param mtlName the Name of the Material to search for
    98    \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;
    11669}
    11770
     
    168121   \param mtlName the Name of the Material to be set.
    169122*/
    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);
     123void 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    }
    175137}
    176138
  • orxonox/branches/physics/src/lib/graphics/importer/material.h

    r3803 r3953  
    1414#endif /* HAVE_CONFIG_H */
    1515
     16#ifndef NULL
     17#define NULL 0
     18#endif
     19
    1620// FORWARD DEFINITIONS //
    1721class Texture;
     
    2226{
    2327 public:
    24   Material (char* mtlName = "");
    25   Material* addMaterial(char* mtlName);
     28  Material (const char* mtlName = NULL);
    2629  ~Material ();
    2730
    28   Material* search(char* mtlName);
    2931  bool select (void);
    3032
    31   void setName (char* mtlName);
     33  void setName (const char* mtlName);
    3234  char* getName (void);
    3335  void setIllum (int illum);
     
    7072  bool specularTextureSet;//!< Chekcs if the specular texture is Set.
    7173
    72   Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
    73 
    74 
    7574};
    7675#endif
  • orxonox/branches/physics/src/lib/graphics/importer/model.cc

    r3801 r3953  
    2323#include "array.h"
    2424#include "vector.h"
     25#include "list.h"
    2526
    2627using namespace std;
    2728
    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//////////////////
    3832/**
    3933   \brief Creates a 3D-Model. and assigns it a Name.
    4034*/
    41 Model::Model(char* modelName)
    42 {
    43   this->initialize();
     35Model::Model(const char* modelName, MODEL_TYPE type)
     36{
     37  PRINTF(4)("new 3D-Model is being created\n");
     38  this->name = NULL;
    4439  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
    18142  this->finalized = false;
    18243  // setting the start group;
     
    18748  this->initGroup (this->currentGroup);
    18849  this->scaleFactor = 1;
    189   this->material = new Material();
    19050
    19151  this->vertices = new Array();
     
    19353  this->normals = new Array();
    19454
    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*/
     66Model::~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*/
     106void 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*/
     127void 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*/
     145void 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*/
     177void 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*/
     198int Model::getGroupCount (void) const
     199{
     200  return this->groupCount;
     201}
     202
     203//////////
     204// INIT //
     205//////////
    198206/**
    199207   \brief sets a name to the Model
     
    204212  if (this->name)
    205213    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
    209223/**
    210224   \brief initializes a new Group model
     
    244258
    245259/**
    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*/
     262bool Model::deleteArrays(void)
     263{
    253264  if (this->vertices)
    254265    delete this->vertices;
     
    257268  if (this->normals)
    258269    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*/
     279bool Model::cleanup(void)
     280{
     281  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
    260282  this->cleanupGroup(this->firstGroup);
    261283  return true;
     
    299321      delete face->next;
    300322    }
    301      
    302 }
    303 
     323}
    304324
    305325/**
     
    316336}
    317337
     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*/
     348Material* 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*/
     359Material* 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*/
     375Material* 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
    318392/**
    319393   \brief parses a group String
     
    323397   With it you should be able to import .obj-files with more than one Models inside.
    324398*/
    325 bool Model::addGroup (char* groupString)
     399bool Model::addGroup (const char* groupString)
    326400{
    327401  PRINTF(5)("Read Group: %s.\n", groupString);
     
    339413    }
    340414  ++this->groupCount;
    341 
    342415}
    343416
     
    348421   If a vertex line is found this function will inject it into the vertex-Array
    349422*/
    350 bool Model::addVertex (char* vertexString)
     423bool Model::addVertex (const char* vertexString)
    351424{
    352425  float subbuffer1;
     
    366439   
    367440*/
    368 bool Model::addVertex(const float x, const float y, const float z)
     441bool Model::addVertex(float x, float y, float z)
    369442{
    370443  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
     
    374447
    375448/**
     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*/
     454bool 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*/
     473bool 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*/
     486bool 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*/
     504bool 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/**
    376512   \brief parses a face-string
    377513   \param faceString The String that will be parsed.
     
    379515   If a face line is found this function will add it to the glList.
    380516*/
    381 bool Model::addFace (char* faceString)
     517bool Model::addFace (const char* faceString)
    382518{
    383519  if (this->currentGroup->faceCount >0)
     
    441577   \param type 0: vertex only, 1: vertex and normal, 2: vertex and Texture, 3 vertex, normal and texture
    442578*/
    443 bool Model::addFace(const float faceElemCount, int type, ...)
     579bool Model::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
    444580{
    445581   if (this->currentGroup->faceCount > 0)
     
    472608
    473609/**
    474    \brief parses a vertexNormal-String
    475    \param normalString The String that will be parsed.
    476 
    477    If a vertexNormal line is found this function will inject it into the vertexNormal-Array
    478 */
    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-Array
    497 */
    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-String
    506    \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-Array
    510 */
    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 Coordinate
    524    \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-Array
    528 */
    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 /**
    537610   \brief Function that selects a material, if changed in the obj file.
    538611   \param matString the Material that will be set.
    539612*/
    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   */     
     613bool Model::setMaterial(const char* matString)
     614{
    549615  if (this->currentGroup->faceCount > 0)
    550616    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new Face;
    551617  this->initFace (this->currentGroup->currentFace);
    552618 
    553   this->currentGroup->currentFace->material = material->search(matString);
     619  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
    554620
    555621  if (this->currentGroup->faceCount == 0)
     
    561627   \param mtl the Material that will be set.
    562628*/
    563 bool Model::addUseMtl (Material* mtl)
     629bool Model::setMaterial(Material* mtl)
    564630{
    565631  if (this->currentGroup->faceCount > 0)
     
    574640
    575641/**
     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*/
     650bool 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/**
    576721   \brief reads and includes the Faces/Materials into the openGL state Machine
    577722*/
    578 bool Model::importToGL (void)
    579 {
    580 
     723bool Model::importToDisplayList(void)
     724{
    581725  // finalize the Arrays
    582726  this->vertices->finalizeArray();
     
    667811
    668812/**
     813   \brief reads and includes the Faces/Materials into the openGL state Machine
     814*/
     815bool 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/**
    669834   \brief Adds a Face-element (one vertex of a face) with all its information.
    670835   \param elem The FaceElement to add to the OpenGL-environment.
     
    688853
    689854}
    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 FaceElements
    697    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 
    769855
    770856/**
     
    833919  */
    834920
    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  
    88
    99#include "material.h"
     10#include "glincl.h"
    1011
    1112// FORWARD DEFINITION //
    1213class Array;
    1314class Vector;
     15template<class T> class tList;
    1416
    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*/
     22typedef enum MODEL_TYPE {MODEL_DISPLAY_LIST,
     23                         MODEL_VERTEX_ARRAY};
     24
    1625
    1726// definition of different modes for setting up Faces
     
    1928#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
    2029#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
     30//! an enumerator for VERTEX_FORMAT
     31typedef enum VERTEX_FORMAT {VERTEX_ONLY = VERTEX,
     32                    VERTEX_NORMAL = NORMAL,
     33                    VERTEX_TEXCOORD = TEXCOORD,
     34                    VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD};
    2135
    2236//! Class that handles 3D-Models. it can also read them in and display them.
    2337class Model
    2438{
    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  /////////////
    4143  //! This is the placeholder of one Vertex beloning to a Face.
    4244  struct FaceElement
     
    6466    char* name;         //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
    6567
    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.
    6770    Face* firstFace;    //!< The first Face in this group.
    6871    Face* currentFace;  //!< The current Face in this Group (the one we are currently working with.)
     
    7376  };
    7477
     78  char* name;            //!< This is the name of the Model.
     79  MODEL_TYPE type;
     80  bool finalized;        //!< Sets the Object to be finalized.
    7581
    7682  Array* vertices;      //!< The Array that handles the Vertices.
     
    7985  Array* vTexture;      //!< The Array that handles the VertexTextureCoordinates.
    8086
    81  
    8287  Group* firstGroup;    //!< The first of all groups.
    8388  Group* currentGroup;  //!< The currentGroup. this is the one we will work with.
    8489  int groupCount;       //!< The Count of Groups.
    8590
    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 Initialisation
     91  tList<Material>* materialList;
     92 
    8893
    89   bool initialize(void);
    9094  bool initGroup(Group* group);
    9195  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);
    92105  bool cleanup(void);
    93106  bool cleanupGroup(Group* group);
     
    95108  bool cleanupFaceElement(FaceElement* faceElem);
    96109
    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);
    110110
    111111 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
    114113
    115   bool buildVertexNormals(void);
     114  Material* findMaterialByName(const char* materialName);
    116115
    117116  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);
    118145};
    119146
  • orxonox/branches/physics/src/lib/graphics/importer/objModel.cc

    r3658 r3953  
    1818#include "objModel.h"
    1919
    20 #include <fstream>
     20#include <stdio.h>
     21#include <string.h>
     22#include <stdlib.h>
     23
     24#define PARSELINELENGTH 8192
    2125
    2226#include "debug.h"
     27#include "compiler.h"
    2328
    2429/**
     
    2732   \param scaling The factor that the model will be scaled with.
    2833*/
    29 OBJModel::OBJModel(char* fileName, float scaling)
     34OBJModel::OBJModel(const char* fileName, float scaling) : Model(fileName)
    3035{
    3136  this->initializeOBJ();
     
    3439  this->importFile (fileName);
    3540
    36   this->importToGL ();
    37 
    38   this->cleanup();
     41  this->finalize();
    3942}
    4043
     
    6366  this->objFileName = NULL;
    6467  this->mtlFileName = NULL;
    65 
    66   this->initialize();
    6768}
    6869
     
    7172   \param fileName The file to import
    7273*/
    73 bool OBJModel::importFile (char* fileName)
     74bool OBJModel::importFile (const char* fileName)
    7475{
    7576  PRINTF(4)("preparing to read in file: %s\n", fileName);
     
    8384  char pathSplitter='/';
    8485#endif /* __WIN32__ */
    85   char* tmpName = fileName;
     86  char* tmpName;
     87  strcpy(tmpName, fileName);
    8688  if (tmpName[0] == pathSplitter)
    8789    tmpName++;
     
    100102 
    101103  this->setName(name);
    102   if (this->material)
    103     this->material->addTexturePath(this->objPath);
     104
    104105  this->objFileName = new char[strlen(name)+1];
    105106  strcpy (this->objFileName, name);
     
    120121  strcat(fileName, this->objFileName);
    121122
    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);
    130127      return false;
    131128    }
    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        }
    138148     
    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);
    160157        }
    161158
    162159      // 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);
    166163        }
    167164     
    168165      // 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);
    172169        }
    173170      // 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);
    185181  delete []fileName;
    186182  return true;
     
    196192
    197193*/
    198 bool OBJModel::readMtlLib (char* mtlFile)
     194bool OBJModel::readMtlLib (const char* mtlFile)
    199195{
    200196  this->mtlFileName = new char [strlen(mtlFile)+1];
     
    205201 
    206202
    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);
    216207      return false;
    217208    }
    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        }
    224268     
    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);
    283288        }
    284289     
    285290
    286291    }
    287   MTL_FILE->close();
     292  fclose(stream);
    288293  delete []fileName;
    289   delete MTL_FILE;
    290294  return true;
    291295}
  • orxonox/branches/physics/src/lib/graphics/importer/objModel.h

    r3655 r3953  
    1313{
    1414 public:
    15   OBJModel(char* fileName, float scaling = 1.0);
     15  OBJModel(const char* fileName, float scaling = 1.0);
    1616  virtual ~OBJModel();
    1717  void initializeOBJ(void);
     
    2424
    2525  ///// readin /////
    26   bool importFile (char* fileName);
     26  bool importFile (const char* fileName);
    2727  bool readFromObjFile (void);
    28   bool readMtlLib (char* matFile);
     28  bool readMtlLib (const char* matFile);
    2929};
    3030
  • orxonox/branches/physics/src/lib/graphics/importer/primitive_model.cc

    r3684 r3953  
    3333PrimitiveModel::PrimitiveModel(PRIMITIVE type, float size, unsigned int detail)
    3434{
    35   this->initialize();
    36 
    3735  switch (type)
    3836    {
     
    5452      break;
    5553    }
    56   this->importToGL ();
    57 
    58   this->cleanup();
     54  this->finalize();
    5955}
    6056
     
    123119            {
    124120              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);
    126122            }
    127123          else if (j == detail)
    128124            {
    129125              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);
    131127            }
    132128          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);
    134130        }
    135131    }
     
    163159      p1 = 2*i+1;
    164160      p2 = 2*i+2;
    165       if (i <= detail);
    166161      p3 = 2*i+4;
    167162      p4 = 2*i+3;
    168163      // 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);
    176172}
    177173
     
    207203      else
    208204        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);
    211207    }
    212208}
     
    238234        v3 = (i+1)*detail + (j+1);
    239235        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);
    241237      }
    242238}
  • orxonox/branches/physics/src/lib/graphics/importer/texture.cc

    r3863 r3953  
    2323   \brief Constructor for a Texture
    2424*/
    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 Texture
    35 */
    3625Texture::Texture(const char* imageName)
    3726{
    38   this->pImage = new Image;
    39   this->pImage->data = NULL;
    40   this->map = NULL;
    4127  this->texture = 0;
    42   this->loadImage(imageName);
     28  if (imageName)
     29    this->loadImage(imageName);
    4330
    4431
     
    5037Texture::~Texture(void)
    5138{
    52   if (this->pImage->data)
    53     delete []this->pImage->data;
    54   delete pImage;
    5539  if (this->texture)
    5640    glDeleteTextures(1, &this->texture);
     
    7357/**
    7458   \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.
    7661*/
    77 bool Texture::loadTexToGL (Image* pImage)
     62GLuint Texture::loadTexToGL (SDL_Surface* surface)
    7863{
    7964  if (GraphicsEngine::texturesEnabled)
    8065    {
    8166      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;
    9074     
    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;
    93141    }
    94142}
     
    104152      if (imageName)
    105153        {
    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)
    108160            {
    109161              PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
    110162              return false;
    111163            }
    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             }
    123164
    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;
    136166         
    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;
    140181        }
    141182      else
  • orxonox/branches/physics/src/lib/graphics/importer/texture.h

    r3863 r3953  
    2020{
    2121 private:
    22   //! Struct to handle Infos about an Image
    23   struct Image
    24   {
    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;     //!< BytesPerPixel
    29     GLenum format;  //!< The Format of the PixelData
    30     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 Image
    3422  GLuint texture;   //!< The Texture-ID of opengl from this Texture.
    35   SDL_Surface* map; //!< The map SDL initializes for this element.
    3623  char* searchTextureInPaths(const char* texName) const;
    3724  void swap(unsigned char &a, unsigned char &b);
    3825 public:
    39   Texture(void);
    40   Texture(const char* imageName);
     26  Texture(const char* imageName = NULL);
    4127  ~Texture(void);
     28
    4229  /** \returns The textureID of this texture.  */
    4330  inline GLuint getTexture(void) {return this->texture;}
    44   bool loadTexToGL (Image* pImage);
     31  GLuint loadTexToGL (SDL_Surface* surface);
    4532
    4633  bool loadImage(const char* imageName);
  • orxonox/branches/physics/src/lib/graphics/text_engine.cc

    r3845 r3953  
    3636#include "vector.h"
    3737#include "debug.h"
    38 
     38#include "list.h"
    3939
    4040////////////
  • orxonox/branches/physics/src/story_entities/world.cc

    r3866 r3953  
    367367            trackManager->condition(2, LEFTRIGHT, this->localPlayer);
    368368            this->glmis->step();
    369 
    370369            break;
    371370          }
  • orxonox/branches/physics/src/track_manager.cc

    r3849 r3953  
    111111    }
    112112  // if not found
    113   else
    114     return NULL;
     113  return NULL;
    115114}
    116115
     
    141140    }
    142141  // if not found
    143   else
    144     return NULL;
     142  return NULL;
    145143}
    146144
     
    762760{
    763761  TrackElement* tmpTrackElem;
     762  TrackElement* tmpJoinElem;
    764763  for (int i = 0; i < count; i++)
    765764    if (!this->firstTrackElem->findByID(trackIDs[i]))
     
    793792  for (int i = 0; i < count; i++)
    794793    {
    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        }
    799800    }
    800801  // time the main Join.
     
    804805  for (int i = 1; i < count; i++)
    805806    {
    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            }
    824827        }
    825828    }
  • orxonox/branches/physics/src/world_entities/player.cc

    r3811 r3953  
    3838Player::Player() : WorldEntity()
    3939{
    40   this->weapons = new tList<Weapon>();
    41   this->activeWeapon = NULL;
    4240  /*
    4341    this is the debug player - actualy we would have to make a new
     
    4644  */
    4745  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);
    4946  travelSpeed = 15.0;
    5047  velocity = new Vector();
    5148  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    5249  bFire = false;
     50  this->bWeaponChange = false;
    5351  acceleration = 10.0;
    5452  //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
    6062}
    6163
     
    6971     this only frees the memory allocated to save the list.
    7072  */
    71   delete this->weapons;
     73  delete this->weaponMan;
    7274}
    7375
     
    7981void Player::addWeapon(Weapon* weapon)
    8082{
    81   this->weapons->add(weapon);
     83  this->weaponMan->addWeapon(weapon);
    8284}
    8385
     
    8991void Player::removeWeapon(Weapon* weapon)
    9092{
    91   this->weapons->remove(weapon);
     93  this->weaponMan->removeWeapon(weapon);
    9294}
    9395
     
    151153  glPopMatrix();
    152154
    153   this->activeWeapon->draw();
    154   this->activeWeaponL->draw();
     155  this->weaponMan->draw();
    155156}
    156157
     
    163164{
    164165  /* 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);
    167169  // player controlled movement
    168170  this->move(time);
     
    180182  Vector accel(0.0, 0.0, 0.0);
    181183  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    182  
    183184  /* calculate the direction in which the craft is heading  */
    184185  Vector direction (1.0, 0.0, 0.0);
     
    210211  if( this->bFire)
    211212    {
    212       //if(this->activeWeapon != NULL)
    213       this->activeWeapon->fire();
    214       //FIX THIS FIX FIIIIIIIIIIIX
    215       this->activeWeaponL->fire();
     213      this->weaponMan->fire();
    216214    }
    217   if( this->bWeaponChange && this->weapons->getSize() > 1)
     215  if( this->bWeaponChange)
    218216    {
    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;
    224219    }
    225220}
     
    240235  if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
    241236  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  
    1111template<class T> class tList;
    1212class Weapon;
     13class WeaponManager;
    1314class Vector;
    1415class World;
     
    4950  Weapon* activeWeapon;  //!< the weapon that is currenty activated
    5051  Weapon* activeWeaponL;  //temporary -- FIX THIS
     52  WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
    5153
    5254  World* myWorld;        //!< reference to the world object
  • orxonox/branches/physics/src/world_entities/skybox.cc

    r3807 r3953  
    187187  model->addVertexNormal (-1.0, 0.0, 0.0);
    188188
    189   model->addUseMtl(material[0]);
    190   model->addFace (4, 3, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top
    191   model->addUseMtl(material[1]);
    192   model->addFace (4, 3, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom
    193   model->addUseMtl(material[2]);
    194   model->addFace (4, 3, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left
    195   model->addUseMtl(material[3]);
    196   model->addFace (4, 3, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right
    197   model->addUseMtl(material[4]);
    198   model->addFace (4, 3, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front
    199   model->addUseMtl(material[5]);
    200   model->addFace (4, 3, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back
     189  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
    201201 
    202202  model->finalize();
  • orxonox/branches/physics/src/world_entities/test_gun.cc

    r3855 r3953  
    4040   creates a new weapon
    4141*/
    42 TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight)
     42TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight)
    4343  :  Weapon (parent, coordinate, direction)
    4444{
     
    4747  this->leftRight = leftRight;
    4848
    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);
    5352
     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);
    5458
    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);
    5766
    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);
    6770    }
    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   */
    8871}
    8972
     
    127110void TestGun::fire()
    128111{
    129   if( this->localTime < this->idleTime)
     112  if( !this->hasWeaponIdleTimeElapsed())
    130113    {
    131114      this->weaponIdle();
    132115      return;
    133116    }
     117
    134118  Projectile* pj = new TestBullet(this);
    135 
    136   pj->setAbsCoor(this->getAbsCoor() + *this->projOffset);
     119  pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
    137120  pj->setAbsDir(this->getAbsDir());
    138 
    139121  pj->setFlightDirection(this->getAbsDir());
    140122  pj->setSpeed(this->getSpeed());
    141 
    142123  this->worldEntities->add(pj);
    143124  this->localTime = 0;
    144125 
    145   this->animation->replay();
     126  this->animation1->replay();
    146127}
    147128
     
    190171void TestGun::draw ()
    191172{
    192  
    193   /* draw gun body 1 */
     173  /* draw gun body */
    194174  glMatrixMode(GL_MODELVIEW);
    195175  glPushMatrix();
    196176  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);
    220185  glPopMatrix();
    221186
    222 
    223   /* draw gun coil 1 */
     187  /* draw objectComponent1: gun coil - animated stuff */
    224188  glMatrixMode(GL_MODELVIEW);
    225189  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);
    232194  glMultMatrixf((float*)matrix);
    233195  this->model->draw(0);
  • orxonox/branches/physics/src/world_entities/test_gun.h

    r3855 r3953  
    3737
    3838 public:
    39   TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight);
     39  TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight);
    4040  virtual ~TestGun ();
    4141
     
    5151  virtual void draw(void);
    5252
    53  private:
    54   Animation3D* animation;
    55   Vector* projOffset;
    56   WorldEntity* dummy1;
    57   int leftRight;   // this will become an enum
     53
     54
    5855
    5956};
  • orxonox/branches/physics/src/world_entities/weapon.cc

    r3862 r3953  
    1616*/
    1717
     18#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1819
    1920#include "weapon.h"
     
    3031
    3132
     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*/
    3237WeaponManager::WeaponManager(int nrOfSlots)
    3338{
     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    }
    3445  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
    4249
    4350WeaponManager::~WeaponManager()
    4451{
    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*/
     77void 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
     98void 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*/
    58110void 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*/
     138void 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*/
     153void 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*/
     167void 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*/
     182int 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
    72194
    73195
     
    78200   creates a new weapon
    79201*/
    80 Weapon::Weapon (PNode* parent, Vector* coordinate, Quaternion* direction)
     202Weapon::Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction)
    81203  : WorldEntity()
    82204{
    83205  parent->addChild(this, PNODE_ALL);
    84   this->setRelCoor(*coordinate);
    85   this->setRelDir(*direction);
     206  this->setRelCoor(coordinate);
     207  this->setRelDir(direction);
    86208  WorldInterface* wi = WorldInterface::getInstance();
    87209  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;
    88218}
    89219
     
    95225{
    96226  // 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*/
    97232}
    98233
     
    190325{}
    191326
    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
    236330
    237331
  • orxonox/branches/physics/src/world_entities/weapon.h

    r3862 r3953  
    3434
    3535#define W_MAX_SLOTS 8
    36 #define W_MAX_CONFS 4
     36#define W_MAX_CONFIGS 4
    3737
    3838class Projectile;
    3939class Weapon;
     40class Animation3D;
    4041
    4142typedef enum {
     
    4849} weaponSoundType;
    4950
     51
    5052//! 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
    5363
    5464//! 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
    5773
    5874//! this is a weapon Configuration: it has up to 8 slots
    5975typedef 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];
    6878};
    6979
     
    7484  ~WeaponManager();
    7585 
    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();
    7889
    79   void nextWeaponConf();
    80   void prevWeaponConf();
    81   void selectConfig(configID config);
     90  void fire();
     91  void tick(float sec);
     92  void draw();
    8293
    8394 private:
    84   int nrOfConfigs;                      //<! number of configurations defined
    8595  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);
    88100};
    89101
     
    93105
    94106 public:
    95   Weapon (PNode* parent, Vector* coordinate, Quaternion* direction);
     107  Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction);
    96108  virtual ~Weapon ();
    97109 
     
    107119  bool isActive(void);
    108120
    109   void setWeaponIdleTime(float time);
    110   float getWeaponIdleTime(void);
    111   bool hasWeaponIdleTimeElapsed(void);
    112121
     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  */
    113152  virtual void fire(void) = 0;
    114153  virtual void hit (WorldEntity* weapon, Vector* loc);
     
    121160 protected:
    122161  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
    126176
    127177 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
    130180  //WeaponSound sound;
    131181};
Note: See TracChangeset for help on using the changeset viewer.