Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3746 in orxonox.OLD


Ignore:
Timestamp:
Apr 7, 2005, 3:54:49 PM (19 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Merged trunk into branch… still not working though…

Location:
orxonox/branches/levelloader
Files:
4 deleted
80 edited
20 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    3838        $(srcdir)/Makefile.in $(srcdir)/config.h.in \
    3939        $(srcdir)/doc/documentation.am $(top_srcdir)/configure AUTHORS \
    40         COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \
    41         install-sh missing mkinstalldirs
     40        COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \
     41        depcomp install-sh missing mkinstalldirs
    4242subdir = .
    4343ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    328328        tags=; \
    329329        here=`pwd`; \
    330         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     330        if (etags --etags-include --version) >/dev/null 2>&1; then \
    331331          include_option=--etags-include; \
    332           empty_fix=.; \
    333332        else \
    334333          include_option=--include; \
    335           empty_fix=; \
    336334        fi; \
    337335        list='$(SUBDIRS)'; for subdir in $$list; do \
    338336          if test "$$subdir" = .; then :; else \
    339             test ! -f $$subdir/TAGS || \
     337            test -f $$subdir/TAGS && \
    340338              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    341339          fi; \
     
    347345          $(AWK) '    { files[$$0] = 1; } \
    348346               END { for (i in files) print i; }'`; \
    349         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    350           test -n "$$unique" || unique=$$empty_fix; \
    351           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    352             $$tags $$unique; \
    353         fi
     347        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     348          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     349             $$tags $$unique
    354350ctags: CTAGS
    355351CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
     
    460456          uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
    461457        *.shar.gz*) \
    462           GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
     458          GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\
    463459        *.zip*) \
    464460          unzip $(distdir).zip ;;\
     
    483479          && chmod -R a-w "$$dc_install_base" \
    484480          && ({ \
    485                (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
     481               (cd ../.. && $(mkdir_p) "$$dc_destdir") \
    486482               && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
    487483               && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
  • orxonox/branches/levelloader/NEWS

    r3314 r3746  
    1 Date: December 20, 2004
    2 Topic: New Webpage under construction
    3 Body: I am proud to announce, that nico is currently developing our new webpage. It has a verry cool new style, and is much more easy to extend, than the old one. <a href="http://www.orxonox.ethz.ch/new">visit it</a>.
     1Date: Mach 05, 2005
     2Topic: Orxonox Convention 2005
     3Body: We are going to make a new Convention, that you are all invited to. Visit the convention section for more details. <A href="http://www.orxonox.ethz.ch/index.php?site=conventions">link.</A
     4
     5Date: February 21, 2005
     6Topic: New Webpage Release
     7Body: We are proud to announce our new webpage. Thanks to nico and his php skills :)
    48
    59Date: December 14, 2004
    610Topic: Repository Moved
    7 Body: Today we moved the repository. The new location of the repository is <A href="http://svn.orxonox.ethz.ch/reporx">http://svn.orxonox.ethz.ch/reporx</A>.
     11Body: Today we moved the repository. The new location of the repository is <A href="https://svn.orxonox.ethz.ch/reporx">http://svn.orxonox.ethz.ch/reporx</A>.
    812
    913Date:   November 16, 2004
    1014Topic:  Importer
    1115Body:   There now exists a possibility to import .obj-files (alias wavefront format) into the Game. You can find some test models here: <A href="/files/models">models</a>. You can also test them with the included importer which is locates in trunk/importer. enjoy.
    12 
    1316
    1417Date:   June 22, 2004
  • orxonox/branches/levelloader/ToDo

    r1904 r3746  
    55--------
    66
    7 - perspective change: smooth glide back in zero mode (pb)
    8 - efficency in garbage collection ShootLaser
    9 - player speed, *speed setting smoother (now taking current fps rate): average
     7#define "objModel.h" has nothing todo in world_entity.h
     8
     9Collision Detection: SetObjectCollisionBox( void );
    1010
    1111
    12 ./configure
    13 -----------
    14 - if dri is not supported glxinfo returns "Xlib:  extension "XFree86-DRI" missing on display ":0.0"." -> this message should not be shown on the console!
    1512
    16 
  • orxonox/branches/levelloader/aclocal.m4

    r3605 r3746  
    1 # generated automatically by aclocal 1.8.5 -*- Autoconf -*-
     1# generated automatically by aclocal 1.8.2 -*- Autoconf -*-
    22
    33# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
     
    4141# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
    4242AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
    43          [AM_AUTOMAKE_VERSION([1.8.5])])
     43         [AM_AUTOMAKE_VERSION([1.8.2])])
    4444
    4545# AM_AUX_DIR_EXPAND
     
    150150fi])])
    151151
    152 # serial 7                                              -*- Autoconf -*-
     152# serial 6                                              -*- Autoconf -*-
    153153
    154154# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
     
    237237    for i in 1 2 3 4 5 6; do
    238238      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    239       # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
    240       # Solaris 8's {/usr,}/bin/sh.
    241       touch sub/conftst$i.h
     239      : > sub/conftst$i.h
    242240    done
    243241    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
     
    267265       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
    268266      # icc doesn't choke on unknown options, it will just issue warnings
    269       # or remarks (even with -Werror).  So we grep stderr for any message
    270       # that says an option was ignored or not supported.
    271       # When given -MP, icc 7.0 and 7.1 complain thusly:
    272       #   icc: Command line warning: ignoring option '-M'; no argument required
    273       # The diagnosis changed in icc 8.0:
    274       #   icc: Command line remark: option '-MP' not supported
    275       if (grep 'ignoring option' conftest.err ||
    276           grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
     267      # (even with -Werror).  So we grep stderr for any message
     268      # that says an option was ignored.
     269      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
    277270        am_cv_$1_dependencies_compiler_type=$depmode
    278271        break
     
    320313# Generate code to set up dependency tracking.   -*- Autoconf -*-
    321314
    322 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
     315# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    323316
    324317# This program is free software; you can redistribute it and/or modify
     
    359352  # Extract the definition of DEP_FILES from the Makefile without
    360353  # running `make'.
    361   DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     354  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
    362355  test -z "$DEPDIR" && continue
    363356  # When using ansi2knr, U may be empty or an underscore; expand it
    364   U=`sed -n 's/^U = //p' < "$mf"`
     357  U=`sed -n -e '/^U = / s///p' < "$mf"`
    365358  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
    366359  # We invoke sed twice because it is the simplest approach to
    367360  # changing $(DEPDIR) to its actual value in the expansion.
    368   for file in `sed -n '
     361  for file in `sed -n -e '
    369362    /^DEP_FILES = .*\\\\$/ {
    370363      s/^DEP_FILES = //
     
    725718# Do not use -m 0755 and let people choose whatever they expect by
    726719# setting umask.
    727 #
    728 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
    729 # Some implementations (such as Solaris 8's) are not thread-safe: if a
    730 # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
    731 # concurrently, both version can detect that a/ is missing, but only
    732 # one can create it and the other will error out.  Consequently we
    733 # restrict ourselves to GNU make (using the --version option ensures
    734 # this.)
    735720AC_DEFUN([AM_PROG_MKDIR_P],
    736 [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
     721[if mkdir -p -- . 2>/dev/null; then
    737722  # Keeping the `.' argument allows $(mkdir_p) to be used without
    738723  # argument.  Indeed, we sometimes output rules like
     
    747732  # directories to create, and then abort because `.' already
    748733  # exists.
    749   for d in ./-p ./--version;
     734  for d in ./-p ./--;
    750735  do
    751736    test -d $d && rmdir $d
  • orxonox/branches/levelloader/configure

    r3605 r3746  
    16031603fi
    16041604
    1605 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
     1605if mkdir -p -- . 2>/dev/null; then
    16061606  # Keeping the `.' argument allows $(mkdir_p) to be used without
    16071607  # argument.  Indeed, we sometimes output rules like
     
    16161616  # directories to create, and then abort because `.' already
    16171617  # exists.
    1618   for d in ./-p ./--version;
     1618  for d in ./-p ./--;
    16191619  do
    16201620    test -d $d && rmdir $d
     
    25222522    for i in 1 2 3 4 5 6; do
    25232523      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    2524       # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
    2525       # Solaris 8's {/usr,}/bin/sh.
    2526       touch sub/conftst$i.h
     2524      : > sub/conftst$i.h
    25272525    done
    25282526    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
     
    25522550       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
    25532551      # icc doesn't choke on unknown options, it will just issue warnings
    2554       # or remarks (even with -Werror).  So we grep stderr for any message
    2555       # that says an option was ignored or not supported.
    2556       # When given -MP, icc 7.0 and 7.1 complain thusly:
    2557       #   icc: Command line warning: ignoring option '-M'; no argument required
    2558       # The diagnosis changed in icc 8.0:
    2559       #   icc: Command line remark: option '-MP' not supported
    2560       if (grep 'ignoring option' conftest.err ||
    2561           grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
     2552      # (even with -Werror).  So we grep stderr for any message
     2553      # that says an option was ignored.
     2554      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
    25622555        am_cv_CXX_dependencies_compiler_type=$depmode
    25632556        break
     
    33603353    for i in 1 2 3 4 5 6; do
    33613354      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    3362       # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
    3363       # Solaris 8's {/usr,}/bin/sh.
    3364       touch sub/conftst$i.h
     3355      : > sub/conftst$i.h
    33653356    done
    33663357    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
     
    33903381       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
    33913382      # icc doesn't choke on unknown options, it will just issue warnings
    3392       # or remarks (even with -Werror).  So we grep stderr for any message
    3393       # that says an option was ignored or not supported.
    3394       # When given -MP, icc 7.0 and 7.1 complain thusly:
    3395       #   icc: Command line warning: ignoring option '-M'; no argument required
    3396       # The diagnosis changed in icc 8.0:
    3397       #   icc: Command line remark: option '-MP' not supported
    3398       if (grep 'ignoring option' conftest.err ||
    3399           grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
     3383      # (even with -Werror).  So we grep stderr for any message
     3384      # that says an option was ignored.
     3385      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
    34003386        am_cv_CC_dependencies_compiler_type=$depmode
    34013387        break
     
    96399625  # Extract the definition of DEP_FILES from the Makefile without
    96409626  # running `make'.
    9641   DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     9627  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
    96429628  test -z "$DEPDIR" && continue
    96439629  # When using ansi2knr, U may be empty or an underscore; expand it
    9644   U=`sed -n 's/^U = //p' < "$mf"`
     9630  U=`sed -n -e '/^U = / s///p' < "$mf"`
    96459631  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
    96469632  # We invoke sed twice because it is the simplest approach to
    96479633  # changing $(DEPDIR) to its actual value in the expansion.
    9648   for file in `sed -n '
     9634  for file in `sed -n -e '
    96499635    /^DEP_FILES = .*\\\\$/ {
    96509636      s/^DEP_FILES = //
  • orxonox/branches/levelloader/src/Makefile.am

    r3605 r3746  
    3737                 simple_animation.cc \
    3838                 factory.cc \
     39                 garbage_collector.cc \
    3940                 story_entities/story_entity.cc \
    4041                 story_entities/campaign.cc \
     
    4546                 world_entities/skysphere.cc \
    4647                 world_entities/terrain.cc \
    47                  world_entities/primitive.cc \
    4848                 world_entities/weapon.cc \
    4949                 world_entities/projectile.cc \
    5050                 world_entities/character_attributes.cc \
     51                 world_entities/test_gun.cc \
     52                 world_entities/test_bullet.cc \
    5153                 ai/ai.cc \
    5254                 lib/coord/p_node.cc \
     
    5456                 lib/coord/helper_parent.cc \
    5557                 lib/data/data_tank.cc \
     58                 lib/graphics/graphics_engine.cc \
    5659                 lib/graphics/light.cc \
    5760                 lib/graphics/font/fontset.cc \
    5861                 lib/graphics/importer/array.cc \
    5962                 lib/graphics/importer/objModel.cc \
     63                 lib/graphics/importer/primitive_model.cc \
    6064                 lib/graphics/importer/model.cc \
    6165                 lib/graphics/importer/material.cc \
     
    6670                 lib/util/list.cc \
    6771                 lib/util/substring.cc \
     72                 lib/util/resource_manager.cc \
    6873                 lib/math/vector.cc \
    6974                 lib/math/curve.cc \
     
    7378                 lib/xmlparser/tinyxmlparser.cc \
    7479                 glmenu/glmenu_imagescreen.cc
     80                 glmenu/glmenu_imagescreen.cc
    7581
    7682noinst_HEADERS = orxonox.h \
     
    8086                 camera.h \
    8187                 keynames.h \
    82                  proto_class.h \
    8388                 command_node.h \
    8489                 message_structures.h \
     
    8691                 track_node.h \
    8792                 simple_animation.h \
     93                 garbage_collector.h \
    8894                 story_entities/story_entity.h \
    8995                 story_entities/story_def.h \
     
    97103                 world_entities/power_up.h \
    98104                 world_entities/terrain.h \
    99                  world_entities/primitive.h \
    100105                 world_entities/weapon.h \
    101106                 world_entities/projectile.h \
    102107                 world_entities/character_attributes.h \
     108                 world_entities/test_gun.h \
     109                 world_entities/test_bullet.h \
    103110                 ai/ai.h \
    104111                 network/synchronisable.h \
    105112                 defs/stdincl.h \
    106113                 defs/glincl.h \
     114                 defs/comincl.h \
    107115                 defs/error.h \
    108116                 defs/debug.h \
     
    110118                 lib/coord/null_parent.h \
    111119                 lib/coord/helper_parent.h \
     120                 lib/graphics/graphics_engine.h \
    112121                 lib/graphics/light.h \
    113122                 lib/graphics/font/fontset.h \
     
    117126                 lib/util/list.h \
    118127                 lib/util/list_template.h \
     128                 lib/util/resource_manager.h \
    119129                 lib/util/ini_parser.h \
    120130                 lib/util/substring.h \
     
    127137
    128138## orxonox.conf will be used from home-dir instead.
    129 EXTRA_DIST = orxonox.conf
     139EXTRA_DIST = orxonox.conf \
     140             proto/proto_class.h \
     141             proto/proto_class.cc \
     142             proto/proto_singleton.h \
     143             proto/proto_singleton.cc
    130144
    131145if SUB_PROJECTS
  • orxonox/branches/levelloader/src/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
     
    5757        track_manager.$(OBJEXT) track_node.$(OBJEXT) \
    5858        simple_animation.$(OBJEXT) factory.$(OBJEXT) \
    59         story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \
    60         world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \
    61         skysphere.$(OBJEXT) terrain.$(OBJEXT) primitive.$(OBJEXT) \
    62         weapon.$(OBJEXT) projectile.$(OBJEXT) \
    63         character_attributes.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
     59        garbage_collector.$(OBJEXT) story_entity.$(OBJEXT) \
     60        campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
     61        player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
     62        terrain.$(OBJEXT) weapon.$(OBJEXT) projectile.$(OBJEXT) \
     63        character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \
     64        test_bullet.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
    6465        null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
    65         data_tank.$(OBJEXT) light.$(OBJEXT) fontset.$(OBJEXT) \
    66         array.$(OBJEXT) objModel.$(OBJEXT) model.$(OBJEXT) \
    67         material.$(OBJEXT) texture.$(OBJEXT) base_entity.$(OBJEXT) \
    68         base_object.$(OBJEXT) ini_parser.$(OBJEXT) list.$(OBJEXT) \
    69         substring.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \
     66        data_tank.$(OBJEXT) graphics_engine.$(OBJEXT) light.$(OBJEXT) \
     67        fontset.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \
     68        primitive_model.$(OBJEXT) model.$(OBJEXT) material.$(OBJEXT) \
     69        texture.$(OBJEXT) base_entity.$(OBJEXT) base_object.$(OBJEXT) \
     70        ini_parser.$(OBJEXT) list.$(OBJEXT) substring.$(OBJEXT) \
     71        resource_manager.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \
    7072        tinystr.$(OBJEXT) tinyxml.$(OBJEXT) tinyxmlerror.$(OBJEXT) \
    7173        tinyxmlparser.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
     
    8486@AMDEP_TRUE@    ./$(DEPDIR)/environment.Po ./$(DEPDIR)/factory.Po \
    8587@AMDEP_TRUE@    ./$(DEPDIR)/fontset.Po ./$(DEPDIR)/game_loader.Po \
     88@AMDEP_TRUE@    ./$(DEPDIR)/garbage_collector.Po \
    8689@AMDEP_TRUE@    ./$(DEPDIR)/glmenu_imagescreen.Po \
     90@AMDEP_TRUE@    ./$(DEPDIR)/graphics_engine.Po \
    8791@AMDEP_TRUE@    ./$(DEPDIR)/helper_parent.Po \
    8892@AMDEP_TRUE@    ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
     
    9195@AMDEP_TRUE@    ./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/objModel.Po \
    9296@AMDEP_TRUE@    ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/p_node.Po \
    93 @AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/primitive.Po \
     97@AMDEP_TRUE@    ./$(DEPDIR)/player.Po \
     98@AMDEP_TRUE@    ./$(DEPDIR)/primitive_model.Po \
    9499@AMDEP_TRUE@    ./$(DEPDIR)/projectile.Po \
     100@AMDEP_TRUE@    ./$(DEPDIR)/resource_manager.Po \
    95101@AMDEP_TRUE@    ./$(DEPDIR)/simple_animation.Po \
    96102@AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
    97103@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po \
    98104@AMDEP_TRUE@    ./$(DEPDIR)/substring.Po ./$(DEPDIR)/terrain.Po \
     105@AMDEP_TRUE@    ./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \
    99106@AMDEP_TRUE@    ./$(DEPDIR)/texture.Po ./$(DEPDIR)/tinystr.Po \
    100107@AMDEP_TRUE@    ./$(DEPDIR)/tinyxml.Po ./$(DEPDIR)/tinyxmlerror.Po \
     
    242249                 simple_animation.cc \
    243250                 factory.cc \
     251                 garbage_collector.cc \
    244252                 story_entities/story_entity.cc \
    245253                 story_entities/campaign.cc \
     
    250258                 world_entities/skysphere.cc \
    251259                 world_entities/terrain.cc \
    252                  world_entities/primitive.cc \
    253260                 world_entities/weapon.cc \
    254261                 world_entities/projectile.cc \
    255262                 world_entities/character_attributes.cc \
     263                 world_entities/test_gun.cc \
     264                 world_entities/test_bullet.cc \
    256265                 ai/ai.cc \
    257266                 lib/coord/p_node.cc \
     
    259268                 lib/coord/helper_parent.cc \
    260269                 lib/data/data_tank.cc \
     270                 lib/graphics/graphics_engine.cc \
    261271                 lib/graphics/light.cc \
    262272                 lib/graphics/font/fontset.cc \
    263273                 lib/graphics/importer/array.cc \
    264274                 lib/graphics/importer/objModel.cc \
     275                 lib/graphics/importer/primitive_model.cc \
    265276                 lib/graphics/importer/model.cc \
    266277                 lib/graphics/importer/material.cc \
     
    271282                 lib/util/list.cc \
    272283                 lib/util/substring.cc \
     284                 lib/util/resource_manager.cc \
    273285                 lib/math/vector.cc \
    274286                 lib/math/curve.cc \
     
    285297                 camera.h \
    286298                 keynames.h \
    287                  proto_class.h \
    288299                 command_node.h \
    289300                 message_structures.h \
     
    291302                 track_node.h \
    292303                 simple_animation.h \
     304                 garbage_collector.h \
    293305                 story_entities/story_entity.h \
    294306                 story_entities/story_def.h \
     
    302314                 world_entities/power_up.h \
    303315                 world_entities/terrain.h \
    304                  world_entities/primitive.h \
    305316                 world_entities/weapon.h \
    306317                 world_entities/projectile.h \
    307318                 world_entities/character_attributes.h \
     319                 world_entities/test_gun.h \
     320                 world_entities/test_bullet.h \
    308321                 ai/ai.h \
    309322                 network/synchronisable.h \
    310323                 defs/stdincl.h \
    311324                 defs/glincl.h \
     325                 defs/comincl.h \
    312326                 defs/error.h \
    313327                 defs/debug.h \
     
    315329                 lib/coord/null_parent.h \
    316330                 lib/coord/helper_parent.h \
     331                 lib/graphics/graphics_engine.h \
    317332                 lib/graphics/light.h \
    318333                 lib/graphics/font/fontset.h \
     
    322337                 lib/util/list.h \
    323338                 lib/util/list_template.h \
     339                 lib/util/resource_manager.h \
    324340                 lib/util/ini_parser.h \
    325341                 lib/util/substring.h \
     
    330346                 glmenu/glmenu_imagescreen.h
    331347
    332 EXTRA_DIST = orxonox.conf
     348EXTRA_DIST = orxonox.conf \
     349             proto/proto_class.h \
     350             proto/proto_class.cc \
     351             proto/proto_singleton.h \
     352             proto/proto_singleton.cc
     353
    333354@SUB_PROJECTS_FALSE@SUB_PROGS =
    334355@SUB_PROJECTS_TRUE@SUB_PROGS = lib subprojects
     
    349370          esac; \
    350371        done; \
    351         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
     372        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
    352373        cd $(top_srcdir) && \
    353           $(AUTOMAKE) --foreign  src/Makefile
     374          $(AUTOMAKE) --gnu  src/Makefile
    354375.PRECIOUS: Makefile
    355376Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    371392install-binPROGRAMS: $(bin_PROGRAMS)
    372393        @$(NORMAL_INSTALL)
    373         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     394        $(mkdir_p) $(DESTDIR)$(bindir)
    374395        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    375396          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    377398          ; then \
    378399            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    379            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    380            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     400           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     401           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    381402          else :; fi; \
    382403        done
     
    386407        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    387408          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    388           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    389           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     409          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     410          rm -f $(DESTDIR)$(bindir)/$$f; \
    390411        done
    391412
     
    416437@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontset.Po@am__quote@
    417438@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
     439@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbage_collector.Po@am__quote@
    418440@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@
     441@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
    419442@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@
    420443@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
     
    429452@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
    430453@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
    431 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive.Po@am__quote@
     454@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@
    432455@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/projectile.Po@am__quote@
     456@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@
    433457@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_animation.Po@am__quote@
    434458@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
     
    436460@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/substring.Po@am__quote@
    437461@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terrain.Po@am__quote@
     462@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bullet.Po@am__quote@
     463@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gun.Po@am__quote@
    438464@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    439465@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinystr.Po@am__quote@
     
    592618@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o terrain.obj `if test -f 'world_entities/terrain.cc'; then $(CYGPATH_W) 'world_entities/terrain.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/terrain.cc'; fi`
    593619
    594 primitive.o: world_entities/primitive.cc
    595 @am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.o -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc; \
    596 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
    597 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/primitive.cc' object='primitive.o' libtool=no @AMDEPBACKSLASH@
    598 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
    599 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    600 @am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc
    601 
    602 primitive.obj: world_entities/primitive.cc
    603 @am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.obj -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`; \
    604 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
    605 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/primitive.cc' object='primitive.obj' libtool=no @AMDEPBACKSLASH@
    606 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
    607 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    608 @am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`
    609 
    610620weapon.o: world_entities/weapon.cc
    611621@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT weapon.o -MD -MP -MF "$(DEPDIR)/weapon.Tpo" -c -o weapon.o `test -f 'world_entities/weapon.cc' || echo '$(srcdir)/'`world_entities/weapon.cc; \
     
    656666@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o character_attributes.obj `if test -f 'world_entities/character_attributes.cc'; then $(CYGPATH_W) 'world_entities/character_attributes.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/character_attributes.cc'; fi`
    657667
     668test_gun.o: world_entities/test_gun.cc
     669@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_gun.o -MD -MP -MF "$(DEPDIR)/test_gun.Tpo" -c -o test_gun.o `test -f 'world_entities/test_gun.cc' || echo '$(srcdir)/'`world_entities/test_gun.cc; \
     670@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/test_gun.Tpo" "$(DEPDIR)/test_gun.Po"; else rm -f "$(DEPDIR)/test_gun.Tpo"; exit 1; fi
     671@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/test_gun.cc' object='test_gun.o' libtool=no @AMDEPBACKSLASH@
     672@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/test_gun.Po' tmpdepfile='$(DEPDIR)/test_gun.TPo' @AMDEPBACKSLASH@
     673@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     674@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_gun.o `test -f 'world_entities/test_gun.cc' || echo '$(srcdir)/'`world_entities/test_gun.cc
     675
     676test_gun.obj: world_entities/test_gun.cc
     677@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_gun.obj -MD -MP -MF "$(DEPDIR)/test_gun.Tpo" -c -o test_gun.obj `if test -f 'world_entities/test_gun.cc'; then $(CYGPATH_W) 'world_entities/test_gun.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_gun.cc'; fi`; \
     678@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/test_gun.Tpo" "$(DEPDIR)/test_gun.Po"; else rm -f "$(DEPDIR)/test_gun.Tpo"; exit 1; fi
     679@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/test_gun.cc' object='test_gun.obj' libtool=no @AMDEPBACKSLASH@
     680@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/test_gun.Po' tmpdepfile='$(DEPDIR)/test_gun.TPo' @AMDEPBACKSLASH@
     681@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     682@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_gun.obj `if test -f 'world_entities/test_gun.cc'; then $(CYGPATH_W) 'world_entities/test_gun.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_gun.cc'; fi`
     683
     684test_bullet.o: world_entities/test_bullet.cc
     685@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_bullet.o -MD -MP -MF "$(DEPDIR)/test_bullet.Tpo" -c -o test_bullet.o `test -f 'world_entities/test_bullet.cc' || echo '$(srcdir)/'`world_entities/test_bullet.cc; \
     686@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/test_bullet.Tpo" "$(DEPDIR)/test_bullet.Po"; else rm -f "$(DEPDIR)/test_bullet.Tpo"; exit 1; fi
     687@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/test_bullet.cc' object='test_bullet.o' libtool=no @AMDEPBACKSLASH@
     688@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/test_bullet.Po' tmpdepfile='$(DEPDIR)/test_bullet.TPo' @AMDEPBACKSLASH@
     689@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     690@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_bullet.o `test -f 'world_entities/test_bullet.cc' || echo '$(srcdir)/'`world_entities/test_bullet.cc
     691
     692test_bullet.obj: world_entities/test_bullet.cc
     693@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_bullet.obj -MD -MP -MF "$(DEPDIR)/test_bullet.Tpo" -c -o test_bullet.obj `if test -f 'world_entities/test_bullet.cc'; then $(CYGPATH_W) 'world_entities/test_bullet.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_bullet.cc'; fi`; \
     694@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/test_bullet.Tpo" "$(DEPDIR)/test_bullet.Po"; else rm -f "$(DEPDIR)/test_bullet.Tpo"; exit 1; fi
     695@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/test_bullet.cc' object='test_bullet.obj' libtool=no @AMDEPBACKSLASH@
     696@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/test_bullet.Po' tmpdepfile='$(DEPDIR)/test_bullet.TPo' @AMDEPBACKSLASH@
     697@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     698@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_bullet.obj `if test -f 'world_entities/test_bullet.cc'; then $(CYGPATH_W) 'world_entities/test_bullet.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/test_bullet.cc'; fi`
     699
    658700ai.o: ai/ai.cc
    659701@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ai.o -MD -MP -MF "$(DEPDIR)/ai.Tpo" -c -o ai.o `test -f 'ai/ai.cc' || echo '$(srcdir)/'`ai/ai.cc; \
     
    736778@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data_tank.obj `if test -f 'lib/data/data_tank.cc'; then $(CYGPATH_W) 'lib/data/data_tank.cc'; else $(CYGPATH_W) '$(srcdir)/lib/data/data_tank.cc'; fi`
    737779
     780graphics_engine.o: lib/graphics/graphics_engine.cc
     781@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.o -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.o `test -f 'lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`lib/graphics/graphics_engine.cc; \
     782@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
     783@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/graphics/graphics_engine.cc' object='graphics_engine.o' libtool=no @AMDEPBACKSLASH@
     784@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
     785@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     786@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.o `test -f 'lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`lib/graphics/graphics_engine.cc
     787
     788graphics_engine.obj: lib/graphics/graphics_engine.cc
     789@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.obj -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.obj `if test -f 'lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) 'lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/graphics_engine.cc'; fi`; \
     790@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
     791@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/graphics/graphics_engine.cc' object='graphics_engine.obj' libtool=no @AMDEPBACKSLASH@
     792@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
     793@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     794@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.obj `if test -f 'lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) 'lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/graphics_engine.cc'; fi`
     795
    738796light.o: lib/graphics/light.cc
    739797@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT light.o -MD -MP -MF "$(DEPDIR)/light.Tpo" -c -o light.o `test -f 'lib/graphics/light.cc' || echo '$(srcdir)/'`lib/graphics/light.cc; \
     
    800858@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o objModel.obj `if test -f 'lib/graphics/importer/objModel.cc'; then $(CYGPATH_W) 'lib/graphics/importer/objModel.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/objModel.cc'; fi`
    801859
     860primitive_model.o: lib/graphics/importer/primitive_model.cc
     861@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive_model.o -MD -MP -MF "$(DEPDIR)/primitive_model.Tpo" -c -o primitive_model.o `test -f 'lib/graphics/importer/primitive_model.cc' || echo '$(srcdir)/'`lib/graphics/importer/primitive_model.cc; \
     862@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/primitive_model.Tpo" "$(DEPDIR)/primitive_model.Po"; else rm -f "$(DEPDIR)/primitive_model.Tpo"; exit 1; fi
     863@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/graphics/importer/primitive_model.cc' object='primitive_model.o' libtool=no @AMDEPBACKSLASH@
     864@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/primitive_model.Po' tmpdepfile='$(DEPDIR)/primitive_model.TPo' @AMDEPBACKSLASH@
     865@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     866@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive_model.o `test -f 'lib/graphics/importer/primitive_model.cc' || echo '$(srcdir)/'`lib/graphics/importer/primitive_model.cc
     867
     868primitive_model.obj: lib/graphics/importer/primitive_model.cc
     869@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive_model.obj -MD -MP -MF "$(DEPDIR)/primitive_model.Tpo" -c -o primitive_model.obj `if test -f 'lib/graphics/importer/primitive_model.cc'; then $(CYGPATH_W) 'lib/graphics/importer/primitive_model.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/primitive_model.cc'; fi`; \
     870@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/primitive_model.Tpo" "$(DEPDIR)/primitive_model.Po"; else rm -f "$(DEPDIR)/primitive_model.Tpo"; exit 1; fi
     871@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/graphics/importer/primitive_model.cc' object='primitive_model.obj' libtool=no @AMDEPBACKSLASH@
     872@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/primitive_model.Po' tmpdepfile='$(DEPDIR)/primitive_model.TPo' @AMDEPBACKSLASH@
     873@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     874@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive_model.obj `if test -f 'lib/graphics/importer/primitive_model.cc'; then $(CYGPATH_W) 'lib/graphics/importer/primitive_model.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/importer/primitive_model.cc'; fi`
     875
    802876model.o: lib/graphics/importer/model.cc
    803877@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT model.o -MD -MP -MF "$(DEPDIR)/model.Tpo" -c -o model.o `test -f 'lib/graphics/importer/model.cc' || echo '$(srcdir)/'`lib/graphics/importer/model.cc; \
     
    9271001@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    9281002@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o substring.obj `if test -f 'lib/util/substring.cc'; then $(CYGPATH_W) 'lib/util/substring.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/substring.cc'; fi`
     1003
     1004resource_manager.o: lib/util/resource_manager.cc
     1005@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; \
     1006@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
     1007@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@
     1008@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
     1009@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 resource_manager.o `test -f 'lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc
     1011
     1012resource_manager.obj: lib/util/resource_manager.cc
     1013@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`; \
     1014@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
     1015@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@
     1016@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
     1017@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 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`
    9291019
    9301020vector.o: lib/math/vector.cc
     
    11141204        tags=; \
    11151205        here=`pwd`; \
    1116         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     1206        if (etags --etags-include --version) >/dev/null 2>&1; then \
    11171207          include_option=--etags-include; \
    1118           empty_fix=.; \
    11191208        else \
    11201209          include_option=--include; \
    1121           empty_fix=; \
    11221210        fi; \
    11231211        list='$(SUBDIRS)'; for subdir in $$list; do \
    11241212          if test "$$subdir" = .; then :; else \
    1125             test ! -f $$subdir/TAGS || \
     1213            test -f $$subdir/TAGS && \
    11261214              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    11271215          fi; \
     
    11331221          $(AWK) '    { files[$$0] = 1; } \
    11341222               END { for (i in files) print i; }'`; \
    1135         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    1136           test -n "$$unique" || unique=$$empty_fix; \
    1137           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    1138             $$tags $$unique; \
    1139         fi
     1223        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     1224          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     1225             $$tags $$unique
    11401226ctags: CTAGS
    11411227CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    11621248
    11631249distdir: $(DISTFILES)
    1164         $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/lib/xmlparser $(distdir)/network $(distdir)/story_entities $(distdir)/world_entities
     1250        $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/lib/xmlparser $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/world_entities
    11651251        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
    11661252        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
     
    12071293installdirs: installdirs-recursive
    12081294installdirs-am:
    1209         for dir in "$(DESTDIR)$(bindir)"; do \
    1210           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    1211         done
     1295        $(mkdir_p) $(DESTDIR)$(bindir)
    12121296install: install-recursive
    12131297install-exec: install-exec-recursive
     
    12991383        uninstall-binPROGRAMS uninstall-info-am
    13001384
     1385                 glmenu/glmenu_imagescreen.cc
    13011386
    13021387#  uncomment the following if orxonox requires the math library
  • orxonox/branches/levelloader/src/camera.cc

    r3605 r3746  
    1717
    1818#include "camera.h"
     19
    1920#include "world.h"
    2021#include "world_entity.h"
     22#include "vector.h"
    2123
    2224using namespace std;
    2325
     26////////////
     27// CAMERA //
     28////////////
     29
    2430/**
    2531   \brief creates a Camera
    26    
    27    This standard constructor sets all parameters to zero
    2832*/
    29 Camera::Camera (World* world)
     33Camera::Camera(void)
    3034{
    31   this->world = world;
    32   this->bound = NULL;
    33   /* give it some physical live */
    34   this->m = 10;
    35   this->a = new Vector(0.0, 0.0, 0.0);
    36   this->v = new Vector(0.0, 0.0, 0.0);
    37   this->fs = new Vector(0.0, 0.0, 0.0);
    38   this->cameraMode = NORMAL;
    39   this->deltaTime = 3000.0;
    40   this->cameraOffset = 1.0;
    41   this->cameraOffsetZ = 10.0;
    42   this->t = 0.0;
     35  this->setClassName("Camera");
     36  this->target = new CameraTarget();
    4337
     38  this->setFovy(90);
     39  this->setAspectRatio(1.2f);
     40  this->setClipRegion(.1, 2000);
    4441
    45   this->setDrawable (false);
     42  this->setViewMode(VIEW_NORMAL);
    4643}
    4744
     
    4946   \brief default destructor
    5047*/
    51 Camera::~Camera ()
     48Camera::~Camera(void)
    5249{
    53   this->bound = NULL;
    54   this->world = NULL;
    55 
    5650}
    5751
    5852/**
    59    \brief time based actualisation of camera parameters
    60    \param deltaT: The amount of time that has passed in milliseconds
    61    
    62    This is called by the World in every time_slice, use it to do fancy time dependant effects (such
    63    as smooth camera movement or swaying).
     53   \brief focuses the Camera onto a Target
     54   \param target the new PNode the Camera should look at.
    6455*/
    65 void Camera::tick (Uint32 deltaT)
     56void Camera::lookAt(PNode* target)
    6657{
    67   if( this->t <= deltaTime)
    68     {this->t += deltaT;}
    69   //printf("time is: t=%f\n", t );
    70   updateDesiredPlace();
    71   //jump(NULL);
     58  this->target->setParent(target);
    7259}
    7360
    7461/**
    75    \brief this calculates the location where the track wants the camera to be
    76    
    77    This refreshes the placement the camera should have according to the
    78    bound entity's position on the track.
     62   \returns The PNode of the Target (from there you can get position and so on
    7963*/
    80 void Camera::updateDesiredPlace ()
     64PNode* Camera::getTarget(void)
    8165{
    82   switch(cameraMode)
    83     {
    84      
    85     case ELLIPTICAL:
    86       {
    87         /*
    88         //r = actual_place.r
    89         Orxonox *orx = Orxonox::getInstance();
    90         Location lookat; 
    91         Placement plFocus;
    92         if( bound != NULL)
    93           {
    94             bound->getLookat (&lookat);
    95             orx->getWorld()->calcCameraPos (&lookat, &plFocus);
    96             Quaternion *fr;
    97             if(t < 20.0)
    98               {
    99                 Vector *start = new Vector(0.0, 1.0, 0.0);
    100                 r = *(new Vector(0.0, 5.0, 0.0));
    101 
    102                 Vector up(0.0, 0.0, 1.0);
    103                
    104                 Vector op(1.0, 0.0, 0.0);
    105                 float angle = angleDeg(op, *start);
    106                 printf("angle is: %f\n", angle);
    107 
    108                 //if in one plane
    109                 from = new Quaternion(angle, up);
    110 
    111                 //from = new Quaternion(*start, *up);
    112                 //&from = &plFocus.w;
    113                 //fr = &plFocus.w; real quaternion use
    114                
     66  return (PNode*)this->target;
     67}
    11568
    11669
    117                 Vector vDirection(1.0, 0.0, 0.0);
    118                 //vDirection = plFocus.w.apply(vDirection);
    119                 to = new Quaternion(vDirection, *start);
    120                 res = new Quaternion();
    121               }
    122             //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z );
    123             rAbs = r.len();
    124             if(t < 30)
    125               {
    126                 ka = rAbs / deltaTime*deltaTime;
    127               }
     70/**
     71   \brief sets a new AspectRatio
     72   \param aspectRatio the new aspect ratio to set (width / height)
     73*/
     74void Camera::setAspectRatio(float aspectRatio)
     75{
     76  this->aspectRatio = aspectRatio;
     77}
    12878
    129             res->quatSlerp(to, from, t/deltaTime, res);
     79/**
     80   \brief sets the Field of View to fofy
     81   \param fovy new field of view factor (in degrees)
     82*/
     83void Camera::setFovy(float fovy)
     84{
     85  this->fovy = fovy;
     86}
    13087
    131             Vector ursp(0.0, 0.0, 0.0);
    132             desiredPlace.r =  ursp - res->apply(r);
     88/**
     89  \brief Sets a new clipping region
     90  \param nearClip The near clip plane
     91  \param farClip The far clip plane
     92*/
     93void Camera::setClipRegion(float nearClip, float farClip)
     94{
     95  this->nearClip = nearClip;
     96  this->farClip = farClip;
     97}
    13398
    134             printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z);
    135             //plLastBPlace = *bound->get_placement();
    136            
    137           }
    138       */
    139       }
     99void Camera::setViewMode(ViewMode mode)
     100{
     101  switch (mode)
     102    {
     103    default:
     104    case VIEW_NORMAL:
     105      this->toFovy = 60.0;
     106      this->toRelCoor = Vector(-10, 5, 0);
    140107      break;
    141     case SMOTH_FOLLOW:
    142       {
    143         /*
    144         Placement *plBound = bound->getPlacement();
    145         Location lcBound;
    146         if(bound != null)
    147           {
    148             bound->getLookat(&lcBound);
    149             Vector vDirection(0.0, 0.0, 1.0);
    150             vDirection = plBound->w.apply(vDirection);
    151             desiredPlace.r = (vDirection * ((lcBound.dist-10.0))) + Vector(0,0,5.0);
    152           }
    153         */
    154         break;
    155       }
    156       /* this is a camera mode that tries just to follow the entity. */
    157     case STICKY:
    158       {
    159         /*
    160         if(bound != null)
    161           {
    162             Placement *plBound = bound->getPlacement();
    163             Vector vDirection(0.0, 0.0, 1.0);
    164             Vector eclipticOffset(0.0, 0.0, 5.0);
    165             vDirection = plBound->w.apply(vDirection);
    166             desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset;
    167           }
    168         */
    169         break;
    170       }
    171       /* the camera is handled like an entity and rolls on the track */
    172     case NORMAL:
    173       if( bound != NULL && world != NULL )
    174         {
    175           //FIXME: camera should be made via relative coordinates
    176           Vector* cameraOffset = new Vector (-10, 5, 0);
    177           this->setRelCoor (cameraOffset);
    178         }
    179       else
    180         {
    181           /*
    182           desiredPlace.r = Vector (0,0,0);
    183           desiredPlace.w = Quaternion ();
    184           */
    185         }
     108    case VIEW_BEHIND:
     109      this->toFovy = 120.0;
     110      this->toRelCoor = Vector(-7, 0, 0);
    186111      break;
     112    case VIEW_FRONT:
     113      this->toFovy = 95.0;
     114      this->toRelCoor = Vector(12, 5, 0);
     115      break;
     116    case VIEW_LEFT:
     117      this->toFovy = 90;
     118      this->toRelCoor = Vector(0, 2, -10);
     119      break;
     120    case VIEW_RIGHT:
     121      this->toFovy = 90;
     122      this->toRelCoor = Vector(0, 2, 10);
     123      break;
     124    case VIEW_TOP:
     125      this->toFovy= 120;
     126      this->toRelCoor = Vector(0, 4, 0);
    187127    }
    188128}
     129
     130
     131/**
     132   \brief Updates the position of the camera.
     133   \param dt The time that elapsed.
     134*/
     135void Camera::tick(float dt)
     136{
     137  dt /= 500;
     138  float tmpFovy = (this->toFovy - this->fovy) * dt;
     139  if (tmpFovy > .001)
     140    this->fovy += (this->toFovy - this->fovy) * dt;
     141  Vector tmpPos = (this->toRelCoor - *this->getRelCoor()) * dt;
     142  if (tmpPos.len() >= .001)
     143    {
     144      tmpPos = tmpPos + *this->getRelCoor();
     145      this->setRelCoor(&tmpPos);
     146    }
     147}
     148
    189149
    190150/**
     
    196156void Camera::apply ()
    197157{
     158  // switching to Projection Matrix
    198159  glMatrixMode (GL_PROJECTION);
    199160  glLoadIdentity ();
    200   // view
    201   // TO DO: implement options for frustum generation
    202   //glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 250.0);
    203   gluPerspective(60, 1.2f, 0.1, 2000);
    204  
    205   //Vector up(0,0,1);
    206   //Vector dir(1,0,0);
    207   //Quaternion q(dir,up);
    208   //float matrix[4][4];
    209   //q.conjugate().matrix (matrix);
    210   //glMultMatrixf ((float*)matrix);
    211   //glTranslatef (10,0,-5);
    212   //
    213   //dir = Vector(-1,-1,0);
    214   //q = Quaternion( dir, up);
    215   //glMatrixMode (GL_MODELVIEW);
    216   //glLoadIdentity ();
    217   //q.matrix (matrix);
    218   //glMultMatrixf ((float*)matrix);
    219   //glTranslatef (2,2,0);
    220   //
    221   //glBegin(GL_TRIANGLES);
    222   //glColor3f(1,0,0);
    223   //glVertex3f(0,0,0.5);
    224   //glColor3f(0,1,0);
    225   //glVertex3f(-0.5,0,-1);
    226   //glColor3f(0,0,1);
    227   //glVertex3f(0.5,0,-1);
    228   //glEnd();   
    229161
    230   // ===== first camera control calculation option
    231   // rotation
    232   float matrix[4][4];
    233   //this->absDirection.conjugate().matrix (matrix);
    234   /* orientation and */
    235   //glMultMatrixf ((float*)matrix);
     162  // setting up the perspective
     163  gluPerspective(this->fovy,
     164                 this->aspectRatio,
     165                 this->nearClip,
     166                 this->farClip);
    236167
    237   /*  translation */
    238   //glTranslatef (this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z );
     168  // speed-up feature
     169  Vector cameraPosition = this->getAbsCoor();
     170  Vector targetPosition = this->target->getAbsCoor();
     171  Vector up = Vector(0, 1, 0);
     172  up = this->getAbsDir().apply(up);
    239173
     174  // Setting the Camera Eye, lookAt and up Vectors
     175  gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
     176            targetPosition.x, targetPosition.y, targetPosition.z,
     177            up.x, up.y, up.z);
    240178
    241   // ===== second camera control calculation option
    242  
    243   gluLookAt(this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z,
    244             this->parent->getAbsCoor ().x, this->parent->getAbsCoor ().y, this->parent->getAbsCoor ().z,
    245             0.0, 1.0, 0.0);
    246  
    247 
     179  // switching back to Modeling Matrix
    248180  glMatrixMode (GL_MODELVIEW);
    249   glLoadIdentity ();
    250181}
    251182
    252183
    253184
    254 /**
    255   \brief bind the camera to an entity
    256   \param entity: The enitity to bind the camera to
    257        
    258   This sets the focus of the camera to the given entity. This means that it will use the given WorldEntity's
    259   Location and get_lookat() to determine the viewpoint the camera will render from.
    260   Note that you cannot bind a camera to a free entity.
    261 */
    262 void Camera::bind (WorldEntity* entity)
     185///////////////////
     186// CAMERA-TARGET //
     187///////////////////
     188
     189
     190CameraTarget::CameraTarget()
    263191{
    264   if( entity != NULL)
    265     {
    266       if( entity->isFree()) printf("Cannot bind camera to free entity");
    267       else
    268         {
    269           this->bound = entity;
    270         }
    271     }
     192  this->setClassName("CameraTarget");
     193  this->setMode(PNODE_MOVEMENT);
    272194}
    273195
     196CameraTarget::~CameraTarget()
     197{
    274198
    275 void Camera::setWorld(World* world)
    276 {
    277   this->world = world;
    278199}
    279 
    280 
  • orxonox/branches/levelloader/src/camera.h

    r3605 r3746  
    77#define _CAMERA_H
    88
    9 #include "world_entity.h"
     9#include "p_node.h"
     10#include "vector.h"
    1011
    1112class World;
     13class CameraTarget;
     14
     15enum ViewMode{VIEW_NORMAL, VIEW_BEHIND, VIEW_FRONT, VIEW_LEFT, VIEW_RIGHT, VIEW_TOP};
    1216
    1317//! Camera
    1418/**
    15    This class controls the viewpoint from which the World is rendered. To use the
    16    Camera it has to be bound to a WorldEntity which serves as the reference focus
    17    point. The Camera itself calls the WorldEntity::get_lookat() and
    18    World::calc_camera_pos() functions to calculate the position it currently should
    19    be in.
     19   This class controls the viewpoint from which the World is rendered.
    2020*/
     21class Camera : public PNode
     22{
     23 private:
     24  CameraTarget* target;            //!< The Target of the Camera (where this Camera Looks at)
    2125
    22 enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL};
     26  float fovy;                      //!< The field of view Angle (in degrees).
     27  float aspectRatio;               //!< The aspect ratio (width / height).
     28  float nearClip;                  //!< The near clipping plane.
     29  float farClip;                   //!< The far clipping plane.
    2330
    24 class Camera : public WorldEntity {
    25  private:
    26   WorldEntity* bound;           //!< the WorldEntity the Camera is bound to
    27   World* world;
    28  
    29   /* physical system - not needed yet */
    30   float m; //!< mass
    31   Vector *fs; //!< seil-kraft
    32   Vector *a;  //!< acceleration
    33   Vector *v;  //!< velocity
    34  
    35   /* elliptical camera mode variables */
    36   float cameraOffset;
    37   float cameraOffsetZ;
    38   float deltaTime;
    39   float t;
    40   Vector r;
    41   float rAbs;
    42   float ka;
    43   float a0;
    44 
    45   Quaternion *from;
    46   Quaternion *to;
    47   Quaternion *res;
    48  
    49  
    50   CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity
    51  
    52   void updateDesiredPlace ();
     31  Vector toRelCoor;
     32  float toFovy;
    5333 
    5434 public:
    55   Camera (World* world);
    56   virtual ~Camera ();
    57  
    58   void tick (Uint32 deltaT);
    59   void apply ();
    60   void bind (WorldEntity* entity);
     35  Camera(void);
     36  virtual ~Camera(void);
    6137
    62   void setWorld(World* world); 
     38  void lookAt(PNode* target);
     39  PNode* getTarget();
    6340
     41  void setAspectRatio(float aspectRatio);
     42  void setFovy(float fovy);
     43  void setClipRegion(float nearClip, float farClip);
     44
     45  void setViewMode(ViewMode mode);
     46  void tick(float dt);
     47  void apply (void);
    6448};
    6549
     50//! A CameraTarget is where the Camera is looking at.
     51class CameraTarget : public PNode
     52{
     53  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
     54 
     55 private:
     56  CameraTarget(void);
     57 
     58 public:
     59  virtual ~CameraTarget(void);
     60};
     61
     62
    6663#endif /* _CAMERA_H */
  • orxonox/branches/levelloader/src/command_node.cc

    r3605 r3746  
    2222#include "game_loader.h"
    2323#include "world.h"
     24#include "list.h"
     25#include "orxonox.h"
     26#include "debug.h"
    2427
    2528#include <stdio.h>
     
    279282  if( this->world->command(cmd)) return;
    280283
    281   WorldEntity* entity = bound->enumerate();
     284  tIterator<WorldEntity>* iterator = bound->getIterator();
     285  WorldEntity* entity = iterator->nextElement();
    282286  while( entity != NULL)
    283287    {
    284288      entity->command (cmd); /*no absorbtion of command! strange*/
    285       entity = bound->nextElement();
    286     }
     289      entity = iterator->nextElement();
     290    }
     291  delete iterator;
    287292}
    288293
  • orxonox/branches/levelloader/src/command_node.h

    r3236 r3746  
    99#define _COMMAND_NODE_H
    1010
    11 #include "stdincl.h"
    1211
     12#include "comincl.h"
     13
     14template<class T> class tList;
    1315class WorldEntity;
    1416class World;
  • orxonox/branches/levelloader/src/defs/debug.h

    r3605 r3746  
    5959#define DEBUG_MODULE_ORXONOX            0
    6060#define DEBUG_MODULE_WORLD              0
    61 #define DEBUG_MODULE_PNODE              2
     61#define DEBUG_MODULE_PNODE              3
    6262#define DEBUG_MODULE_WORLD_ENTITY       0
    6363#define DEBUG_MODULE_COMMAND_NODE       0
     64#define DEBUG_MODULE_GRAPHICS           0
     65#define DEBUG_MODULE_LOAD               0
    6466
    6567#define DEBUG_MODULE_IMPORTER           0
    6668#define DEBUG_MODULE_TRACK_MANAGER      0
    67 #define DEBUG_MODULE_LIGHT              3
    68 #define DEBUG_MODULE_PLAYER             0
     69#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
     70#define DEBUG_MODULE_LIGHT              0
     71#define DEBUG_MODULE_PLAYER             3
    6972#define DEBUG_MODULE_MATH               0
    7073
  • orxonox/branches/levelloader/src/defs/stdincl.h

    r3530 r3746  
    99#define _STDINCL_H
    1010               
    11 #define null 0   //!< null
    12 
    1311typedef unsigned char byte;
    1412
     
    2321
    2422#include <assert.h>
     23#include <stddef.h>
    2524#include <stdlib.h>
    2625#include <string.h>
     
    2827#include "glincl.h"
    2928
    30 #include "error.h"
    31 #include "debug.h"
    3229
    3330// MATH //
     
    3936#include "list_template.h"
    4037#include "message_structures.h"
    41 #include "orxonox.h"
    4238#include "data_tank.h"
    4339#include "base_object.h"
    4440#include "factory.h"
     41#include "debug.h"
    4542
    4643#define CREATE_FACTORY(x) \
  • orxonox/branches/levelloader/src/game_loader.cc

    r3557 r3746  
    2525#include "vector.h"
    2626#include "factory.h"
     27#include "debug.h"
    2728
    2829#include <string.h>
     
    8990  switch(campaignID)
    9091    {
    91       // Debug Level 0: Debug level used to test the base frame work.
     92      /*
     93         Debug Level 0: Debug level used to test the base frame work.
     94         As you can see, all storyentity data is allocated before game
     95         start. the storyentity will load themselfs shortly before start
     96         through the StoryEntity::init() funtion.
     97      */
    9298    case DEBUG_CAMPAIGN_0:
    9399      {
     
    99105
    100106        World* world1 = new World(DEBUG_WORLD_1);
    101         world1->setNextStoryID(WORLD_ID_GAMEEND);
     107        world1->setNextStoryID(WORLD_ID_2);
    102108        debugCampaign->addEntity(world1, WORLD_ID_1);
     109
     110        World* world2 = new World(DEBUG_WORLD_2);
     111        world2->setNextStoryID(WORLD_ID_GAMEEND);
     112        debugCampaign->addEntity(world2, WORLD_ID_2);
    103113
    104114        this->currentCampaign = debugCampaign;
  • orxonox/branches/levelloader/src/game_loader.h

    r3530 r3746  
     1/*!
     2    \file game_loader.h
     3    \brief loads campaigns, worlds and all other story_entities
     4*/
     5
    16#ifndef _GAME_LOADER_H
    27#define _GAME_LOADER_H
    38
    4 #include "stdincl.h"
     9//#include "stdincl.h"
    510#include "story_def.h"
    611#include "factory.h"
     12#include "comincl.h"
     13#include "error.h"
    714
    815//-----------------------------------------------------------------------------
     
    1421class CammandNode;
    1522
    16 
     23//! The GameLoader
     24/**
     25   The game loader loads all game date. this is performed in the following way:
     26   1. Read the structure of campaings and worlds
     27   2. Create the instances of the tree: here _ALL_ StoryEntities are created
     28      also if they are not yet used. the worlds should load their data in
     29      the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
     30      Elsewhere, all the data will be allocated at the beginning... mess...
     31   3. StoryEntities are load() and init() before they start
     32   4. once the gamloader starts the game there will be a campaing starting a
     33      world. this is done by callaing those StoryEntity::start()
     34*/
    1735class GameLoader
    1836{
  • orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.cc

    r3605 r3746  
    4141{
    4242   this->setClassName ("GLMenuImageScreen");
     43   this->init();
    4344}
    4445
     
    5051GLMenuImageScreen::~GLMenuImageScreen()
    5152{
    52   if (backMat)
    53     delete backMat;
     53  if (this->backMat)
     54    delete this->backMat;
    5455}
    5556
     
    8182  // Select Our VU Meter Background Texture
    8283  this->backMat = new Material("load_screen");
    83   this->backMat->setDiffuseMap("../data/pictures/load_screen.jpg");
     84  this->backMat->setDiffuseMap("pictures/load_screen.jpg");
    8485  this->maxValue = 10;
    8586  this->currentValue = 0;
     
    110111void GLMenuImageScreen::draw ()
    111112{
    112   /*
    113   // Display a quad texture to the screen
    114   glEnable(GL_TEXTURE_2D);
    115   glBegin(GL_QUADS);
    116  
    117   // Display the top left vertice
    118   glTexCoord2f(0.0f, 1.0f);
    119   glVertex3f(-2.5, 2.5, 0);
    120  
    121   // Display the bottom left vertice
    122   glTexCoord2f(0.0f, 0.0f);
    123   glVertex3f(-2.5, -2.5, 0);
    124  
    125   // Display the bottom right vertice
    126   glTexCoord2f(1.0f, 0.0f);
    127   glVertex3f(2.5, -2.5, 0);
    128  
    129   // Display the top right vertice
    130   glTexCoord2f(1.0f, 1.0f);
    131   glVertex3f(2.5, 2.5, 0);
    132 
    133   glEnd();
    134   glEnable(GL_TEXTURE_2D); 
    135   */
    136113
    137114  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     115
     116  PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n",
     117         this->currentValue, this->maxValue);
    138118
    139119  /* screen size */
     
    154134  int barWidth = 230;
    155135  int barHeight = 30;
    156 
    157   int val = (int)((float)this->currentValue/(float)this->maxValue) * barWidth;
     136 
     137  float val = ((float)this->currentValue/(float)this->maxValue) * barWidth;
     138  if( val > (float)barWidth)
     139    val = (float)barWidth;
    158140
    159141  glMatrixMode(GL_PROJECTION);
     
    170152  glDisable(GL_LIGHTING);
    171153
     154  /* draw the progress bar */
    172155  glBegin(GL_QUADS);
    173156  glColor3f(0.96, 0.84, 0.34);
    174157  glVertex2i(barX, barY);
    175   glVertex2i(barX + val, barY);
    176   glVertex2i(barX + val, barY + barHeight);
     158  glVertex2i(barX + (int)val, barY);
     159  glVertex2i(barX + (int)val, barY + barHeight);
    177160  glVertex2i(barX, barY + barHeight);
    178161  glColor3f(1.0, 1.0, 1.0);
     
    223206  glPopAttrib();
    224207
    225   SDL_GL_SwapBuffers();                   
     208  SDL_GL_SwapBuffers();             
    226209}
    227210 
  • orxonox/branches/levelloader/src/glmenu/glmenu_imagescreen.h

    r3605 r3746  
    4545  float offsetX, offsetY;    //!< offset of the image from left and up
    4646  Material* backMat;         //!< Background Material.
     47
     48  /* progress bar values */
    4749  int currentValue;          //!< the current count of step() calls fired yet
    4850  int maxValue;              //!< total count of steps
  • orxonox/branches/levelloader/src/lib/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    183183          esac; \
    184184        done; \
    185         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/Makefile'; \
     185        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/Makefile'; \
    186186        cd $(top_srcdir) && \
    187           $(AUTOMAKE) --foreign  src/lib/Makefile
     187          $(AUTOMAKE) --gnu  src/lib/Makefile
    188188.PRECIOUS: Makefile
    189189Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    278278        tags=; \
    279279        here=`pwd`; \
    280         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     280        if (etags --etags-include --version) >/dev/null 2>&1; then \
    281281          include_option=--etags-include; \
    282           empty_fix=.; \
    283282        else \
    284283          include_option=--include; \
    285           empty_fix=; \
    286284        fi; \
    287285        list='$(SUBDIRS)'; for subdir in $$list; do \
    288286          if test "$$subdir" = .; then :; else \
    289             test ! -f $$subdir/TAGS || \
     287            test -f $$subdir/TAGS && \
    290288              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    291289          fi; \
     
    297295          $(AWK) '    { files[$$0] = 1; } \
    298296               END { for (i in files) print i; }'`; \
    299         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    300           test -n "$$unique" || unique=$$empty_fix; \
    301           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    302             $$tags $$unique; \
    303         fi
     297        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     298          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     299             $$tags $$unique
    304300ctags: CTAGS
    305301CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/levelloader/src/lib/coord/helper_parent.h

    r3605 r3746  
    88#define _HELPER_PARENT_H
    99
    10 #include "stdincl.h"
     10
    1111#include "p_node.h"
    1212
  • orxonox/branches/levelloader/src/lib/coord/null_parent.cc

    r3605 r3746  
    1919
    2020#include "null_parent.h"
     21#include "stdincl.h"
     22#include "vector.h"
     23#include "list.h"
    2124
    2225
     
    5154  this->parent = this;
    5255  this->mode = PNODE_ALL;
    53   this->absCoordinate = *absCoordinate;
     56  *this->absCoordinate = *absCoordinate;
    5457  this->setName("NullParent");
    5558}
     
    7477   worry, normaly...
    7578*/
    76 void NullParent::update ()
     79void NullParent::update (float dt)
    7780{
    7881
    79   PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    80   this->absCoordinate = this->relCoordinate;
    81   this->absDirection = parent->getAbsDir () * this->relDirection;
    82  
    83   PNode* pn = this->children->enumerate ();
     82  PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z);
     83  *this->absCoordinate = *this->relCoordinate;
     84  *this->absDirection = parent->getAbsDir () * *this->relDirection;
     85
     86  tIterator<PNode>* iterator = this->children->getIterator();
     87  //PNode* pn = this->children->enumerate ();
     88  PNode* pn = iterator->nextElement();
    8489  while( pn != NULL)
    8590    {
     
    8994      if( this->bRelDirChanged || this->bAbsDirChanged)
    9095        pn->parentDirChanged ();
    91       pn->update ();
    92       pn = this->children->nextElement ();
     96      pn->update (dt);
     97      //pn = this->children->nextElement ();
     98      pn = iterator->nextElement();
    9399    }
    94100
  • orxonox/branches/levelloader/src/lib/coord/null_parent.h

    r3605 r3746  
    88#define _NULL_PARENT_H
    99
    10 #include "stdincl.h"
     10
    1111#include "p_node.h"
    1212
     
    1919
    2020
    21   virtual void update ();
    22 
     21  virtual void update (float dt);
     22 
    2323 private:
    2424  NullParent ();
  • orxonox/branches/levelloader/src/lib/coord/p_node.cc

    r3605 r3746  
    2121
    2222#include "p_node.h"
    23 
     23#include "stdincl.h"
     24
     25#include "error.h"
     26#include "debug.h"
     27#include "list.h"
     28#include "vector.h"
    2429#include "null_parent.h"
    25 #include "vector.h"
     30
     31
     32//#include "vector.h"
     33//#include "quaternion.h"
    2634
    2735using namespace std;
     
    5260  this->init(parent);
    5361
    54   this->absCoordinate = *absCoordinate;
     62  *this->absCoordinate = *absCoordinate;
    5563  if (parent != NULL)
    5664    {
    57       this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     65      *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    5866      parent->addChild (this);
    5967    }
    6068  else
    61     this->relCoordinate = Vector(0,0,0);
     69    this->relCoordinate = new Vector(0,0,0);
    6270}
    6371
     
    94102}
    95103
     104
    96105void PNode::init(PNode* parent)
    97106{
     
    103112  this->parent = parent;
    104113  this->objectName = NULL;
     114
     115  this->absCoordinate = new Vector();
     116  this->relCoordinate = new Vector();
     117  this->absDirection = new Quaternion();
     118  this->relDirection = new Quaternion();
     119  this->lastAbsCoordinate = new Vector();
    105120}
    106121
     
    129144   \brief get relative coordinates
    130145   \returns relative coordinates to its parent
    131 */
    132 Vector PNode::getRelCoor ()
    133 {
    134   Vector r = this->relCoordinate; /* return a copy, so it can't be modified */
    135   return r;
     146   
     147   the reference that is returned is a pointer to the real relCoor, so don't
     148   change it unless you realy know what you are doing.
     149*/
     150Vector* PNode::getRelCoor ()
     151{
     152  //Vector r = *this->relCoordinate; /* return a copy, so it can't be modified */
     153  return this->relCoordinate;
    136154}
    137155
     
    148166{
    149167  this->bRelCoorChanged = true;
    150   this->relCoordinate = *relCoord;
     168  *this->relCoordinate = *relCoord;
     169}
     170
     171
     172/**
     173   \brief set relative coordinates
     174   \param relCoord relative coordinates to its parent
     175
     176   it is very importand, that you use this function, if you want to update the
     177   relCoordinates. If you don't use this, the PNode won't recognize, that something
     178   has changed and won't update the children Nodes.
     179*/
     180void PNode::setRelCoor (Vector relCoord)
     181{
     182  this->bRelCoorChanged = true;
     183  *this->relCoordinate = relCoord;
    151184}
    152185
     
    158191Vector PNode::getAbsCoor ()
    159192{
    160   return this->absCoordinate;
     193  return *this->absCoordinate;
    161194}
    162195
     
    172205{
    173206  this->bAbsCoorChanged = true;
    174   this->absCoordinate = *absCoord;
     207  *this->absCoordinate = *absCoord;
     208}
     209
     210
     211
     212/**
     213   \param absCoord set absolute coordinate
     214
     215   it is very importand, that you use this function, if you want to update the
     216   absCoordinates. If you don't use this, the PNode won't recognize, that something
     217   has changed and won't update the children Nodes.
     218*/
     219void PNode::setAbsCoor (Vector absCoord)
     220{
     221  this->bAbsCoorChanged = true;
     222  *this->absCoordinate = absCoord;
    175223}
    176224
     
    200248  if( this->bAbsCoorChanged)
    201249    {
    202       this->absCoordinate = this->absCoordinate + *shift;
     250      *this->absCoordinate = *this->absCoordinate + *shift;
    203251    }
    204252  else
    205253    {
    206       this->relCoordinate = this->relCoordinate + *shift;
     254      *this->relCoordinate = *this->relCoordinate + *shift;
     255      this->bRelCoorChanged = true;
     256    }
     257}
     258
     259
     260
     261/**
     262   \brief shift coordinate (abs and rel)
     263   \param shift vector
     264
     265   this function shifts the current coordinates about the vector shift. this is
     266   usefull because from some place else you can:
     267   PNode* someNode = ...;
     268   Vector objectMovement = calculateShift();
     269   someNode->shiftCoor(objectMovement);
     270
     271   elsewhere you would have to:
     272   PNode* someNode = ...;
     273   Vector objectMovement = calculateShift();
     274   Vector currentCoor = someNode->getRelCoor();
     275   Vector newCoor = currentCoor + objectMovement;
     276   someNode->setRelCoor(newCoor);
     277   
     278   yea right... shorter...
     279
     280*/
     281void PNode::shiftCoor (Vector shift)
     282{
     283  if( this->bAbsCoorChanged)
     284    {
     285      *this->absCoordinate = *this->absCoordinate + shift;
     286    }
     287  else
     288    {
     289      *this->relCoordinate = *this->relCoordinate + shift;
    207290      this->bRelCoorChanged = true;
    208291    }
     
    217300Quaternion PNode::getRelDir ()
    218301{
    219   return this->relDirection;
     302  return *this->relDirection;
    220303}
    221304
     
    232315{
    233316  this->bRelCoorChanged = true;
    234   this->relDirection = *relDir;
     317  *this->relDirection = *relDir;
     318}
     319
     320
     321void PNode::setRelDir (Quaternion relDir)
     322{
     323  this->bRelCoorChanged = true;
     324  *this->relDirection = relDir;
    235325}
    236326
     
    242332Quaternion PNode::getAbsDir ()
    243333{
    244   return this->absDirection;
     334  return *this->absDirection;
    245335}
    246336
     
    257347{
    258348  this->bAbsDirChanged = true;
    259   this->absDirection = *absDir;
    260 }
     349  *this->absDirection = *absDir;
     350}
     351
     352
     353
     354/**
     355   \brief sets the absolute direction (0,0,1)
     356   \param absDir absolute coordinates
     357
     358   it is very importand, that you use this function, if you want to update the
     359   absDirection. If you don't use this, the PNode won't recognize, that something
     360   has changed and won't update the children Nodes.
     361*/
     362void PNode::setAbsDir (Quaternion absDir)
     363{
     364  this->bAbsDirChanged = true;
     365  *this->absDirection = absDir;
     366}
     367
    261368
    262369
     
    285392{}
    286393
     394
     395/**
     396   \brief shift coordinate (abs and rel)
     397   \param shift vector
     398
     399   this function shifts the current coordinates about the vector shift. this is
     400   usefull because from some place else you can:
     401   PNode* someNode = ...;
     402   Quaternion objectMovement = calculateShift();
     403   someNode->shiftCoor(objectMovement);
     404
     405   elsewhere you would have to:
     406   PNode* someNode = ...;
     407   Quaternion objectMovement = calculateShift();
     408   Quaternion currentCoor = someNode->getRelCoor();
     409   Quaternion newCoor = currentCoor + objectMovement;
     410   someNode->setRelCoor(newCoor);
     411   
     412   yea right... shorter...
     413
     414   \todo implement this
     415*/
     416void PNode::shiftDir (Quaternion shift)
     417{}
     418
     419
     420/**
     421   \brief this calculates the current movement speed of the node
     422*/
     423float PNode::getSpeed()
     424{
     425  if(this->time == 0)
     426    return 1000;
     427  Vector diff;
     428  diff = *this->absCoordinate - *this->lastAbsCoordinate;
     429  float x = diff.len();
     430  return x / this->time;
     431}
     432
     433
    287434/**
    288435   \brief adds a child and makes this node to a parent
     
    308455  if( pNode->parent != NULL )
    309456    {
    310       PRINTF(2)("PNode::addChild() - reparenting node: removing it and adding it again\n");
     457      PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n");
    311458      pNode->parent->children->remove(pNode);
    312459    }
     
    338485void PNode::remove()
    339486{
    340   NullParent* np = NullParent::getInstance();
    341   PNode* pn = this->children->enumerate();
     487  NullParent* nullParent = NullParent::getInstance();
     488
     489  tIterator<PNode>* iterator = this->children->getIterator();
     490  PNode* pn = iterator->nextElement();
     491 
    342492  while( pn != NULL)
    343493    {
    344       this->children->remove(pn);
    345       np->addChild(pn, pn->getMode());
    346       pn = this->children->nextElement();
    347     }
     494      //this->children->remove(pn);
     495      nullParent->addChild(pn, pn->getMode());
     496      pn = iterator->nextElement();
     497    }
     498  delete iterator;
     499  this->parent->children->remove(this);
    348500}
    349501
     
    410562   worry, normaly...
    411563*/
    412 void PNode::update ()
    413 {
    414   PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    415   // printf("%s", this->objectName);
     564void PNode::update (float dt)
     565{
     566  *this->lastAbsCoordinate = *this->absCoordinate;
     567  this->time = dt;
     568  PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z);
    416569  if(this->mode & PNODE_MOVEMENT )
    417570    {
     
    419572        {
    420573          /* if you have set the absolute coordinates this overrides all other changes */
    421           this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     574          *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    422575        }
    423576      else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     
    426579          if( this->parent == NULL)
    427580            {
    428               this->absCoordinate = this->relCoordinate;
     581              *this->absCoordinate = *this->relCoordinate;
    429582            }
    430583          else
    431             this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;         /* update the current absCoordinate */
     584            *this->absCoordinate = parent->getAbsCoor() + *this->relCoordinate;       /* update the current absCoordinate */
    432585        }
    433586    }
     
    438591        {
    439592          /* if you have set the absolute coordinates this overrides all other changes */
    440           this->relDirection = this->absDirection - parent->getAbsDir();
     593          *this->relDirection = *this->absDirection - parent->getAbsDir();
    441594        }
    442595      else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
    443596        {
    444597          /* update the current absDirection - remember * means rotation around sth.*/
    445           this->absDirection = parent->getAbsDir() * this->relDirection;
     598          *this->absDirection = parent->getAbsDir() * *this->relDirection;
    446599        }
    447600    }
     
    452605        {
    453606          /* if you have set the absolute coordinates this overrides all other changes */
    454           this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     607          *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    455608        }
    456609      else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     
    458611          /*this is bad style... must be deleted later - just for testing*/
    459612          if( this->parent == NULL)
    460             this->absCoordinate = this->relCoordinate;
     613            *this->absCoordinate = *this->relCoordinate;
    461614          else
    462             this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate);              /* update the current absCoordinate */
     615            *this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(*this->relCoordinate);            /* update the current absCoordinate */
    463616        }
    464617    }
    465618 
    466619 
    467   PNode* pn = this->children->enumerate();
     620  tIterator<PNode>* iterator = this->children->getIterator();
     621  //PNode* pn = this->children->enumerate();
     622  PNode* pn = iterator->nextElement();
    468623  while( pn != NULL)
    469624    {
     
    473628      if( this->bRelDirChanged || this->bAbsDirChanged)
    474629        pn->parentDirChanged ();
    475       pn->update();
    476       pn = this->children->nextElement();
    477     }
     630
     631      pn->update(dt);
     632      //pn = this->children->nextElement();
     633      pn = iterator->nextElement();
     634    }
     635  delete iterator;
    478636
    479637  this->timeStamp = timeStamp;
     
    507665{
    508666  PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n",
    509          this->absCoordinate.x,
    510          this->absCoordinate.y,
    511          this->absCoordinate.z);
     667         this->absCoordinate->x,
     668         this->absCoordinate->y,
     669         this->absCoordinate->z);
    512670}
    513671
  • orxonox/branches/levelloader/src/lib/coord/p_node.h

    r3605 r3746  
    2323
    2424#include "base_object.h"
     25//#include "vector.h"
    2526
    2627// FORWARD DEFINITION \\
     
    2829class Quaternion;
    2930class Vector;
     31template<class T> class tList;
    3032
    3133//! enumeration for the different translation-binding-types
     
    5557
    5658
    57   Vector getRelCoor ();
     59  Vector* getRelCoor ();
    5860  void setRelCoor (Vector* relCoord);
    59   //void setRelCoor (Vector relCoord);
     61  void setRelCoor (Vector relCoord);
    6062  Vector getAbsCoor ();
    6163  void setAbsCoor (Vector* absCoord);
    62   //void setAbsCoor (Vector absCoord);
     64  void setAbsCoor (Vector absCoord);
    6365  void shiftCoor (Vector* shift);
     66  void shiftCoor (Vector shift);
    6467  //void shiftCoor (Vector shift);
    6568
    6669  Quaternion getRelDir ();
    6770  void setRelDir (Quaternion* relDir);
     71  void setRelDir (Quaternion relDir);
    6872  Quaternion getAbsDir ();
    6973  void setAbsDir (Quaternion* absDir);
     74  void setAbsDir (Quaternion absDir);
    7075  void shiftDir (Quaternion* shift);
     76  void shiftDir (Quaternion shift);
     77
     78  float getSpeed();
    7179
    7280  void addChild (PNode* pNode);
     
    8290  int getMode();
    8391
    84   virtual void update ();
     92  virtual void update (float dt);
    8593  void processTick (float dt);
    8694
     
    9098
    9199  void debug ();
    92 
    93  private:
    94   void init(PNode* parent);
    95100
    96101 protected:
     
    102107  bool bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
    103108
    104   Vector relCoordinate;    //!< coordinates relative to the parent
    105   Vector absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
    106   Quaternion relDirection; //!< direction relative to the parent
    107   Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
     109  Vector* relCoordinate;    //!< coordinates relative to the parent
     110  Vector* absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
     111  Quaternion* relDirection; //!< direction relative to the parent
     112  Quaternion* absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
    108113
    109114  int mode;                //!< the mode of the binding
    110115
     116 private:
     117  void init(PNode* parent);
     118
     119  Vector* lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate
     120  float time;                //!< time since last update
    111121};
    112122
  • orxonox/branches/levelloader/src/lib/graphics/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    177177          esac; \
    178178        done; \
    179         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/Makefile'; \
     179        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/Makefile'; \
    180180        cd $(top_srcdir) && \
    181           $(AUTOMAKE) --foreign  src/lib/graphics/Makefile
     181          $(AUTOMAKE) --gnu  src/lib/graphics/Makefile
    182182.PRECIOUS: Makefile
    183183Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    272272        tags=; \
    273273        here=`pwd`; \
    274         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     274        if (etags --etags-include --version) >/dev/null 2>&1; then \
    275275          include_option=--etags-include; \
    276           empty_fix=.; \
    277276        else \
    278277          include_option=--include; \
    279           empty_fix=; \
    280278        fi; \
    281279        list='$(SUBDIRS)'; for subdir in $$list; do \
    282280          if test "$$subdir" = .; then :; else \
    283             test ! -f $$subdir/TAGS || \
     281            test -f $$subdir/TAGS && \
    284282              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    285283          fi; \
     
    291289          $(AWK) '    { files[$$0] = 1; } \
    292290               END { for (i in files) print i; }'`; \
    293         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    294           test -n "$$unique" || unique=$$empty_fix; \
    295           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    296             $$tags $$unique; \
    297         fi
     291        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     292          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     293             $$tags $$unique
    298294ctags: CTAGS
    299295CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.am

    r3499 r3746  
    55AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
    66AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data
    7 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gaphics
     7AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
    88AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
    99AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang
     
    2727                  model.cc \
    2828                  objModel.cc \
     29                  primitive_model.cc \
    2930                  array.cc \
    3031                  material.cc \
    3132                  texture.cc \
    32                   $(MAINSRCDIR)/lib/math/vector.cc
     33                  $(MAINSRCDIR)/lib/graphics/graphics_engine.cc \
     34                  $(MAINSRCDIR)/lib/lang/base_object.cc \
     35                  $(MAINSRCDIR)/lib/math/vector.cc \
     36                  $(MAINSRCDIR)/lib/util/resource_manager.cc
    3337
    3438noinst_HEADERS= framework.h \
     
    3640                model.h \
    3741                objModel.h \
     42                primitive_model.h \
    3843                array.h \
    3944                material.h \
  • orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    4242subdir = src/lib/graphics/importer
    4343DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
    44         $(srcdir)/Makefile.in
     44        $(srcdir)/Makefile.in TODO
    4545ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4646am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
    5555am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \
    56         model.$(OBJEXT) objModel.$(OBJEXT) array.$(OBJEXT) \
    57         material.$(OBJEXT) texture.$(OBJEXT) vector.$(OBJEXT)
     56        model.$(OBJEXT) objModel.$(OBJEXT) primitive_model.$(OBJEXT) \
     57        array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
     58        graphics_engine.$(OBJEXT) base_object.$(OBJEXT) \
     59        vector.$(OBJEXT) resource_manager.$(OBJEXT)
    5860importer_OBJECTS = $(am_importer_OBJECTS)
    5961importer_LDADD = $(LDADD)
     
    6163depcomp = $(SHELL) $(top_srcdir)/depcomp
    6264am__depfiles_maybe = depfiles
    63 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \
     65@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \
     66@AMDEP_TRUE@    ./$(DEPDIR)/base_object.Po \
     67@AMDEP_TRUE@    ./$(DEPDIR)/framework.Po \
     68@AMDEP_TRUE@    ./$(DEPDIR)/graphics_engine.Po \
    6469@AMDEP_TRUE@    ./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \
    65 @AMDEP_TRUE@    ./$(DEPDIR)/objModel.Po ./$(DEPDIR)/texture.Po \
    66 @AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po
     70@AMDEP_TRUE@    ./$(DEPDIR)/objModel.Po \
     71@AMDEP_TRUE@    ./$(DEPDIR)/primitive_model.Po \
     72@AMDEP_TRUE@    ./$(DEPDIR)/resource_manager.Po \
     73@AMDEP_TRUE@    ./$(DEPDIR)/texture.Po ./$(DEPDIR)/vector.Po \
     74@AMDEP_TRUE@    ./$(DEPDIR)/windowHandler.Po
    6775CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    6876        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     
    185193target_vendor = @target_vendor@
    186194MAINSRCDIR = ../../..
    187 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/gaphics -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
     195AM_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
    188196AM_LDFLAGS = $(MWINDOWS)
    189197importer_SOURCES = framework.cc \
     
    191199                  model.cc \
    192200                  objModel.cc \
     201                  primitive_model.cc \
    193202                  array.cc \
    194203                  material.cc \
    195204                  texture.cc \
    196                   $(MAINSRCDIR)/lib/math/vector.cc
     205                  $(MAINSRCDIR)/lib/graphics/graphics_engine.cc \
     206                  $(MAINSRCDIR)/lib/lang/base_object.cc \
     207                  $(MAINSRCDIR)/lib/math/vector.cc \
     208                  $(MAINSRCDIR)/lib/util/resource_manager.cc
    197209
    198210noinst_HEADERS = framework.h \
     
    200212                model.h \
    201213                objModel.h \
     214                primitive_model.h \
    202215                array.h \
    203216                material.h \
     
    217230          esac; \
    218231        done; \
    219         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile'; \
     232        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile'; \
    220233        cd $(top_srcdir) && \
    221           $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile
     234          $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile
    222235.PRECIOUS: Makefile
    223236Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    239252install-binPROGRAMS: $(bin_PROGRAMS)
    240253        @$(NORMAL_INSTALL)
    241         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     254        $(mkdir_p) $(DESTDIR)$(bindir)
    242255        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    243256          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    245258          ; then \
    246259            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    247            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    248            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     260           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     261           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    249262          else :; fi; \
    250263        done
     
    254267        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    255268          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    256           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    257           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     269          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     270          rm -f $(DESTDIR)$(bindir)/$$f; \
    258271        done
    259272
     
    271284
    272285@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
     286@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@
    273287@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@
     288@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
    274289@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
    275290@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
    276291@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
     292@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@
     293@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@
    277294@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    278295@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
     
    295312@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    296313
     314graphics_engine.o: $(MAINSRCDIR)/lib/graphics/graphics_engine.cc
     315@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.o -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/graphics_engine.cc; \
     316@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
     317@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' object='graphics_engine.o' libtool=no @AMDEPBACKSLASH@
     318@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
     319@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     320@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/graphics_engine.cc
     321
     322graphics_engine.obj: $(MAINSRCDIR)/lib/graphics/graphics_engine.cc
     323@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.obj -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; fi`; \
     324@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
     325@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' object='graphics_engine.obj' libtool=no @AMDEPBACKSLASH@
     326@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
     327@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     328@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; fi`
     329
     330base_object.o: $(MAINSRCDIR)/lib/lang/base_object.cc
     331@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base_object.o -MD -MP -MF "$(DEPDIR)/base_object.Tpo" -c -o base_object.o `test -f '$(MAINSRCDIR)/lib/lang/base_object.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/lang/base_object.cc; \
     332@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/base_object.Tpo" "$(DEPDIR)/base_object.Po"; else rm -f "$(DEPDIR)/base_object.Tpo"; exit 1; fi
     333@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/lang/base_object.cc' object='base_object.o' libtool=no @AMDEPBACKSLASH@
     334@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/base_object.Po' tmpdepfile='$(DEPDIR)/base_object.TPo' @AMDEPBACKSLASH@
     335@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     336@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base_object.o `test -f '$(MAINSRCDIR)/lib/lang/base_object.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/lang/base_object.cc
     337
     338base_object.obj: $(MAINSRCDIR)/lib/lang/base_object.cc
     339@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base_object.obj -MD -MP -MF "$(DEPDIR)/base_object.Tpo" -c -o base_object.obj `if test -f '$(MAINSRCDIR)/lib/lang/base_object.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/lang/base_object.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/lang/base_object.cc'; fi`; \
     340@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/base_object.Tpo" "$(DEPDIR)/base_object.Po"; else rm -f "$(DEPDIR)/base_object.Tpo"; exit 1; fi
     341@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/lang/base_object.cc' object='base_object.obj' libtool=no @AMDEPBACKSLASH@
     342@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/base_object.Po' tmpdepfile='$(DEPDIR)/base_object.TPo' @AMDEPBACKSLASH@
     343@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     344@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base_object.obj `if test -f '$(MAINSRCDIR)/lib/lang/base_object.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/lang/base_object.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/lang/base_object.cc'; fi`
     345
    297346vector.o: $(MAINSRCDIR)/lib/math/vector.cc
    298347@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.o -MD -MP -MF "$(DEPDIR)/vector.Tpo" -c -o vector.o `test -f '$(MAINSRCDIR)/lib/math/vector.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/math/vector.cc; \
     
    310359@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    311360@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`
     361
     362resource_manager.o: $(MAINSRCDIR)/lib/util/resource_manager.cc
     363@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; \
     364@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
     365@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@
     366@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
     367@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     368@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
     369
     370resource_manager.obj: $(MAINSRCDIR)/lib/util/resource_manager.cc
     371@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`; \
     372@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
     373@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@
     374@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
     375@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     376@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`
    312377uninstall-info-am:
    313378
     
    332397          $(AWK) '    { files[$$0] = 1; } \
    333398               END { for (i in files) print i; }'`; \
    334         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    335           test -n "$$unique" || unique=$$empty_fix; \
    336           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    337             $$tags $$unique; \
    338         fi
     399        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     400          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     401             $$tags $$unique
    339402ctags: CTAGS
    340403CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    391454all-am: Makefile $(PROGRAMS) $(HEADERS)
    392455installdirs:
    393         for dir in "$(DESTDIR)$(bindir)"; do \
    394           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    395         done
     456        $(mkdir_p) $(DESTDIR)$(bindir)
    396457install: install-am
    397458install-exec: install-exec-am
  • orxonox/branches/levelloader/src/lib/graphics/importer/framework.cc

    r3499 r3746  
    1717
    1818#include "vector.h"
     19
     20#include "primitive_model.h"
     21
    1922
    2023int verbose;
     
    7679    obj = new OBJModel(argv[1]);
    7780  else
    78     {
    79       // This is an example, of how it is possible, to create a new Model, and adding some vertex-information.
    80       // This also packs everything into a DisplayList, and can be handled exactly as any other model.
    81       // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created).
    82       /*
    83       obj = (OBJModel*) new Model();
    84       obj->setName("CUBE");
    85       obj->addVertex (-0.5, -0.5, 0.5);
    86       obj->addVertex (0.5, -0.5, 0.5);
    87       obj->addVertex (-0.5, 0.5, 0.5);
    88       obj->addVertex (0.5, 0.5, 0.5);
    89       obj->addVertex (-0.5, 0.5, -0.5);
    90       obj->addVertex (0.5, 0.5, -0.5);
    91       obj->addVertex (-0.5, -0.5, -0.5);
    92       obj->addVertex (0.5, -0.5, -0.5);
    93      
    94       obj->addVertexTexture (0.0, 0.0);
    95       obj->addVertexTexture (1.0, 0.0);
    96       obj->addVertexTexture (0.0, 1.0);
    97       obj->addVertexTexture (1.0, 1.0);
    98       obj->addVertexTexture (0.0, 2.0);
    99       obj->addVertexTexture (1.0, 2.0);
    100       obj->addVertexTexture (0.0, 3.0);
    101       obj->addVertexTexture (1.0, 3.0);
    102       obj->addVertexTexture (0.0, 4.0);
    103       obj->addVertexTexture (1.0, 4.0);
    104       obj->addVertexTexture (2.0, 0.0);
    105       obj->addVertexTexture (2.0, 1.0);
    106       obj->addVertexTexture (-1.0, 0.0);
    107       obj->addVertexTexture (-1.0, 1.0);
    108 
    109       obj->addFace ("1 2 4 3");
    110       obj->addFace ("3 4 6 5");
    111       obj->addFace ("5 6 8 7");
    112       obj->addFace ("7 8 2 1");
    113       obj->addFace ("2 8 6 4");
    114       obj->addFace ("7 1 3 5");
    115       obj->finalize();
    116       */
    117       obj = (OBJModel*) new Model(CYLINDER);
    118     }
     81    obj = new PrimitiveModel(SPHERE);
     82
    11983  M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0);
    12084  rotAxis = Vector (0.0,1.0,0.0);
     
    166130      switch (event.type) {
    167131      case SDL_MOUSEMOTION:
    168         PRINTF(3)("Mouse motion about %d,%d Pixels to (%d,%d).\n",
     132        PRINTF(4)("Mouse motion about %d,%d Pixels to (%d,%d).\n",
    169133                  event.motion.xrel, event.motion.yrel,
    170134                  event.motion.x, event.motion.y);
     
    205169        if (event.button.button == 4)
    206170          {
    207             PRINTF(0)("MouseWheel up\n");
     171            PRINTF(4)("MouseWheel up\n");
    208172            zoomTo *= .5;
    209173          }
    210174        else if (event.button.button == 5)
    211175          {
    212             PRINTF(2)("MouseWheel down\n");
     176            PRINTF(4)("MouseWheel down\n");
    213177            zoomTo *= 2.0;
    214178          }
     
    240204        else
    241205            {
    242               PRINTF(2)("MouseButton %d released at (%d,%d).\n",
     206              PRINTF(4)("MouseButton %d released at (%d,%d).\n",
    243207                        event.button.button, event.button.x, event.button.y);
    244208            }
  • orxonox/branches/levelloader/src/lib/graphics/importer/framework.h

    r3499 r3746  
    44#include "windowHandler.h" // Include the Whandler Basecode
    55#include "objModel.h"
     6#include "vector.h"
    67
    78class Vector;
     
    3435
    3536WindowHandler wHandler;  // Create an instance of the whandler basecode class
    36 OBJModel* obj;
     37Model* obj;
    3738
    3839
  • orxonox/branches/levelloader/src/lib/graphics/importer/material.cc

    r3605 r3746  
    2121#include "texture.h"
    2222#include "debug.h"
     23#include "resource_manager.h"
    2324#include <stdlib.h>
    2425#include <string.h>
     26
     27//! \todo check if we are in RESOURCE MANAGER-mode
     28#include "resource_manager.h"
    2529
    2630using namespace std;
     
    5862    delete []this->name;
    5963  if (this->diffuseTexture)
    60     this->diffuseTexture;
     64    ResourceManager::getInstance()->unload(this->diffuseTexture);
    6165  if (this->nextMat)
    6266    delete this->nextMat;
     
    8993  this->nextMat = NULL;
    9094  this->name ="";
    91   this->setIllum(1);
     95  this->setIllum(3);
    9296  this->setDiffuse(0,0,0);
    9397  this->setAmbient(0,0,0);
     
    104108  this->ambientTextureSet = false;
    105109  this->specularTextureSet = false;
    106 
    107  
    108110}
    109111
     
    167169}
    168170
    169 
    170171/**
    171172   \brief Set the Name of the Material. (Important for searching)
     
    321322void Material::addTexturePath(char* pathName)
    322323{
    323   PathList::getInstance()->addPath(pathName);
     324  ResourceManager::getInstance()->addImageDir(pathName);
    324325}
    325326
     
    333334{
    334335  PRINTF(4)("setting Diffuse Map %s\n", dMap);
    335   diffuseTexture = new Texture();
    336   this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
    337 
     336  //    diffuseTexture = new Texture();
     337  //    this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
     338
     339  //! \todo check if RESOURCE MANAGER is availiable
     340  //! \todo Textures from .mtl-file need special care.
     341  this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
    338342}
    339343
  • orxonox/branches/levelloader/src/lib/graphics/importer/model.cc

    r3605 r3746  
    3434{
    3535  this->initialize();
    36 }
    37 
    38 /**
    39    \brief Creates a 3D-Model of Primitive-Type type
    40 
    41    if you want to just display a Cube/Sphere/Cylinder/... without any material.
    42    
    43    \todo implement Cube/Sphere/Cylinder/...
    44 */
    45 Model::Model(PRIMITIVE type)
    46 {
    47   this->initialize();
    48 
    49   switch (type)
    50     {
    51     default:
    52     case CUBE:
    53       this->cubeModel();
    54       break;
    55     case SPHERE:
    56       this->sphereModel();
    57       break;
    58     case CYLINDER:
    59       this->cylinderModel();
    60       break;
    61 
    62     }
    63   this->importToGL ();
    64 
    65   this->cleanup();
    6636}
    6737
     
    492462
    493463      tmpElem->vertexNumber = va_arg (itemlist, int) -1;
    494       if (type >= 2)
     464      if (type & TEXCOORD)
    495465        tmpElem->texCoordNumber = va_arg (itemlist, int) -1;
    496       if (type == 1 || type ==3)
     466      if (type & NORMAL)
    497467        tmpElem->normalNumber = va_arg(itemlist, int) -1;
    498468      this->currentGroup->currentFace->vertexCount++;
     
    797767void Model::cubeModel(void)
    798768{
    799   this->addVertex ("-0.5 -0.5 0.5");
    800   this->addVertex ("0.5 -0.5 0.5");
    801   this->addVertex ("-0.5 0.5 0.5");
    802   this->addVertex ("0.5 0.5 0.5");
    803   this->addVertex ("-0.5 0.5 -0.5");
    804   this->addVertex ("0.5 0.5 -0.5");
    805   this->addVertex ("-0.5 -0.5 -0.5");
    806   this->addVertex ("0.5 -0.5 -0.5");
    807 
    808   this->addVertexTexture ("0.0 0.0");
    809   this->addVertexTexture ("1.0 0.0");
    810   this->addVertexTexture ("0.0 1.0");
    811   this->addVertexTexture ("1.0 1.0");
    812   this->addVertexTexture ("0.0 2.0");
    813   this->addVertexTexture ("1.0 2.0");
    814   this->addVertexTexture ("0.0 3.0");
    815   this->addVertexTexture ("1.0 3.0");
    816   this->addVertexTexture ("0.0 4.0");
    817   this->addVertexTexture ("1.0 4.0");
    818   this->addVertexTexture ("2.0 0.0");
    819   this->addVertexTexture ("2.0 1.0");
    820   this->addVertexTexture ("-1.0 0.0");
    821   this->addVertexTexture ("-1.0 1.0");
    822 
    823   this->addVertexNormal ("0.0 0.0 1.0");
    824   this->addVertexNormal ("0.0 0.0 1.0");
    825   this->addVertexNormal ("0.0 0.0 1.0");
    826   this->addVertexNormal ("0.0 0.0 1.0");
    827   this->addVertexNormal ("0.0 1.0 0.0");
    828   this->addVertexNormal ("0.0 1.0 0.0");
    829   this->addVertexNormal ("0.0 1.0 0.0");
    830   this->addVertexNormal ("0.0 1.0 0.0");
    831   this->addVertexNormal ("0.0 0.0 -1.0");
    832   this->addVertexNormal ("0.0 0.0 -1.0");
    833   this->addVertexNormal ("0.0 0.0 -1.0");
    834   this->addVertexNormal ("0.0 0.0 -1.0");
    835   this->addVertexNormal ("0.0 -1.0 0.0");
    836   this->addVertexNormal ("0.0 -1.0 0.0");
    837   this->addVertexNormal ("0.0 -1.0 0.0");
    838   this->addVertexNormal ("0.0 -1.0 0.0");
    839   this->addVertexNormal ("1.0 0.0 0.0");
    840   this->addVertexNormal ("1.0 0.0 0.0");
    841   this->addVertexNormal ("1.0 0.0 0.0");
    842   this->addVertexNormal ("1.0 0.0 0.0");
    843   this->addVertexNormal ("-1.0 0.0 0.0");
    844   this->addVertexNormal ("-1.0 0.0 0.0");
    845   this->addVertexNormal ("-1.0 0.0 0.0");
    846   this->addVertexNormal ("-1.0 0.0 0.0");
     769  this->addVertex (-0.5, -0.5, 0.5);
     770  this->addVertex (0.5, -0.5, 0.5);
     771  this->addVertex (-0.5, 0.5, 0.5);
     772  this->addVertex (0.5, 0.5, 0.5);
     773  this->addVertex (-0.5, 0.5, -0.5);
     774  this->addVertex (0.5, 0.5, -0.5);
     775  this->addVertex (-0.5, -0.5, -0.5);
     776  this->addVertex (0.5, -0.5, -0.5);
     777
     778  this->addVertexTexture (0.0, 0.0);
     779  this->addVertexTexture (1.0, 0.0);
     780  this->addVertexTexture (0.0, 1.0);
     781  this->addVertexTexture (1.0, 1.0);
     782  this->addVertexTexture (0.0, 2.0);
     783  this->addVertexTexture (1.0, 2.0);
     784  this->addVertexTexture (0.0, 3.0);
     785  this->addVertexTexture (1.0, 3.0);
     786  this->addVertexTexture (0.0, 4.0);
     787  this->addVertexTexture (1.0, 4.0);
     788  this->addVertexTexture (2.0, 0.0);
     789  this->addVertexTexture (2.0, 1.0);
     790  this->addVertexTexture (-1.0, 0.0);
     791  this->addVertexTexture (-1.0, 1.0);
     792
     793  this->addVertexNormal (0.0, 0.0, 1.0);
     794  this->addVertexNormal (0.0, 0.0, 1.0);
     795  this->addVertexNormal (0.0, 0.0, 1.0);
     796  this->addVertexNormal (0.0, 0.0, 1.0);
     797  this->addVertexNormal (0.0, 1.0, 0.0);
     798  this->addVertexNormal (0.0, 1.0, 0.0);
     799  this->addVertexNormal (0.0, 1.0, 0.0);
     800  this->addVertexNormal (0.0, 1.0, 0.0);
     801  this->addVertexNormal (0.0, 0.0, -1.0);
     802  this->addVertexNormal (0.0, 0.0, -1.0);
     803  this->addVertexNormal (0.0, 0.0, -1.0);
     804  this->addVertexNormal (0.0, 0.0, -1.0);
     805  this->addVertexNormal (0.0, -1.0, 0.0);
     806  this->addVertexNormal (0.0, -1.0, 0.0);
     807  this->addVertexNormal (0.0, -1.0, 0.0);
     808  this->addVertexNormal (0.0, -1.0, 0.0);
     809  this->addVertexNormal (1.0, 0.0, 0.0);
     810  this->addVertexNormal (1.0, 0.0, 0.0);
     811  this->addVertexNormal (1.0, 0.0, 0.0);
     812  this->addVertexNormal (1.0, 0.0, 0.0);
     813  this->addVertexNormal (-1.0, 0.0, 0.0);
     814  this->addVertexNormal (-1.0, 0.0, 0.0);
     815  this->addVertexNormal (-1.0, 0.0, 0.0);
     816  this->addVertexNormal (-1.0, 0.0, 0.0);
    847817
    848818  /* normaleLess-testingMode
     
    855825  */
    856826
    857   this->addFace ("1/1/1 2/2/2 4/4/3 3/3/4");
    858   this->addFace ("3/3/5 4/4/6 6/6/7 5/5/8");
    859   this->addFace ("5/5/9 6/6/10 8/8/11 7/7/12");
    860   this->addFace ("7/7/13 8/8/14 2/10/15 1/9/16");
    861   this->addFace ("2/2/17 8/11/18 6/12/19 4/4/20");
    862   this->addFace ("7/13/21 1/1/22 3/3/23 5/14/24");
    863 
    864 }
    865 
    866 /**
    867    \brief Builds a Sphere into the Model
    868 */
    869 void Model::sphereModel()
    870 {
    871   int detail = 30;
    872   if (detail <= 0) detail = 1;
    873   float df = (float)detail;
    874   for (float i = 0.0; i < df/2; i+=1.0)
    875     {
    876       for (float j = 0.0; j < df; j+=1.0)
    877       {
    878         float vz = i/df *2.0*PI - PI/2.0;
    879         this->addVertex(cos(j/df*2.0*PI) * cos(vz) ,
    880                         sin(j/df*2.0*PI) * cos(vz),
    881                         sin(vz));
    882         //if (j==0.0)
    883         //printf ("%f %f\n", vz, sin (vz));
    884         if (i==0.0)
    885           PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));
    886       }
    887     }
    888   vertices->debug();
    889   for (int i = 0; i < detail/2; i++)
    890     for (int j = 1; j < detail; j++)
    891       {
    892         unsigned int v1,v2,v3,v4;
    893         v1 = i*detail +j;
    894 
    895         /*      if (j+1 == detail)
    896           {
    897             v2 = i*detail +1;
    898             v3 = i*detail+detail + 1;
    899           }
    900           else*/
    901           {
    902             v2 = i*detail +j+1;
    903             v3 = i*detail+detail + j+1;
    904           }
    905         v4 = i*detail+detail + j;
    906         //printf("%i %i %i %i\n", v1, v2, v3, v4);
    907         this->addFace(4, 0, v1, v2, v3, v4);
    908       }
    909 }
    910 
    911 /**
    912    \brief Creates a Cylinder.
    913 */
    914 void Model::cylinderModel(void)
    915 {
    916   unsigned int detail = 20;
    917   float size = 1.0;
    918 
    919   // check if devision by zero
    920   if (detail <= 3)
    921     detail = 3;
    922   int count = 0;
    923   // defining Points of the Cylinder.
    924   for (float phi = 0.0; phi < 2.0*PI; phi += 2.0*PI/(float)detail)
    925     {
    926       this->addVertex(size*cos(phi), size*sin(phi), -size);
    927       this->addVertex(size*cos(phi), size*sin(phi), size);
    928       count ++;
    929     }
    930   this->addVertex(0, 0, -size);
    931   this->addVertex(0, 0, size);
    932 
    933  
    934   if (count != detail)
    935     PRINTF(1)("calculation error, count should be %d but is %d.\n", detail, count);
    936   vertices->debug();
    937 
    938   // adding Faces
    939   for (int i = 0; i < detail-1; i++)
    940     {
    941       int p1, p2, p3, p4;
    942       p1 = 2*i+1;
    943       p2 = 2*i+2;
    944       if (i <= detail);
    945       p3 = 2*i+4;
    946       p4 = 2*i+3;
    947       // something is wrong here
    948       this->addFace(4, 0, p1, p2, p3, p4);
    949       this->addFace(3, 0, p4, p1, 2*detail+1);
    950       this->addFace(3, 0, p2, p3, 2*detail+2);
    951     }
    952   addFace(4,0, 2*detail-1, 2*detail, 2, 1);
    953   this->addFace(3, 0, 1, 2*detail-1, 2*detail+1);
    954   this->addFace(3, 0, 2*detail, 2, 2*detail+2);
    955 
    956 }
     827  this->addFace (4, 3, 1,1,1, 2,2,2, 4,4,3, 3,3,4);
     828  this->addFace (4, 3, 3,3,5, 4,4,6, 6,6,7, 5,5,8);
     829  this->addFace (4, 3, 5,5,9, 6,6,10, 8,8,11, 7,7,12);
     830  this->addFace (4, 3, 7,7,13, 8,8,14, 2,10,15, 1,9,16);
     831  this->addFace (4, 3, 2,2,17, 8,11,18, 6,12,19, 4,4,20);
     832  this->addFace (4, 3, 7,13,21, 1,1,22, 3,3,23, 5,14,24);
     833
     834}
  • orxonox/branches/levelloader/src/lib/graphics/importer/model.h

    r3499 r3746  
    1515using namespace std;
    1616
    17 //! Specification of different primitives the Model knows
    18 enum PRIMITIVE {PLANE, CUBE, SPHERE, CYLINDER};
     17// definition of different modes for setting up Faces
     18#define VERTEX 0       //!< If Faces are created WITH Vertex-Coordinate
     19#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
     20#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
    1921
    2022//! Class that handles 3D-Models. it can also read them in and display them.
     
    2325 public:
    2426  Model(void);
    25   Model(PRIMITIVE type);
    2627  Model(char* modelName);
    2728  virtual ~Model(void);
     
    114115
    115116  void cubeModel(void);
    116   void sphereModel(void);
    117   void cylinderModel(void);
    118117};
    119118
  • orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc

    r3605 r3746  
    2121
    2222#include "debug.h"
    23 
    24 /**
    25    \brief Crates a 3D-Model and loads in a File.
    26    \param fileName file to parse and load (must be a .obj file)
    27 */
    28 OBJModel::OBJModel(const char* fileName)
    29 {
    30   this->initializeOBJ();
    31 
    32   this->importFile (fileName);
    33 
    34   this->importToGL ();
    35 
    36   this->cleanup();
    37 }
    3823
    3924/**
     
    193178      else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
    194179        {
    195           PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer);
     180          PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
    196181        }
    197182    }
     
    200185  delete []fileName;
    201186  return true;
    202 
    203187}
    204188
  • orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h

    r3542 r3746  
    1313{
    1414 public:
    15   OBJModel(const char* fileName);
    16   OBJModel(const char* fileName, float scaling);
     15  OBJModel(const char* fileName, float scaling = 1.0);
    1716  virtual ~OBJModel();
    1817  void initializeOBJ(void);
     
    2827  bool readFromObjFile (void);
    2928  bool readMtlLib (const char* matFile);
    30 
    3129};
    3230
  • orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc

    r3605 r3746  
    2222#include "texture.h"
    2323
    24 // headers only for PathList
    25 #include <unistd.h>
    26 #include <sys/types.h>
    27 #include <sys/stat.h>
    28 #include <stdlib.h>
    29 #include <fstream>
    30 
    31 /**
    32    \brief creates a ned PathList.
    33    
    34    It is a good idea to use this as an initial List,
    35    because if you give on a name the Path will not be checked for its existence.
    36 */
    37 PathList::PathList()
    38 {
    39   this->pathName = NULL;
    40   this->next = NULL;
    41 }
    42 
    43 /**
    44    \brief Creates a new PathList with a Name.
    45    \param pName the Name of The Path.
    46 
    47    This function just adds the Path without checking if it exists.
    48 */
    49 PathList::PathList(char* pName)
    50 {
    51   this->pathName = new char [strlen(pName)+1];
    52   strcpy (this->pathName, pName);
    53   this->next = NULL;
    54 }
    55 
    56 /**
    57    \brief destroys a PathList
    58 
    59    It does this by deleting the Name and then delete its preceding PathList.
    60 */
    61 PathList::~PathList()
    62 {
    63   if (this->pathName)
    64     delete []this->pathName;
    65   if (this->next)
    66     delete this->next;
    67 }
    68 
    69 PathList* PathList::firstPath = NULL;
    70 
    71 /**
    72    \returns A Pointer to the first Path of the Pathlist
    73 */
    74 PathList* PathList::getInstance(void)
    75 {
    76   if (firstPath)
    77     return firstPath;
    78   firstPath = new PathList();
    79 }
    80 /**
    81    \brief Adds a new Pathlist Element.
    82    \param pName
    83    
    84    Adding a Path automatically checks if the Path exists,
    85    and if it does not it will not add it to the List.
    86 */
    87 void PathList::addPath (char* pName)
    88 {
    89   if (pName[0] == '\0')
    90     {
    91       PRINTF(2)("not Adding empty Path to the List.\n");
    92       return;
    93     }
    94   char* tmpPName = new char[strlen(pName)];
    95   strncpy(tmpPName, pName, strlen(pName)-1);
    96   tmpPName[strlen(pName)-1] = '\0';
    97   if (access (tmpPName, F_OK) == 0)
    98     {
    99       struct stat status;
    100       stat(tmpPName, &status);
    101       if (status.st_mode & S_IFDIR)
    102         {
    103           PRINTF(4)("Adding Path %s to the PathList.\n", pName);
    104           PathList* tmpPathList = this;
    105           while (tmpPathList->next)
    106             tmpPathList = tmpPathList->next;
    107           tmpPathList->next = new PathList(pName);
    108         }
    109       else
    110         PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName);
    111     }
    112   else
    113       PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName);
    114   delete []tmpPName;
    115 }
    116 
    117 
     24#include "graphics_engine.h"
    11825
    11926/**
     
    12734  this->texture = 0;
    12835}
     36
     37/**
     38   \brief Constructor for a Texture
     39*/
     40Texture::Texture(const char* imageName)
     41{
     42  this->pImage = new Image;
     43  this->pImage->data = NULL;
     44  this->map = NULL;
     45  this->texture = 0;
     46  this->loadImage(imageName);
     47
    12948
    13049/**
     
    14362
    14463/**
    145    \brief Searches for a Texture inside one of the defined Paths
    146    \param texName The name of the texture o search for.
    147    \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
    148 */
    149 char* Texture::searchTextureInPaths(char* texName) const
    150 {
    151   char* tmpName = NULL;
    152   PathList* pList = PathList::getInstance();
    153   while (pList)
    154     {
    155       if (pList->pathName)
    156         {
    157           tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
    158           strcpy(tmpName, pList->pathName);
    159         }
    160       else
    161         {
    162           tmpName = new char [strlen(texName)+1];
    163           tmpName[0]='\0';
    164         }
    165       strcat(tmpName, texName);
    166       if (access (tmpName, F_OK) == 0)
    167         return tmpName;
    168      
    169       if (tmpName)
    170         delete []tmpName;
    171       tmpName = NULL;
    172       pList = pList->next;
    173     }
    174   return NULL;
    175 }
    176 
    177 /**
    17864   \brief a Simple function that switches two char values
    17965   \param a The first value
     
    19581bool Texture::loadTexToGL (Image* pImage)
    19682{
    197   PRINTF(4)("Loading texture to OpenGL-Environment.\n");
    198   glGenTextures(1, &this->texture);
    199   glBindTexture(GL_TEXTURE_2D, this->texture);
    200   /* not Working, and not needed.
    201   glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
    202                 height, 0, GL_BGR,
    203                 GL_UNSIGNED_BYTE, map->pixels );
    204   */
    205   gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data);
    206  
    207   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
    208   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
    209 }
    210 
     83  if (GraphicsEngine::texturesEnabled)
     84    {
     85      PRINTF(4)("Loading texture to OpenGL-Environment.\n");
     86      glGenTextures(1, &this->texture);
     87      glBindTexture(GL_TEXTURE_2D, this->texture);
     88      /* not Working, and not needed.
     89         glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
     90         height, 0, GL_BGR,
     91         GL_UNSIGNED_BYTE, map->pixels );
     92      */
     93      gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data);
     94     
     95      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
     96      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);     
     97    }
     98}
    21199
    212100#ifdef HAVE_SDL_SDL_IMAGE_H
    213 bool Texture::loadImage(char* imageName)
    214 {
    215   char* imgNameWithPath = searchTextureInPaths(imageName);
    216   if (imgNameWithPath)
    217     {
    218       this->map=IMG_Load(imgNameWithPath);
    219       if(!map)
    220         {
    221           PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
     101bool Texture::loadImage(const char* imageName)
     102{
     103  if (GraphicsEngine::texturesEnabled)
     104    {
     105      if (imageName)
     106        {
     107          this->map=IMG_Load(imageName);
     108          if(!map)
     109            {
     110              PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
     111              return false;
     112            }
     113          pImage->height = map->h;
     114          pImage->width  = map->w;
     115          pImage->data   = (GLubyte*)map->pixels;
     116          pImage->bpp    = map->format->BytesPerPixel;
     117          if (pImage->bpp == 3)
     118            pImage->format = GL_RGB;
     119          else if (pImage->bpp == 4)
     120            pImage->format = GL_RGBA;
     121         
     122          if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb")))
     123            for (int i=0;i<map->h * map->w *3;i+=3)
     124              {
     125                GLuint temp = pImage->data[i];
     126                pImage->data[i] = pImage->data[i+2];
     127                pImage->data[i+2] = temp;
     128              }
     129          /* this is the real swapping algorithm */
     130          for( int i = 0 ; i < (pImage->height / 2) ; ++i )
     131            for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp )
     132              for(int k = 0; k < pImage->bpp; ++k)
     133                swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]);
     134         
     135          this->loadTexToGL (this->pImage);
     136          SDL_FreeSurface(map);
     137          this->pImage->data = NULL;
     138        }
     139      else
     140        {
     141          PRINTF(2)("Image not Found: %s\n", imageName);
    222142          return false;
    223143        }
    224       pImage->height = map->h;
    225       pImage->width  = map->w;
    226       pImage->data   = (GLubyte*)map->pixels;
    227       pImage->bpp    = map->format->BytesPerPixel;
    228       if (pImage->bpp == 3)
    229         pImage->format = GL_RGB;
    230       else if (pImage->bpp == 4)
    231         pImage->format = GL_RGBA;
    232          
    233       if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
    234         for (int i=0;i<map->h * map->w *3;i+=3)
    235           {
    236             GLuint temp = pImage->data[i];
    237             pImage->data[i] = pImage->data[i+2];
    238             pImage->data[i+2] = temp;
    239           }
    240       /* this is the real swapping algorithm */
    241       for( int i = 0 ; i < (pImage->height / 2) ; ++i )
    242         for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp )
    243           for(int k = 0; k < pImage->bpp; ++k)
    244             swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]);
    245  
    246       this->loadTexToGL (this->pImage);
    247       SDL_FreeSurface(map);
    248       this->pImage->data = NULL;
    249     }
    250   else
    251     {
    252       PRINTF(2)("Image not Found: %s\n", imgNameWithPath);
    253       return false;
    254144    }
    255145}
     
    262152   \todo Checks where to find the Image
    263153*/
    264 bool Texture::loadImage(char* imageName)
    265 {
    266   char* imgNameWithPath = searchTextureInPaths(imageName);
    267   if (imgNameWithPath)
    268     {
    269       if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
    270         {
    271           PRINTF(4)("Requested bmp-image. Trying to Import.\n");
    272           return this->loadBMP(imgNameWithPath);
    273         }
    274      
    275       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
    276         {
    277           PRINTF(4)("Requested jpeg-image. Trying to Import\n");
    278           return this->loadJPG(imgNameWithPath);
    279         }
    280       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
    281         {
    282           PRINTF(4)("Requested tga-image. Trying to Import\n");
    283           return this->loadTGA(imgNameWithPath);
    284         }
    285       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
    286         {
    287           PRINTF(4)("Requested png-image. Trying to Import\n");
    288           return this->loadPNG(imgNameWithPath);
     154bool Texture::loadImage(const char* imageName)
     155{
     156  if (GraphicsEngine::texturesEnabled)
     157    {
     158      if (imageName)
     159        {
     160          if (!strncmp(imageName+strlen(imageName)-4, ".bmp", 4))
     161            {
     162              PRINTF(4)("Requested bmp-image. Trying to Import.\n");
     163              return this->loadBMP(imageName);
     164            }
     165         
     166          else if (!strncmp(imageName+strlen(imageName)-4, ".jpg", 4) || !strncmp(imageName+strlen(imageName)-5, ".jpg", 5))
     167            {
     168              PRINTF(4)("Requested jpeg-image. Trying to Import\n");
     169              return this->loadJPG(imageName);
     170            }
     171          else if (!strncmp(imageName+strlen(imageName)-4, ".tga", 4))
     172            {
     173              PRINTF(4)("Requested tga-image. Trying to Import\n");
     174              return this->loadTGA(imageName);
     175            }
     176          else if (!strncmp(imageName+strlen(imageName)-4, ".png", 4))
     177            {
     178              PRINTF(4)("Requested png-image. Trying to Import\n");
     179              return this->loadPNG(imageName);
     180            }
     181          else
     182            {
     183              PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imageName);
     184              return false;
     185            }
    289186        }
    290187      else
    291188        {
    292           PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
     189          PRINTF(2)("Image not Found: %s\n", imageName);
    293190          return false;
    294191        }
    295192    }
    296   else
    297     {
    298       PRINTF(2)("Image not Found: %s\n", imgNameWithPath);
    299       return false;
    300     }
    301 }
    302 
     193}
    303194/**
    304195   \brief reads in a Windows BMP-file, and imports it to openGL.
  • orxonox/branches/levelloader/src/lib/graphics/importer/texture.h

    r3605 r3746  
    2828#endif /* HAVE_SDL_SDL_IMAGE_H */
    2929
    30 
    31 
    32 //! Class to handle lists of paths.
    33 /**
    34    \todo Ability to return Paths by itself.
    35 
    36    It is simple to use, and good, for all PathList you want.
    37    just create a new Pathlist, and add Paths.
    38 */
    39 class PathList
    40 {
    41  private:
    42   PathList();
    43   static PathList* firstPath; //!< A static Pointer to the first PathList in the List.
    44  public:
    45   PathList(char* pName);
    46   ~PathList();
    47   static PathList* getInstance(void);
    48  
    49   void addPath (char* pName);
    50   char* pathName;              //!< The Name of the current Path.
    51   PathList* next;              //!< Pointer to the next Pathlist.
    52 };
    53 
    5430//! A Class, that reads in Textures from different fileformats.
    5531class Texture
     
    7046  GLuint texture;   //!< The Texture-ID of opengl from this Texture.
    7147  SDL_Surface* map; //!< The map SDL initializes for this element.
    72   char* searchTextureInPaths(char* texName) const;
     48  char* searchTextureInPaths(const char* texName) const;
    7349  inline void swap(unsigned char &a, unsigned char &b);
    7450 public:
    7551  Texture(void);
     52  Texture(const char* imageName);
    7653  ~Texture(void);
    7754  /** \returns The textureID of this texture.  */
     
    7956  bool loadTexToGL (Image* pImage);
    8057
    81   bool loadImage(char* imageName);
     58  bool loadImage(const char* imageName);
    8259#ifndef HAVE_SDL_SDL_IMAGE_H
    8360
  • orxonox/branches/levelloader/src/lib/graphics/light.cc

    r3605 r3746  
    2121
    2222#include "glincl.h"
     23#include "vector.h"
    2324
    2425using namespace std;
  • orxonox/branches/levelloader/src/lib/gui/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    179179          esac; \
    180180        done; \
    181         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
     181        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
    182182        cd $(top_srcdir) && \
    183           $(AUTOMAKE) --foreign  src/lib/gui/Makefile
     183          $(AUTOMAKE) --gnu  src/lib/gui/Makefile
    184184.PRECIOUS: Makefile
    185185Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    274274        tags=; \
    275275        here=`pwd`; \
    276         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     276        if (etags --etags-include --version) >/dev/null 2>&1; then \
    277277          include_option=--etags-include; \
    278           empty_fix=.; \
    279278        else \
    280279          include_option=--include; \
    281           empty_fix=; \
    282280        fi; \
    283281        list='$(SUBDIRS)'; for subdir in $$list; do \
    284282          if test "$$subdir" = .; then :; else \
    285             test ! -f $$subdir/TAGS || \
     283            test -f $$subdir/TAGS && \
    286284              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    287285          fi; \
     
    293291          $(AWK) '    { files[$$0] = 1; } \
    294292               END { for (i in files) print i; }'`; \
    295         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    296           test -n "$$unique" || unique=$$empty_fix; \
    297           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    298             $$tags $$unique; \
    299         fi
     293        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     294          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     295             $$tags $$unique
    300296ctags: CTAGS
    301297CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/levelloader/src/lib/gui/console/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
     
    205205          esac; \
    206206        done; \
    207         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile'; \
     207        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile'; \
    208208        cd $(top_srcdir) && \
    209           $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile
     209          $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile
    210210.PRECIOUS: Makefile
    211211Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    227227install-binPROGRAMS: $(bin_PROGRAMS)
    228228        @$(NORMAL_INSTALL)
    229         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     229        $(mkdir_p) $(DESTDIR)$(bindir)
    230230        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    231231          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    233233          ; then \
    234234            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    235            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    236            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     235           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     236           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    237237          else :; fi; \
    238238        done
     
    242242        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    243243          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    244           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    245           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     244          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     245          rm -f $(DESTDIR)$(bindir)/$$f; \
    246246        done
    247247
     
    299299          $(AWK) '    { files[$$0] = 1; } \
    300300               END { for (i in files) print i; }'`; \
    301         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    302           test -n "$$unique" || unique=$$empty_fix; \
    303           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    304             $$tags $$unique; \
    305         fi
     301        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     302          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     303             $$tags $$unique
    306304ctags: CTAGS
    307305CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    358356all-am: Makefile $(PROGRAMS) $(HEADERS)
    359357installdirs:
    360         for dir in "$(DESTDIR)$(bindir)"; do \
    361           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    362         done
     358        $(mkdir_p) $(DESTDIR)$(bindir)
    363359install: install-am
    364360install-exec: install-exec-am
  • orxonox/branches/levelloader/src/lib/gui/gui/Makefile.am

    r3499 r3746  
    2121
    2222#AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
    23 LIBS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
     23AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    2424
    2525bin_PROGRAMS=gui
  • orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
     
    131131LDFLAGS = @LDFLAGS@
    132132LIBOBJS = @LIBOBJS@
    133 
    134 #AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
    135 LIBS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
     133LIBS = @LIBS@
    136134LTLIBOBJS = @LTLIBOBJS@
    137135MAKEINFO = @MAKEINFO@
     
    195193MAINSRCDIR = ../../..
    196194AM_CXXFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/gaphics -I$(MAINSRCDIR)/lib/graphics/font -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai
     195
     196#AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
     197AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    197198gui_SOURCES = orxonox_gui.cc \
    198199            orxonox_gui_gtk.cc \
     
    238239          esac; \
    239240        done; \
    240         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile'; \
     241        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile'; \
    241242        cd $(top_srcdir) && \
    242           $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile
     243          $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile
    243244.PRECIOUS: Makefile
    244245Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    260261install-binPROGRAMS: $(bin_PROGRAMS)
    261262        @$(NORMAL_INSTALL)
    262         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     263        $(mkdir_p) $(DESTDIR)$(bindir)
    263264        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    264265          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    266267          ; then \
    267268            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    268            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    269            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     269           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     270           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    270271          else :; fi; \
    271272        done
     
    275276        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    276277          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    277           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    278           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     278          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     279          rm -f $(DESTDIR)$(bindir)/$$f; \
    279280        done
    280281
     
    338339          $(AWK) '    { files[$$0] = 1; } \
    339340               END { for (i in files) print i; }'`; \
    340         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    341           test -n "$$unique" || unique=$$empty_fix; \
    342           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    343             $$tags $$unique; \
    344         fi
     341        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     342          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     343             $$tags $$unique
    345344ctags: CTAGS
    346345CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    397396all-am: Makefile $(PROGRAMS) $(HEADERS)
    398397installdirs:
    399         for dir in "$(DESTDIR)$(bindir)"; do \
    400           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    401         done
     398        $(mkdir_p) $(DESTDIR)$(bindir)
    402399install: install-am
    403400install-exec: install-exec-am
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui.cc

    r3499 r3746  
    9595
    9696  // Reading Values from File
    97   exec->setFilename("~/.orxonox.conf");
     97  exec->setConfFile("~/.orxonox/orxonox.conf");
    9898  exec->readFromFile(orxonoxGUI);
    9999  // Merging changes to the Options from appended flags.
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.cc

    r3499 r3746  
    2525
    2626#include "orxonox_gui_exec.h"
     27
    2728#include <iostream>
    2829#include <string>
     30
     31#include <sys/stat.h>
     32#include <sys/types.h>
     33
    2934
    3035HashTable* orxonoxFlagHash;
     
    5055  this->saveSettings->saveability();
    5156  this->execBox->fill(this->saveSettings);
    52   this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem");
     57  this->verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem");
    5358  this->verboseMode->setFlagName("verbose", "v", 0);
    5459  this->verboseMode->saveability();
     
    9095
    9196/**
     97   \brief sets the confDir and File-name out of an input-string
     98*/
     99void OrxonoxGuiExec::setConfFile(char* confFile)
     100{
     101  char splitter =
     102#ifdef __WIN32__
     103    '\\';
     104#else
     105  '/';
     106#endif
     107  char* tmpConfFile = new char[strlen(confFile)+1];
     108  strcpy(tmpConfFile, confFile);
     109  char* tmp = strrchr(tmpConfFile, splitter);
     110  if (tmp)
     111    {
     112      tmp[0] = '\0';
     113      this->setConfDir(tmpConfFile);
     114      this->setFileName(tmp+1);
     115    }
     116  else
     117    {
     118      this->setConfDir("~/");
     119      this->setFileName(tmpConfFile);
     120    }
     121  delete []tmp;
     122  delete []tmpConfFile;
     123}
     124
     125/**
     126   \brief sets the Directory of the configuration files
     127   \param confDir the Directory for the configuration files
     128*/
     129void OrxonoxGuiExec::setConfDir(char* confDir)
     130{
     131  if (!strncmp(confDir, "~/", 2))
     132    {
     133      char tmp[500];
     134#ifdef __WIN32__
     135      strcpy(tmp, getenv("USERPROFILE"));
     136#else
     137      strcpy(tmp, getenv("HOME"));
     138#endif
     139      this->confDir = new char[strlen(tmp)+strlen(confDir)];
     140      sprintf(this->confDir, "%s%s", tmp, confDir+1);
     141    }
     142  else
     143    {
     144      this->confDir = new char[strlen(confDir)+1];
     145      strcpy(this->confDir, confDir);
     146    }
     147  PRINTF(3)("Config Directory is: %s.\n", this->confDir);
     148  mkdir(this->confDir, 0755);
     149}
     150
     151/**
    92152   \brief Sets the location of the configuration File.
    93    \param filename the location of the configFile
     153   \param fileName the location of the configFile
    94154
    95155   \todo: memory allocation could be better.
     
    97157   The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows
    98158*/
    99 void OrxonoxGuiExec::setFilename(char* filename)
    100 {
    101   char* buffer = (char*)malloc(2048*sizeof(char));
    102   sprintf(buffer, "%s", filename);
    103   if(!strncmp(buffer, "~/", 2))
    104   {
    105 #ifdef __WIN32__
    106     sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2);
    107 #else
    108     sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2);
    109 #endif
    110   }
    111   else if(buffer)
    112     strcpy(this->configFile, buffer);
    113   free (buffer);
     159void OrxonoxGuiExec::setFileName(char* fileName)
     160{
     161  if (!this->confDir)
     162    this->setConfDir("~/");
     163  this->configFile = new char[strlen(this->confDir)+strlen(fileName)+2];
     164  sprintf(this->configFile, "%s/%s", this->confDir, fileName);
     165  PRINTF(3)("ConfigurationFile is %s.\n", this->configFile);
    114166}
    115167
     
    117169   \returns The name of the Configuration-File
    118170*/
    119 char* OrxonoxGuiExec::getConfigFile(void)
     171char* OrxonoxGuiExec::getConfigFile(void) const
    120172{
    121173  return this->configFile;
     
    190242            space2under[0] = '_';
    191243          }
    192         if(widget->isOption <=3)
    193           fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value);
    194         else if(widget->isOption == 5)
    195           fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue);
     244          fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<Option*>(widget)->save());
    196245      }
    197246
     
    259308    {
    260309      PRINT(3)("Located Option %s.\n", widget->title);
    261       if(widget->isOption >= 1 && widget->isOption <= 3)
    262         {
    263           static_cast<Option*>(widget)->value = atoi(info->variableValue);
    264           static_cast<Option*>(widget)->redraw(); //!< \todo change this to setValue.
    265         }
    266       else if(widget->isOption == 5)
    267         static_cast<OptionLabel*>(widget)->setValue(info->variableValue);
     310      if(widget->isOption >= 1)
     311          static_cast<Option*>(widget)->load(info->variableValue);
    268312    }
    269313}
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.h

    r3499 r3746  
    2222  CheckButton* alwaysShow;     //!< A CheckButton, for if orxonox should start with or without gui.
    2323  Button* quit;                //!< A Button to quit the Gui without starting orxonox.
     24  char* confDir;               //!< The directory of the orxonox-configuration-files.
    2425  char* configFile;            //!< The name of the .orxonox.conf(ig)-file.
    2526  FILE* CONFIG_FILE;           //!< Filehandler for reading and writing.
     
    3738 
    3839  Widget* getWidget(void);
    39  
    40   void setFilename(char* filename);
    41   char* getConfigFile(void);
     40
     41  void setConfFile(char* confFile);
     42  void setConfDir(char* confDir);
     43  void setFileName(char* fileName);
     44  char* getConfigFile(void) const;
    4245  int shouldsave(void);
    4346  void writeToFile(Widget* widget);
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.cc

    r3499 r3746  
    2525
    2626
     27#include "orxonox_gui_gtk.h"
     28
     29#include <stdarg.h>
    2730#include <iostream>
    28 
    29 #include "orxonox_gui_gtk.h"
    3031
    3132
     
    6869#else /* HAVE_GTK2 */
    6970  char boolAns = 'y';
    70   char ans[10];
     71  char ans[10];
     72  PRINT(0)("================================\n");
     73  PRINT(0)("= ORXONOX CONFIGURATION WIZARD =\n");
     74  PRINT(0)("================================    - version:" PACKAGE_VERSION "\n");
     75
    7176  while(true)
    7277    {
    73       PRINT(0)(" Listing all the Orxonox Options: \n");
     78      PRINT(0)("\n Listing all the Orxonox Options: \n");
    7479      PRINT(0)("  #############################\n");
    7580      Window::mainWindow->walkThrough(Widget::listOptionsAndGroups, 1);
     
    122127      //! \todo move this into the gui-gtk-file
    123128      //! \todo finish it.
     129      //! \todo memory leek at save(); and save is a BAD word, use saveString instead, or something like it.
    124130    }
    125131#endif /* HAVE_GTK2 */
     
    133139
    134140/* WIDGET */
    135 
    136 /**
    137    \brief deletes any given Widget
    138    This is still pretty crappy.
    139 */
    140 Widget::~Widget(void)
    141 {
    142   this->destroy();
    143 }
    144 
    145 /**
    146    \brief Initializes a widget.
    147    Initializes the next Pointer and the other Widget-specific Defaults.
    148 */
    149 void Widget::init(void)
     141/**
     142   \brief constructs a Widget
     143*/
     144Widget::Widget(void)
    150145{
    151146  next = NULL;
     
    155150
    156151/**
    157    \brief Destroys a Widget
    158 */
    159 void Widget::destroy(void)
    160 {
    161   if (this->title)
     152   \brief deletes any given Widget
     153   This is still pretty crappy.
     154*/
     155Widget::~Widget(void)
     156{
     157    if (this->title)
    162158    {
    163159      delete []this->title;
     
    172168    delete this->next;
    173169  this->next = NULL;
    174 
    175170  //!  \todo not hiding widget, deleting.
    176171  //  this->hide();
    177172  //  delete this->widget;
     173}
     174
     175/**
     176   \brief sets a new Title to a Widget
     177   \param title The new Title to set to the Widget
     178*/
     179void Widget::setTitle(const char* title)
     180{
     181  if (this->title)
     182    delete []this->title;
     183  this->title = new char[strlen(title)+1];
     184  strcpy(this->title, title);
    178185}
    179186
     
    273280{
    274281  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
    275     cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";
    276   if (widget->isOption >= 1 && widget->isOption <= 3)
    277     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
    278   else if (widget->isOption == 5)
    279     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     282    PRINT(0)("[%s]\n", static_cast<Packer*>(widget)->groupName);
     283  if (widget->isOption >= 1)
     284    {
     285      Widget::listOptions(widget);
     286    }
    280287}
    281288
     
    286293void Widget::listOptions(Widget* widget)
    287294{
    288   if (widget->isOption >= 1 && widget->isOption <= 3)
    289     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
    290   else if (widget->isOption == 5)
    291     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     295  if(widget->isOption >= 1)
     296    PRINT(0)("  %s is %s\n", static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
    292297}
    293298
     
    300305{
    301306 
    302   if (widget->isOption >= 1 && widget->isOption <= 3)
     307  if (widget->isOption >= 1)
    303308    {
    304309      int* count =(int*)data;
    305310      *count = *count +1;
    306       cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
    307     }
    308   else if (widget->isOption == 5)
    309     {
    310       int* count =(int*)data;
    311       *count = *count +1;
    312       cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     311      PRINT(0)(" %d:%s is %s\n", *count, static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
    313312    }
    314313}
     
    513512
    514513/* PACKERS */
    515 
    516 /**
    517    \brief Initializes a Packer.
    518 
    519    Sets the down-pinter to NULL and other PackerSpecific-values to their defaults.
    520 */
    521 void Packer::init(void)
     514/**
     515   \brief Constructs a Packer
     516*/
     517Packer::Packer(void)
    522518{
    523519  this->down = NULL;
    524520  this->groupName = NULL;
    525 
    526 
    527   static_cast<Widget*>(this)->init();
    528   return;
    529521}
    530522
     
    532524   \brief Destroys a Packer.
    533525*/
    534 void Packer::destroy(void)
     526Packer::~Packer(void)
    535527{
    536528  PRINTF(4)("deleting the Packer part.\n");
     
    543535    delete this->down;
    544536  this->down = NULL;
    545 
    546   static_cast<Widget*>(this)->destroy();
    547537}
    548538
     
    575565   sets the Container-Specific defaults.
    576566*/
    577 void Container::init(void)
     567Container::Container(void)
    578568{
    579569  this->isOption = -1;
    580 
    581   static_cast<Packer*>(this)->init();
    582 
    583   return;
    584570}
    585571
     
    587573   \brief Destroys a Container.
    588574*/
    589 void Container::destroy(void)
     575Container::~Container(void)
    590576{
    591577  PRINTF(4)("deleting the Container part.\n");
    592 
    593   static_cast<Packer*>(this)->destroy();
    594578}
    595579
     
    665649Window::~Window(void)
    666650{
    667   this->destroy();
     651  if (this->title)
     652    PRINTF(3)("deleting the Window: %s\n", this->title);
     653  else
     654    PRINTF(3)("deleting the Window.\n");
     655  //  this->hide();
    668656}
    669657
     
    677665 
    678666  isOpen = false;
    679 
    680   static_cast<Container*>(this)->init();
    681667
    682668#ifdef HAVE_GTK2
     
    691677
    692678/**
    693    \brief Destroys a Window.
    694 */
    695 void Window::destroy(void)
    696 {
    697   if (this->title)
    698     PRINTF(3)("deleting the Window: %s\n", this->title);
    699   else
    700     PRINTF(3)("deleting the Window.\n");
    701   //  this->hide();
    702   static_cast<Container*>(this)->destroy();
    703  
    704 }
    705 
    706 /**
    707679   \brief Shows all Widgets that are included within this->widget.
    708680*/
     
    730702   \param title title the Window should get.
    731703*/
    732 void Window::setTitle(char* title)
     704void Window::setTitle(const char* title)
    733705{
    734706  if (this->title)
     
    823795Frame::~Frame(void)
    824796{
    825   this->destroy();
    826 }
    827 
    828 /**
    829     \brief Initializes a new Frame with default settings
    830 */
    831 void Frame::init(void)
    832 {
    833   static_cast<Container*>(this)->init();
    834 
    835 #ifdef HAVE_GTK2
    836   this->widget = gtk_frame_new("");
    837   gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    838 #endif /* HAVE_GTK2 */
    839 }
    840 
    841 /**
    842    \brief Destroys a Frame.
    843 */
    844 void Frame::destroy(void)
    845 {
    846797  if (this->title)
    847798    PRINTF(3)("deleting the Frame: %s\n", this->title);
    848799  else
    849800    PRINTF(3)("deleting the Frame.\n");
    850 
    851    static_cast<Container*>(this)->destroy();
     801}
     802
     803/**
     804    \brief Initializes a new Frame with default settings
     805*/
     806void Frame::init(void)
     807{
     808#ifdef HAVE_GTK2
     809  this->widget = gtk_frame_new("");
     810  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
     811#endif /* HAVE_GTK2 */
    852812}
    853813
     
    856816   \param title The title the Frame should get.
    857817*/
    858 void Frame::setTitle(char* title)
     818void Frame::setTitle(const char* title)
    859819{
    860820  if (this->title)
     
    892852EventBox::~EventBox(void)
    893853{
    894   this->destroy();
    895 
    896 }
    897 
    898 /**
    899    \brief Initializes a new EventBox
    900 */
    901 void EventBox::init(void)
    902 {
    903   this->isOption = -1;
    904 
    905   static_cast<Container*>(this)->init();
    906 
    907 #ifdef HAVE_GTK2
    908   this->widget = gtk_event_box_new();
    909   gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    910 #endif /* HAVE_GTK2 */
    911 }
    912 
    913 /**
    914    \brief Destroys an EventBox.
    915 */
    916 void EventBox::destroy(void)
    917 {
    918854  if (this->title)
    919855    PRINTF(3)("deleting the EventBox: %s\n", this->title);
    920856  else
    921857    PRINTF(3)("deleting the EventBox.\n");
    922 
    923   static_cast<Container*>(this)->destroy();
    924 }
    925 
    926 /**
    927    \brief Sets the Title of the EventBox(not implemented)
    928    \param title Name the EventBox should get(only datastructure-internal).
    929 */
    930 void EventBox::setTitle(char* title)
    931 {
    932   if (this->title)
    933     delete []this->title;
    934   this->title = new char[strlen(title)+1];
    935   strcpy(this->title, title);
     858}
     859
     860/**
     861   \brief Initializes a new EventBox
     862*/
     863void EventBox::init(void)
     864{
     865  this->isOption = -1;
     866
     867#ifdef HAVE_GTK2
     868  this->widget = gtk_event_box_new();
     869  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
     870#endif /* HAVE_GTK2 */
    936871}
    937872
     
    960895Box::~Box(void)
    961896{
    962   this->destroy();
    963 }
    964 
    965 /**
    966    \brief Initializes a new Box with type boxtype
    967    \param boxtype see Box(char boxtype)
    968 */
    969 void Box::init(char boxtype)
    970 {
    971   this->isOption = -2;
    972 
    973   static_cast<Packer*>(this)->init();
    974 #ifdef HAVE_GTK2
    975   if (boxtype == 'v')
    976     {
    977       this->widget = gtk_vbox_new(FALSE, 0);
    978     }
    979   else
    980     {
    981       this->widget = gtk_hbox_new(FALSE, 0);
    982     }
    983 #endif /* HAVE_GTK2 */
    984 }
    985 
    986 /**
    987    \brief Destroys a Box.
    988 */
    989 void Box::destroy(void)
    990 {
    991897  if (this->title)
    992898    PRINTF(3)("deleting the Box: %s\n", this->title);
     
    994900    PRINTF(3)("deleting the Box.\n");
    995901
    996   static_cast<Packer*>(this)->destroy();
     902}
     903
     904/**
     905   \brief Initializes a new Box with type boxtype
     906   \param boxtype see Box(char boxtype)
     907*/
     908void Box::init(char boxtype)
     909{
     910  this->isOption = -2;
     911
     912#ifdef HAVE_GTK2
     913  if (boxtype == 'v')
     914    {
     915      this->widget = gtk_vbox_new(FALSE, 0);
     916    }
     917  else
     918    {
     919      this->widget = gtk_hbox_new(FALSE, 0);
     920    }
     921#endif /* HAVE_GTK2 */
    997922}
    998923
     
    1022947}
    1023948
    1024 /**
    1025    \brief Sets the Title of a Box.
    1026    \param title the new Title to set.
    1027 */
    1028 void Box::setTitle(char* title)
    1029 {
    1030   if (this->title)
    1031     delete []this->title;
    1032   this->title = new char[strlen(title)+1];
    1033   strcpy(this->title, title);
    1034 }
    1035 
    1036949/* OPTION */
    1037950
     
    1040953   sets all Option-Specific-Values to their defaults.
    1041954*/
    1042 void Option::init(void)
     955Option::Option(void)
    1043956{
    1044957  this->value = 0;
     
    1047960  this->saveable = false;
    1048961  this->defaultValue = 0;
    1049 
    1050   static_cast<Widget*>(this)->init();
    1051 
    1052   return;
    1053962}
    1054963
     
    1056965   \brief Destroys an Option.
    1057966*/
    1058 void Option::destroy(void)
     967Option::~Option(void)
    1059968{
    1060969  PRINTF(4)("deleting the Option Part.\n");
     
    1063972  if (this->flagNameShort)
    1064973    delete []this->flagNameShort;
    1065 
    1066   static_cast<Widget*>(this)->destroy();
    1067974}
    1068975
     
    11231030
    11241031/**
     1032   \brief saves an Option
     1033   \returns the String that should be saved.
     1034
     1035   this is a default Option save
     1036*/
     1037char* Option::save(void)
     1038{
     1039  char* value = new char [10];
     1040  sprintf (value, "%d", this->value);
     1041  return value;
     1042}
     1043
     1044/**
     1045   \brief loads an Option from of its loadString
     1046   \param loadString the string from which to load the data from
     1047*/
     1048void Option::load(char* loadString)
     1049{
     1050  this->value = atoi(loadString);
     1051  PRINT(3)("Loading %s: %s %d\n", this->title, loadString, value);
     1052  this->redraw();
     1053}
     1054
     1055/**
    11251056   \returns The saveable-state.
    11261057*/
     
    11611092Button::~Button(void)
    11621093{
    1163   this->destroy();
    1164 }
    1165 
    1166 /**
    1167    \brief Initializes a new Button
    1168 */
    1169 void Button::init(void)
    1170 {
    1171   isOption = 0;
    1172 
    1173   static_cast<Option*>(this)->init();
    1174 
    1175 #ifdef HAVE_GTK2
    1176   widget = gtk_button_new_with_label("");
    1177 #endif /* HAVE_GTK2 */
    1178 }
    1179 
    1180 /**
    1181    \brief Destroys a Button.
    1182 */
    1183 void Button::destroy(void)
    1184 {
    11851094  if (this->title)
    11861095    PRINTF(3)("deleting the Label: %s\n", this->title);
     
    11881097    PRINTF(3)("deleting the Label.\n");
    11891098
    1190   static_cast<Option*>(this)->destroy();
     1099}
     1100
     1101/**
     1102   \brief Initializes a new Button
     1103*/
     1104void Button::init(void)
     1105{
     1106  isOption = 0;
     1107
     1108#ifdef HAVE_GTK2
     1109  widget = gtk_button_new_with_label("");
     1110#endif /* HAVE_GTK2 */
    11911111}
    11921112
     
    11951115   \param title The name the Button should get
    11961116*/
    1197 void Button::setTitle(char *title)
     1117void Button::setTitle(const char *title)
    11981118{
    11991119  if (this->title)
     
    12451165CheckButton::~CheckButton(void)
    12461166{
    1247   this->destroy();
    1248 }
    1249 
    1250 /**
    1251    \brief Initialize a new CheckButton with default settings
    1252 */
    1253 void CheckButton::init(void)
    1254 {
    1255   this->isOption = 1;
    1256 
    1257   static_cast<Option*>(this)->init();
    1258 
    1259 #ifdef HAVE_GTK2
    1260   this->widget = gtk_check_button_new_with_label("");
    1261 #endif /* HAVE_GTK2 */
    1262 }
    1263 
    1264 /**
    1265    \brief Destroys a CheckButton.
    1266 */
    1267 void CheckButton::destroy(void)
    1268 {
    12691167  if (this->title)
    12701168    PRINTF(3)("deleting the CheckButton: %s\n", this->title);
    12711169  else
    12721170    PRINTF(3)("deleting the CheckButton.\n");
    1273 
    1274   static_cast<Option*>(this)->destroy();
     1171}
     1172
     1173/**
     1174   \brief Initialize a new CheckButton with default settings
     1175*/
     1176void CheckButton::init(void)
     1177{
     1178  this->isOption = 1;
     1179
     1180#ifdef HAVE_GTK2
     1181  this->widget = gtk_check_button_new_with_label("");
     1182#endif /* HAVE_GTK2 */
    12751183}
    12761184
     
    12791187   \param title The new Name the CheckButton should display.
    12801188*/
    1281 void CheckButton::setTitle(char* title)
     1189void CheckButton::setTitle(const char* title)
    12821190{
    12831191  if (this->title)
     
    13061214#else /* HAVE_GTK2 */
    13071215  char tmpChar[20];
    1308   cout << "\nPlease give me a new value for " << this->title << " [0,1](defualt:" << this->defaultValue << "): ";
     1216  cout << "\nPlease give me a new value for " << this->title << " [0,1](default:" << this->defaultValue << "): ";
    13091217  cin >> tmpChar;
    13101218
     
    13501258Slider::~Slider(void)
    13511259{
    1352   this->destroy();
    1353 }
    1354 
    1355 /**
    1356    \brief Initializes a Slider with start and end Values
    1357    params: see Slider::Slider(char* slidername, int start, int end)
    1358 */
    1359 void Slider::init(int start, int end)
    1360 {
    1361   this->isOption = 2;
    1362 
    1363   static_cast<Option*>(this)->init();
    1364 
    1365   this->start = start;
    1366   this->end = end;
    1367 #ifdef HAVE_GTK2
    1368  widget = gtk_hscale_new_with_range(this->start, this->end, 5);
    1369 #endif /* HAVE_GTK2 */
    1370 }
    1371 
    1372 /**
    1373    \brief Destroys a Slider.
    1374 */
    1375 void Slider::destroy(void)
    1376 {
    13771260  if (this->title)
    13781261    PRINTF(3)("deleting the Slider: %s\n", this->title);
    13791262  else
    13801263    PRINTF(3)("deleting the Slider.\n");
    1381 
    1382   static_cast<Option*>(this)->destroy();
    1383 
    1384 }
    1385 
    1386 /**
    1387    \brief Sets a new Title to the Slider
    1388    \param title The new Name of the slider
    1389 */
    1390 void Slider::setTitle(char* title)
    1391 {
    1392   if (this->title)
    1393     delete []this->title;
    1394   this->title = new char[strlen(title)+1];
    1395   strcpy(this->title, title);
     1264}
     1265
     1266/**
     1267   \brief Initializes a Slider with start and end Values
     1268   params: see Slider::Slider(char* slidername, int start, int end)
     1269*/
     1270void Slider::init(int start, int end)
     1271{
     1272  this->isOption = 2;
     1273
     1274  this->start = start;
     1275  this->end = end;
     1276#ifdef HAVE_GTK2
     1277 widget = gtk_hscale_new_with_range(this->start, this->end, 5);
     1278#endif /* HAVE_GTK2 */
    13961279}
    13971280
     
    14251308#else /* HAVE_GTK2 */
    14261309  char tmpChar[20];
    1427   cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](defualt:" << this->defaultValue << "): ";
     1310  cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](default:" << this->defaultValue << "): ";
    14281311  cin >> tmpChar;
    14291312
     
    14371320
    14381321/* MENU */
     1322
     1323/**
     1324   \brief constructs a new Menu, without adding any items to it.
     1325   \param menuName the Name the Menu gets.
     1326*/
     1327Menu::Menu(const char* menuName)
     1328{
     1329  this->init();
     1330  this->setTitle(menuName);
     1331}
    14391332
    14401333/**
     
    14481341  this->init();
    14491342  this->setTitle(menuname);
    1450    
     1343  va_list itemlist;                     //!< The list to readin multiple Options.
     1344
    14511345  char *itemName;
    14521346
    1453 #ifdef HAVE_GTK2             /////////////////////// REINPLEMENT
    14541347  va_start(itemlist, menuname);
    14551348  while(strcmp(itemName = va_arg(itemlist, char*), "lastItem"))
     
    14581351    }
    14591352  va_end(itemlist);
    1460 #endif /* HAVE_GTK2 */
    1461 
    1462 #ifdef HAVE_GTK2
    1463   gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
    1464   this->connectSignal("changed", this->OptionChange);
    1465 #endif /* HAVE_GTK2 */
    14661353}
    14671354
     
    14711358Menu::~Menu(void)
    14721359{
    1473   this->destroy();
    1474 }
    1475 
    1476 /**
    1477    \brief Initializes a new Menu with no items
    1478 */
    1479 void Menu::init(void)
    1480 {
    1481   this->isOption = 2;
    1482 
    1483   static_cast<Option*>(this)->init();
    1484 
    1485 #ifdef HAVE_GTK2
    1486   this->widget = gtk_option_menu_new();
    1487   this->menu = gtk_menu_new();
    1488 #endif /* HAVE_GTK2 */
    1489 
    1490 }
    1491 
    1492 /**
    1493    \brief Destroys a Menu.
    1494 */
    1495 void Menu::destroy(void)
    1496 {
    14971360  if (this->title)
    14981361    PRINTF(3)("deleting the Menu: %s\n", this->title);
     
    15001363    PRINTF(3)("deleting the Menu.\n");
    15011364  //! \todo destroy menu
    1502  
    1503   static_cast<Option*>(this)->destroy();
    1504 }
    1505 
    1506 
    1507 /**
    1508  * Sets the Database-Name of this Menu
    1509  \param title Database-Name to be set.
    1510 */
    1511 void Menu::setTitle(char* title)
    1512 {
    1513   if (this->title)
    1514     delete []this->title;
    1515   this->title = new char[strlen(title)+1];
    1516   strcpy(this->title, title);
     1365  this->currItem = this->firstItem;
     1366  while(this->currItem)
     1367    {
     1368      delete []this->currItem->name;
     1369      /*
     1370        #ifdef HAVE_GTK2
     1371        free(this->currItem->item);
     1372        #endif /* HAVE_GTK2 */
     1373      MenuItem* tmpItem = this->currItem;
     1374      this->currItem = this->currItem->next;
     1375      delete tmpItem;
     1376    }
     1377}
     1378
     1379/**
     1380   \brief Initializes a new Menu with no items
     1381*/
     1382void Menu::init(void)
     1383{
     1384  this->isOption = 2;
     1385  this->firstItem = NULL;
     1386
     1387#ifdef HAVE_GTK2
     1388  this->widget = gtk_option_menu_new();
     1389  this->menu = gtk_menu_new();
     1390  gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
     1391  this->connectSignal("changed", this->OptionChange);
     1392#endif /* HAVE_GTK2 */
     1393}
     1394
     1395/**
     1396   \brief saves the Label of the Menu
     1397   \returns the name of the selected Menu-Item
     1398*/
     1399char* Menu::save(void)
     1400{
     1401  MenuItem* tmpItem = this->firstItem;
     1402  for (int i = 0; i<this->value; i++)
     1403    tmpItem = tmpItem->next;
     1404     
     1405  return tmpItem->name;
     1406}
     1407
     1408/**
     1409   \brief loads a Menu from of its loadString
     1410   \param loadString the string from which to load the data from
     1411*/
     1412void Menu::load(char* loadString)
     1413{
     1414  MenuItem* tmpItem = firstItem;
     1415  bool foundItem = false;
     1416  while (tmpItem)
     1417    {
     1418      if (!strcmp(loadString, tmpItem->name))
     1419        {foundItem = true; break;}
     1420      tmpItem = tmpItem->next;
     1421    }
     1422  if (foundItem)
     1423    this->value = tmpItem->itemNumber;
     1424  else
     1425    {
     1426      this->value = 0;
     1427      PRINTF(2)("Sorry, but %s has not been found in the Itemlist of %s\n", loadString, this->title);
     1428    }
     1429  PRINTF(3)( "Loading %s: setting to %d\n", this->title, this->value);
     1430  this->redraw();
    15171431}
    15181432
     
    15201434   \brief appends a new Item to the Menu-List.
    15211435   \param itemName the itemName to be appendet.
    1522 
    1523    \todo make the item-list readable without GTK
    15241436*/
    15251437void Menu::addItem(char* itemName)
    15261438{
    1527 #ifdef HAVE_GTK2
    1528   this->item = gtk_menu_item_new_with_label(itemName);
    1529   gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item);
    1530 #endif /* HAVE_GTK2 */
     1439  if (!this->firstItem)
     1440    {
     1441      this->firstItem = this->currItem = new MenuItem;
     1442      this->currItem->itemNumber = 0;
     1443    }
     1444  else
     1445    {
     1446      int tmpI = this->currItem->itemNumber;
     1447      this->currItem = this->currItem->next = new MenuItem;
     1448      this->currItem->itemNumber = tmpI+1;
     1449    }
     1450
     1451  this->currItem->name = new char[strlen(itemName)+1];
     1452  strcpy(this->currItem->name, itemName);
     1453
     1454#ifdef HAVE_GTK2
     1455  this->currItem->item = gtk_menu_item_new_with_label(itemName);
     1456  gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->currItem->item);
     1457#endif /* HAVE_GTK2 */
     1458  this->currItem->next = NULL;
    15311459}
    15321460
     
    15511479#else /* HAVE_GTK2 */
    15521480  char tmpChar[20];
    1553   cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): ";
     1481  cout << "\nPlease give me a new value for " << this->title << "(default:" << this->defaultValue << "): ";
    15541482  cin >> tmpChar;
    15551483  this->value = atoi(tmpChar);
     
    15781506OptionLabel::~OptionLabel(void)
    15791507{
    1580   this->destroy();
    1581 }
    1582 
    1583 /**
    1584    \brief Initializes an OptionLabel
    1585 */
    1586 void OptionLabel::init(void)
    1587 {
    1588   this->isOption = 5;
    1589   static_cast<Option*>(this)->init();
    1590 
    1591   cValue = NULL;
    1592 
    1593 #ifdef HAVE_GTK2
    1594   this->widget = gtk_label_new("");
    1595 #endif /* HAVE_GTK2 */
    1596 }
    1597 
    1598 /**
    1599    \brief Destroys a OptionLabel.
    1600 */
    1601 void OptionLabel::destroy(void)
    1602 {
    16031508  if (this->title)
    16041509    PRINTF(3)("deleting the OptionLabel: %s\n", this->title);
     
    16071512  if (this->cValue)
    16081513    delete []this->cValue;
    1609 
    1610   static_cast<Option*>(this)->destroy();
    1611 }
    1612 
     1514}
     1515
     1516/**
     1517   \brief Initializes an OptionLabel
     1518*/
     1519void OptionLabel::init(void)
     1520{
     1521  this->isOption = 5;
     1522  cValue = NULL;
     1523
     1524#ifdef HAVE_GTK2
     1525  this->widget = gtk_label_new("");
     1526#endif /* HAVE_GTK2 */
     1527}
    16131528
    16141529/**
     
    16281543
    16291544/**
    1630    \brief Sets a ned Title to the OptionLabel.
    1631    \param title The now title of the OptionLabel.
    1632 */
    1633 void OptionLabel::setTitle(char* title)
    1634 {
    1635   if (this->title)
    1636     delete []this->title;
    1637   this->title = new char [strlen(title)+1];
    1638   strcpy(this->title, title);
    1639   this->redraw();
    1640 }
    1641 
    1642 /**
    16431545   \brief Redraws an OptionLabel(not implemented yet, but it works).
    16441546*/
     
    16661568
    16671569/**
     1570   \brief creates the Optionlabel save-string
     1571   \returns the String to save.
     1572*/
     1573char* OptionLabel::save(void)
     1574{
     1575  return cValue;
     1576}
     1577
     1578/**
     1579   \brief loads an Option from of its loadString
     1580   \param loadString the string from which to load the data from
     1581*/
     1582void OptionLabel::load(char* loadString)
     1583{
     1584  PRINTF(3)( "Loading %s: setting to %s\n", this->title, loadString);
     1585  this->setValue(loadString);
     1586}
     1587
     1588/**
    16681589   \brief Creates a new default Label with no Text.
    16691590   You migth consider adding Label::setTitle with this.
     
    16891610Label::~Label(void)
    16901611{
    1691   this->destroy();
    1692 }
    1693 
    1694 /**
    1695    \brief initializes a new Label
    1696 */
    1697 void Label::init(void)
    1698 {
    1699   this->isOption = 0;
    1700 
    1701   static_cast<Widget*>(this)->init();
    1702 
    1703 #ifdef HAVE_GTK2
    1704   this->widget = gtk_label_new("");
    1705   gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
    1706 #endif /* HAVE_GTK2 */
    1707 }
    1708 
    1709 /**
    1710    \brief Destroys a Label.
    1711 */
    1712 void Label::destroy(void)
    1713 {
    17141612  if (this->title)
    17151613    PRINTF(3)("deleting the Label: %s\n", this->title);
    17161614  else
    17171615    PRINTF(3)("deleting the Label.\n");
    1718 
    1719   static_cast<Widget*>(this)->destroy();
     1616}
     1617
     1618/**
     1619   \brief initializes a new Label
     1620*/
     1621void Label::init(void)
     1622{
     1623  this->isOption = 0;
     1624
     1625#ifdef HAVE_GTK2
     1626  this->widget = gtk_label_new("");
     1627  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
     1628#endif /* HAVE_GTK2 */
    17201629}
    17211630
     
    18131722ProgressBar::~ProgressBar(void)
    18141723{
    1815   this->destroy();
     1724  if (this->title)
     1725    PRINTF(3)("deleting the ProgressBar: %s\n", this->title);
     1726  else
     1727    PRINTF(3)("deleting the ProgressBar.\n");
    18161728}
    18171729
     
    18251737  this->totalSize = 0.0;
    18261738
    1827   static_cast<Widget*>(this)->init();
    18281739#ifdef HAVE_GTK2
    18291740  this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
    18301741  this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
    18311742#endif /* HAVE_GTK2 */
    1832 }
    1833 
    1834 /**
    1835    \brief Destroys a ProgressBar.
    1836 */
    1837 void ProgressBar::destroy(void)
    1838 {
    1839   if (this->title)
    1840     PRINTF(3)("deleting the ProgressBar: %s\n", this->title);
    1841   else
    1842     PRINTF(3)("deleting the ProgressBar.\n");
    1843 
    1844   static_cast<Widget*>(this)->destroy();
    1845 }
    1846 
    1847 /**
    1848    \brief Sets a ned Title to the ProgressBar.
    1849    \param title The now title of the ProgressBar.
    1850 */
    1851 void ProgressBar::setTitle(char* title)
    1852 {
    1853   if (this->title)
    1854     delete []this->title;
    1855   this->title = new char [strlen(title)+1];
    1856   strcpy(this->title, title);
    18571743}
    18581744
     
    19131799Image::~Image(void)
    19141800{
    1915   this->destroy();
    1916 }
    1917 
    1918 /**
    1919     \brief Initializes a new Image
    1920 */
    1921 void Image::init(void)
    1922 {
    1923   isOption = 0;
    1924 
    1925   static_cast<Widget*>(this)->init();
    1926 }
    1927 
    1928 /**
    1929    \brief Destroys a Image.
    1930 */
    1931 void Image::destroy(void)
    1932 {
    19331801  if (this->title)
    19341802    PRINTF(3)("deleting the Image: %s\n", this->title);
    19351803  else
    19361804    PRINTF(3)("deleting the Image.\n");
    1937 
    1938   static_cast<Widget*>(this)->destroy();
    1939 }
    1940 
    1941 /**
    1942    \brief Sets a ned Title to the Image.
    1943    \param title The now title of the OptionLabel.
    1944 */
    1945 void Image::setTitle(char* title)
    1946 {
    1947   if (this->title)
    1948     delete []this->title;
    1949   this->title = new char [strlen(title)+1];
    1950   strcpy(this->title, title);
    1951 }
     1805}
     1806
     1807/**
     1808    \brief Initializes a new Image
     1809*/
     1810void Image::init(void)
     1811{
     1812  isOption = 0;
     1813}
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h

    r3605 r3746  
    3939
    4040 public:
     41  Widget(void);
    4142  virtual ~Widget(void);
    42   void init(void);
    43   void destroy(void);
    4443
    4544  void show(void);
    4645  void hide(void);
    4746  void setSize(int width, int height);
    48   virtual void setTitle(char* title) = 0;  //!< An abstract Function, that sets the title of Widgets.
     47  virtual void setTitle(const char* title);  //!< An abstract Function, that sets the title of Widgets.
    4948
    5049  Widget* findWidgetByName(char* name, unsigned int depth);
     
    9089{
    9190 public:
     91  Packer(void);
     92  virtual ~Packer(void);
     93
    9294  Widget* down; //!< this points to the Widget below this.
    9395  char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved.
    94 
    95   void init(void);
    96   void destroy(void);
    9796
    9897  void setGroupName(char* name);
     
    115114 
    116115 public:
    117   void init(void);
    118   void destroy(void);
    119 
     116  Container(void);
     117  virtual ~Container(void);
    120118  //  void setBorderWidth(int borderwidth);
    121   //  virtual void setTitle(char* title) = 0;
    122119  void fill(Widget* lowerWidget);
    123120};
     
    138135  Window(void);
    139136  Window(char* windowName);
    140   ~Window(void);
    141   void init(void);
    142   void destroy(void);
    143  
    144   void setTitle(char* title);
     137  virtual ~Window(void);
     138  void init(void);
     139 
     140  void setTitle(const char* title);
    145141  void showall(void);
    146142  void open(void);
     
    164160  Frame(void);
    165161  Frame(char* frameName);
    166   ~Frame(void);
    167   void init(void);
    168   void destroy(void);
    169  
    170   void setTitle(char* title);
     162  virtual ~Frame(void);
     163  void init(void);
     164
     165  void setTitle(const char* title);
    171166};
    172167
     
    180175  EventBox(void);
    181176  EventBox(char* eventBoxName);
    182   ~EventBox(void);
    183   void init(void);
    184   void destroy(void);
    185  
    186   void setTitle(char* title);
     177  virtual ~EventBox(void);
     178  void init(void);
    187179};
    188180
     
    198190  Box(void);
    199191  Box(char boxtype);
    200   ~Box(void);
     192  virtual ~Box(void);
    201193  void init(char boxtype);
    202   void destroy(void);
    203194 
    204195  void fill(Widget* lowerWidget);
    205 
    206   void setTitle(char* title);
    207196};
    208197
     
    217206 
    218207 public:
    219   void init(void);
    220   void destroy(void);
     208  Option(void);
     209  virtual ~Option(void);
     210  void init(void);
    221211
    222212  int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume
     
    227217  void saveability(void);
    228218  void saveability(bool isSaveable);
     219  virtual char* save(void);
     220  virtual void load(char* loadString);
     221
    229222  bool isSaveable(void);
    230223  void setFlagName(char* flagname, int defaultvalue);
     
    246239 public:
    247240  Button(char* buttonname);
    248   ~Button(void);
    249   void init(void);
    250   void destroy(void);
    251 
    252   void setTitle(char* title);
     241  virtual ~Button(void);
     242  void init(void);
     243
     244  void setTitle(const char* title);
    253245  void redraw(void);
    254246  void changeOption(void);
     
    262254 public:
    263255  CheckButton(char* buttonname);
    264   ~CheckButton(void);
    265   void init(void);
    266   void destroy(void);
    267 
    268   void setTitle(char* title);
     256  virtual ~CheckButton(void);
     257  void init(void);
     258
     259  void setTitle(const char* title);
    269260  bool isActive(void);           //!< a Bool value to see, if this CheckButton is active.
    270261  void redraw(void);
     
    283274 public:
    284275  Slider(char* slidername, int start, int end);
    285   ~Slider(void);
     276  virtual ~Slider(void);
    286277  void init(int start, int end);
    287   void destroy(void);
    288 
    289   void setTitle(char* title);
     278
    290279  void setValue(int value);
    291280  void redraw(void);
     
    299288#ifdef HAVE_GTK2
    300289  GtkWidget* menu;                      //!< The menu That will hold the Options.
    301   GtkWidget* item;                      //!< One Item From a Menu.
    302 #endif /* HAVE_GTK2 */
    303   va_list itemlist;                     //!< The list to readin multiple Options.
    304  
    305  public:
     290#endif /* HAVE_GTK2 */
     291
     292  //! A struct to handle the MenuItems
     293  struct MenuItem
     294  {
     295    char* name;                         //!< The name of this entry.
     296    int itemNumber;                     //!< The n'th entry of this menu;
     297#ifdef HAVE_GTK2
     298    GtkWidget* item;                    //!< One Item From a Menu.
     299#endif /* HAVE_GTK2 */
     300    MenuItem* next;                     //!< Pointer to the next MenuItem.
     301  };
     302  MenuItem* firstItem;                  //!< Pointer to the first Item.
     303  MenuItem* currItem;                   //!< Pointer to the current Item.
     304 
     305 public:
     306  Menu(const char* menuName);
    306307  Menu(char* menuname, ...);
    307   ~Menu(void);
    308   void init(void);
    309   void destroy(void);
    310  
    311   void setTitle(char* title);
     308  virtual ~Menu(void);
     309  void init(void);
     310
     311  virtual char* save(void);
     312  virtual void load(char* loadString);
     313 
    312314  void addItem(char* itemName);
    313315  void redraw(void);
     
    322324 public:
    323325  OptionLabel(char* label, char* value);
    324   ~OptionLabel(void);
    325   void init(void);
    326   void destroy(void);
    327  
     326  virtual ~OptionLabel(void);
     327  void init(void);
    328328 
    329329  void setValue(char* newValue);
    330   void setTitle(char* title);
     330
     331  virtual char* save(void);
     332  virtual void load(char* loadString);
     333
    331334  void redraw(void);
    332335  void changeOption(void);
     
    342345  Label(void);
    343346  Label(char* text);
    344   ~Label(void);
    345   void init(void);
    346   void destroy(void);
     347  virtual ~Label(void);
     348  void init(void);
    347349 
    348350  void setTitle(char* text);
     
    359361  ProgressBar(void);
    360362  ProgressBar(char* label);
    361   ~ProgressBar(void);
    362   void init(void);
    363   void destroy(void);
    364 
    365   void setTitle(char* title);
     363  virtual ~ProgressBar(void);
     364  void init(void);
     365
    366366  void setProgress(double progress);
    367367  void setTotalSize(double totalSize);
     
    385385 public:
    386386  Image(char* imgaename);
    387   ~Image(void);
    388   void init(void);
    389   void destroy(void);
    390 
    391   void setTitle(char* title);
     387  virtual ~Image(void);
     388  void init(void);
    392389};
    393390
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc

    r3499 r3746  
    2727#include "orxonox_gui_video.h"
    2828
     29#include "glincl.h"
     30
    2931/**
    3032   \brief Creates the Video-Option-Frame
     
    4042  this->fullscreen->saveability();
    4143  this->videoBox->fill(this->fullscreen);
    42   this->resolution = new Menu("Resolution", "640x480", "800x600", "1024x768", "1280x1024", "1400x1050", "1600x1200", "1920x1200", "lastItem");
     44  this->resolution = new Menu("Resolution");
     45  this->getResolutions(this->resolution);
    4346  this->resolution->saveability();
    4447  this->videoBox->fill(this->resolution);
     
    146149}
    147150
     151void OrxonoxGuiVideo::getResolutions(Menu* menu)
     152{
     153  SDL_Init(SDL_INIT_VIDEO);
     154  SDL_Rect **modes;
     155  int i;
     156  int x = 0,y =0; // check for difference
     157  char tmpChar[100];
     158 
     159  /* Get available fullscreen/hardware modes */
     160  modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
     161 
     162  /* Check is there are any modes available */
     163  if(modes == (SDL_Rect **)0){
     164    PRINTF(2)("No video-modes available!\n");
     165    exit(-1);
     166  }
     167 
     168  /* Check if our resolution is restricted */
     169  if(modes == (SDL_Rect **)-1){
     170    PRINTF(2)("All resolutions available.\n");
     171  }
     172  else{
     173    /* Print valid modes */
     174    PRINT(4)("Available Modes\n");
     175    for(i = 0; modes[i] ;++i)
     176      {
     177        if (x != modes[i]->w || y != modes[i]->h)
     178          {
     179            PRINT(4)("  %d x %d\n", modes[i]->w, modes[i]->h);
     180            sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);
     181            menu->addItem(tmpChar);
     182            x = modes[i]->w; y = modes[i]->h;
     183          }
     184      }
     185  }
     186  SDL_Quit();
     187}
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.h

    r3499 r3746  
    4545  OrxonoxGuiVideo(void);
    4646  ~OrxonoxGuiVideo(void);
     47
     48  Widget* getWidget(void);
     49
     50  void getResolutions(Menu* menu);
    4751 
    48   Widget* getWidget(void);
     52
    4953};
    5054#endif /* _ORXONOX_GUI_VIDEO_H */
  • orxonox/branches/levelloader/src/lib/lang/base_object.cc

    r3605 r3746  
    1818
    1919#include "base_object.h"
     20#include "stdincl.h"
    2021
    2122
     
    2930{
    3031  this->className = NULL;
     32  this->finalized = false;
    3133}
    3234
     
    5759  return true;
    5860}
     61
     62/*
     63bool BaseObject::isFinalized()
     64{
     65 
     66}
     67*/
     68
     69void BaseObject::finalize()
     70{
     71  this->finalized = true;
     72}
  • orxonox/branches/levelloader/src/lib/lang/base_object.h

    r3605 r3746  
    2121  bool isA (char* className);
    2222
     23  inline bool isFinalized() { return this->finalized; }
     24  void finalize();
     25
    2326 private:
    2427  char* className;
    25 
     28  bool finalized;
    2629};
    2730
  • orxonox/branches/levelloader/src/lib/math/vector.cc

    r3605 r3746  
    6565float Vector::operator* (const Vector& v) const
    6666{
    67   return x*v.x+y*v.y+z*v.z;
     67  return x * v.x + y * v.y+ z * v.z;
    6868}
    6969
  • orxonox/branches/levelloader/src/lib/util/list.h

    r3605 r3746  
    4646};
    4747
    48 class Iterator
    49 {
    50 
     48
     49
     50template<class T> struct listElement
     51{
     52  listElement* prev;
     53  T* curr;
     54  listElement* next;
     55};
     56
     57template<class T> class tIterator
     58{
    5159 public:
    52   bool hasNext();
    53   WorldEntity* next();
     60  tIterator(listElement<T>* startElement);
     61  ~tIterator();
     62 
     63  T* nextElement();
    5464
    5565 private:
    56 
    57 };
     66  listElement<T>* currentEl;
     67  listElement<T>* tmpEl;
     68};
     69
     70
     71template<class T>
     72inline tIterator<T>::tIterator (listElement<T>* startElement)
     73{
     74  this->currentEl = startElement;
     75  this->tmpEl = NULL;
     76}
     77
     78
     79template<class T>
     80tIterator<T>::~tIterator ()
     81{
     82  this->currentEl = NULL;
     83}
     84
     85
     86template<class T>
     87inline T* tIterator<T>::nextElement ()
     88{
     89  if( this->currentEl == NULL)
     90    return NULL;
     91
     92  this->tmpEl = this->currentEl;
     93  this->currentEl = this->currentEl->next;
     94  return this->tmpEl->curr;
     95}
     96
    5897
    5998
    6099template<class T> class tList
    61100{
    62  private:
    63   struct listElement
    64   {
    65     listElement* prev;
    66     T* curr;
    67     listElement* next;
    68   };
    69 
    70   Uint32 size;
    71   listElement* first;
    72   listElement* last;
    73   listElement* currentEl;
    74  
    75101 public:
    76102  tList ();
    77103  ~tList ();
    78  
    79104
    80105  void add(T* entity);
     
    85110  int getSize();
    86111  T* enumerate();
     112  tIterator<T>* getIterator();
    87113  T* nextElement();
    88114  T* nextElement(T* toEntity);
    89115  T* toArray();
    90116  void debug();
     117
     118 private:
     119  Uint32 size;
     120  listElement<T>* first;
     121  listElement<T>* last;
     122  listElement<T>* currentEl;
    91123};
    92124
     
    106138  while(this->currentEl != NULL)
    107139    {
    108       listElement* le = this->currentEl->next;
     140      listElement<T>* le = this->currentEl->next;
    109141      //delete this->currentEl->curr;
    110142      delete this->currentEl;
     
    118150
    119151template<class T>
    120 void tList<T>::add(T* entity)
     152inline void tList<T>::add(T* entity)
    121153{
    122154  if( entity == NULL) return;
    123   listElement* el = new listElement;
     155  listElement<T>* el = new listElement<T>;
    124156  el->prev = this->last;
    125157  el->curr = entity;
     
    135167
    136168template<class T>
    137 void tList<T>::remove(T* entity)
     169inline void tList<T>::remove(T* entity)
    138170{
    139171  if( entity == NULL) return;
    140172  this->currentEl = this->first;
    141   listElement* te;
     173  listElement<T>* te;
    142174  while( this->currentEl != NULL)
    143175    {
     
    150182          else this->currentEl->next->prev = this->currentEl->prev;
    151183
    152           te = this->currentEl->next;  // for what am i doing this?
     184          //te = this->currentEl->next;  // for what am i doing this?
    153185          delete this->currentEl;
    154           this->currentEl = te;
     186          //this->currentEl = te;
     187          this->currentEl = NULL;
    155188          this->size--;
    156189          return;
     
    167200  while(this->currentEl != NULL)
    168201    {
    169       listElement* le = this->currentEl->next;
     202      listElement<T>* le = this->currentEl->next;
    170203      //delete this->currentEl->curr;
    171204      delete this->currentEl;
     
    203236{
    204237  //if( this->last == this->first == NULL) return NULL;
    205   if(this->size == 0) return NULL;
     238  if( this->size == 0) return NULL;
    206239  this->currentEl = this->first;
    207240  return this->currentEl->curr;
     
    210243
    211244template<class T>
     245inline tIterator<T>* tList<T>::getIterator()
     246{
     247  tIterator<T>* iterator = new tIterator<T>(this->first);
     248  return iterator;
     249}
     250
     251
     252template<class T>
    212253T* tList<T>::nextElement()
    213254{
    214255  // if( this->last == this->first == NULL) return NULL;
    215   if(this->size == 0) return NULL;
     256  if( this->size == 0) return NULL;
    216257  this->currentEl = this->currentEl->next;
    217   if(this->currentEl == NULL) return NULL;
     258  if( this->currentEl == NULL) return NULL;
    218259  return this->currentEl->curr;
    219260}
  • orxonox/branches/levelloader/src/lib/util/resource_manager.cc

    r3742 r3746  
    391391   \param directoryName the Directory to check for
    392392   \returns true if it is a directory/symlink false otherwise
     393   \todo implement for win32 usage too
     394   \bug does return false by default on win32
    393395*/
    394396bool ResourceManager::isDir(const char* directoryName)
    395397{
     398        #ifdef __WIN32__
     399                return false;
     400        #elif
    396401  struct stat status;
    397402  stat(directoryName, &status);
     
    400405  else
    401406    return false;
     407  #endif
    402408}
    403409
     
    406412   \param fileName the File to check for
    407413   \returns true if it is a regular file/symlink, false otherwise
     414   \todo implement fo win32 usage too
     415   \bug does return false by default on win32
    408416*/
    409417bool ResourceManager::isFile(const char* fileName)
    410418{
     419        #ifdef __WIN32__
     420                return false;
     421        #elif
    411422  struct stat status;
    412423  stat(fileName, &status);
     
    415426  else
    416427    return false;
     428  #endif
    417429}
    418430
  • orxonox/branches/levelloader/src/message_structures.h

    r3224 r3746  
    66#ifndef _MESSAGE_STRUCTURES_H
    77#define _MESSAGE_STRUCTURES_H
     8
     9#include "stdincl.h"
    810
    911#define CMD_LENGHT 16
  • orxonox/branches/levelloader/src/orxonox.cc

    r3605 r3746  
    2222   main-programmer: Patrick Boenzli
    2323   co-programmer: Christian Meyer
     24   co-programmer: Benjamin Grauer: injected ResourceManager/GraphicsEngine
    2425*/
    2526
    2627#include "orxonox.h"
     28
    2729#include "world.h"
    28 #include "camera.h"
    2930#include "data_tank.h"
    3031#include "command_node.h"
    3132#include "game_loader.h"
     33#include "graphics_engine.h"
     34#include "resource_manager.h"
     35#include "debug.h"
     36
    3237#include <string.h>
    33 int verbose = 4;
     38int verbose = 3;
    3439
    3540using namespace std;
     
    5156  if( world != NULL) delete world;
    5257  if( localinput != NULL) delete world;
    53   if( localcamera != NULL) delete localcamera;
    5458  if( resources != NULL) delete resources;
     59  delete GraphicsEngine::getInstance(); // deleting the Graphics
     60  delete ResourceManager::getInstance(); // deletes the Resource Manager
    5561}
    5662
     
    110116int Orxonox::initVideo()
    111117{
    112   printf("> Initializing video\n");
    113   if (SDL_Init(SDL_INIT_VIDEO) == -1)
    114     {
    115       printf ("could not initialize SDL Video\n");
    116       return -1;
    117     }
    118   // Set video mode
    119   // TO DO: parse arguments for settings
    120   //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
    121   //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
    122   //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
    123   //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    124  
    125 
    126   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
    127   SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
    128   SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
    129   SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
    130   SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
    131   SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
    132   SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
    133 
    134 
    135 
    136   int bpp = 16;
    137   int width = 640;
    138   int height = 480;
    139   //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
    140   //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
    141 
    142   Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
    143 
    144   /* query SDL for information about our video hardware */
    145   const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
    146  
    147   if( videoInfo == NULL)
    148     {
    149       printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());
    150       SDL_Quit ();
    151     }
    152   if( videoInfo->hw_available)
    153     videoFlags |= SDL_HWSURFACE;
    154   else
    155     videoFlags |= SDL_SWSURFACE;
    156   /*
    157   if(VideoInfo -> blit_hw)                           
    158     VideoFlags |= SDL_HWACCEL;
    159   */
    160  
    161   if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
    162   {
    163     printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
    164     SDL_Quit();
    165     return -1;
    166   }
    167  
    168   // Set window labeling
    169   SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    170  
    171   // TO DO: Create a cool icon and use it here
    172   // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 
    173 
     118  PRINTF(3)("> Initializing video\n");
     119 
     120  GraphicsEngine::getInstance();
     121 
    174122  return 0;
    175123}
     
    215163int Orxonox::initResources()
    216164{
    217   printf("Not yet implemented\n");
     165  //  printf("Not yet implemented\n");
     166  PRINT(3)("initializing ResourceManager\n");
     167  resourceManager = ResourceManager::getInstance();
     168  resourceManager->setDataDir("../data/");
    218169  return 0;
    219170}
     
    270221{
    271222  // Handle special events such as reshape, quit, focus changes
     223  switch (event->type)
     224    {
     225    case SDL_VIDEORESIZE:
     226      GraphicsEngine* tmpGEngine = GraphicsEngine::getInstance();
     227      tmpGEngine->resolutionChanged(&event->resize);
     228      break;
     229    }
    272230}
    273231 
     
    291249}
    292250
    293 
    294 /**
    295    \brief retrieve a pointer to the local Camera
    296    \return a pointer to localcamera
    297 */
    298 Camera* Orxonox::getCamera()
    299 {
    300   return localcamera;
    301 }
    302 
    303 
    304251/**
    305252   \brief retrieve a pointer to the local CommandNode
     
    329276}
    330277
     278
     279
    331280/**
    332281   \brief main function
     
    336285int main(int argc, char** argv)
    337286
     287 
     288  /* reading arguments
     289     
     290     currently supported arguments are:
     291     <no args>                   ::    just starts orxonox
     292     --benchmark                 ::    start the benchmark without starting orxonox
     293     
     294     this is a preselection: it matches to one of the start* functions, the
     295     finetuning is made in those functions.
     296  */
     297
     298
     299  int i;
     300  for(i = 0; i < argc; ++i)
     301    {
     302      if(! strcmp( "--help", argv[i])) return startHelp();
     303      else if(! strcmp( "--benchmark", argv[i])) return startBenchmarks();
     304    }
     305
     306  PRINTF(2)("Orxonox does not understand the arguments");
     307  return startOrxonox(argc, argv);
     308}
     309
     310
     311
     312int startHelp()
     313{
     314  printf("orxonox: starts the orxonox game - rules\n");
     315  printf("usage: orxonox [arg]\n\n");
     316  printf("valid options:\n");
     317  printf(" --benchmark\tstarts the orxonox benchmark\n");
     318  printf(" --help \tshows this menu\n");
     319}
     320
     321
     322int startOrxonox(int argc, char** argv)
     323{
    338324  printf(">>> Starting Orxonox <<<\n");
    339325  Orxonox *orx = Orxonox::getInstance();
     
    347333  orx->start();
    348334 
    349   //delete orx;
    350  
    351   return 0;
    352 }
     335  delete orx;
     336 
     337}
     338
     339
     340#include "list.h"
     341#include "world_entity.h"
     342#include "vector.h"
     343#include "player.h"
     344#include "base_object.h"
     345
     346#ifdef __WIN32__
     347#elif
     348#include <asm/msr.h>
     349#include <linux/timex.h>
     350#endif
     351
     352
     353#define LIST_MAX 1000
     354#define VECTOR_MAX 1000000
     355#define ITERATIONS 10000
     356
     357
     358int startBenchmarks()
     359{
     360        #ifndef __WIN32__
     361  printf("===========================================================\n");
     362  printf("=                      BENCHMARKS                         =\n");
     363  printf("===========================================================\n");
     364  printf(" the author is not paying any attention to cacheing effects\n");
     365  printf(" of the CPU.\n\n");
     366  printf("[title]\t\t\t\t\t     [cycles]\t[loops]\n\n");
     367  //  printf("------------------------------------------------------------\n\n");
     368
     369  // first measure the time overhead:
     370  unsigned long ini, end, dt, tmp;
     371  rdtscl(ini); rdtscl(end);
     372  dt = end - ini;
     373
     374  int type = -1;
     375  /* type   -1 == all
     376     type    0 == framework
     377     type    1 == vector
     378     type    2 == quaternion
     379     type    3 == lists
     380  */
     381  if(type == 0 || type == -1)
     382    {
     383      /* framework test*/
     384     
     385      printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS);
     386      /* ************WorldEntity class test************** */
     387      WorldEntity* w = NULL;
     388      int i = 0;
     389      unsigned long mittel = 0;
     390     
     391      for(i = 0; i < ITERATIONS; ++i)
     392        {
     393          rdtscl(ini);
     394         
     395          WorldEntity* w = new WorldEntity();
     396         
     397          rdtscl(end);
     398          delete w;
     399          mittel += (end - ini - dt);
     400        }
     401      float mi = mittel / (float)ITERATIONS;
     402      printf(" Generate a WorldEntity object:\t\t%11.2f\n", mi);
     403     
     404      /*
     405        mittel = 0;
     406        for(i = 0; i < ITERATIONS; ++i)
     407        {
     408        rdtscl(ini);
     409       
     410        WorldEntity* w = new Primitive(P_SPHERE);
     411       
     412        rdtscl(end);
     413        delete w;
     414        mittel += (end - ini - dt);
     415        }
     416        mi = mittel / (float)ITERATIONS;
     417        printf(" Generate a Primitive  object:\t\t%11.2f\n", mi);
     418      */
     419
     420      mittel = 0;
     421      for(i = 0; i < ITERATIONS; ++i)
     422        {
     423          rdtscl(ini);
     424         
     425          Vector* v = new Vector();
     426         
     427          rdtscl(end);
     428          delete v;
     429          mittel += (end - ini - dt);
     430        }
     431      mi = mittel / (float)ITERATIONS;
     432      printf(" Generate a Vector object:\t\t%11.2f\n", mi);
     433
     434
     435     mittel = 0;
     436      for(i = 0; i < ITERATIONS; ++i)
     437        {
     438          rdtscl(ini);
     439         
     440          Quaternion* q = new Quaternion();
     441         
     442          rdtscl(end);
     443          delete q;
     444          mittel += (end - ini - dt);
     445        }
     446      mi = mittel / (float)ITERATIONS;
     447      printf(" Generate a Quaternion object:\t\t%11.2f\n", mi);
     448
     449
     450
     451
     452      printf("\nCalling function inline &| virtual, \t\t\t%i\n", ITERATIONS);
     453      mittel = 0;
     454      w = new WorldEntity();
     455      for(i = 0; i < ITERATIONS; ++i)
     456        {
     457          rdtscl(ini);
     458         
     459          w->tick(0.0f);
     460
     461          rdtscl(end);
     462          mittel += (end - ini - dt);
     463          }
     464      //delete w;
     465      mi = mittel / (float)ITERATIONS;
     466      printf(" Virt funct tick() of WE: \t\t%11.2f\n", mi);
     467
     468
     469      mittel = 0;
     470      WorldEntity wo;
     471      for(i = 0; i < ITERATIONS; ++i)
     472        {
     473          rdtscl(ini);
     474         
     475          wo.tick(0.0f);
     476           
     477          rdtscl(end);
     478          mittel += (end - ini - dt);
     479          }
     480      //delete w;
     481      mi = mittel / (float)ITERATIONS;
     482      printf(" Inl virt funct tick() of WE v2: \t%11.2f\n", mi);
     483
     484     
     485      mittel = 0;
     486      BaseObject* bo = new BaseObject();
     487      for(i = 0; i < ITERATIONS; ++i)
     488        {
     489          rdtscl(ini);
     490         
     491          bo->isFinalized();
     492           
     493          rdtscl(end);
     494          mittel += (end - ini - dt);
     495          }
     496      //delete w;
     497      mi = mittel / (float)ITERATIONS;
     498      printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi);
     499
     500     
     501      tList<WorldEntity>* list = new tList<WorldEntity>();
     502
     503     
     504      /* ************Primitvie class test************** */
     505      list = new tList<WorldEntity>();
     506 
     507     
     508      /*
     509        mittel = 0;
     510        w = new Primitive(P_SPHERE);
     511        for(i = 0; i < ITERATIONS; ++i)
     512        {
     513        rdtscl(ini);
     514       
     515        w->tick(0.0f);
     516       
     517        rdtscl(end);
     518        mittel += (end - ini - dt);
     519        }
     520        mi = mittel / (float)ITERATIONS;
     521        printf(" Call function tick() of Prim:\t\t%11.2f\n", mi);
     522      */
     523     
     524    }
     525 
     526  if(type == 1 || type == -1)
     527    {
     528      printf("\nDoing some simple vector operations: \t\t\t%i\n", VECTOR_MAX);
     529      /* vector test */
     530      Vector* a = new Vector(1.3, 5.3, 4.1);
     531      Vector* b = new Vector(0.4, 2.5, 6.2);
     532      Vector* c = new Vector();
     533     
     534      unsigned long mittel, ini, end;
     535      float mi;
     536      int i = 0;
     537      // addition
     538      mittel = 0;
     539      for(i = 0; i < VECTOR_MAX; ++i)
     540        {
     541          rdtscl(ini);
     542         
     543          *c = *a + *b;
     544           
     545          rdtscl(end);
     546          mittel += (end - ini - dt);
     547        }
     548      mi = mittel / (float)VECTOR_MAX;
     549      printf(" Addition of two vectors:\t\t%11.2f\n", mi);
     550     
     551      // multiplikation
     552
     553      mittel = 0;
     554      for(i = 0; i < VECTOR_MAX; ++i)
     555        {
     556          rdtscl(ini);
     557         
     558          *c = a->cross( *b);
     559           
     560          rdtscl(end);
     561          mittel += (end - ini - dt);
     562        }
     563      mi = mittel / (float)VECTOR_MAX;
     564      printf(" CrossMult of two vectors:\t\t%11.2f\n", mi);
     565
     566    }
     567  if( type == 2 || type == -1)
     568    {
     569      /* quaternion test */
     570      printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX);
     571      /* vector test */
     572      Quaternion* a = new Quaternion();
     573      Quaternion* b = new Quaternion();
     574      Quaternion* c = new Quaternion();
     575     
     576      unsigned long mittel, ini, end;
     577      float mi;
     578      int i = 0;
     579      // quaternion generieren mit spez konstruktor
     580      mittel = 0;
     581      Vector* qa = new Vector(4.6, 9.3, 0.4);
     582      Vector* qb = new Vector(3.5, 6.1, 4.3);
     583      for(i = 0; i < VECTOR_MAX; ++i)
     584        {
     585          rdtscl(ini);
     586         
     587          Quaternion* qu = new Quaternion(*qa, *qb);
     588         
     589          rdtscl(end);
     590          delete qu;
     591          mittel += (end - ini - dt);
     592        }
     593      delete a;
     594      delete b;
     595      mi = mittel / (float)VECTOR_MAX;
     596      printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi);
     597     
     598     
     599      // multiplication
     600      mittel = 0;
     601      for(i = 0; i < VECTOR_MAX; ++i)
     602        {
     603          rdtscl(ini);
     604         
     605          *c = *a * *b;
     606         
     607          rdtscl(end);
     608          mittel += (end - ini - dt);
     609        }
     610      mi = mittel / (float)VECTOR_MAX;
     611      printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi);
     612     
     613     
     614     
     615      // rotating a vector by a quaternion
     616      mittel = 0;
     617      for(i = 0; i < VECTOR_MAX; ++i)
     618        {
     619          rdtscl(ini);
     620         
     621          *qa = a->apply(*qb);
     622         
     623          rdtscl(end);
     624          mittel += (end - ini - dt);
     625        }
     626      mi = mittel / (float)VECTOR_MAX;
     627      printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi);
     628     
     629     
     630     
     631      // generate rotation matrix
     632      mittel = 0;
     633      float matrix[4][4];
     634      for(i = 0; i < VECTOR_MAX; ++i)
     635        {
     636          rdtscl(ini);
     637         
     638          a->matrix(matrix);
     639         
     640          rdtscl(end);
     641          mittel += (end - ini - dt);
     642        }
     643      mi = mittel / (float)VECTOR_MAX;
     644      printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
     645    }
     646  if( type == 3 || type == -1)
     647    {
     648      /* list tests*/
     649      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
     650      tList<char>* list = new tList<char>();
     651      char* name;
     652     
     653      printf(" Adding[1..10] elements to list, found:\n");
     654      list->add("1");
     655      list->add("2");
     656      list->add("3");
     657      list->add("4");
     658      list->add("5");
     659      list->add("6");
     660      list->add("7");
     661      list->add("8");
     662      list->add("9");
     663      list->add("10");
     664     
     665      /*give list out */
     666      tIterator<char>* iterator = list->getIterator();
     667      name = iterator->nextElement();
     668      printf("  List Elements: \t\t");
     669      while( name != NULL)
     670        {
     671          printf("%s,", name);
     672          name = iterator->nextElement();
     673        }
     674      delete iterator;
     675      printf("\n");
     676     
     677     
     678      /*removing some elements from the list*/
     679      printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");
     680      list->remove("2");
     681      list->remove("3");
     682      list->remove("6");
     683      list->remove("8");
     684      list->remove("10");
     685      list->add("11");
     686      /*give list out */
     687      iterator = list->getIterator();
     688      name = iterator->nextElement();
     689      printf("  List Elements: \t\t");
     690      while( name != NULL)
     691        {
     692          printf("%s,", name);
     693          name = iterator->nextElement();
     694        }
     695      delete iterator;
     696      printf("\n");
     697     
     698      delete list;
     699      printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX);
     700     
     701      tList<int>* plist = new tList<int>();
     702      unsigned long mittel, ini, end;
     703      float mi;
     704      int i = 0;
     705      mittel = 0;
     706      for(i = 0; i < LIST_MAX; ++i)
     707        {
     708          rdtscl(ini);
     709         
     710          plist->add(&i);
     711         
     712          rdtscl(end);
     713          mittel += (end - ini - dt);
     714        }
     715      mi = mittel / (float)LIST_MAX;
     716      printf(" Adding reference to list:\t\t%11.2f\n", mi);
     717     
     718      mittel = 0;
     719      for(i = 0; i < LIST_MAX; ++i)
     720        {
     721          rdtscl(ini);
     722         
     723          plist->remove(&i);
     724         
     725          rdtscl(end);
     726          mittel += (end - ini - dt);
     727        }
     728      mi = mittel / (float)LIST_MAX;
     729      printf(" Removing 1st reference from list:\t%11.2f\n", mi);
     730     
     731
     732      printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
     733      list = new tList<char>();
     734      printf(" Adding[1..10] elements to list, found:\n");
     735      list->add("1");
     736      list->add("2");
     737      list->add("3");
     738      list->add("4");
     739      list->add("5");
     740      list->add("6");
     741      list->add("7");
     742      list->add("8");
     743      list->add("9");
     744      list->add("10");
     745     
     746      /*give list out */
     747      iterator = list->getIterator();
     748      name = iterator->nextElement();
     749      printf("  List Elements: \t\t");
     750      while( name != NULL)
     751        {
     752          printf("%s,", name);
     753          name = iterator->nextElement();
     754        }
     755      delete iterator;
     756      printf("\n");
     757     
     758     
     759      int c = 0;
     760      printf(" Going trough list with nextElement(el) func: ");
     761      name = list->firstElement();
     762      while(c < 20)
     763        {
     764          printf("%s,", name);
     765          name = list->nextElement(name);
     766          c++;
     767        }
     768      printf("\n");
     769     
     770
     771     
     772    }
     773  #endif
     774}
  • orxonox/branches/levelloader/src/orxonox.conf

    r3605 r3746  
    1313x=up_world
    1414z=down_world
    15 
     151=view0
     162=view1
     173=view2
     184=view3
     195=view4
     205=view5
  • orxonox/branches/levelloader/src/orxonox.h

    r3605 r3746  
    77#define _ORXONOX_H
    88
    9 #include "stdincl.h"
     9#include "comincl.h"
     10#include "glincl.h"
    1011
    1112class CommandNode;
     
    1516class Camera;
    1617class GameLoader;
     18class ResourceManager;
    1719
    1820//! Orxonox core singleton class
     
    2426  static Orxonox* singletonRef;
    2527  Orxonox ();
    26   virtual ~Orxonox ();
    2728
    2829  char configfilename[256];   //!< Filename of the configuration-file.
     
    3031  DataTank* resources;        //!< DataContainer
    3132  CommandNode* localinput;    //!< Command Handler
    32   Camera* localcamera;        //!< The current Camera
    3333  SDL_Surface* screen;        //!< The current Screen
    3434  GameLoader* gameLoader;     //!< The gameLoader
     35  ResourceManager* resourceManager; //!< The ResourceManager
    3536 
    3637  bool bQuitOrxonox;          //!< If Orxonox should Quit
     
    5758 public:
    5859  static Orxonox* getInstance ();
     60  virtual ~Orxonox ();
     61
    5962  void start();
    6063  void quitGame();
     
    6669 
    6770  CommandNode* getLocalInput();
    68   Camera* getCamera();
    6971  World* getWorld();
    7072  SDL_Surface* getScreen ();
     
    7375};
    7476
     77int startHelp(void);
     78int startOrxonox(int argc, char** argv);
     79int startBenchmarks(void);
     80
    7581#endif /* _ORXONOX_H */
    7682
  • orxonox/branches/levelloader/src/simple_animation.cc

    r3605 r3746  
     1
    12
    23
     
    1920#include "simple_animation.h"
    2021#include "stdincl.h"
    21 #include "p_node.h"
     22#include "vector.h"
     23#include "world_entity.h"
    2224
    2325using namespace std;
    2426
     27
     28
     29SimpleAnimation* SimpleAnimation::singletonRef = 0;
     30/**
     31   \brief gets the singleton instance
     32   \returns singleton instance
     33*/
     34SimpleAnimation* SimpleAnimation::getInstance()
     35{
     36  if( singletonRef == NULL)
     37    singletonRef = new SimpleAnimation();
     38  return singletonRef;
     39}
     40
    2541/**
    2642   \brief standard constructor
    27    \param the point of the object
    28    \param and the orientation of it
    29    \param at this time
    30 */
    31 KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time)
    32 {
    33   this->setRelCoor(point);
    34   this->setRelDir(orientation);
    35   this->time = time;
    36 }
    37 
    38 
    39 /**
    40    \brief standard constructor
    41    \param the point of the object
    42    \param and the orientation of it
    43    \param at this time
    44    \param function of the velocity of the movement
    45 */
    46 KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
    47 {
    48   this->setRelCoor(point);
    49   this->setRelDir(orientation);
    50   this->time = time;
    51   this->mode = mode;
    52 }
    53 
    54 
    55 /**
    56    \brief standard deconstructor
    57 */
    58 KeyFrame::~KeyFrame()
    59 {
    60 }
    61 
    62 
    63 /**
    64    \brief sets the important properties of a Keyframe
    65    \param the point of the object
    66    \param and the orientation of it
    67    \param at this time
    68 */
    69 void KeyFrame::set(Vector* point, Quaternion* orientation, float time)
    70 {
    71   this->setRelCoor(point);
    72   this->setRelDir(orientation);
    73   this->time = time;
    74 }
    75 
    76 
    77 /**
    78    \brief sets the important properties of a Keyframe
    79    \param the point of the object
    80    \param and the orientation of it
    81    \param at this time
    82    \param function of the velocity of the movement
    83 */
    84 void KeyFrame::set(Vector* point, Quaternion* orientation, float time, movementMode mode)
    85 {
    86   this->setRelCoor(point);
    87   this->setRelDir(orientation);
    88   this->time = time;
    89   this->mode = mode;
    90 }
    91 
    92 
    93 
    94 /**
    95    \brief standard constructor
    96 */
    97 SimpleAnimation::SimpleAnimation (PNode* parent)
     43*/
     44SimpleAnimation::SimpleAnimation ()
    9845{
    9946   this->setClassName ("SimpleAnimation");
    10047   this->frames = new tList<KeyFrame>();
     48   this->animators = new tList<Animation>();
    10149   this->localTime = 0;
    102    this->bPause = false;
    103    this->parent = parent;
     50   this->bRunning = false;
     51   this->currentFrame = NULL;
     52   this->lastFrame = NULL;
     53
     54   this->tmpVect = new Vector();
     55   this->lastPosition = new Vector();
     56   this->deltaT = 0.2;
    10457}
    10558
     
    11164SimpleAnimation::~SimpleAnimation ()
    11265{
    113   KeyFrame* frame = this->frames->enumerate();
     66  tIterator<KeyFrame>* iterator = this->frames->getIterator();
     67  KeyFrame* frame = iterator->nextElement();
    11468  while( frame != NULL)
    11569    {
    11670      delete frame;
    117       frame = frames->nextElement();
    118     }
     71      frame = iterator->nextElement();
     72    }
     73  delete iterator;
    11974  delete this->frames;
     75}
     76
     77
     78/**
     79   \brief this determines the start of an Animator Describtion
     80
     81   this can then be followed by different commands like addKeyFrame(..) etc. and
     82   will be closed with AnimatiorEnd()
     83*/
     84void SimpleAnimation::animatorBegin()
     85{
     86  this->bDescriptive = true;
     87}
     88
     89
     90/**
     91   \brief this determines the end of an Animator Describtion
     92
     93   this can then be followed by different commands like addKeyFrame(..) etc. and
     94   will be closed with AnimatiorEnd()
     95*/
     96void SimpleAnimation::animatorEnd()
     97{
     98  this->workingObject = NULL;
     99  this->bDescriptive = false;
     100}
     101
     102
     103/*
     104  Vector* lastPosition;
     105  Vector* tmpVect;
     106  tList<KeyFrame>* frames;
     107  animationMode animMode;
     108  movementMode movMode;
     109  bool bRunning;
     110  float deltaT;
     111*/
     112
     113/**
     114   \brief select an object to work on by using this function
     115   \param object wo work on
     116*/
     117void SimpleAnimation::selectObject(WorldEntity* entity)
     118{
     119  Animation* anim = getAnimationFromWorldEntity(entity);
     120  if( anim == NULL)
     121    {
     122      printf("SimpleAnimation::selectObject() - object not found, creating one\n");
     123      anim = new Animation;
     124      anim->object = entity;
     125      anim->lastPosition = new Vector();
     126      anim->tmpVect = new Vector();
     127      frames = new tList<KeyFrame>();
     128      bRunning = false;
     129      deltaT = 0.0;
     130      this->animators->add(anim);
     131    }
     132  this->workingAnimator = anim;
    120133}
    121134
     
    125138   \brief adds a keyframe with properties
    126139   \param the point of the object
    127    \param and the orientation of it
     140   \param and the direction of it
    128141   \param at this time
    129142*/
    130 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
    131 {
    132   KeyFrame* frame = new KeyFrame(point, orientation, time);
     143void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time)
     144{
     145  if( !this->bDescriptive)
     146    {
     147      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     148      return;
     149    }
     150  KeyFrame* frame = new KeyFrame;
     151  frame->position = point;
     152  frame->direction = direction;
     153  frame->time = time;
     154  frame->mode = DEFAULT_ANIMATION_MODE;
     155  frame->object = this->workingObject;
    133156  this->frames->add(frame);
    134157}
     
    138161   \brief adds a keyframe with properties
    139162   \param the point of the object
    140    \param and the orientation of it
     163   \param and the direction of it
    141164   \param at this time
    142165   \param function of the velocity of the movement
    143166*/
    144 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
    145 {
    146   KeyFrame* frame = new KeyFrame(point, orientation, time, mode);
     167void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode)
     168{
     169  if( !this->bDescriptive)
     170    {
     171      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     172      return;
     173    }
     174  KeyFrame* frame = new KeyFrame;
     175  frame->position = point;
     176  frame->direction = direction;
     177  frame->time = time;
     178  frame->mode = mode;
     179  frame->object = this->workingObject;
    147180  this->frames->add(frame);
    148181}
     
    154187void SimpleAnimation::addKeyFrame(KeyFrame* frame)
    155188{
     189  if( !this->bDescriptive)
     190    {
     191      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     192      return;
     193    }
     194  frame->object = this->workingObject;
    156195  this->frames->add(frame);
    157196}
     
    163202void SimpleAnimation::reset()
    164203{
    165   KeyFrame* frame = this->frames->enumerate();
     204  tIterator<KeyFrame>* iterator = this->frames->getIterator();
     205  KeyFrame* frame = iterator->nextElement();
    166206  while( frame != NULL)
    167207    {
    168208      delete frame;
    169       frame = frames->nextElement();
    170     }
     209      frame = iterator->nextElement();
     210    }
     211  delete iterator;
    171212  delete this->frames;
    172213
    173214  this->frames = new tList<KeyFrame>();
    174215  this->localTime = 0;
    175   this->bPause = false;
    176 
     216  this->bRunning = false;
     217
     218  this->currentFrame = NULL;
     219  this->lastFrame = NULL;
    177220}
    178221
     
    181224*/
    182225void SimpleAnimation::start()
    183 {}
     226{
     227  if( this->bRunning)
     228    {
     229      PRINTF(2)("SimpleAnimatin is already running. You are trying to start it again.\n");
     230    return;
     231    }
     232 
     233  this->localTime = 0;
     234  this->lastFrame = this->frames->firstElement();
     235  this->currentFrame = this->frames->nextElement(this->currentFrame);
     236  this->bRunning = true;
     237}
    184238
    185239
     
    188242*/
    189243void SimpleAnimation::stop()
    190 {}
     244{
     245  this->bRunning = false;
     246}
    191247
    192248/**
     
    196252{
    197253  this->localTime = 0;
    198   this->bPause = false;
     254  this->lastFrame = this->frames->firstElement();
     255  this->currentFrame = this->frames->nextElement(this->currentFrame);
     256  this->bRunning = true;
    199257}
    200258
     
    204262void SimpleAnimation::pause()
    205263{
    206   this->bPause = true;
     264  this->bRunning = false;
    207265}
    208266
     
    212270void SimpleAnimation::resume()
    213271{
    214   this->bPause = false;
     272  this->bRunning = true;
    215273}
    216274
     
    221279void SimpleAnimation::tick(float time)
    222280{
    223   if(!this->bPause)
    224     {
    225 
    226 
    227 
    228     }
    229 }
     281  this->localTime += time;
     282  tIterator<Animation>* iterator = this->animators->getIterator();
     283  Animation* anim = iterator->nextElement();
     284  while( anim != NULL)
     285    {
     286      if( anim->bRunning)
     287        {
     288         
     289         
     290          /* first get the current frame via time-stamps */
     291          while( this->localTime > anim->currentFrame->time)
     292            {
     293              printf("SimpleAnimation::tick(...) - changing Frame\n");
     294             
     295              //this->currentFrame->object->setRelCoor(*this->currentFrame->position);
     296              *anim->lastPosition = *anim->currentFrame->position;
     297             
     298              anim->lastFrame = anim->currentFrame;
     299              anim->currentFrame = anim->frames->nextElement(anim->currentFrame);
     300              anim->movMode = anim->currentFrame->mode;
     301              if( anim->movMode == NEG_EXP)
     302                {
     303                  *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
     304                  anim->deltaT = 1/anim->currentFrame->time * logf(1.0 + 600.0/anim->tmpVect->len());
     305                }
     306            }
     307         
     308          /* now animate it */
     309          switch( anim->movMode)
     310            {
     311            case LINEAR:
     312             
     313              *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
     314              *anim->tmpVect = *anim->tmpVect * this->localTime / anim->currentFrame->time;
     315              anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect);
     316              *anim->lastPosition = *anim->tmpVect;
     317              break;
     318            case EXP:
     319             
     320              break;
     321            case NEG_EXP:
     322              *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
     323              *anim->tmpVect = *anim->tmpVect * (1 - exp(- this->localTime * anim->deltaT));     
     324              anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect);
     325              *anim->lastPosition = *anim->tmpVect;
     326              break;
     327            case SIN:
     328              *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
     329              *anim->tmpVect = *anim->tmpVect * 0.5*(1 - cos(M_PI * this->localTime / anim->currentFrame->time));     
     330              anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect);
     331              *anim->lastPosition = *anim->tmpVect;
     332              break;
     333            case COS:
     334             
     335              break;
     336            case QUADRATIC:
     337              *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position;
     338              *anim->tmpVect = *anim->tmpVect * 1/3 * ldexpf(this->localTime, 3);
     339              break;
     340            default:
     341              break;
     342            }
     343        }
     344      anim = iterator->nextElement();
     345    }
     346  delete anim;
     347}
     348
     349
     350
     351Animation* SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity)
     352{
     353  tIterator<Animation>* iterator = this->animators->getIterator();
     354  Animation* anim = iterator->nextElement();
     355  while( anim != NULL)
     356    {
     357      if( anim->object == entity)
     358        return anim;
     359      anim = iterator->nextElement();
     360    }
     361  delete iterator;
     362  return NULL;
     363}
  • orxonox/branches/levelloader/src/simple_animation.h

    r3605 r3746  
    1212
    1313#include "base_object.h"
    14 #include "p_node.h"
    1514#include "list.h"
    1615
    1716
    18 typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS};
     17class Vector;
     18class Quaternion;
     19class WorldEntity;
     20class PNode;
     21
     22typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
     23typedef enum animationMode{SINGLE=0, LOOP};
     24#define DEFAULT_ANIMATION_MODE LINEAR
    1925
    2026
    21 //! KeyFrame Class
     27//! KeyFrame Struct
    2228/**
    23    This represents one point with orientation of the animation
     29   This represents one point with direction of the animation
    2430*/
    25 class KeyFrame : public PNode {
    26  public:
    27   KeyFrame(Vector* point, Quaternion* orientation, float time);
    28   KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
    29   virtual ~KeyFrame();
    30 
    31   void set(Vector* point, Quaternion* orientation, float time);
    32   void set(Vector* point, Quaternion* orientation, float time, movementMode mode);
    33  
    34  private:
     31typedef struct KeyFrame {
     32  Vector* position;
     33  Quaternion* direction;
     34  WorldEntity* object;
    3535  float time;
    3636  movementMode mode;
    3737};
    3838
     39//! Animation Struct
     40/**
     41   This represents an animation for a object
     42*/
     43typedef struct Animation {
     44  WorldEntity* object;
     45  KeyFrame* currentFrame;
     46  KeyFrame* lastFrame;
     47  Vector* lastPosition;
     48  Vector* tmpVect;
     49  tList<KeyFrame>* frames;
     50  animationMode animMode;
     51  movementMode movMode;
     52  bool bRunning;
     53  float deltaT;
     54};
    3955
    4056//! Animation Class
     
    4561 
    4662 public:
    47   SimpleAnimation(PNode* parent);
    48   virtual ~SimpleAnimation();
     63  static SimpleAnimation* getInstance();
    4964
    50   void addKeyFrame(Vector* point, Quaternion* orientation, float time);
    51   void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
     65  void animatorBegin();
     66  void animatorEnd();
     67  void selectObject(WorldEntity* entity);
     68  void addKeyFrame(Vector* point, Quaternion* direction, float time);
     69  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
    5270  void addKeyFrame(KeyFrame* frame);
    5371  void reset();
     72
    5473
    5574  void start();
     
    6281
    6382 private:
    64   bool bPause;                     //<! is set, when there is a pause
    65   tList<KeyFrame>* frames;        //<! where keyframes are stored in
     83  SimpleAnimation();
     84  virtual ~SimpleAnimation();
     85
     86  static SimpleAnimation* singletonRef;
     87  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
     88  bool bRunning;                   //<! is set, when the animation is running
     89  tList<KeyFrame>* frames;         //<! where keyframes are stored in
     90  tList<Animation>* animators;      //<! a list of animation's
     91  KeyFrame* currentFrame;          //<! the frame that is been played now
     92  KeyFrame* lastFrame;
     93  Vector* lastPosition;
     94  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
    6695  float localTime;
    6796  PNode* parent;
    6897 
     98  Vector* tmpVect;                 //<! this is the temporary vector save place -
     99  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
     100  Animation* workingAnimator;       //<! the animator with which you are currently working
     101  float deltaT;                    //<! this is a time constant for the movement
     102
     103  Animation* getAnimationFromWorldEntity(WorldEntity* entity);
    69104
    70105};
  • orxonox/branches/levelloader/src/story_entities/campaign.cc

    r3557 r3746  
    1818
    1919#include "campaign.h"
     20
     21#include "story_entity.h"
     22
    2023#include "world.h"
    2124#include "camera.h"
    22 #include "story_entity.h"
    2325#include "factory.h"
    2426#include "game_loader.h"
    2527
     28#include "list.h"
     29
    2630using namespace std;
    2731
     
    3034Campaign::Campaign ()
    3135{
    32   this->entities = new ListTemplate<StoryEntity>();
     36  this->entities = new tList<StoryEntity>();
    3337  this->isInit = false;
    3438}
     39
    3540
    3641Campaign::~Campaign () {}
     
    4752        GameLoader* loader = GameLoader::getInstance();
    4853       
    49   this->entities = new ListTemplate<StoryEntity>();
     54  this->entities = new tList<StoryEntity>();
    5055  this->isInit = false;
    5156 
     
    106111    {
    107112      se->displayLoadScreen();
     113      se->preLoad();
    108114      se->load();
    109115      se->init();
     
    232238  if( storyID == WORLD_ID_GAMEEND)
    233239    return NULL;
    234   ListTemplate<StoryEntity>* l;
     240
     241  /*
     242  tList<StoryEntity>* l;
    235243  StoryEntity* entity = NULL;
    236244  l = this->entities->getNext(); 
     
    239247      entity = l->getObject();
    240248      l = l->getNext();
     249
    241250      int id = entity->getStoryID();
    242251      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
     
    246255          return entity;
    247256        }
    248     }
     257
     258    }
     259  */
     260
     261
     262
     263  StoryEntity* entity = this->entities->enumerate();
     264  while( entity != NULL)
     265    {
     266      int id = entity->getStoryID();
     267      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
     268      if(id == storyID)
     269        {
     270          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
     271          return entity;
     272        }
     273      entity = this->entities->nextElement();
     274    }
     275
     276
     277
    249278  return NULL;
    250279}
  • orxonox/branches/levelloader/src/story_entities/campaign.h

    r3605 r3746  
    88
    99class World;
     10template<class T> class tList;
    1011
    1112class Campaign : public StoryEntity {
     
    3435
    3536 private:
    36   ListTemplate<StoryEntity>* entities;
     37  //ListTemplate<StoryEntity>* entities;
     38  tList<StoryEntity>* entities;
    3739  bool running;
    3840
  • orxonox/branches/levelloader/src/story_entities/story_entity.cc

    r3499 r3746  
    7272
    7373
     74/**
     75   \brief stuff that will have to be initialized before load
     76
     77   this gives all storyentities the possibility to init stuff before the
     78   load function, where all the stuff is been made ready for start
     79*/
     80ErrorMessage StoryEntity::preLoad()
     81{}
     82
     83/**
     84    \brief loads the current entity
     85
     86    this is here to enable you loading maps into the entities. for all other actions you
     87    should take the init() function.
     88    load() is exec before init()
     89*/
     90ErrorMessage StoryEntity::load()
     91{}
     92
     93
    7494/**
    7595    \brief initialize the entity before use.
     
    7898    After execution of this function, the Entity is ready to be played/executed,
    7999    this shifts the initialisation work before the execution - very important...
     100    init() is exec shortly before start()
    80101*/
    81102ErrorMessage StoryEntity::init()
    82103{}
    83104
    84 
    85 /**
    86     \brief loads the current entity
    87 
    88     this is here to enable you loading maps into the entities. for all other actions you
    89     should take the init() function.
    90 */
    91 ErrorMessage StoryEntity::load()
    92 {}
    93105
    94106/**
  • orxonox/branches/levelloader/src/story_entities/story_entity.h

    r3525 r3746  
    88#define _STORY_ENTITY_H
    99
    10 #include "stdincl.h"
     10#include "base_object.h"
    1111
    1212#include "story_def.h"
     13#include "error.h"
     14
    1315
    1416//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
     
    2325  bool isPaused; //! is true if the entity is paused
    2426
     27  virtual ErrorMessage preLoad();
    2528  virtual ErrorMessage load();
    2629  virtual ErrorMessage init();
  • orxonox/branches/levelloader/src/story_entities/world.cc

    r3606 r3746  
    1818
    1919#include "world.h"
    20 #include "world_entity.h"
    21 #include "track_manager.h"
    22 #include "player.h"
    23 #include "command_node.h"
    24 #include "camera.h"
    25 #include "environment.h"
    26 #include "primitive.h"
     20
     21#include "orxonox.h"
     22
    2723#include "p_node.h"
    2824#include "null_parent.h"
    2925#include "helper_parent.h"
     26#include "track_node.h"
     27#include "world_entity.h"
     28#include "player.h"
     29#include "camera.h"
     30#include "environment.h"
     31#include "skysphere.h"
     32#include "terrain.h"
     33#include "light.h"
     34
     35#include "track_manager.h"
     36#include "garbage_collector.h"
     37#include "simple_animation.h"
     38
     39#include "command_node.h"
    3040#include "glmenu_imagescreen.h"
    31 #include "skysphere.h"
    32 #include "light.h"
    3341#include "fontset.h"
     42#include "list.h"
    3443#include "factory.h"
    3544#include "game_loader.h"
     
    3746#include "terrain.h"
    3847
     48
     49
    3950using namespace std;
    4051
    4152CREATE_FACTORY(World);
     53
     54WorldInterface* WorldInterface::singletonRef = 0;
     55
     56
     57/**
     58   \brief private constructor because of singleton
     59*/
     60WorldInterface::WorldInterface()
     61{
     62  this->worldIsInitialized = false;
     63  this->worldReference = NULL;
     64}
     65
     66/**
     67   \brief public deconstructor
     68*/
     69WorldInterface::~WorldInterface()
     70{
     71  this->singletonRef = NULL;
     72  this->worldIsInitialized = false;
     73  this->worldReference = NULL;
     74}
     75
     76/**
     77   \brief gets the singleton instance
     78   \returns singleton instance
     79*/
     80WorldInterface* WorldInterface::getInstance()
     81{
     82  if( singletonRef == NULL)
     83    singletonRef = new WorldInterface();
     84  return singletonRef;
     85}
     86
     87
     88/**
     89   \brief initializes the interface
     90   \param reference to the world
     91
     92   if the worldinterface is not initilizes, there wont be any
     93   useable interface
     94*/
     95void WorldInterface::init(World* world)
     96{
     97  this->worldReference = world;
     98  if( world != NULL)
     99    {
     100      this->worldIsInitialized = true;
     101      PRINTF(3)("WorldInterface up and running\n");
     102    }
     103}
     104
     105
     106/**
     107   \brief gets the entity list from the world
     108   \return entity list
     109*/
     110tList<WorldEntity>* WorldInterface::getEntityList()
     111{
     112  if( this->worldIsInitialized)
     113    return this->worldReference->getEntities();
     114  PRINT(1)("Someone tried to use the WorldInterface before it has been initizlized! this can result in SEGFAULTs!\n");
     115  return NULL;
     116}
     117
     118
    42119
    43120World::World( TiXmlElement* root)
     
    110187  cn->reset();
    111188
     189  ResourceManager::getInstance()->debug();
     190  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
     191  ResourceManager::getInstance()->debug();
     192
     193  delete WorldInterface::getInstance();
     194
    112195  delete this->nullParent;
    113196  delete this->entities;
     
    116199  if( this->worldName) delete this->worldName;
    117200  if( this->path) delete this->path;
    118 }
    119 
    120 /**
    121    \brief initializes a new World
     201
     202  //delete garbagecollecor
     203  //delete animator
     204}
     205
     206/**
     207   \brief initializes the world.
     208
     209   set all stuff here that is world generic and does not use to much memory
     210   because the real init() function StoryEntity::init() will be called
     211   shortly before start of the game. 
     212   since all worlds are initiated/referenced before they will be started.
     213   NO LEVEL LOADING HERE - NEVER!
    122214*/
    123215void World::init(char* name, int worldID)
     
    128220  this->debugWorldNr = worldID;
    129221  this->entities = new tList<WorldEntity>();
    130 
    131   // Enable default GL stuff
    132   glEnable(GL_DEPTH_TEST);
    133 
     222}
     223
     224
     225/**
     226   \brief this is executed before load
     227
     228   since the load function sometimes needs data, that has been init before
     229   the load and after the proceeding storyentity has finished
     230*/
     231ErrorMessage World::preLoad()
     232{
     233  /* init the world interface */
     234  WorldInterface* wi = WorldInterface::getInstance();
     235  wi->init(this);
     236  this->garbageCollector = GarbageCollector::getInstance();
     237  this->simpleAnimation = SimpleAnimation::getInstance();
    134238}
    135239
     
    153257        // load the campaign document
    154258        if( !XMLDoc->LoadFile())
     259      this->glmis->step();
    155260
    156261        {
     
    257362   
    258363        // bind camera
    259     this->localCamera = new Camera(this);
     364    this->localCamera = new Camera();
    260365    this->localCamera->setName ("camera");
    261     this->localCamera->bind (localPlayer);
     366    //this->localCamera->bind (localPlayer);
    262367    this->localPlayer->addChild (this->localCamera);
    263368
     
    267372      /*monitor progress*/
    268373  //  this->glmis->step();
     374
     375      // LIGHT initialisation
     376      lightMan = LightManager::getInstance();
     377      lightMan->setAmbientColor(.1,.1,.1);
     378      lightMan->addLight();
     379      //      lightMan->setAttenuation(1.0, .01, 0.0);
     380      //      lightMan->setDiffuseColor(1,1,1);
     381      //  lightMan->addLight(1);
     382      //  lightMan->setPosition(20, 10, -20);
     383      //  lightMan->setDiffuseColor(0,0,0);
     384      lightMan->debug();
     385            lightMan->setPosition(-5.0, 10.0, -40.0);
     386
    269387
    270388            // Create SkySphere
     
    274392            this->skySphere->setMode(PNODE_MOVEMENT);
    275393
    276             /*monitor progress*/
    277           //  this->glmis->step();
    278          
    279           //  trackManager->setBindSlave(env);
     394
     395            //      trackManager->setBindSlave(env);
     396            PNode* tn = trackManager->getTrackNode();
     397            tn->addChild(this->localPlayer);
     398
     399            //localCamera->setParent(TrackNode::getInstance());
     400            tn->addChild(this->localCamera);
     401            //      localCamera->lookAt(tn);
     402            this->localPlayer->setMode(PNODE_ALL);
     403            //Vector* cameraOffset = new Vector (0, 5, -10);
     404            //trackManager->condition(2, LEFTRIGHT, this->localPlayer);
    280405
    281406  // initialize debug coord system
     
    290415  terrain->setRelCoor(new Vector(0,-10,0));
    291416  this->spawn(terrain);
    292 
    293 }
    294 
    295 /**
    296    \brief initializes a new World
     417}
     418
     419
     420/**
     421   \brief initializes a new World shortly before start
     422
     423   this is the function, that will be loaded shortly before the world is
     424   started
    297425*/
    298426ErrorMessage World::init()
     
    302430  cn->addToWorld(this);
    303431  cn->enable(true);
    304 
    305432PRINTF0("> Done Loading world: '%s'\n", getPath());
    306433}
     
    363490  this->glmis = GLMenuImageScreen::getInstance();
    364491  this->glmis->init();
    365   this->glmis->setMaximum(10);
     492  this->glmis->setMaximum(8);
    366493  this->glmis->draw();
    367494 
     
    378505  PRINTF(3)("World::releaseLoadScreen - start\n");
    379506  this->glmis->setValue(this->glmis->getMaximum());
    380   SDL_Delay(500);
     507  //SDL_Delay(500);
    381508  PRINTF(3)("World::releaseLoadScreen - end\n");
     509}
     510
     511
     512/**
     513   \brief gets the list of entities from the world
     514   \returns entity list
     515*/
     516tList<WorldEntity>* World::getEntities()
     517{
     518  return this->entities;
     519}
     520
     521
     522/**
     523   \brief this returns the current game time
     524   \returns elapsed game time
     525*/
     526double World::getGameTime()
     527{
     528  return this->gameTime;
    382529}
    383530
     
    435582  glLoadIdentity();
    436583
    437   entity = this->entities->enumerate();
     584  //entity = this->entities->enumerate();
     585  tIterator<WorldEntity>* iterator = this->entities->getIterator();
     586  entity = iterator->nextElement();
    438587  while( entity != NULL )
    439588    {
    440589      if( entity->bDraw ) entity->draw();
    441       entity = this->entities->nextElement();
    442     }
     590      //entity = this->entities->nextElement();
     591      entity = iterator->nextElement();
     592    }
     593  delete iterator;
    443594 
    444595  glCallList (objectList);
     
    477628  p4->debug ();
    478629 
    479   p1->update ();
     630  p1->update (0);
    480631
    481632  printf ("World::debug() - update\n");
     
    486637
    487638  p2->shiftCoor (new Vector(-1, -1, -1));
    488   p1->update ();
     639  p1->update (0);
    489640
    490641  p1->debug ();
     
    496647
    497648
    498  p1->update ();
     649 p1->update (0);
    499650
    500651  p1->debug ();
     
    593744  if(!this->bPause)
    594745    {
    595       Uint32 dt = currentFrame - this->lastFrame;
     746      this->dt = currentFrame - this->lastFrame;
    596747     
    597       if(dt > 0)
     748      if( this->dt > 0)
    598749        {
    599750          float fps = 1000/dt;
     
    607758          PRINTF(2)("fps = 1000 - frame rate is adjusted\n");
    608759          SDL_Delay(10);
    609           dt = 10;
     760          this->dt = 10;
    610761        }
    611762      //this->timeSlice (dt);
    612763     
    613764      /* function to let all entities tick (iterate through list) */
    614       WorldEntity* entity;
    615       float seconds = dt / 1000.0; 
    616       assert( this->nullParent != NULL);
    617       entity = entities->enumerate();
     765      float seconds = this->dt / 1000.0;     
     766      this->gameTime += seconds;
     767      //entity = entities->enumerate();
     768      tIterator<WorldEntity>* iterator = this->entities->getIterator();
     769      WorldEntity* entity = iterator->nextElement();
    618770      while( entity != NULL)
    619771        {
    620772          entity->tick (seconds);
    621           entity = entities->nextElement();
    622         }
     773          entity = iterator->nextElement();
     774        }
     775      delete iterator;
     776      //skySphere->updatePosition(localCamera->absCoordinate);
     777     
    623778      /* update tick the rest */
     779      this->trackManager->tick(this->dt);
    624780      assert( this->localCamera != NULL);
    625781      assert( this->trackManager != NULL);
    626       this->localCamera->tick(dt);
    627 
    628       this->trackManager->tick(dt);
     782      this->localCamera->tick(this->dt);
     783      this->garbageCollector->tick(seconds);
     784      this->simpleAnimation->tick(seconds);
    629785    }
    630786  this->lastFrame = currentFrame;
     
    640796void World::update()
    641797{
    642   this->nullParent->update ();
     798  this->garbageCollector->update();
     799  this->nullParent->update (dt);
    643800}
    644801
     
    728885bool World::command(Command* cmd)
    729886{
     887  if( !strcmp( cmd->cmd, "view0")) this->localCamera->setViewMode(VIEW_NORMAL);
     888  else if( !strcmp( cmd->cmd, "view1")) this->localCamera->setViewMode(VIEW_BEHIND);
     889  else if( !strcmp( cmd->cmd, "view2")) this->localCamera->setViewMode(VIEW_FRONT);
     890  else if( !strcmp( cmd->cmd, "view3")) this->localCamera->setViewMode(VIEW_LEFT);
     891  else if( !strcmp( cmd->cmd, "view4")) this->localCamera->setViewMode(VIEW_RIGHT);
     892  else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);
     893 
    730894  return false;
    731895}
  • orxonox/branches/levelloader/src/story_entities/world.h

    r3605 r3746  
    88
    99#include "stdincl.h"
    10 
     10#include "comincl.h"
    1111#include "story_entity.h"
    1212#include "p_node.h"
    1313
     14
     15class World;
     16class WorldEntity;
    1417class TrackManager;
    15 class WorldEntity;
    1618class Camera;
    1719class PNode;
     
    2123class FontSet;
    2224class Terrain;
     25class GarbageCollector;
     26class SimpleAnimation;
    2327
     28//! The game world Interface
     29/**
     30   this is a singleton interface, that enables world_entities to access the
     31   world. for those objects, there is no easier way than over this interface!
     32*/
     33class WorldInterface : BaseObject {
     34
     35 public:
     36  ~WorldInterface();
     37  static WorldInterface* getInstance();
     38  void init(World* world);
     39  tList<WorldEntity>* getEntityList();
     40
     41 private:
     42  WorldInterface();
     43  static WorldInterface* singletonRef;    //!< singleton reference to this object
     44  bool worldIsInitialized;                //!< true if the world has been initialized
     45  World* worldReference;                  //!< this is a reference to the running world
     46
     47};
    2448
    2549//! The game world
     
    3963  virtual ~World ();
    4064
     65  double getGameTime();
    4166
    4267  /* classes from story-entity */
     68  virtual ErrorMessage preLoad();
    4369  virtual ErrorMessage load ();
    4470  virtual ErrorMessage init ();
     
    5581  bool command (Command* cmd);
    5682
     83  tList<WorldEntity>* getEntities();
     84
    5785  /* interface to world */
    5886  void spawn (WorldEntity* entity);
     
    6896  void init(char* name, int worldID);
    6997
    70   Uint32 lastFrame;             //!< last time of frame
    71   bool bQuitOrxonox;            //!< quit this application
    72   bool bQuitCurrentGame;        //!< quit only the current game and return to menu
    73   bool bPause;                  //!< pause mode
     98  Uint32 lastFrame;                   //!< last time of frame
     99  Uint32 dt;                          //!< time needed to calculate this frame
     100  double gameTime;                    //!< this is where the game time is saved
     101  bool bQuitOrxonox;                  //!< quit this application
     102  bool bQuitCurrentGame;              //!< quit only the current game and return to menu
     103  bool bPause;                        //!< pause mode
    74104
    75   FontSet* testFont;            //!< A test Font. \todo fix this, so it is for real.
    76   GLMenuImageScreen* glmis;     //!< The Level-Loader Display
     105  FontSet* testFont;                  //!< A test Font. \todo fix this, so it is for real.
     106  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
    77107
    78108  char* worldName;              //!< The name of this World
     
    80110  int debugWorldNr;             //!< The Debug Nr. needed, if something goes wrong
    81111
    82   PNode* nullParent;            //!< The zero-point, that everything has as its parent.
    83   TrackManager* trackManager;   //!< The reference of the TrackManager that handles the course through the Level.
    84   Camera* localCamera;          //!< The current Camera
    85   Skysphere* skySphere;         //!< The Environmental Heaven of orxonox \todo insert this to environment insted
    86   LightManager* lightMan;       //!< The Lights of the Level
    87   Terrain* terrain;             //!< The Terrain of the World.
     112  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
     113  TrackManager* trackManager;         //!< The reference of the TrackManager that handles the course through the Level.
     114  Camera* localCamera;                //!< The current Camera
     115  Skysphere* skySphere;               //!< The Environmental Heaven of orxonox \todo insert this to environment insted
     116  LightManager* lightMan;             //!< The Lights of the Level
     117  Terrain* terrain;                   //!< The Terrain of the World.
    88118
    89   GLuint objectList;            //!< temporary: \todo this will be ereased soon
    90   tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
    91   WorldEntity* localPlayer;     //!< The Player, you fly through the level.
     119  GLuint objectList;                  //!< temporary: \todo this will be ereased soon
     120  tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
     121  WorldEntity* localPlayer;           //!< The Player, you fly through the level.
     122
     123  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
     124
     125  SimpleAnimation* simpleAnimation;   //!< reference to the SimpleAnimation object
    92126 
    93127  /* function for main-loop */
  • orxonox/branches/levelloader/src/subprojects/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    177177          esac; \
    178178        done; \
    179         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/Makefile'; \
     179        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/Makefile'; \
    180180        cd $(top_srcdir) && \
    181           $(AUTOMAKE) --foreign  src/subprojects/Makefile
     181          $(AUTOMAKE) --gnu  src/subprojects/Makefile
    182182.PRECIOUS: Makefile
    183183Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    272272        tags=; \
    273273        here=`pwd`; \
    274         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     274        if (etags --etags-include --version) >/dev/null 2>&1; then \
    275275          include_option=--etags-include; \
    276           empty_fix=.; \
    277276        else \
    278277          include_option=--include; \
    279           empty_fix=; \
    280278        fi; \
    281279        list='$(SUBDIRS)'; for subdir in $$list; do \
    282280          if test "$$subdir" = .; then :; else \
    283             test ! -f $$subdir/TAGS || \
     281            test -f $$subdir/TAGS && \
    284282              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    285283          fi; \
     
    291289          $(AWK) '    { files[$$0] = 1; } \
    292290               END { for (i in files) print i; }'`; \
    293         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    294           test -n "$$unique" || unique=$$empty_fix; \
    295           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    296             $$tags $$unique; \
    297         fi
     291        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     292          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     293             $$tags $$unique
    298294ctags: CTAGS
    299295CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/levelloader/src/subprojects/testmain/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
     
    197197          esac; \
    198198        done; \
    199         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile'; \
     199        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile'; \
    200200        cd $(top_srcdir) && \
    201           $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile
     201          $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile
    202202.PRECIOUS: Makefile
    203203Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    219219install-binPROGRAMS: $(bin_PROGRAMS)
    220220        @$(NORMAL_INSTALL)
    221         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     221        $(mkdir_p) $(DESTDIR)$(bindir)
    222222        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    223223          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    225225          ; then \
    226226            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    227            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    228            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     227           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     228           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    229229          else :; fi; \
    230230        done
     
    234234        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    235235          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    236           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    237           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     236          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     237          rm -f $(DESTDIR)$(bindir)/$$f; \
    238238        done
    239239
     
    289289          $(AWK) '    { files[$$0] = 1; } \
    290290               END { for (i in files) print i; }'`; \
    291         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    292           test -n "$$unique" || unique=$$empty_fix; \
    293           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    294             $$tags $$unique; \
    295         fi
     291        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     292          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     293             $$tags $$unique
    296294ctags: CTAGS
    297295CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    348346all-am: Makefile $(PROGRAMS) $(HEADERS)
    349347installdirs:
    350         for dir in "$(DESTDIR)$(bindir)"; do \
    351           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    352         done
     348        $(mkdir_p) $(DESTDIR)$(bindir)
    353349install: install-am
    354350install-exec: install-exec-am
  • orxonox/branches/levelloader/src/track_manager.cc

    r3605 r3746  
    1818#include "track_manager.h"
    1919
     20#include "base_object.h"
    2021#include "p_node.h"
    2122#include "substring.h"
    2223
    2324#include "track_node.h"
     25#include "stdincl.h"
     26#include "list.h"
     27#include "debug.h"
     28
     29
    2430
    2531#include <stdarg.h>
     
    6773  if ((!this->isJoined &&this->childCount > 0) || (this->isJoined && this->mainJoin))
    6874    {
    69       TrackElement* enumElem = children->enumerate();
     75      tIterator<TrackElement>* iterator = this->children->getIterator();
     76      TrackElement* enumElem = iterator->nextElement();
    7077      while (enumElem)
    7178        {
    7279          delete enumElem;
    73           enumElem = children->nextElement();
    74         }
     80          enumElem = iterator->nextElement();
     81        }
     82      delete iterator;
    7583      delete this->children;
    7684    }
     
    92100  if (this->childCount > 0)
    93101    {
    94       TrackElement* enumElem = this->children->enumerate();
     102      tIterator<TrackElement>* iterator = this->children->getIterator();
     103      TrackElement* enumElem = iterator->nextElement();
    95104      TrackElement* tmpElem;
    96105      while (enumElem)
     
    98107          if ((tmpElem = enumElem->findByID(trackID)))
    99108            return tmpElem;
    100           enumElem = this->children->nextElement();
    101         }
     109          enumElem = iterator->nextElement();
     110        }
     111      delete iterator;
    102112    }
    103113  else
     
    145155  else
    146156    {
    147       TrackElement* enumElem = this->children->enumerate();
     157      tIterator<TrackElement>* iterator = this->children->getIterator();
     158      TrackElement* enumElem = iterator->nextElement();
    148159      while (enumElem)
    149160        {
    150161          if(!enumElem->backLoopCheck(trackElem))
    151162            return false;
    152           enumElem = this->children->nextElement();
    153         }
     163          enumElem = iterator->nextElement();
     164        }
     165      delete iterator;
    154166     
    155167      return true;
     
    287299  PNode* tmpNode = (PNode*)node;
    288300
    289   if (tmpNode->getRelCoor().z < 0)
     301  if (tmpNode->getRelCoor()->z < 0)
    290302    return 0;
    291303  else
     
    308320  PNode* tmpNode = (PNode*)node;
    309321
    310   Vector nodeRelCoord = tmpNode->getRelCoor();
     322  Vector nodeRelCoord = *tmpNode->getRelCoor();
    311323  float minDist = 100000000;
    312324  int childNumber = 0;
     
    910922void TrackManager::drawGraph(float dt) const
    911923{
    912 
    913924  for (int i = 1; i <= trackElemCount; i++)
    914925    {
     
    922933            glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
    923934          }
    924   glEnd();
     935      glEnd();
    925936    }
    926937}
  • orxonox/branches/levelloader/src/track_manager.h

    r3605 r3746  
    1212#define _TRACK_MANAGER_H
    1313
    14 #include "stdincl.h"
    1514#include "curve.h"
    1615#include "substring.h"
     16#include "base_object.h"
    1717
    1818class PNode;
    19 class TrackNamer;
     19template<class T> class tList;
    2020
    2121// Static Definitions
  • orxonox/branches/levelloader/src/track_node.cc

    r3605 r3746  
    4646  this->trackManager = TrackManager::getInstance();
    4747  this->setMode(PNODE_ALL);
    48   this->absCoordinate = *absCoordinate;
     48  this->absCoordinate = absCoordinate;
    4949}
    5050
  • orxonox/branches/levelloader/src/world_entities/environment.cc

    r3605 r3746  
    3030Environment::Environment () : WorldEntity()
    3131{
    32   this->model = new OBJModel("../data/models/fighter.obj");
     32  this->model = (Model*) ResourceManager::getInstance()->load("cube", RP_LEVEL);
     33  //  this->model = new OBJModel("../data/models/fighter.obj");
    3334}
    3435
     
    5455        string = grabParameter( root, "model");
    5556        if( string != NULL)
    56                 this->model = new OBJModel( string);
     57        this->model = (Model*) ResourceManager::getInstance()->load( string, RP_LEVEL);
    5758        else
    5859        {
    5960                PRINTF0("Environment is missing a proper 'model'\n");
    60                 this->model = new OBJModel( "../data/models/reaplow.obj");
     61        this->model = (Model*) ResourceManager::getInstance()->load( "cube", RP_LEVEL);
    6162        }
    6263        if( this->model == NULL)
  • orxonox/branches/levelloader/src/world_entities/player.cc

    r3605 r3746  
    2020#include "player.h"
    2121
     22#include "track_manager.h"
     23#include "objModel.h"
     24#include "resource_manager.h"
     25#include "weapon.h"
     26#include "test_gun.h"
     27#include "world.h"
     28
     29#include "list.h"
    2230#include "stdincl.h"
    23 //#include "collision.h"
    24 #include "objModel.h"
    25 #include "list.h"
    26 #include "weapon.h"
    27 #include "track_manager.h"
    2831
    2932using namespace std;
     
    3538   \param isFree if the player is free
    3639*/
    37 Player::Player(bool isFree) : WorldEntity(isFree)
    38 {
    39   this->model = new OBJModel("../data/models/reaplow.obj");
     40Player::Player() : WorldEntity()
     41{
    4042  this->weapons = new tList<Weapon>();
    4143  this->activeWeapon = NULL;
    42 
     44  /*
     45    this is the debug player - actualy we would have to make a new
     46     class derivated from Player for each player. for now, we just use
     47     the player.cc for debug also
     48  */
     49  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
    4350  travelSpeed = 15.0;
    44   velocity = Vector();
     51  velocity = new Vector();
    4552  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    4653  bFire = false;
    4754  acceleration = 10.0;
     55  //weapons:
     56  Weapon* wp = new TestGun(this, new Vector(-1.1, 0.0, 2.6), new Quaternion());
     57  this->weapons->add(wp);
     58  this->activeWeapon = wp; 
    4859}
    4960
     
    5364Player::~Player ()
    5465{
    55   Weapon* w = this->weapons->enumerate();
    56   while( w != NULL)
    57     {
    58       delete w;
    59       w = this->weapons->nextElement();
    60     }
     66  /* do not delete the weapons, they are contained in the pnode tree
     67     and will be deleted there.
     68     this only frees the memory allocated to save the list.
     69  */
    6170  delete this->weapons;
    62  
    63   //delete this->velocity;
    6471}
    6572
     
    94101        string = grabParameter( root, "model");
    95102        if( string != NULL)
    96                 this->model = new OBJModel( string);
     103        this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
    97104        else
    98105        {
    99106                PRINTF0("Player is missing a proper 'model'\n");
    100                 this->model = new OBJModel( "../data/models/reaplow.obj");
     107        this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
    101108        }
    102109        if( this->model == NULL)
     
    104111                PRINTF0("Player model '%s' could not be loaded\n", string);
    105112        }
     113       
     114        this->weapons = new tList<Weapon>();
     115  this->activeWeapon = NULL;
     116  /*
     117    this is the debug player - actualy we would have to make a new
     118     class derivated from Player for each player. for now, we just use
     119     the player.cc for debug also
     120  */
     121  travelSpeed = 15.0;
     122  velocity = new Vector();
     123  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
     124  bFire = false;
     125  acceleration = 10.0;
     126  //weapons:
     127  Weapon* wp = new TestGun(this, new Vector(-1.1, 0.0, 2.6), new Quaternion());
     128  this->weapons->add(wp);
     129  this->activeWeapon = wp;
    106130}
    107131
     
    192216void Player::tick (float time)
    193217{
     218  /* link tick to weapon */
     219  this->activeWeapon->tick(time);
    194220  // player controlled movement
    195   this->move (time);
     221  this->move(time);
    196222  // weapon system manipulation
    197   this->fire();
     223  this->weapon();
    198224}
    199225
     
    214240  //orthDirection = orthDirection.cross (direction);
    215241
    216   if( this->bUp && this->getRelCoor().x < 20)
     242  if( this->bUp && this->getRelCoor()->x < 20)
    217243    accel = accel+(direction*acceleration);
    218   if( this->bDown && this->getRelCoor().x > -5)
     244  if( this->bDown && this->getRelCoor()->x > -5)
    219245    accel = accel-(direction*acceleration);
    220   if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
     246  if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor()->z*2)
    221247    accel = accel - (orthDirection*acceleration);
    222   if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
     248  if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor()->z*2)
    223249    accel = accel + (orthDirection*acceleration);
    224250  if( this->bAscend )
     
    233259   \brief weapon manipulation by the player
    234260*/
    235 void Player::fire()
    236 {
    237   if(this->bFire)
     261void Player::weapon()
     262{
     263  if( this->bFire)
    238264    {
    239265      if(this->activeWeapon != NULL)
    240266        this->activeWeapon->fire();
    241267    }
    242   if(this->bWeaponChange)
     268  if( this->bWeaponChange && this->weapons->getSize() > 1)
    243269    {
    244       Weapon* w = this->weapons->enumerate();
     270      PRINTF(1)("changing the weapon of the player: deactivate old, activate new\n");
     271      this->activeWeapon->deactivate();
     272      //this->weapons->enumerate();  FIX: strang weapon change...
    245273      this->activeWeapon = this->weapons->nextElement(this->activeWeapon);
     274      this->activeWeapon->activate();
    246275    }
    247276}
  • orxonox/branches/levelloader/src/world_entities/player.h

    r3605 r3746  
    1010
    1111template<class T> class tList;
    12 class OBJModel;
    1312class Weapon;
     13class Vector;
     14class World;
    1415
    1516//! Basic controllable WorldEntity
     
    1920 
    2021 public:
    21   Player(bool isFree = false);
     22  Player();
    2223  Player(TiXmlElement* root);
    2324  virtual ~Player();
     
    4849  tList<Weapon>* weapons;//!< a list of weapon
    4950  Weapon* activeWeapon;  //!< the weapon that is currenty activated
     51  World* myWorld;        //!< reference to the world object
    5052
    51   Vector velocity;       //!< the velocity of the player.
     53  Vector* velocity;       //!< the velocity of the player.
    5254  float travelSpeed;     //!< the current speed of the player (to make soft movement)
    5355  float acceleration;    //!< the acceleration of the player.
    5456 
    5557  void move(float time);
    56   void fire(void);
     58  void weapon(void);
    5759 
    5860};
  • orxonox/branches/levelloader/src/world_entities/projectile.cc

    r3605 r3746  
    1818
    1919#include "projectile.h"
    20 #include "stdincl.h"
     20
    2121#include "world_entity.h"
     22#include "weapon.h"
     23#include "null_parent.h"
     24#include "model.h"
    2225#include "vector.h"
    23 #include "objModel.h"
    2426
    2527using namespace std;
     
    2931   \brief standard constructor
    3032*/
    31 Projectile::Projectile () : WorldEntity()
     33Projectile::Projectile (Weapon* weapon) : WorldEntity()
    3234{
    33   this->model = new OBJModel("");
     35  this->model = (Model*)ResourceManager::getInstance()->load("sphere", PRIM, RP_LEVEL);
     36  this->weapon = weapon;
     37  this->flightDirection = NULL;
     38  this->currentLifeTime = 0.0f;
     39  this->ttl = 0.75f; /* sec */
     40  this->speed = 2.0f;
    3441}
    3542
     
    4047Projectile::~Projectile ()
    4148{
    42 
     49  /*
     50     do not delete the test projectModel, since it is pnode
     51     and will be cleaned out by world
     52  */
     53  //delete this->projectileModel;
    4354}
    4455
     56
     57/**
     58   \brief this sets the flight direction of the projectile
     59   \param directin in which to flight
     60
     61   this function will calculate a vector out of this to be used in the
     62   tick function
     63*/
     64void Projectile::setFlightDirection(Quaternion flightDirection)
     65{
     66  if( this->flightDirection == NULL)
     67    this->flightDirection = new Vector();
     68  Vector v(1, 0, 0);
     69  *this->flightDirection = flightDirection.apply(v);
     70  this->flightDirection->normalize();
     71}
     72
     73
     74/**
     75   \brief this sets the time to life of the projectile
     76   \param ttl in second
     77
     78   after this life time, the projectile will garbage collect itself
     79*/
     80void Projectile::setTTL(float ttl)
     81{
     82  this->ttl = ttl;
     83}
     84
     85
     86/**
     87   \brief sets the speed of the projectile
     88*/
     89void Projectile::setSpeed(float speed)
     90{
     91  this->speed = speed * 3; /* fix speed settings */
     92  PRINTF(4)("Projectile::setting speed to: %f\n", this->speed);
     93}
    4594
    4695/**
     
    4998*/
    5099void Projectile::tick (float time)
    51 {}
     100{
     101  Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
     102  this->shiftCoor(v);
     103
     104  this->currentLifeTime += time;
     105  if( this->ttl < this->currentLifeTime)
     106    {
     107      PRINTF(5)("FINALIZE==========================\n");
     108      PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl);
     109      PRINTF(5)("FINALIZE===========================\n");
     110      this->finalize();
     111      this->currentLifeTime = 0.0f;
     112    }
     113}
    52114
    53115/**
  • orxonox/branches/levelloader/src/world_entities/projectile.h

    r3605 r3746  
    22    \projectile.h
    33    \brief a projectile, that is been shooted by a weapon
     4
     5    You can use this class to make some shoots, but this isn't the real idea. If you want to just test, if the
     6    shooting funcions work, use the Projectile class. But if you want to implement your own shoots its
     7    different:<br>
     8    Make a new class and derive it from Projectile. To have a weapon work well, reimplement the functions
     9    - void tick()
     10    - void draw()
     11    - void hit() (only if you have working collision detection)
     12    When you have implemented these functions you have just to add the projectiles to your weapon. You ll want
     13    to make this by looking into the function
     14    - Weapon::fire()
     15    there you just change the line:
     16    Projectile* pj = new Projectile();    TO     Projectile* pj = new MyOwnProjectileClass();
     17    and schwups it works... :)
    418*/
    519
     
    923#include "world_entity.h"
    1024
     25class Vector;
     26class Weapon;
    1127
    1228class Projectile : public WorldEntity
     
    1531
    1632 public:
    17   Projectile ();
     33  Projectile (Weapon* weapon);
    1834  virtual ~Projectile ();
     35
     36  void setFlightDirection(Quaternion flightDirection);
     37  void setSpeed(float speed);
     38  void setTTL(float ttl);
    1939
    2040  virtual void hit (WorldEntity* weapon, Vector* loc);
     
    2444  virtual void draw ();
    2545
    26  private:
     46 protected:
    2747  //physical attriutes like: force, speed, acceleration etc.
    28 
     48  float speed;                         //!< this is the speed of the projectile
     49  float currentLifeTime;               //!< this is the time, the projectile exists in this world (incremented by tick)
     50  float ttl;                           //!< time to life, after this time, the projectile will garbage collect itself
     51  Vector* flightDirection;             //!< direction in which the shoot flights
     52  Weapon* weapon;                      //!< weapon the shoot belongs to
     53 
    2954};
    3055
  • orxonox/branches/levelloader/src/world_entities/skysphere.cc

    r3605 r3746  
    2626#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    2727
    28 #include "material.h"
     28
    2929#include "skysphere.h"
    3030#include "stdincl.h"
     31
     32#include "material.h"
    3133#include "vector.h"
    32 #include "world_entity.h"
     34//#include "world_entity.h"
     35
    3336
    3437using namespace std;
     
    100103  glPushMatrix();
    101104  glMatrixMode(GL_MODELVIEW);
    102   glTranslatef(this->absCoordinate.x,
    103                this->absCoordinate.y,
    104                this->absCoordinate.z);
     105  Vector r = this->getAbsCoor();
     106  glTranslatef(r.x, r.y, r.z);
    105107
    106108  //glRotatef(-30, 1, 0, 0);
  • orxonox/branches/levelloader/src/world_entities/skysphere.h

    r3605 r3746  
    1414
    1515/* INCLUDES */
    16 #include "p_node.h"
    1716#include "world_entity.h"
    1817
  • orxonox/branches/levelloader/src/world_entities/terrain.cc

    r3605 r3746  
    1616
    1717#include "terrain.h"
    18 
     18#include "stdincl.h"
     19#include "model.h"
     20#include "vector.h"
    1921#include "glincl.h"
    2022
     
    4345  if (strstr(fileName, ".obj") || strstr(fileName, ".OBJ"))
    4446    {
    45       this->model = (OBJModel*)new OBJModel(fileName);
     47      this->model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_LEVEL);
    4648    }
    4749  else
  • orxonox/branches/levelloader/src/world_entities/weapon.cc

    r3605 r3746  
    2121#include "world_entity.h"
    2222#include "vector.h"
    23 #include "objModel.h"
     23#include "model.h"
    2424#include "projectile.h"
     25#include "list.h"
     26#include "world.h"
    2527
    2628using namespace std;
     
    3234   creates a new weapon
    3335*/
    34 Weapon::Weapon () : WorldEntity()
    35 {}
     36Weapon::Weapon (PNode* parent, Vector* coordinate, Quaternion* direction)
     37  : WorldEntity()
     38{
     39  parent->addChild(this, PNODE_ROTATE_AND_MOVE);
     40  this->setRelCoor(coordinate);
     41  this->setRelDir(direction);
     42  WorldInterface* wi = WorldInterface::getInstance();
     43  this->worldEntities = wi->getEntityList();
     44}
    3645
    3746
     
    145154*/
    146155void Weapon::setWeaponIdleTime(float time)
    147 {}
     156{
     157  this->idleTime = time;
     158}
    148159
    149160/**
     
    155166*/
    156167float Weapon::getWeaponIdleTime(void)
    157 {}
     168{
     169  return this->idleTime;
     170}
    158171
    159172/**
     
    165178*/
    166179bool Weapon::hasWeaponIdleTimeElapsed(void)
    167 {}
     180{
     181  return (this->localTime>this->idleTime)?true:false;
     182}
    168183
    169184
  • orxonox/branches/levelloader/src/world_entities/weapon.h

    r3605 r3746  
    4343
    4444 public:
    45   Weapon ();
     45  Weapon (PNode* parent, Vector* coordinate, Quaternion* direction);
    4646  virtual ~Weapon ();
    4747 
     
    5757  bool isActive(void);
    5858
    59   virtual void setWeaponIdleTime(float time);
    60   virtual float getWeaponIdleTime(void);
    61   virtual bool hasWeaponIdleTimeElapsed(void);
     59  void setWeaponIdleTime(float time);
     60  float getWeaponIdleTime(void);
     61  bool hasWeaponIdleTimeElapsed(void);
    6262
    63   virtual void fire(void);
     63  virtual void fire(void) = 0;
    6464  virtual void hit (WorldEntity* weapon, Vector* loc);
    6565  virtual void destroy(void);
     
    6969  virtual void draw(void);
    7070
     71 protected:
     72  tList<WorldEntity>* worldEntities;
     73  float localTime;
     74  float idleTime;
     75  float slowDownFactor;
    7176
    7277 private:
    7378  bool enabled;
    74   float localTime;
    75   float slowDownFactor;
    7679  Projectile* projectile;
    7780  //WeaponSound sound;
    78 
    7981};
    8082
  • orxonox/branches/levelloader/src/world_entities/world_entity.cc

    r3605 r3746  
    1919
    2020#include "world_entity.h"
    21 #include "stdincl.h"
     21#include "objModel.h"
     22#include "list.h"
     23
     24//#include "stdincl.h"
    2225//#include "collision.h"
    2326
     
    4851{
    4952  // if( collisioncluster != NULL) delete collisioncluster;
    50   delete this->model;
     53  if (this->model)
     54    ResourceManager::getInstance()->unload(this->model);
    5155}
    5256
     
    167171   Handle all stuff that should update with time inside this method (movement, animation, etc.)
    168172*/
    169 void WorldEntity::tick(float time)
     173inline void WorldEntity::tick(float time)
    170174{
    171175}
     
    177181   This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
    178182*/
    179 void WorldEntity::draw()
     183inline void WorldEntity::draw()
    180184{}
    181185
  • orxonox/branches/levelloader/src/world_entities/world_entity.h

    r3605 r3746  
    77#define _WORLD_ENTITY_H
    88
    9 #include "stdincl.h"
    109#include "p_node.h"
    11 #include "objModel.h"
     10#include "comincl.h"
     11#include "resource_manager.h"
     12
    1213
    1314//class CollisionCluster;
    1415class CharacterAttributes;
     16class Model;
    1517
    1618
     
    4850 
    4951 protected:
    50   OBJModel* model;                  //!< The model that should be loaded for this entity.
     52  Model* model;                  //!< The model that should be loaded for this entity.
    5153  CharacterAttributes* charAttr;      //!< the character attributes of a world_entity
    5254 
Note: See TracChangeset for help on using the changeset viewer.