Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3365 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 7, 2005, 1:14:33 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/parenting back to the.
merged with command:
svn merge branches/parenting trunk -r 3247:HEAD
resolved all conflicts in favor of parenting.

Location:
orxonox/trunk
Files:
2 deleted
37 edited
16 copied

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/configure

    r3240 r3365  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.59 for orxonox 2.0.1-pre-alpha.
     3# Generated by GNU Autoconf 2.59 for orxonox 0.2.1-pre-alpha.
    44#
    55# Report bugs to <orxonox-dev at mail.datacore.ch>.
     
    270270PACKAGE_NAME='orxonox'
    271271PACKAGE_TARNAME='orxonox'
    272 PACKAGE_VERSION='2.0.1-pre-alpha'
    273 PACKAGE_STRING='orxonox 2.0.1-pre-alpha'
     272PACKAGE_VERSION='0.2.1-pre-alpha'
     273PACKAGE_STRING='orxonox 0.2.1-pre-alpha'
    274274PACKAGE_BUGREPORT='orxonox-dev at mail.datacore.ch'
    275275
     
    789789  # This message is too long to be a string in the A/UX 3.1 sh.
    790790  cat <<_ACEOF
    791 \`configure' configures orxonox 2.0.1-pre-alpha to adapt to many kinds of systems.
     791\`configure' configures orxonox 0.2.1-pre-alpha to adapt to many kinds of systems.
    792792
    793793Usage: $0 [OPTION]... [VAR=VALUE]...
     
    856856if test -n "$ac_init_help"; then
    857857  case $ac_init_help in
    858      short | recursive ) echo "Configuration of orxonox 2.0.1-pre-alpha:";;
     858     short | recursive ) echo "Configuration of orxonox 0.2.1-pre-alpha:";;
    859859   esac
    860860  cat <<\_ACEOF
     
    984984if $ac_init_version; then
    985985  cat <<\_ACEOF
    986 orxonox configure 2.0.1-pre-alpha
     986orxonox configure 0.2.1-pre-alpha
    987987generated by GNU Autoconf 2.59
    988988
     
    998998running configure, to aid debugging if configure makes a mistake.
    999999
    1000 It was created by orxonox $as_me 2.0.1-pre-alpha, which was
     1000It was created by orxonox $as_me 0.2.1-pre-alpha, which was
    10011001generated by GNU Autoconf 2.59.  Invocation command line was
    10021002
     
    17191719# Define the identity of the package.
    17201720 PACKAGE='orxonox'
    1721  VERSION='2.0.1-pre-alpha'
     1721 VERSION='0.2.1-pre-alpha'
    17221722
    17231723
     
    79467946cat >&5 <<_CSEOF
    79477947
    7948 This file was extended by orxonox $as_me 2.0.1-pre-alpha, which was
     7948This file was extended by orxonox $as_me 0.2.1-pre-alpha, which was
    79497949generated by GNU Autoconf 2.59.  Invocation command line was
    79507950
     
    80098009cat >>$CONFIG_STATUS <<_ACEOF
    80108010ac_cs_version="\\
    8011 orxonox config.status 2.0.1-pre-alpha
     8011orxonox config.status 0.2.1-pre-alpha
    80128012configured by $0, generated by GNU Autoconf 2.59,
    80138013  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
  • orxonox/trunk/doc/orxodox.src

    r2710 r3365  
    77PROJECT_NAME           = Orxonox
    88PROJECT_NUMBER         = 1
    9 OUTPUT_DIRECTORY       = doc/doxygen/
     9OUTPUT_DIRECTORY       = doxygen/
    1010CREATE_SUBDIRS         = YES
    1111OUTPUT_LANGUAGE        = English
     
    3434#---------------------------------------------------------------------------
    3535EXTRACT_ALL            = NO
    36 EXTRACT_PRIVATE        = NO
    37 EXTRACT_STATIC         = NO
     36EXTRACT_PRIVATE        = YES
     37EXTRACT_STATIC         = YES
    3838EXTRACT_LOCAL_CLASSES  = YES
    3939EXTRACT_LOCAL_METHODS  = NO
     
    6969# configuration options related to the input files
    7070#---------------------------------------------------------------------------
    71 INPUT                  = src/
     71INPUT                  = .
    7272FILE_PATTERNS          =
    73 RECURSIVE              = YES
     73RECURSIVE              = NO
    7474EXCLUDE                =
    7575EXCLUDE_SYMLINKS       = NO
  • orxonox/trunk/src/Makefile.am

    r3246 r3365  
    2424                 story_entity.cc \
    2525                 environment.cc \
    26                  importer/object.cc \
     26                 importer/model.cc \
    2727                 importer/array.cc \
    2828                 importer/material.cc \
     29                 importer/texture.cc \
    2930                 list.cc \
    30                  p_node.cc
     31                 p_node.cc \
     32                 null_parent.cc \
     33                 base_object.cc \
     34                 helper_parent.cc \
     35                 track_manager.cc \
     36                 matrix.cc \
     37                 curve.cc \
     38                 glmenu_imagescreen.cc
     39
    3140
    3241noinst_HEADERS = ability.h \
     
    5463                 shoot_laser.h \
    5564                 world_entity.h \
    56                  coordinates.h \
    5765                 message_structures.h \
    5866                 shoot_rocket.h \
     
    6270                 game_loader.h \
    6371                 campaign.h \
    64                  p_node.h
     72                 p_node.h \
     73                 null_parent.h \
     74                 base_object.h \
     75                 helper_parent.h \
     76                 track_manager.h \
     77                 matrix.h \
     78                 curve.h \
     79                 glmenu_imagescreen.h
     80
    6581
    6682## orxonox.conf will be used from home-dir instead.
  • orxonox/trunk/src/Makefile.in

    r3246 r3365  
    5959        track.$(OBJEXT) base_entity.$(OBJEXT) game_loader.$(OBJEXT) \
    6060        campaign.$(OBJEXT) story_entity.$(OBJEXT) \
    61         environment.$(OBJEXT) object.$(OBJEXT) array.$(OBJEXT) \
    62         material.$(OBJEXT) list.$(OBJEXT) p_node.$(OBJEXT)
     61        environment.$(OBJEXT) model.$(OBJEXT) array.$(OBJEXT) \
     62        material.$(OBJEXT) texture.$(OBJEXT) list.$(OBJEXT) \
     63        p_node.$(OBJEXT) null_parent.$(OBJEXT) base_object.$(OBJEXT) \
     64        helper_parent.$(OBJEXT) track_manager.$(OBJEXT) \
     65        matrix.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
    6366orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    6467orxonox_LDADD = $(LDADD)
     
    6770am__depfiles_maybe = depfiles
    6871@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \
    69 @AMDEP_TRUE@    ./$(DEPDIR)/base_entity.Po ./$(DEPDIR)/camera.Po \
     72@AMDEP_TRUE@    ./$(DEPDIR)/base_entity.Po \
     73@AMDEP_TRUE@    ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \
    7074@AMDEP_TRUE@    ./$(DEPDIR)/campaign.Po ./$(DEPDIR)/collision.Po \
    71 @AMDEP_TRUE@    ./$(DEPDIR)/command_node.Po \
     75@AMDEP_TRUE@    ./$(DEPDIR)/command_node.Po ./$(DEPDIR)/curve.Po \
    7276@AMDEP_TRUE@    ./$(DEPDIR)/data_tank.Po \
    7377@AMDEP_TRUE@    ./$(DEPDIR)/environment.Po \
    7478@AMDEP_TRUE@    ./$(DEPDIR)/game_loader.Po \
     79@AMDEP_TRUE@    ./$(DEPDIR)/glmenu_imagescreen.Po \
     80@AMDEP_TRUE@    ./$(DEPDIR)/helper_parent.Po \
    7581@AMDEP_TRUE@    ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
    7682@AMDEP_TRUE@    ./$(DEPDIR)/list.Po ./$(DEPDIR)/material.Po \
    77 @AMDEP_TRUE@    ./$(DEPDIR)/object.Po ./$(DEPDIR)/orxonox.Po \
     83@AMDEP_TRUE@    ./$(DEPDIR)/matrix.Po ./$(DEPDIR)/model.Po \
     84@AMDEP_TRUE@    ./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/orxonox.Po \
    7885@AMDEP_TRUE@    ./$(DEPDIR)/p_node.Po ./$(DEPDIR)/player.Po \
    79 @AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/track.Po \
     86@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \
     87@AMDEP_TRUE@    ./$(DEPDIR)/track.Po ./$(DEPDIR)/track_manager.Po \
    8088@AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \
    8189@AMDEP_TRUE@    ./$(DEPDIR)/world_entity.Po
     
    214222                 story_entity.cc \
    215223                 environment.cc \
    216                  importer/object.cc \
     224                 importer/model.cc \
    217225                 importer/array.cc \
    218226                 importer/material.cc \
     227                 importer/texture.cc \
    219228                 list.cc \
    220                  p_node.cc
     229                 p_node.cc \
     230                 null_parent.cc \
     231                 base_object.cc \
     232                 helper_parent.cc \
     233                 track_manager.cc \
     234                 matrix.cc \
     235                 curve.cc \
     236                 glmenu_imagescreen.cc
    221237
    222238noinst_HEADERS = ability.h \
     
    244260                 shoot_laser.h \
    245261                 world_entity.h \
    246                  coordinates.h \
    247262                 message_structures.h \
    248263                 shoot_rocket.h \
     
    252267                 game_loader.h \
    253268                 campaign.h \
    254                  p_node.h
     269                 p_node.h \
     270                 null_parent.h \
     271                 base_object.h \
     272                 helper_parent.h \
     273                 track_manager.h \
     274                 matrix.h \
     275                 curve.h \
     276                 glmenu_imagescreen.h
    255277
    256278EXTRA_DIST = orxonox.conf
     
    332354@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    333355@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@
     356@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@
    334357@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@
    335358@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/campaign.Po@am__quote@
    336359@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collision.Po@am__quote@
    337360@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_node.Po@am__quote@
     361@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Po@am__quote@
    338362@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@
    339363@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@
    340364@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
     365@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@
     366@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@
    341367@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
    342368@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@
    343369@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
    344370@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
    345 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
     371@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Po@am__quote@
     372@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
     373@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null_parent.Po@am__quote@
    346374@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@
    347375@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
    348376@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
    349377@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
     378@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    350379@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track.Po@am__quote@
     380@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_manager.Po@am__quote@
    351381@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
    352382@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world.Po@am__quote@
     
    369399@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    370400
    371 object.o: importer/object.cc
    372 @am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.o -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc; \
    373 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi
    374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/object.cc' object='object.o' libtool=no @AMDEPBACKSLASH@
    375 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@
    376 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    377 @am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc
    378 
    379 object.obj: importer/object.cc
    380 @am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.obj -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`; \
    381 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi
    382 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/object.cc' object='object.obj' libtool=no @AMDEPBACKSLASH@
    383 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@
    384 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    385 @am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`
     401model.o: importer/model.cc
     402@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 'importer/model.cc' || echo '$(srcdir)/'`importer/model.cc; \
     403@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/model.Tpo" "$(DEPDIR)/model.Po"; else rm -f "$(DEPDIR)/model.Tpo"; exit 1; fi
     404@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/model.cc' object='model.o' libtool=no @AMDEPBACKSLASH@
     405@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/model.Po' tmpdepfile='$(DEPDIR)/model.TPo' @AMDEPBACKSLASH@
     406@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     407@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o model.o `test -f 'importer/model.cc' || echo '$(srcdir)/'`importer/model.cc
     408
     409model.obj: importer/model.cc
     410@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT model.obj -MD -MP -MF "$(DEPDIR)/model.Tpo" -c -o model.obj `if test -f 'importer/model.cc'; then $(CYGPATH_W) 'importer/model.cc'; else $(CYGPATH_W) '$(srcdir)/importer/model.cc'; fi`; \
     411@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/model.Tpo" "$(DEPDIR)/model.Po"; else rm -f "$(DEPDIR)/model.Tpo"; exit 1; fi
     412@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/model.cc' object='model.obj' libtool=no @AMDEPBACKSLASH@
     413@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/model.Po' tmpdepfile='$(DEPDIR)/model.TPo' @AMDEPBACKSLASH@
     414@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     415@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o model.obj `if test -f 'importer/model.cc'; then $(CYGPATH_W) 'importer/model.cc'; else $(CYGPATH_W) '$(srcdir)/importer/model.cc'; fi`
    386416
    387417array.o: importer/array.cc
     
    416446@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    417447@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.obj `if test -f 'importer/material.cc'; then $(CYGPATH_W) 'importer/material.cc'; else $(CYGPATH_W) '$(srcdir)/importer/material.cc'; fi`
     448
     449texture.o: importer/texture.cc
     450@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture.o -MD -MP -MF "$(DEPDIR)/texture.Tpo" -c -o texture.o `test -f 'importer/texture.cc' || echo '$(srcdir)/'`importer/texture.cc; \
     451@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/texture.Tpo" "$(DEPDIR)/texture.Po"; else rm -f "$(DEPDIR)/texture.Tpo"; exit 1; fi
     452@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/texture.cc' object='texture.o' libtool=no @AMDEPBACKSLASH@
     453@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/texture.Po' tmpdepfile='$(DEPDIR)/texture.TPo' @AMDEPBACKSLASH@
     454@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     455@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture.o `test -f 'importer/texture.cc' || echo '$(srcdir)/'`importer/texture.cc
     456
     457texture.obj: importer/texture.cc
     458@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture.obj -MD -MP -MF "$(DEPDIR)/texture.Tpo" -c -o texture.obj `if test -f 'importer/texture.cc'; then $(CYGPATH_W) 'importer/texture.cc'; else $(CYGPATH_W) '$(srcdir)/importer/texture.cc'; fi`; \
     459@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/texture.Tpo" "$(DEPDIR)/texture.Po"; else rm -f "$(DEPDIR)/texture.Tpo"; exit 1; fi
     460@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/texture.cc' object='texture.obj' libtool=no @AMDEPBACKSLASH@
     461@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/texture.Po' tmpdepfile='$(DEPDIR)/texture.TPo' @AMDEPBACKSLASH@
     462@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     463@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture.obj `if test -f 'importer/texture.cc'; then $(CYGPATH_W) 'importer/texture.cc'; else $(CYGPATH_W) '$(srcdir)/importer/texture.cc'; fi`
    418464uninstall-info-am:
    419465
  • orxonox/trunk/src/camera.cc

    r3236 r3365  
    4242  this->t = 0.0;
    4343
    44   this->actualPlace.r.x = 0.0;
    45   this->actualPlace.r.y = 10.0;
    46   this->actualPlace.r.z = -5.0;
     44
     45  this->setDrawable (false);
    4746}
    4847
     
    6766  //printf("time is: t=%f\n", t );
    6867  updateDesiredPlace();
    69   jump(NULL);
     68  //jump(NULL);
    7069}
    7170
     
    8382    case ELLIPTICAL:
    8483      {
     84        /*
    8585        //r = actual_place.r
    8686        Orxonox *orx = Orxonox::getInstance();
     
    9595              {
    9696                Vector *start = new Vector(0.0, 1.0, 0.0);
    97                 //r = /*actual_place.r*/ *start - plFocus.r;
    9897                r = *(new Vector(0.0, 5.0, 0.0));
    9998
     
    120119            //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z );
    121120            rAbs = r.len();
    122             if(t < 30.0) /* FIXME!!*/
     121            if(t < 30)
    123122              {
    124123                ka = rAbs / deltaTime*deltaTime;
    125124              }
    126             /* this is the new length of the vector */
    127             //float len = ka * powf((deltaTime - t), 2);
    128            
    129             /* calc the rotation */
    130             /*
    131             Vector axis(0.0, 0.0, 1.0);
    132             if(t < 30.0)
    133               a0 = PI/4 - atanf(fabs(r.x) / fabs(r.y));
    134             printf("a0 = %f\n", a0);
    135             float angle = a0/deltaTime * (deltaTime - t);
    136             printf("angle is: %f\n", angle);
    137             Quaternion q(angle, axis);
    138             */
    139             //r = q.apply(r);
    140             //r = r * (len/r.len());
    141            
    142             //res->quatSlerp(from, to, t/deltaTime, res);
     125
    143126            res->quatSlerp(to, from, t/deltaTime, res);
    144127
    145128            Vector ursp(0.0, 0.0, 0.0);
    146             desiredPlace.r = /*plFocus.r -*/ ursp - res->apply(r);
     129            desiredPlace.r = ursp - res->apply(r);
    147130
    148131            printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z);
    149132            //plLastBPlace = *bound->get_placement();
     133           
    150134          }
     135      */
    151136      }
    152137      break;
    153138    case SMOTH_FOLLOW:
    154139      {
     140        /*
    155141        Placement *plBound = bound->getPlacement();
    156142        Location lcBound;
     
    160146            Vector vDirection(0.0, 0.0, 1.0);
    161147            vDirection = plBound->w.apply(vDirection);
    162             desiredPlace.r = (vDirection * ((lcBound.dist-10.0)/* / l*/)) + Vector(0,0,5.0);
     148            desiredPlace.r = (vDirection * ((lcBound.dist-10.0))) + Vector(0,0,5.0);
    163149          }
     150        */
    164151        break;
    165152      }
     
    167154    case STICKY:
    168155      {
     156        /*
    169157        if(bound != null)
    170158          {
     
    175163            desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset;
    176164          }
     165        */
    177166        break;
    178167      }
    179168      /* the camera is handled like an entity and rolls on the track */
    180169    case NORMAL:
    181       Location lookat; 
    182170      if( bound != NULL && world != NULL )
    183171        {
    184           bound->getLookat (&lookat);
    185           world->calcCameraPos (&lookat, &desiredPlace);
     172          //FIXME: camera should be made via relative coordinates
     173          Vector* cameraOffset = new Vector (-10, 5, 0);
     174          this->setRelCoor (cameraOffset);
    186175        }
    187176      else
    188177        {
     178          /*
    189179          desiredPlace.r = Vector (0,0,0);
    190180          desiredPlace.w = Quaternion ();
     181          */
    191182        }
    192183      break;
     
    237228  // rotation
    238229  float matrix[4][4];
    239   actualPlace.w.conjugate().matrix (matrix);
     230  //this->absDirection.conjugate().matrix (matrix);
    240231  /* orientation and */
    241   glMultMatrixf ((float*)matrix);
     232  //glMultMatrixf ((float*)matrix);
     233
    242234  /*  translation */
    243   glTranslatef (-actualPlace.r.x, -actualPlace.r.y,- actualPlace.r.z);
    244 //Placement *plBound = bound->get_placement();
     235  //glTranslatef (this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z );
     236
    245237
    246238  // ===== second camera control calculation option
    247   /*
    248    gluLookAt(actual_place.r.x, actual_place.r.y, actual_place.r.z,
    249               plBound->r.x, plBound->r.y, plBound->r.z,
    250               0.0, 0.0, 1.0);
    251   */
     239 
     240  gluLookAt(this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z,
     241            this->parent->getAbsCoor ().x, this->parent->getAbsCoor ().y, this->parent->getAbsCoor ().z,
     242            0.0, 1.0, 0.0);
     243 
    252244
    253245  glMatrixMode (GL_MODELVIEW);
     
    255247}
    256248
    257 /**
    258   \brief set the camera position
    259   \param plc: The Placement to set the camera to
    260        
    261         This will set the actual and desired placement of the camera to plc
    262 */
    263 void Camera::jump (Placement* plc = NULL)
    264 {
    265   if( plc == NULL)
    266     {
    267       actualPlace = desiredPlace;
    268       //printf("Camera|jump: camer@ %f, %f, %f\n\n", actual_place.r.x, actual_place.r.y, actual_place.r.z);
    269     }
    270   else
    271     {
    272       desiredPlace = *plc;
    273       actualPlace = *plc;
    274     }
    275 }
     249
    276250
    277251/**
  • orxonox/trunk/src/camera.h

    r3236 r3365  
    88
    99#include "stdincl.h"
     10#include "world_entity.h"
    1011
    11 class WorldEntity;
     12
    1213class World;
    1314
     
    2324enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL};
    2425
    25 class Camera {
     26class Camera : public WorldEntity {
    2627 private:
    2728  WorldEntity* bound;           //!< the WorldEntity the Camera is bound to
    28   Placement actualPlace;                //!< the Camera's current position
    29   Placement desiredPlace;        //!< where the Camera should be according to calculations
    3029  World* world;
    3130 
     
    3736 
    3837  /* elliptical camera mode variables */
    39   Placement plLastBPlace;
    4038  float cameraOffset;
    4139  float cameraOffsetZ;
     
    6361  void apply ();
    6462  void bind (WorldEntity* entity);
    65   void jump (Placement* plc);
    6663  void destroy();
    6764
  • orxonox/trunk/src/curve.cc

    r3217 r3365  
    1111   ### File Specific:
    1212   main-programmer: Benjamin Grauer
    13    co-programmer: ...
     13   co-programmer: Patrick Boenzli
     14
     15   ADD: Patrick Boenzli           B-Spline
     16
    1417
    1518   TODO:
    1619     local-Time implementation
    17      closed Bezier Curve
    1820     NURBS
    1921     
     
    2123
    2224#include "curve.h"
    23 
    24 
     25#include "matrix.h"
     26#include "debug.h"
     27
     28#include <math.h>
     29#include <stdio.h>
    2530
    2631/**
     
    3742  currentNode->next = 0; // not sure if this really points to NULL!!
    3843  currentNode->number = (++nodeCount);
     44  this->rebuild();
    3945  return;
    4046}
    4147
     48/**
     49   \brief Finds a Node by its Number, and returns its Position
     50   \param nodeToFind the n'th node in the List of nodes
     51   \returns A Vector to the Position of the Node.
     52*/
     53Vector Curve::getNode(unsigned int nodeToFind)
     54{
     55  if (nodeToFind > this->nodeCount)
     56    return Vector(0,0,0);
     57  PathNode* tmpNode = this->firstNode;
     58  for (int i = 1; i < nodeToFind; i++)
     59    tmpNode = tmpNode->next;
     60  return tmpNode->position;
     61}
     62
     63///////////////////////////////////
     64/// Bezier Curve //////////////////
     65///////////////////////////////////
    4266
    4367/**
     
    4569*/
    4670BezierCurve::BezierCurve (void)
     71{
     72  this->derivation = 0;
     73  dirCurve = new BezierCurve(1);
     74  this->init();
     75}
     76
     77/**
     78   \brief Creates a new BezierCurve-Derivation-Curve
     79*/
     80BezierCurve::BezierCurve (int derivation)
     81{
     82  this->derivation = derivation;
     83  dirCurve=NULL;
     84  this->init();
     85}
     86
     87/**
     88   \brief Deletes a BezierCurve.
     89
     90   It does this by freeing all the space taken over from the nodes
     91*/
     92BezierCurve::~BezierCurve(void)
     93{
     94  PathNode* tmpNode;
     95  currentNode = firstNode;
     96  while (tmpNode != 0)
     97    {
     98      tmpNode = currentNode;
     99      currentNode = currentNode->next;
     100      delete tmpNode;
     101    }
     102  if (dirCurve)
     103    delete dirCurve;
     104}
     105
     106/**
     107   \brief Initializes a BezierCurve
     108*/
     109void BezierCurve::init(void)
    47110{
    48111  nodeCount = 0;
     
    58121
    59122/**
    60    \brief Deletes a BezierCurve.
     123   \brief Rebuilds a Curve
     124*/
     125void BezierCurve::rebuild(void)
     126{
     127  PathNode* tmpNode = firstNode;
     128
     129  // rebuilding the Curve itself
     130  float k=0;
     131  float n = nodeCount -1;
     132  float binCoef = 1;
     133  while(tmpNode)
     134    {
     135      tmpNode->factor = binCoef;
     136      if (tmpNode =tmpNode->next)
     137        {
     138          binCoef *=(n-k)/(k+1);
     139          ++k;
     140        }
     141    }
     142
     143  // rebuilding the Derivation curve
     144  if(this->derivation == 0)
     145    {
     146      tmpNode = firstNode;
     147      delete dirCurve;
     148      dirCurve = new BezierCurve(1);
     149      while(tmpNode->next)
     150        {
     151          Vector tmpVector = (tmpNode->next->position)- (tmpNode->position);
     152          tmpVector.x*=(float)nodeCount;
     153          tmpVector.y*=(float)nodeCount;
     154          tmpVector.z*=(float)nodeCount;
     155          tmpVector.normalize();
     156          this->dirCurve->addNode(tmpVector);
     157          tmpNode = tmpNode->next;
     158        }
     159    }
     160}
     161
     162/**
     163   \brief calculates the Position on the curve
     164   \param t The position on the Curve (0<=t<=1)
     165   \return the Position on the Path
     166*/
     167Vector BezierCurve::calcPos(float t)
     168{
     169  Vector ret = Vector(0.0,0.0,0.0);
     170  if (this->nodeCount >= 3)
     171    {
     172      PathNode* tmpNode = this->firstNode;
     173      double factor = pow(1.0-t,nodeCount-1);
     174      while(tmpNode)
     175        {
     176          ret.x += tmpNode->factor * factor * tmpNode->position.x;
     177          ret.y += tmpNode->factor * factor * tmpNode->position.y;
     178          ret.z += tmpNode->factor * factor * tmpNode->position.z;
     179          factor *= t/(1.0-t); // same as pow but much faster.
     180         
     181          tmpNode = tmpNode->next;
     182        }
     183    }
     184  else if (nodeCount == 2)
     185    {
     186      ret = this->firstNode->position *(1.0-t);
     187      ret = ret + this->firstNode->next->position * t;
     188    }
     189  else if (nodeCount == 1)
     190    ret = this->firstNode->position;
     191  return ret;
     192}
     193
     194/**
     195   \brief Calulates the direction of the Curve at time t.
     196   \param The time at which to evaluate the curve.
     197   \returns The vvaluated Vector.
     198*/
     199Vector BezierCurve::calcDir (float t)
     200{
     201  return dirCurve->calcPos(t);
     202}
     203
     204/**
     205   \brief Calculates the Quaternion needed for our rotations
     206   \param t The time at which to evaluate the cuve.
     207   \returns The evaluated Quaternion.
     208*/
     209Quaternion BezierCurve::calcQuat (float t)
     210{
     211  return Quaternion (calcDir(t), Vector(0,0,1));
     212}
     213
     214
     215/**
     216  \brief returns the Position of the point calculated on the Curve
     217  \return a Vector to the calculated position
     218*/
     219Vector BezierCurve::getPos(void) const
     220{
     221  return curvePoint;
     222}
     223
     224
     225
     226///////////////////////////////////
     227//// Uniform Point curve  /////////
     228///////////////////////////////////
     229/**
     230   \brief Creates a new UPointCurve
     231*/
     232UPointCurve::UPointCurve (void)
     233{
     234  this->derivation = 0;
     235  this->init();
     236}
     237
     238/**
     239   \brief Creates a new UPointCurve-Derivation-Curve of deriavation'th degree
     240*/
     241UPointCurve::UPointCurve (int derivation)
     242{
     243  this->derivation = derivation;
     244  dirCurve=NULL;
     245  this->init();
     246}
     247
     248/**
     249   \brief Deletes a UPointCurve.
    61250
    62251   It does this by freeing all the space taken over from the nodes
    63252*/
    64 BezierCurve::~BezierCurve (void)
     253UPointCurve::~UPointCurve(void)
    65254{
    66255  PathNode* tmpNode;
     
    72261      delete tmpNode;
    73262    }
     263  if (dirCurve)
     264    delete dirCurve;
     265}
     266
     267/**
     268   \brief Initializes a UPointCurve
     269*/
     270void UPointCurve::init(void)
     271{
     272  nodeCount = 0;
     273  firstNode = new PathNode;
     274  currentNode = firstNode;
     275
     276  firstNode->position = Vector (.0, .0, .0);
     277  firstNode->number = 0;
     278  firstNode->next = 0; // not sure if this really points to NULL!!
     279
     280  return;
     281}
     282
     283/**
     284   \brief Rebuilds a UPointCurve
     285   
     286   \todo very bad algorithm
     287*/
     288void UPointCurve::rebuild(void)
     289{
     290  // rebuilding the Curve itself
     291  PathNode* tmpNode = this->firstNode;
     292  int i=0;
     293  Matrix xTmpMat = Matrix(this->nodeCount, this->nodeCount);
     294  Matrix yTmpMat = Matrix(this->nodeCount, this->nodeCount);
     295  Matrix zTmpMat = Matrix(this->nodeCount, this->nodeCount);
     296  Matrix xValMat = Matrix(this->nodeCount, 3);
     297  Matrix yValMat = Matrix(this->nodeCount, 3);
     298  Matrix zValMat = Matrix(this->nodeCount, 3);
     299  while(tmpNode)
     300    {
     301      Vector fac = Vector(1,1,1);
     302      for (int j = 0; j < this->nodeCount; j++)
     303        {
     304          xTmpMat(i,j) = fac.x; fac.x *= (float)i/(float)this->nodeCount;//tmpNode->position.x;
     305          yTmpMat(i,j) = fac.y; fac.y *= (float)i/(float)this->nodeCount;//tmpNode->position.y;
     306          zTmpMat(i,j) = fac.z; fac.z *= (float)i/(float)this->nodeCount;//tmpNode->position.z;
     307        }
     308      xValMat(i,0) = tmpNode->position.x;
     309      yValMat(i,0) = tmpNode->position.y;
     310      zValMat(i,0) = tmpNode->position.z;
     311      ++i;
     312      tmpNode = tmpNode->next;
     313    }
     314  tmpNode = this->firstNode;
     315  xValMat = xTmpMat.Inv() *= xValMat;
     316  yValMat = yTmpMat.Inv() *= yValMat;
     317  zValMat = zTmpMat.Inv() *= zValMat;
     318  i = 0;
     319  while(tmpNode)
     320    {
     321      tmpNode->vFactor.x = xValMat(i,0);
     322      tmpNode->vFactor.y = yValMat(i,0);
     323      tmpNode->vFactor.z = zValMat(i,0);
     324
     325      i++;
     326      tmpNode = tmpNode->next;
     327    }
    74328}
    75329
     
    79333   \return the Position on the Path
    80334*/
    81 Vector BezierCurve::calcPos(float t)
    82 {
    83   if (nodeCount <=4)
    84     {
    85       //      if (verbose >= 1)
    86       //      printf ("Please define at least 4 nodes, until now you have only defined %i.\n", nodeCount);
    87       return Vector(0,0,0);
    88     }
     335Vector UPointCurve::calcPos(float t)
     336{
    89337  PathNode* tmpNode = firstNode;
    90    
    91338  Vector ret = Vector(0.0,0.0,0.0);
    92   double factor;
    93   int k=0;
    94   while(tmpNode!=0)
    95     {
    96       k++;
    97       factor = ncr (nodeCount, k);
    98      
    99       for (int j=0; j<nodeCount-k; j++)
    100         factor*=(1-t);
    101       for (int j=0; j<k; j++)
    102         factor*=t;
    103       ret.x += factor * tmpNode->position.x;
    104       ret.y += factor * tmpNode->position.y;
    105       ret.z += factor * tmpNode->position.z;
    106      
     339  float factor = 1.0;
     340  while(tmpNode)
     341    {
     342      ret.x += tmpNode->vFactor.x * factor;
     343      ret.y += tmpNode->vFactor.y * factor;
     344      ret.z += tmpNode->vFactor.z * factor;
     345      factor *= t;
     346
    107347      tmpNode = tmpNode->next;
    108 
    109348    }
    110349  return ret;
     
    116355   \returns The vvaluated Vector.
    117356*/
    118 Vector BezierCurve::calcDir (float t)
     357Vector UPointCurve::calcDir (float t)
    119358{
    120359  PathNode* tmpNode = firstNode;
    121   BezierCurve* tmpCurve = new BezierCurve();
    122   Vector ret;
    123   Vector tmpVector;
    124 
    125   while (tmpNode->next != 0)
    126     {
    127       tmpVector = (tmpNode->next->position)- (tmpNode->position);
    128       tmpVector.x*=(float)nodeCount;
    129       tmpVector.y*=(float)nodeCount;
    130       tmpVector.z*=(float)nodeCount;
    131 
    132       tmpCurve->addNode(tmpVector);
     360  Vector ret = Vector(0.0,0.0,0.0);
     361  float factor = 1.0/t;
     362  int k=0;
     363  while(tmpNode)
     364    {
     365      ret.x += tmpNode->vFactor.x * factor *k;
     366      ret.y += tmpNode->vFactor.y * factor *k;
     367      ret.z += tmpNode->vFactor.z * factor *k;
     368      factor *= t;
     369      k++;
    133370      tmpNode = tmpNode->next;
    134371    }
    135   ret = tmpCurve->calcPos(t);
    136372  ret.normalize();
    137 
    138373  return ret;
    139374}
     
    144379   \returns The evaluated Quaternion.
    145380*/
    146 Quaternion BezierCurve::calcQuat (float t)
     381Quaternion UPointCurve::calcQuat (float t)
    147382{
    148383  return Quaternion (calcDir(t), Vector(0,0,1));
     
    154389  \return a Vector to the calculated position
    155390*/
    156 Vector BezierCurve::getPos() const
     391Vector UPointCurve::getPos(void) const
    157392{
    158393  return curvePoint;
    159394}
    160 
    161 /**
    162    \brief ncr-calculator, did not find an other method
    163    \todo a c++ variante to do this
    164 */
    165 int ncr(int n, int i)
    166 {
    167   int ret = 1;
    168   for (int k=1; k<=n; k++)
    169     ret*=k;
    170   for (int k=1; k<=i; k++)
    171     ret/=k;
    172   for (int k=1; k<=n-i; k++)
    173     ret/=k;
    174 
    175   return ret;
    176 }
    177 
  • orxonox/trunk/src/curve.h

    r3217 r3365  
     1
    12/*!
    23    \file curve.h
     
    1112#include "vector.h"
    1213
     14//! An Enumerator that defines what sort of Curves are availible
     15enum CurveType {BEZIERCURVE, UPOINTCURVE};
    1316
    14 //! An abstract class to handle curves.
     17
     18//! An abstract class to handle curves. Needed for the Tracking system in orxonox.
    1519class Curve
    1620{
     
    1923  Vector curvePoint;     //!< The point on the Cureve at a local Time.
    2024  float localTime;       //!< If the time of one point is asked more than once the programm will not calculate it again.
     25  Curve* dirCurve;       //!< The derivation-curve of this Curve.
     26  int derivation;        //!< Which derivation of a Curve is this.
    2127
    2228  //! Handles the curve-points (dynamic List)
     
    2430  {
    2531    int number;          //!< The N-th node of this curve.
     32    float factor;        //!< Curve specific multiplier factor.
     33    Vector vFactor;      //!< A Vector-factor for multipliing.
    2634    Vector position;     //!< Vector Pointung to this curve-point.
    2735    PathNode* next;      //!< Pointer to the next Node.
     
    3139  PathNode* currentNode; //!< The node we are working with (the Last node).
    3240
     41 private:
     42  virtual void rebuild(void) = 0;
    3343 public:
    34   void addNode (const Vector& newNode);
     44  void addNode(const Vector& newNode);
     45  Vector getNode(unsigned int nodeToFind);
     46  inline int getNodeCount(void) { return this->nodeCount;}
    3547
     48  virtual Vector calcPos(float t) = 0;
     49  virtual Vector calcDir(float t) = 0;
     50  virtual Quaternion calcQuat(float t) = 0;
     51 
    3652};
    3753
    38 //! Bezier Curve
     54//!    Class to handle bezier curves in 3-dimesnsional space
    3955/**
    40    Class to handle bezier curves in 3-dimesnsional space
    41    
    42    needed for  the Tracking system in OrxOnoX.
     56   This Curve is good, for Fast Interaction. If you want to change it during the game, go on.
     57   !!be aware!! BezierCurves only flow through their first and last Node. Their Tangents at those Points a directed to the second and second-last Point.
    4358*/
    4459class BezierCurve : public Curve
    4560{
    4661 private:
    47   // all from Curve-Class
     62  void rebuild(void);
    4863 public:
    49   BezierCurve (void);
    50   ~BezierCurve (void);
    51   Vector calcPos (float t);
    52   Vector calcDir (float t);
    53   Quaternion calcQuat (float t);
     64  BezierCurve(void);
     65  BezierCurve(int derivation);
     66  ~BezierCurve(void);
     67  void init(void);
     68
     69  Vector calcPos(float t);
     70  Vector calcDir(float t);
     71  Quaternion calcQuat(float t);
    5472 
    5573 
    56   Vector getPos () const;
     74  Vector getPos(void) const;
    5775};
    5876
    59 int ncr(int n, int i);
     77
     78//! B-Spline
     79/**
     80   class to handle b-spline in 3d space
     81*/
     82class BSplieCurve : public Curve
     83{
    6084
    6185
     86};
     87
     88//! Uniform Point Curve-class
     89/**
     90   A UPoint Curve is a A Curve, that flows through all the nodes given it.
     91   The Algorithm to buid the curve is rather slow, but Painting and tracing along the curve has high speed, so do not change this curve during the Game.
     92
     93   This Curve is very erattic, so i do not recommend to use it.
     94*/
     95class UPointCurve : public Curve
     96{
     97 private:
     98  void rebuild(void);
     99 public:
     100  UPointCurve(void);
     101  UPointCurve(int derivation);
     102  ~UPointCurve(void);
     103  void init(void);
     104
     105  Vector calcPos(float t);
     106  Vector calcDir(float t);
     107  Quaternion calcQuat(float t);
     108 
     109  Vector getPos(void) const;
     110};
     111
    62112#endif /* _CURVE_H */
  • orxonox/trunk/src/data_tank.cc

    r2190 r3365  
    1919using namespace std;
    2020
     21long DataTank::timeStamp = 0;
     22
    2123DataTank::DataTank () {}
    2224DataTank::~DataTank () {}
  • orxonox/trunk/src/data_tank.h

    r3224 r3365  
    1010  ~DataTank ();
    1111
     12  static long timeStamp;
     13
    1214};
    1315
  • orxonox/trunk/src/debug.h

    r3293 r3365  
    88
    99#ifdef  DEBUG
     10extern int verbose;
    1011#define PRINTF(x) \
    1112           PRINTF ## x
  • orxonox/trunk/src/environment.cc

    r3236 r3365  
    2121#include "world_entity.h"
    2222#include "vector.h"
     23#include "importer/model.h"
    2324
    2425using namespace std;
    2526
    2627
    27 //Sorry Bensch
    28 #define LEVEL_LENGTH 500
    2928
    3029Environment::Environment () : WorldEntity()
    3130{
    32 
    33   /*
    34   //Sorry Bensch: x,y = 10
    35   for (int x = 0; x < 50; x++)
    36     {
    37       for (int y = 0; y < 50; y++)
    38         {
    39           mountainTest[x][y] =0;
    40                                                  
    41         }
    42     }
    43   //Sorry Bensch: x,y = 9
    44   for (int x = 1; x < LEVEL_LENGTH; x++)
    45     {
    46       for (int y = 1; y < LEVEL_LENGTH; y++)
    47         {
    48           //mountainTest[x][y] = (float)random() / 900000000;
    49           mountainTest[x][y] = (float)(random() % 4);                                       
    50         }
    51     }
    52   */
     31  this->model = new Model("reaplow.obj");
    5332}
    5433
    5534
    5635
    57 Environment::~Environment () {}
     36Environment::~Environment ()
     37{
     38  delete this->model;
     39}
    5840
    5941void Environment::tick (float time) {}
     
    7153  float matrix[4][4];
    7254 
    73   glTranslatef(getPlacement()->r.x,getPlacement()->r.y,getPlacement()->r.z);
    74   getPlacement()->w.matrix (matrix);
    75   glMultMatrixf ((float*)matrix);
    76 
    77   glBegin(GL_TRIANGLES);
    78   glColor3f(1,0,1);
    79   glVertex3f(0,0,0.5);
    80   glVertex3f(-0.5,0,-1);
    81   glVertex3f(0.5,0,-1);
     55  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     56  //rotate
     57  this->getAbsDir ().matrix (matrix);
     58  glMultMatrixf((float*)matrix);
    8259 
    83   glVertex3f(0,0,0.5);
    84   glVertex3f(0,0.5,-1);
    85   glVertex3f(0,-0.5,-1);
    86   glEnd();
    87    
    88   glBegin(GL_QUADS);
    89   glColor3f(1,0,1);
    90   glVertex3f(0.5,0.5,-1);
    91   glVertex3f(0.5,-0.5,-1);
    92   glVertex3f(-0.5,-0.5,-1);
    93   glVertex3f(-0.5,0.5,-1);
    94   glEnd();
     60  glMatrixMode(GL_MODELVIEW);
     61  this->model->draw();
    9562}
    9663
    97 /*
    98 void Environment::paint()
    99 {
    100  
    101   glPushMatrix();
    102   //glScalef(0.5, 0.5, 1.0);
    103   //glTranslatef(xCor, yCor, zCor);
    104   glTranslatef( -16.0, -2.0, 0.0);
    105  
    106   glColor3f(0.0, 1.0, 0.0);
    107  
    108   glBegin(GL_LINES);
    109   for (int x = 0; x < LEVEL_LENGTH; x += 1)
    110     {
    111       for (int y = 0; y < 190; y += 1)
    112         {
    113           glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
    114           glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]);
    115         }
    116     }
    117   glEnd();
    118  
    119  
    120   glBegin(GL_LINES);
    121   for (int y = 0; y < LEVEL_LENGTH; y += 1)
    122     {
    123       for (int x = 0; x < 90; x += 1)
    124         {
    125           glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
    126           glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]);
    127         }
    128     }
    129   glEnd();
    130  
    131   glPopMatrix();
    132  
    133 }
    134 
    135 void Environment::drawEnvironment()
    136 {
    137 
    138 }
    139 
    140 */
  • orxonox/trunk/src/importer/Makefile.am

    r3201 r3365  
    88importer_SOURCES= framework.cc \
    99                  windowHandler.cc \
    10                   object.cc \
     10                  model.cc \
    1111                  array.cc \
    1212                  material.cc \
     13                  texture.cc \
    1314                  vector.cc
    1415
    1516noinst_HEADERS= framework.h \
    1617                windowHandler.h \
    17                 object.h \
     18                model.h \
    1819                array.h \
    19                 material.h
     20                material.h \
     21                texture.h
    2022
    2123
  • orxonox/trunk/src/importer/Makefile.in

    r3219 r3365  
    5454PROGRAMS = $(bin_PROGRAMS)
    5555am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \
    56         object.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \
    57         vector.$(OBJEXT)
     56        model.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \
     57        texture.$(OBJEXT) vector.$(OBJEXT)
    5858importer_OBJECTS = $(am_importer_OBJECTS)
    5959importer_LDADD = $(LDADD)
     
    6262am__depfiles_maybe = depfiles
    6363@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \
    64 @AMDEP_TRUE@    ./$(DEPDIR)/material.Po ./$(DEPDIR)/object.Po \
    65 @AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po
     64@AMDEP_TRUE@    ./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \
     65@AMDEP_TRUE@    ./$(DEPDIR)/texture.Po ./$(DEPDIR)/vector.Po \
     66@AMDEP_TRUE@    ./$(DEPDIR)/windowHandler.Po
    6667CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    6768        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     
    176177importer_SOURCES = framework.cc \
    177178                  windowHandler.cc \
    178                   object.cc \
     179                  model.cc \
    179180                  array.cc \
    180181                  material.cc \
     182                  texture.cc \
    181183                  vector.cc
    182184
    183185noinst_HEADERS = framework.h \
    184186                windowHandler.h \
    185                 object.h \
     187                model.h \
    186188                array.h \
    187                 material.h
     189                material.h \
     190                texture.h
    188191
    189192all: all-am
     
    256259@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@
    257260@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
    258 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
     261@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
     262@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    259263@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
    260264@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@
  • orxonox/trunk/src/importer/framework.cc

    r3237 r3365  
    5252int main(int argc, char *argv[])
    5353{
    54   int verbose = 3;
     54  verbose = 2;
    5555
    5656  PRINTF(2)("This is The big verbose-Test %i, %s\n", 1, "cool");
     
    7171  PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h);
    7272  if (argc>=3)
    73     obj = new Object (argv[1], atof(argv[2]));
     73    obj = new Model (argv[1], atof(argv[2]));
    7474  else if (argc>=2)
    75     obj = new Object(argv[1]);
     75    obj = new Model(argv[1]);
    7676  else
    77     obj = new Object();
     77    obj = new Model();
    7878 
    7979  M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0);
     
    215215          case SDLK_c:
    216216            if (!obj)
    217               obj = new Object(argv[1]);
     217              obj = new Model(argv[1]);
    218218            break;
    219219          }
  • orxonox/trunk/src/importer/framework.h

    r2963 r3365  
    33 
    44#include "windowHandler.h" // Include the Whandler Basecode
    5 #include "object.h"
     5#include "model.h"
    66#include "vector.h"
    77
     
    3333
    3434WindowHandler wHandler;  // Create an instance of the whandler basecode class
    35 Object* obj;
     35Model* obj;
    3636
    3737
  • orxonox/trunk/src/importer/material.cc

    r3208 r3365  
    1313   co-programmer: ...
    1414
    15    TGA-code: borrowed from nehe-Tutorials
    16 
    1715*/
    1816
    1917#include "material.h"
    2018
    21 // headers only for PathList
    22 #include <unistd.h>
    23 #include <sys/types.h>
    24 #include <sys/stat.h>
    25 #include <stdlib.h>
    26 #include <fstream>
    27 
    2819using namespace std;
    2920
    30 /**
    31    \brief creates a ned PathList.
    32    
    33    It is a good idea to use this as an initial List,
    34    because if you give on a name the Path will not be checked for its existence.
    35 */
    36 PathList::PathList()
    37 {
    38   this->pathName = NULL;
    39   this->next = NULL;
    40 }
    41 
    42 /**
    43    \brief Creates a new PathList with a Name.
    44    \param pName the Name of The Path.
    45 
    46    This function just adds the Path without checking if it exists.
    47 */
    48 PathList::PathList(char* pName)
    49 {
    50   this->pathName = new char [strlen(pName)+1];
    51   strcpy (this->pathName, pName);
    52   this->next = NULL;
    53 }
    54 
    55 /**
    56    \brief destroys a PathList
    57 
    58    It does this by deleting the Name and then delete its preceding PathList.
    59 */
    60 PathList::~PathList()
    61 {
    62   if (this->pathName)
    63     delete []this->pathName;
    64   if (this->next)
    65     delete this->next;
    66 }
    67 
    68 /**
    69    \brief Adds a new Pathlist Element.
    70    \param pName
    71    
    72    Adding a Path automatically checks if the Path exists,
    73    and if it does not it will not add it to the List.
    74 */
    75 void PathList::addPath (char* pName)
    76 {
    77   if (pName[0] == '\0')
    78     {
    79       PRINTF(3)("not Adding empty Path to the List.\n");
    80       return;
    81     }
    82   char* tmpPName = new char[strlen(pName)];
    83   strncpy(tmpPName, pName, strlen(pName)-1);
    84   tmpPName[strlen(pName)-1] = '\0';
    85   if (access (tmpPName, F_OK) == 0)
    86     {
    87       struct stat status;
    88       stat(tmpPName, &status);
    89       if (status.st_mode & S_IFDIR)
    90         {
    91           PRINTF(2)("Adding Path %s to the PathList.\n", pName);
    92           PathList* tmpPathList = this;
    93           while (tmpPathList->next)
    94             tmpPathList = tmpPathList->next;
    95           tmpPathList->next = new PathList(pName);
    96         }
    97       else
    98         PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName);
    99     }
    100   else
    101       PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName);
    102   delete []tmpPName;
    103 }
    10421
    10522/**
     
    13350  if (this->name)
    13451    delete []this->name;
    135   if (this->diffuseTextureSet)
    136     glDeleteTextures (1, &this->diffuseTexture);
     52  if (this->diffuseTexture)
     53    this->diffuseTexture;
    13754  if (this->nextMat)
    13855    delete this->nextMat;
     
    17289  this->setTransparency(0.0);
    17390
    174   if (!this->pathList)
    175     this->pathList = new PathList("");
    176 
     91
     92  this->diffuseTexture = NULL;
     93  this->ambientTexture = NULL;
     94  this->specularTexture = NULL;
    17795
    17896  this->diffuseTextureSet = false;
     
    182100 
    183101}
    184 
    185 PathList *Material::pathList = NULL;
    186102
    187103/**
     
    233149
    234150  if (this->diffuseTextureSet)
    235     glBindTexture(GL_TEXTURE_2D, this->diffuseTexture);
     151    glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
    236152  else
    237153    glBindTexture(GL_TEXTURE_2D, 0);
     
    394310void Material::addTexturePath(char* pathName)
    395311{
    396   this->pathList->addPath (pathName);
    397 }
    398 
    399 /**
    400    \brief Searches for a Texture inside one of the defined Paths
    401    \param texName The name of the texture o search for.
    402    \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
    403 */
    404 char* Material::searchTextureInPaths(char* texName) const
    405 {
    406   char* tmpName = NULL;
    407   PathList* pList = pathList;
    408   while (pList)
    409     {
    410       if (pList->pathName)
    411         {
    412           tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];
    413           strcpy(tmpName, pList->pathName);
    414         }
    415       else
    416         {
    417           tmpName = new char [strlen(texName)+1];
    418           tmpName[0]='\0';
    419         }
    420       strcat(tmpName, texName);
    421       if (access (tmpName, F_OK) == 0)
    422         return tmpName;
    423      
    424       if (tmpName)
    425         delete []tmpName;
    426       tmpName = NULL;
    427       pList = pList->next;
    428     }
    429   return NULL;
    430 }
    431 
     312  PathList::getInstance()->addPath(pathName);
     313}
    432314
    433315// MAPPING //
     
    440322{
    441323  PRINTF(3)("setting Diffuse Map %s\n", dMap);
    442 
    443   //  diffuseTextureSet = loadBMP(dMap, &diffuseTexture);
    444   this->diffuseTextureSet = this->loadImage(dMap, &this->diffuseTexture);
     324  diffuseTexture = new Texture();
     325  this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
    445326
    446327}
     
    477358
    478359}
    479 
    480 /**
    481    \brief Loads a Texture to the openGL-environment.
    482    \param pImage The Image to load to openGL
    483    \param texture The Texture to apply it to.
    484 */
    485 bool Material::loadTexToGL (Image* pImage, GLuint* texture)
    486 {
    487   PRINTF(2)("Loading texture to OpenGL-Environment.\n");
    488   glGenTextures(1, texture);
    489   glBindTexture(GL_TEXTURE_2D, *texture);
    490   /* not Working, and not needed.
    491   glTexImage2D( GL_TEXTURE_2D, 0, 3, width,
    492                 height, 0, GL_BGR,
    493                 GL_UNSIGNED_BYTE, map->pixels );
    494   */
    495   gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, GL_RGB, GL_UNSIGNED_BYTE, pImage->data);
    496  
    497   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
    498   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
    499 }
    500 
    501 
    502 #ifdef HAVE_SDL_SDL_IMAGE_H
    503 bool Material::loadImage(char* imageName, GLuint* texture)
    504 {
    505   char* imgNameWithPath = searchTextureInPaths(imageName);
    506   if (imgNameWithPath)
    507     {
    508       SDL_Surface* map;
    509       Image* pImage = new Image;
    510       map=IMG_Load(imgNameWithPath);
    511       if(!map)
    512         {
    513           PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
    514           return false;
    515         }
    516       pImage->height = map->h;
    517       pImage->width  = map->w;
    518       pImage->data   = (GLubyte*)map->pixels;
    519       if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))
    520         for (int i=0;i<map->h * map->w *3;i+=3)
    521           {
    522             GLuint temp = pImage->data[i];
    523             pImage->data[i] = pImage->data[i+2];
    524             pImage->data[i+2] = temp;
    525           }
    526       this->loadTexToGL (pImage, texture);
    527     }
    528   else
    529     {
    530       PRINTF(1)("Image not Found: %s\n", imgNameWithPath);
    531       return false;
    532     }
    533 }
    534 
    535 
    536 #else /* HAVE_SDL_SDL_IMAGE_H */
    537 /**
    538    \brief Makes the Programm ready to Read-in a texture-File
    539    1. Checks what type of Image should be imported
    540    2. ToDO: Checks where to find the Image
    541 */
    542 bool Material::loadImage(char* imageName, GLuint* texture)
    543 {
    544   char* imgNameWithPath = searchTextureInPaths(imageName);
    545   if (imgNameWithPath)
    546     {
    547       if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4))
    548         {
    549           PRINTF(3)("Requested bmp-image. Trying to Import.\n");
    550           return this->loadBMP(imgNameWithPath, texture);
    551         }
    552      
    553       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5))
    554         {
    555           PRINTF(3)("Requested jpeg-image. Trying to Import\n");
    556           return this->loadJPG(imgNameWithPath, texture);
    557         }
    558       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4))
    559         {
    560           PRINTF(3)("Requested tga-image. Trying to Import\n");
    561           return this->loadTGA(imgNameWithPath, texture);
    562         }
    563       else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4))
    564         {
    565           PRINTF(3)("Requested png-image. Trying to Import\n");
    566           return this->loadPNG(imgNameWithPath, texture);
    567         }
    568       else
    569         {
    570           PRINTF(1)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);
    571           return false;
    572         }
    573     }
    574   else
    575     {
    576       PRINTF(1)("Image not Found: %s\n", imgNameWithPath);
    577       return false;
    578     }
    579 }
    580 
    581 /**
    582    \brief reads in a Windows BMP-file, and imports it to openGL.
    583    \param bmpName The name of the Image to load.
    584    \param texture A pointer to the Texture which should be read to.
    585 */
    586 bool Material::loadBMP (char* bmpName, GLuint* texture)
    587 {
    588   Image* pImage = new Image;
    589   FILE *file;
    590   unsigned long size;                 // size of the image in bytes.
    591   unsigned long i;                    // standard counter.
    592   unsigned short int planes;          // number of planes in image (must be 1)
    593   unsigned short int bpp;             // number of bits per pixel (must be 24)
    594   GLuint temp;                          // temporary color storage for bgr-rgb conversion.
    595 
    596   // make sure the file is there.
    597   if ((file = fopen(bmpName, "rb"))==NULL)
    598     {
    599       PRINTF(1)("File Not Found : %s\n",bmpName);
    600       return false;
    601     }
    602   // seek through the bmp header, up to the width/height:
    603   fseek(file, 18, SEEK_CUR);
    604  
    605   // read the width
    606   if ((i = fread(&pImage->width, 4, 1, file)) != 1)
    607     {
    608       PRINTF(1)("Error reading width from %s.\n", bmpName);
    609       return false;
    610     }
    611   // read the height
    612   if ((i = fread(&pImage->height, 4, 1, file)) != 1)
    613     {
    614       PRINTF(1)("Error reading height from %s.\n", bmpName);
    615       return false;
    616     }
    617  
    618   // calculate the size (assuming 24 bits or 3 bytes per pixel).
    619   size = pImage->width * pImage->height * 3;
    620  
    621   // read the planes
    622   if ((fread(&planes, 2, 1, file)) != 1)
    623     {
    624       PRINTF(1)("Error reading planes from %s.\n", bmpName);
    625       return false;
    626     }
    627   if (planes != 1)
    628     {
    629       PRINTF(1)("Planes from %s is not 1: %u\n", bmpName, planes);
    630       return false;
    631     }
    632  
    633   // read the bpp
    634   if ((i = fread(&bpp, 2, 1, file)) != 1)
    635     {
    636       PRINTF(1)("Error reading bpp from %s.\n", bmpName);
    637       return false;
    638     }
    639   if (bpp != 24)
    640     {
    641       PRINTF(1)("Bpp from %s is not 24: %u\n", bmpName, bpp);
    642       return false;
    643     }
    644  
    645   // seek past the rest of the bitmap header.
    646   fseek(file, 24, SEEK_CUR);
    647  
    648   // read the data.
    649   pImage->data = (GLubyte *) malloc(size);
    650   if (pImage->data == NULL)
    651     {
    652       PRINTF(1)("Error allocating memory for color-corrected image data");
    653       return false;     
    654     }
    655  
    656   if ((i = fread(pImage->data, size, 1, file)) != 1)
    657     {
    658       PRINTF(1)("Error reading image data from %s.\n", bmpName);
    659       return false;
    660     }
    661   fclose(file);
    662 
    663   // reverse all of the colors. (bgr -> rgb)
    664   for (i=0;i<size;i+=3)
    665     {
    666       temp = pImage->data[i];
    667       pImage->data[i] = pImage->data[i+2];
    668       pImage->data[i+2] = temp;
    669     }
    670   this->loadTexToGL (pImage, texture);
    671  
    672 
    673   if (pImage)
    674     {
    675       if (pImage->data)
    676         {
    677           free(pImage->data);
    678         }
    679      
    680       free(pImage);
    681     }
    682   return true;
    683 
    684 }
    685 
    686 /**
    687    \brief reads in a jpg-file
    688    \param jpgName the Name of the Image to load
    689    \param texture a reference to the Texture to write the image to
    690 */
    691 bool Material::loadJPG (char* jpgName, GLuint* texture)
    692 {
    693 #ifdef HAVE_JPEGLIB_H
    694   struct jpeg_decompress_struct cinfo;
    695   Image *pImage = NULL;
    696   FILE *pFile;
    697  
    698   // Open a file pointer to the jpeg file and check if it was found and opened
    699   if((pFile = fopen(jpgName, "rb")) == NULL)
    700     {
    701       // Display an error message saying the file was not found, then return NULL
    702       PRINTF(1)("Unable to load JPG File %s.\n", jpgName);
    703       return false;
    704     }
    705  
    706   // Create an error handler
    707   jpeg_error_mgr jerr;
    708  
    709   // Have our compression info object point to the error handler address
    710   cinfo.err = jpeg_std_error(&jerr);
    711  
    712   // Initialize the decompression object
    713   jpeg_create_decompress(&cinfo);
    714  
    715   // Specify the data source (Our file pointer)
    716   jpeg_stdio_src(&cinfo, pFile);
    717  
    718   // Allocate the structure that will hold our eventual jpeg data (must free it!)
    719   pImage = (Image*)malloc(sizeof(Image));
    720  
    721   // DECOFING
    722   // Read in the header of the jpeg file
    723   jpeg_read_header(&cinfo, TRUE);
    724  
    725   // Start to decompress the jpeg file with our compression info
    726   jpeg_start_decompress(&cinfo);
    727  
    728   // Get the image dimensions and row span to read in the pixel data
    729   pImage->rowSpan = cinfo.image_width * cinfo.num_components;
    730   pImage->width   = cinfo.image_width;
    731   pImage->height   = cinfo.image_height;
    732  
    733   // Allocate memory for the pixel buffer
    734   pImage->data = new unsigned char[pImage->rowSpan * pImage->height];
    735  
    736   // Here we use the library's state variable cinfo.output_scanline as the
    737   // loop counter, so that we don't have to keep track ourselves.
    738  
    739   // Create an array of row pointers
    740   unsigned char** rowPtr = new unsigned char*[pImage->height];
    741   for (int i = 0; i < pImage->height; i++)
    742     rowPtr[i] = &(pImage->data[i*pImage->rowSpan]);
    743  
    744   // Now comes the juice of our work, here we extract all the pixel data
    745   int rowsRead = 0;
    746   while (cinfo.output_scanline < cinfo.output_height)
    747     {
    748       // Read in the current row of pixels and increase the rowsRead count
    749       rowsRead += jpeg_read_scanlines(&cinfo, &rowPtr[rowsRead], cinfo.output_height - rowsRead);
    750     }
    751  
    752   // Delete the temporary row pointers
    753   delete [] rowPtr;
    754  
    755   // Finish decompressing the data
    756   jpeg_finish_decompress(&cinfo);//  decodeJPG(&cinfo, pImage);
    757  
    758   // This releases all the stored memory for reading and decoding the jpeg
    759   jpeg_destroy_decompress(&cinfo);
    760  
    761   // Close the file pointer that opened the file
    762   fclose(pFile);
    763  
    764 
    765   if(pImage == NULL)
    766     exit(0);
    767  
    768   this->loadTexToGL (pImage, texture);
    769   if (pImage)
    770     {
    771       if (pImage->data)
    772         {
    773           free(pImage->data);
    774         }
    775      
    776       free(pImage);
    777     }
    778   return true;
    779 #else /* HAVE_JPEGLIB_H */
    780   PRINTF(1)("sorry, but you did not compile with jpeg-support.\nEither install SDL_image or jpeglib, and recompile to see the image\n");
    781   return false;
    782 #endif /* HAVE_JPEGLIB_H */
    783 
    784 }
    785 
    786 /**
    787    \brief reads in a tga-file
    788    \param tgaName the Name of the Image to load
    789    \param texture a reference to the Texture to write the image to
    790 */
    791 bool Material::loadTGA(const char * tgaName, GLuint* texture)
    792 {
    793   typedef struct
    794   {
    795     GLubyte Header[12];
    796   } TGAHeader;
    797   TGAHeader tgaHeader;                 
    798  
    799   GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0}; // Uncompressed TGA Header
    800   GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header
    801   FILE * fTGA;
    802   fTGA = fopen(tgaName, "rb");
    803 
    804   if(fTGA == NULL)
    805     {
    806       PRINTF(1)("Error could not open texture file: %s\n", tgaName);
    807       return false;
    808     }
    809  
    810   if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0)
    811     {
    812       PRINTF(1)("Error could not read file header of %s\n", tgaName);
    813       if(fTGA != NULL)
    814         {
    815           fclose(fTGA);
    816         }
    817       return false;
    818     }
    819  
    820   if(memcmp(uTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
    821     {
    822       loadUncompressedTGA(tgaName, fTGA, texture);
    823       if (fTGA)
    824         fclose (fTGA);
    825     }
    826   else if(memcmp(cTGAcompare, &tgaHeader, sizeof(TGAHeader)) == 0)
    827     {
    828       loadCompressedTGA(tgaName, fTGA, texture);
    829         if (fTGA)
    830           fclose (fTGA);
    831     }
    832   else
    833     {
    834       PRINTF(1)("Error TGA file be type 2 or type 10\n");
    835       if (fTGA)
    836         fclose(fTGA);
    837       return false;
    838     }
    839   return true;
    840 }
    841 
    842 /**
    843    \brief reads in an uncompressed tga-file
    844    \param filename the Name of the Image to load
    845    \param fTGA a Pointer to a File, that should be read
    846    \param texture a reference to the Texture to write the image to
    847 */
    848 bool Material::loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)
    849 {
    850   GLubyte header[6];      // First 6 Useful Bytes From The Header
    851   GLuint  bytesPerPixel;  // Holds Number Of Bytes Per Pixel Used In The TGA File
    852   GLuint  imageSize;      // Used To Store The Image Size When Setting Aside Ram
    853   GLuint  temp;           // Temporary Variable
    854   GLuint  type;
    855   GLuint  Height;         // Height of Image
    856   GLuint  Width;          // Width of Image
    857   GLuint  Bpp;            // Bits Per Pixel
    858 
    859   Image* pImage = new Image;
    860   GLuint cswap;
    861   if(fread(header, sizeof(header), 1, fTGA) == 0)
    862     {
    863       PRINTF(1)("Error could not read info header\n");
    864       return false;
    865     }
    866  
    867   Width = pImage->width  = header[1] * 256 + header[0];
    868   Height =  pImage->height = header[3] * 256 + header[2];
    869   Bpp = pImage->bpp = header[4];
    870   // Make sure all information is valid
    871   if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
    872     {
    873       PRINTF(1)("Error invalid texture information\n");
    874       return false;
    875     }
    876  
    877   if(pImage->bpp == 24)
    878     {
    879       pImage->type = GL_RGB;
    880     }
    881   else
    882     {
    883       pImage->type = GL_RGBA;
    884     }
    885  
    886   bytesPerPixel = (Bpp / 8);
    887   imageSize = (bytesPerPixel * Width * Height);
    888   pImage->data = (GLubyte*) malloc(imageSize);
    889  
    890   if(pImage->data == NULL)
    891     {
    892       PRINTF(1)("Error could not allocate memory for image\n");
    893       return false;
    894     }
    895  
    896   if(fread(pImage->data, 1, imageSize, fTGA) != imageSize)
    897     {
    898       PRINTF(1)("Error could not read image data\n");
    899       if(pImage->data != NULL)
    900         {
    901           free(pImage->data);
    902         }
    903       return false;
    904     }
    905  
    906   for(cswap = 0; cswap < (int)imageSize; cswap += bytesPerPixel)
    907     {
    908       pImage->data[cswap] ^= pImage->data[cswap+2] ^=
    909         pImage->data[cswap] ^= pImage->data[cswap+2];
    910     }
    911  
    912   this->loadTexToGL (pImage, texture);
    913 
    914   return true;
    915 }
    916 
    917 /**
    918    \brief reads in a compressed tga-file
    919    \param filename the Name of the Image to load
    920    \param fTGA a Pointer to a File, that should be read
    921    \param texture a reference to the Texture to write the image to
    922 */
    923 bool Material::loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)
    924 {
    925   GLubyte header[6];      // First 6 Useful Bytes From The Header
    926   GLuint  bytesPerPixel;  // Holds Number Of Bytes Per Pixel Used In The TGA File
    927   GLuint  imageSize;      // Used To Store The Image Size When Setting Aside Ram
    928   GLuint  temp;           // Temporary Variable
    929   GLuint  type;
    930   GLuint  Height;         // Height of Image
    931   GLuint  Width;          // Width of Image
    932   GLuint  Bpp;            // Bits Per Pixel
    933 
    934   Image* pImage = new Image;
    935 
    936  
    937   if(fread(header, sizeof(header), 1, fTGA) == 0)
    938     {
    939       PRINTF(1)("Error could not read info header\n");
    940       return false;
    941     }
    942  
    943   Width = pImage->width  = header[1] * 256 + header[0];
    944   Height = pImage->height = header[3] * 256 + header[2];
    945   Bpp = pImage->bpp     = header[4];
    946 
    947   GLuint pixelcount     = Height * Width;
    948   GLuint currentpixel   = 0;
    949   GLuint currentbyte    = 0;
    950   GLubyte * colorbuffer = (GLubyte *)malloc(bytesPerPixel);
    951 
    952   //Make sure all pImage info is ok
    953   if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32)))
    954     {
    955       PRINTF(1)("Error Invalid pImage information\n");
    956       return false;
    957     }
    958  
    959   bytesPerPixel = (Bpp / 8);
    960   imageSize             = (bytesPerPixel * Width * Height);
    961   pImage->data  = (GLubyte*) malloc(imageSize);
    962  
    963   if(pImage->data == NULL)
    964     {
    965       PRINTF(1)("Error could not allocate memory for image\n");
    966       return false;
    967     }
    968  
    969   do
    970     {
    971       GLubyte chunkheader = 0;
    972      
    973       if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
    974         {
    975           PRINTF(1)("Error could not read RLE header\n");
    976           if(pImage->data != NULL)
    977             {
    978               free(pImage->data);
    979             }
    980           return false;
    981         }
    982       // If the ehader is < 128, it means the that is the number of RAW color packets minus 1
    983       if(chunkheader < 128)
    984         {
    985           short counter;
    986           chunkheader++;
    987           // Read RAW color values
    988           for(counter = 0; counter < chunkheader; counter++)
    989             {
    990               // Try to read 1 pixel
    991               if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel)
    992                 {
    993                   PRINTF(1)("Error could not read image data\n");
    994                   if(colorbuffer != NULL)
    995                     {
    996                       free(colorbuffer);
    997                     }
    998                  
    999                   if(pImage->data != NULL)
    1000                     {
    1001                       free(pImage->data);
    1002                     }
    1003                  
    1004                   return false;
    1005                 }
    1006               // write to memory
    1007               // Flip R and B vcolor values around in the process
    1008               pImage->data[currentbyte    ] = colorbuffer[2];                               
    1009               pImage->data[currentbyte + 1] = colorbuffer[1];
    1010               pImage->data[currentbyte + 2] = colorbuffer[0];
    1011              
    1012               if(bytesPerPixel == 4) // if its a 32 bpp image
    1013                 {
    1014                   pImage->data[currentbyte + 3] = colorbuffer[3];// copy the 4th byte
    1015                 }
    1016              
    1017               currentbyte += bytesPerPixel;
    1018               currentpixel++;
    1019 
    1020               // Make sure we haven't read too many pixels
    1021               if(currentpixel > pixelcount)     
    1022                 {
    1023                   PRINTF(1)("Error too many pixels read\n");
    1024                   if(colorbuffer != NULL)
    1025                     {
    1026                       free(colorbuffer);
    1027                     }
    1028                  
    1029                   if(pImage->data != NULL)
    1030                     {
    1031                       free(pImage->data);
    1032                     }
    1033                  
    1034                   return false;
    1035                 }
    1036             }
    1037         }
    1038       // chunkheader > 128 RLE data, next color  reapeated chunkheader - 127 times
    1039       else
    1040         {
    1041           short counter;
    1042           chunkheader -= 127;   // Subteact 127 to get rid of the ID bit
    1043           if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values
    1044             {
    1045               PRINTF(1)("Error could not read from file");
    1046               if(colorbuffer != NULL)
    1047                 {
    1048                   free(colorbuffer);
    1049                 }
    1050              
    1051               if(pImage->data != NULL)
    1052                 {
    1053                   free(pImage->data);
    1054                 }
    1055              
    1056               return false;
    1057             }
    1058          
    1059           for(counter = 0; counter < chunkheader; counter++) //copy the color into the image data as many times as dictated
    1060             {                                                   
    1061               // switch R and B bytes areound while copying
    1062               pImage->data[currentbyte    ] = colorbuffer[2];
    1063               pImage->data[currentbyte + 1] = colorbuffer[1];
    1064               pImage->data[currentbyte + 2] = colorbuffer[0];
    1065              
    1066               if(bytesPerPixel == 4)
    1067                 {
    1068                   pImage->data[currentbyte + 3] = colorbuffer[3];
    1069                 }
    1070              
    1071               currentbyte += bytesPerPixel;
    1072               currentpixel++;
    1073              
    1074               if(currentpixel > pixelcount)
    1075                 {
    1076                   PRINTF(1)("Error too many pixels read\n");
    1077                   if(colorbuffer != NULL)
    1078                     {
    1079                       free(colorbuffer);
    1080                     }
    1081                  
    1082                   if(pImage->data != NULL)
    1083                     {
    1084                       free(pImage->data);
    1085                     }
    1086                  
    1087                   return false;
    1088                 }
    1089             }
    1090         }
    1091     }
    1092  
    1093   while(currentpixel < pixelcount);     // Loop while there are still pixels left
    1094 
    1095   this->loadTexToGL (pImage, texture);
    1096 
    1097   return true;
    1098 }
    1099 
    1100 
    1101 /*
    1102 static int ST_is_power_of_two(unsigned int number)
    1103 {
    1104   return (number & (number - 1)) == 0;
    1105 }
    1106 */
    1107 
    1108 /**
    1109    \brief reads in a png-file
    1110    \param pngName the Name of the Image to load
    1111    \param texture a reference to the Texture to write the image to
    1112 */
    1113 bool Material::loadPNG(const char* pngName, GLuint* texture)
    1114 {
    1115 #ifdef HAVE_PNG_H
    1116   Image* pImage = new Image;
    1117 
    1118   FILE *PNG_file = fopen(pngName, "rb");
    1119   if (PNG_file == NULL)
    1120     {
    1121       return 0;
    1122     }
    1123  
    1124   GLubyte PNG_header[8];
    1125  
    1126   fread(PNG_header, 1, 8, PNG_file);
    1127   if (png_sig_cmp(PNG_header, 0, 8) != 0)
    1128     {
    1129       PRINTF(2)("Not Recognized as a pngFile\n");
    1130       fclose (PNG_file);
    1131       return 0;
    1132     }
    1133  
    1134   png_structp PNG_reader = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    1135   if (PNG_reader == NULL)
    1136     {
    1137       fclose(PNG_file);
    1138       return 0;
    1139     }
    1140  
    1141   png_infop PNG_info = png_create_info_struct(PNG_reader);
    1142   if (PNG_info == NULL)
    1143     {
    1144       png_destroy_read_struct(&PNG_reader, NULL, NULL);
    1145       fclose(PNG_file);
    1146       return 0;
    1147     }
    1148  
    1149   png_infop PNG_end_info = png_create_info_struct(PNG_reader);
    1150   if (PNG_end_info == NULL)
    1151     {
    1152       png_destroy_read_struct(&PNG_reader, &PNG_info, NULL);
    1153       fclose(PNG_file);
    1154       return 0;
    1155     }
    1156  
    1157   if (setjmp(png_jmpbuf(PNG_reader)))
    1158     {
    1159       png_destroy_read_struct(&PNG_reader, &PNG_info, &PNG_end_info);
    1160       fclose(PNG_file);
    1161       return (0);
    1162     }
    1163  
    1164   png_init_io(PNG_reader, PNG_file);
    1165   png_set_sig_bytes(PNG_reader, 8);
    1166  
    1167   png_read_info(PNG_reader, PNG_info);
    1168  
    1169   pImage->width = png_get_image_width(PNG_reader, PNG_info);
    1170   pImage->height = png_get_image_height(PNG_reader, PNG_info);
    1171  
    1172   png_uint_32 bit_depth, color_type;
    1173   bit_depth = png_get_bit_depth(PNG_reader, PNG_info);
    1174   color_type = png_get_color_type(PNG_reader, PNG_info);
    1175  
    1176   if (color_type == PNG_COLOR_TYPE_PALETTE)
    1177     {
    1178       png_set_palette_to_rgb(PNG_reader);
    1179     }
    1180  
    1181   if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
    1182     {
    1183       png_set_gray_1_2_4_to_8(PNG_reader);
    1184     }
    1185  
    1186   if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
    1187     {
    1188       png_set_gray_to_rgb(PNG_reader);
    1189     }
    1190  
    1191   if (png_get_valid(PNG_reader, PNG_info, PNG_INFO_tRNS))
    1192     {
    1193       png_set_tRNS_to_alpha(PNG_reader);
    1194     }
    1195   else
    1196     {
    1197       png_set_filler(PNG_reader, 0xff, PNG_FILLER_AFTER);
    1198     }
    1199  
    1200   if (bit_depth == 16)
    1201     {
    1202       png_set_strip_16(PNG_reader);
    1203     }
    1204  
    1205   png_read_update_info(PNG_reader, PNG_info);
    1206  
    1207   pImage->data = (png_byte*)malloc(4 * pImage->width * pImage->height);
    1208   png_byte** PNG_rows = (png_byte**)malloc(pImage->height * sizeof(png_byte*));
    1209  
    1210   unsigned int row;
    1211   for (row = 0; row < pImage->height; ++row)
    1212     {
    1213       PNG_rows[pImage->height - 1 - row] = pImage->data + (row * 4 * pImage->width);
    1214     }
    1215  
    1216   png_read_image(PNG_reader, PNG_rows);
    1217  
    1218   free(PNG_rows);
    1219  
    1220   png_destroy_read_struct(&PNG_reader, &PNG_info, &PNG_end_info);
    1221   fclose(PNG_file);
    1222  
    1223   /*  if (!ST_is_power_of_two(pImage->width) || !ST_is_power_of_two(pImage->height))
    1224     {
    1225       free(pImage->data);
    1226       return 0;
    1227     }
    1228   */
    1229   this->loadTexToGL (pImage, texture); 
    1230  
    1231   free(pImage->data);
    1232  
    1233   return true;
    1234 #else /* HAVE_PNG_H */
    1235   PRINTF(1)("sorry, but you did not compile with png-support.\nEither install SDL_image or libpng, and recompile to see the image\n");
    1236   return false;
    1237 #endif /* HAVE_PNG_H */
    1238 
    1239 }
    1240 
    1241 #endif /* HAVE_SDL_SDL_IMAGE_H */
  • orxonox/trunk/src/importer/material.h

    r3196 r3365  
    1414
    1515#include "../stdincl.h"
     16#include "texture.h"
    1617
    1718#if HAVE_CONFIG_H
     
    1920#endif /* HAVE_CONFIG_H */
    2021
    21 #ifdef HAVE_SDL_SDL_IMAGE_H
    22 #include <SDL/SDL_image.h>
    23 #else
    24 // IMAGE LIBS //
    25 #ifdef HAVE_JPEGLIB_H
    26 extern "C"{         // This has to be done, because not a c++ lib
    27 #include <jpeglib.h>
    28 }
    29 #endif /* HAVE_JPEGLIB_H */
    30 #ifdef HAVE_PNG_H
    31 #include <png.h>
    32 #endif /* HAVE_PNG_H */
    33 #endif /* HAVE_SDL_SDL_IMAGE_H */
    3422
    35 //! Class to handle lists of paths.
    36 /**
    37    \todo Ability to return Paths by itself.
    38 
    39    It is simple to use, and good, for all PathList you want.
    40    just create a new Pathlist, and add Paths.
    41 */
    42 class PathList
    43 {
    44  public:
    45   PathList();
    46   PathList(char* pName);
    47 
    48   ~PathList();
    49   void addPath (char* pName);
    50   char* pathName;          //!< The Name of the current Path.
    51   PathList* next;          //!< Pointer to the next Pathlist.
    52 };
    5323
    5424
     
    9262
    9363 private:
    94   //! Struct to handle Infos about an Image
    95   struct Image
    96   {
    97     int rowSpan;    //!< The count of the rows this Image has.
    98     GLuint width;   //!< The width of the Image.
    99     GLuint height;  //!< The height of the Image.
    100     GLuint bpp;     //!< BitsPerPixel
    101     GLuint type;    //!< Type of the Image.
    102     GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
    103   };
    104 
    105 
    10664  char* name;        //!< The Name of the Material.
    10765  int illumModel;    //!< The IlluminationModel is either flat or smooth.
     
    11270  float transparency;//!< The transperency of the Material.
    11371
    114   static PathList* pathList; //!< A pointer to the first element of Pathlist. This is static, because pathlists are global \todo copy this to the Globals.h or DataTank for deletion at the end.
    115  
    116   GLuint diffuseTexture; //!< The diffuse texture of the Material.
    117   GLuint ambientTexture; //!< The ambient texture of the Material.
    118   GLuint specularTexture;//!< The specular texture of the Material.
     72  Texture* diffuseTexture; //!< The diffuse texture of the Material.
     73  Texture* ambientTexture; //!< The ambient texture of the Material.
     74  Texture* specularTexture;//!< The specular texture of the Material.
    11975 
    12076  bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set.
     
    12480  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
    12581
    126   // TEXTURING
    127   bool loadTexToGL (Image* pImage, GLuint* texture);
    12882
    129   bool loadImage(char* imageName, GLuint* texture);
    130 #ifndef HAVE_SDL_SDL_IMAGE_H
    131 
    132   bool loadBMP (char* bmpName, GLuint* texture);
    133 
    134   bool loadJPG (char* jpgName, GLuint* texture);
    135 
    136   /// TGA ///
    137 
    138   bool loadTGA(const char * tgaName, GLuint* texture);
    139   bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
    140   bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
    141 
    142   bool loadPNG(const char* pngName, GLuint* texture);
    143 #endif
    14483};
    14584#endif
  • orxonox/trunk/src/list.h

    r3224 r3365  
    7878 
    7979
    80   void add(WorldEntity* entity);
    81   void remove(WorldEntity* entity);
     80  void add(T* entity);
     81  void remove(T* entity);
    8282  void destroy();
    8383  T* firstElement();
     
    104104
    105105template<class T>
    106 void tList<T>::add(WorldEntity* entity)
     106void tList<T>::add(T* entity)
    107107{
    108108  listElement* el = new listElement;
     
    120120
    121121template<class T>
    122 void tList<T>::remove(WorldEntity* entity)
     122void tList<T>::remove(T* entity)
    123123{
    124124  this->currentEl = this->first;
  • orxonox/trunk/src/orxonox.cc

    r3226 r3365  
    115115  // Set video mode
    116116  // TO DO: parse arguments for settings
    117   SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
    118   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
    119   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
    120   SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    121  
     117  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
     118  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
     119  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
     120  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
     121 
     122
     123  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
     124  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
     125  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
     126  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
     127  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
     128  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
     129  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
     130
     131
     132
    122133  int bpp = 16;
    123134  int width = 640;
    124135  int height = 480;
    125   Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
    126  
    127   if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL)
     136  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
     137  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
     138
     139  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
     140
     141  /* query SDL for information about our video hardware */
     142  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
     143 
     144  if( videoInfo == NULL)
     145    {
     146      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());
     147      SDL_Quit ();
     148    }
     149  if( videoInfo->hw_available)
     150    videoFlags |= SDL_HWSURFACE;
     151  else
     152    videoFlags |= SDL_SWSURFACE;
     153  /*
     154  if(VideoInfo -> blit_hw)                           
     155    VideoFlags |= SDL_HWACCEL;
     156  */
     157 
     158  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
    128159  {
    129     printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());
     160    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
    130161    SDL_Quit();
    131162    return -1;
     
    133164 
    134165  // Set window labeling
    135   SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
     166  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    136167 
    137168  // TO DO: Create a cool icon and use it here
     
    139170
    140171  // OpenGL stuff
    141   // (Is this all we initialize globally???)
    142   glClearColor(0.0, 0.0, 0.0, 0.0);
    143   glEnable(GL_DEPTH_TEST);
     172  glClearColor (0.0, 0.0, 0.0, 0.0);
     173  glEnable (GL_DEPTH_TEST);
    144174 
    145175  // LIGHTING
     
    148178  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
    149179
    150   glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
    151   glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
    152   glEnable(GL_LIGHTING);
    153   glEnable(GL_LIGHT0);
    154   glEnable(GL_DEPTH_TEST);
    155   glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
    156   glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
     180  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
     181  glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight);
     182  glEnable (GL_LIGHTING);
     183  glEnable (GL_LIGHT0);
     184  glEnable (GL_DEPTH_TEST);
     185  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
     186  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
    157187   
     188  //glEnable (GL_TEXTURE_2D);
    158189  //  glEnable(GL_COLOR);
    159190  //  glShadeModel(GL_SMOOTH);
     
    311342
    312343
     344SDL_Surface* Orxonox::getScreen ()
     345{
     346  return this->screen;
     347}
    313348
    314349
  • orxonox/trunk/src/orxonox.h

    r3226 r3365  
    6868  Camera* getCamera();
    6969  World* getWorld();
     70  SDL_Surface* getScreen ();
    7071 
    7172  //void mainLoop();
  • orxonox/trunk/src/p_node.cc

    r3246 r3365  
    1414   main-programmer: Patrick Boenzli
    1515   co-programmer: ...
     16
     17   \todo Null-Parent => center of the coord system - singleton
     18   \todo Smooth-Parent: delay, speed
     19   \todo destroy the stuff again, delete...
    1620*/
    1721
     
    2832   \todo this constructor is not jet implemented - do it
    2933*/
    30 PNode::PNode () {}
     34PNode::PNode ()
     35{
     36  this->children = new tList<PNode>();
     37  this->bRelCoorChanged = true;
     38  this->bAbsCoorChanged = false;
     39  this->bRelDirChanged = true;
     40  this->bAbsDirChanged = false;
     41  this->parent = NULL;
     42}
     43
     44
     45/**
     46   \brief constructor with coodinates
     47*/
     48PNode::PNode (Vector* absCoordinate, PNode* parent )
     49{
     50  this->absCoordinate = *absCoordinate;
     51  this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     52 
     53  this->children = new tList<PNode>();
     54  this->bRelCoorChanged = true;
     55  this->bAbsCoorChanged = false;
     56  this->bRelDirChanged = true;
     57  this->bAbsDirChanged = false;
     58  this->parent = parent;
     59
     60  parent->addChild (this);
     61}
    3162
    3263
     
    3667   \todo this deconstructor is not jet implemented - do it
    3768*/
    38 PNode::~PNode () {}
    39 
     69PNode::~PNode ()
     70{
     71  /*
     72  delete &this->children;
     73  delete &this->relCoordinate;
     74  delete &this->absCoordinate;
     75  delete &this->relDirection;
     76  delete &this->absDirection;
     77  */
     78  this->parent = NULL;
     79  /* there is currently a problem with cleaning up - fix*/
     80}
     81
     82
     83/**
     84   \brief deletes the hole pnode tree
     85
     86   cleans up all pnodes
     87*/
     88void PNode::destroy ()
     89{
     90  PNode* pn = this->children->enumerate();
     91  while( pn != NULL)
     92    {
     93      pn->destroy ();
     94      pn = this->children->nextElement();
     95    }
     96  this->children->destroy ();
     97}
     98
     99
     100/**
     101   \brief get relative coordinates
     102   \returns relative coordinates to its parent
     103*/
     104Vector PNode::getRelCoor ()
     105{
     106  Vector r = this->relCoordinate; /* return a copy, so it can't be modified */
     107  return r;
     108}
     109
     110
     111/**
     112   \brief set relative coordinates
     113   \param relative coordinates to its parent
     114
     115   it is very importand, that you use this function, if you want to update the
     116   relCoordinates. If you don't use this, the PNode won't recognize, that something
     117   has changed and won't update the children Nodes.
     118*/
     119void PNode::setRelCoor (Vector* relCoord)
     120{
     121  this->bRelCoorChanged = true;
     122  this->relCoordinate = *relCoord;
     123}
     124
     125
     126/**
     127   \brief get absolute coordinates
     128   \returns absolute coordinates from (0,0,0)
     129*/
     130Vector PNode::getAbsCoor ()
     131{
     132  return this->absCoordinate;
     133}
     134
     135
     136/**
     137   \brief get relative coordinates
     138   \returns relative coordinates to its parent
     139
     140   it is very importand, that you use this function, if you want to update the
     141   absCoordinates. If you don't use this, the PNode won't recognize, that something
     142   has changed and won't update the children Nodes.
     143*/
     144void PNode::setAbsCoor (Vector* absCoord)
     145{
     146  this->bAbsCoorChanged = true;
     147  this->absCoordinate = *absCoord;
     148}
     149
     150
     151/**
     152   \brief shift coordinate (abs and rel)
     153   \param shift vector
     154
     155   this function shifts the current coordinates about the vector shift. this is
     156   usefull because from some place else you can:
     157   PNode* someNode = ...;
     158   Vector objectMovement = calculateShift();
     159   someNode->shiftCoor(objectMovement);
     160
     161   elsewhere you would have to:
     162   PNode* someNode = ...;
     163   Vector objectMovement = calculateShift();
     164   Vector currentCoor = someNode->getRelCoor();
     165   Vector newCoor = currentCoor + objectMovement;
     166   someNode->setRelCoor(newCoor);
     167   
     168   yea right... shorter...
     169
     170*/
     171void PNode::shiftCoor (Vector* shift)
     172{
     173  if( this->bAbsCoorChanged)
     174    {
     175      this->absCoordinate = this->absCoordinate + *shift;
     176    }
     177  else
     178    {
     179      this->relCoordinate = this->relCoordinate + *shift;
     180      this->bRelCoorChanged = true;
     181    }
     182}
     183
     184
     185
     186/**
     187   \brief get relative direction
     188   \returns relative direction to its parent
     189*/
     190Quaternion PNode::getRelDir ()
     191{
     192  return this->relDirection;
     193}
     194
     195
     196/**
     197   \brief set relative direction
     198   \param relative direction to its parent
     199
     200   it is very importand, that you use this function, if you want to update the
     201   relDirection. If you don't use this, the PNode won't recognize, that something
     202   has changed and won't update the children Nodes.
     203*/
     204void PNode::setRelDir (Quaternion* relDir)
     205{
     206  this->bRelCoorChanged = true;
     207  this->relDirection = *relDir;
     208}
     209
     210
     211/**
     212   \brief gets the absolute direction (0,0,1)
     213   \returns absolute coordinates
     214*/
     215Quaternion PNode::getAbsDir ()
     216{}
     217
     218
     219/**
     220   \brief sets the absolute direction (0,0,1)
     221   \param absolute coordinates
     222
     223   it is very importand, that you use this function, if you want to update the
     224   absDirection. If you don't use this, the PNode won't recognize, that something
     225   has changed and won't update the children Nodes.
     226*/
     227void PNode::setAbsDir (Quaternion* absDir)
     228{}
     229
     230
     231/**
     232   \brief shift coordinate (abs and rel)
     233   \param shift vector
     234
     235   this function shifts the current coordinates about the vector shift. this is
     236   usefull because from some place else you can:
     237   PNode* someNode = ...;
     238   Quaternion objectMovement = calculateShift();
     239   someNode->shiftCoor(objectMovement);
     240
     241   elsewhere you would have to:
     242   PNode* someNode = ...;
     243   Quaternion objectMovement = calculateShift();
     244   Quaternion currentCoor = someNode->getRelCoor();
     245   Quaternion newCoor = currentCoor + objectMovement;
     246   someNode->setRelCoor(newCoor);
     247   
     248   yea right... shorter...
     249
     250*/
     251void PNode::shiftDir (Quaternion* shift)
     252{}
     253
     254
     255
     256/**
     257   \brief adds a child and makes this node to a parent
     258   \param child reference
     259
     260   use this to add a child to this node.
     261*/
     262void PNode::addChild (PNode* pNode)
     263{
     264  this->addChild(pNode, DEFAULT_MODE);
     265}
     266
     267
     268/**
     269   \brief adds a child and makes this node to a parent
     270   \param child reference
     271   \param on which changes the child should also change ist state
     272
     273   use this to add a child to this node.
     274*/
     275void PNode::addChild (PNode* pNode, parentingMode mode)
     276{
     277  pNode->mode = mode;
     278  pNode->parent = this;
     279  this->children->add (pNode);
     280}
     281
     282
     283/**
     284   /brief removes a child from the node
     285*/
     286void PNode::removeChild (PNode* pNode)
     287{
     288  this->children->remove (pNode);
     289}
     290
     291
     292/**
     293   \brief sets the parent of this PNode
     294*/
     295void PNode::setParent (PNode* parent)
     296{
     297  this->parent = parent;
     298}
     299
     300/**
     301   \brief set the mode of this parent manualy
     302*/
     303void PNode::setMode (parentingMode mode)
     304{
     305  this->mode = mode;
     306}
     307
     308/**
     309   \brief has to be called, if the parent coordinate has changed
     310   
     311   normaly this will be done by the parent itself automaticaly. If you call this, you
     312   will force an update of the coordinated of the node.
     313*/
     314void PNode::parentCoorChanged ()
     315{
     316  this->bRelCoorChanged = true;
     317}
     318
     319
     320/**
     321   \brief has to be called, if the parent direction has changed
     322   
     323   normaly this will be done by the parent itself automaticaly. If you call this, you
     324   will force an update of the direction of the node.
     325*/
     326void PNode::parentDirChanged ()
     327{
     328  this->bRelDirChanged = true;
     329}
     330
     331
     332/**
     333   \brief updates the absCoordinate/absDirection
     334
     335   this is used to go through the parent-tree to update all the absolute coordinates
     336   and directions. this update should be done by the engine, so you don't have to
     337   worry, normaly...
     338*/
     339void PNode::update (float timeStamp)
     340{
     341  printf ("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
     342
     343      if( this->mode == MOVEMENT || this->mode == ALL)
     344        {
     345          if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     346            {
     347              printf("PNode::update () - this->bAbsCoorChanged = true\n");
     348              /* if you have set the absolute coordinates this overrides all other changes */
     349              this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     350            }
     351          else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     352            {
     353              /*this is bad style... must be deleted later - just for testing*/
     354              if( this->parent == NULL)
     355                {
     356                this->absCoordinate = this->relCoordinate;
     357                }
     358              else
     359                this->absCoordinate = parent->getAbsCoor () + this->relCoordinate;            /* update the current absCoordinate */
     360            }
     361        }
     362     
     363      if( this->mode == ROTATION && this->mode == ALL)
     364        {
     365          if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     366            {
     367              /* if you have set the absolute coordinates this overrides all other changes */
     368              this->relDirection = this->absDirection - parent->getAbsDir ();
     369            }
     370          else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     371            {
     372              /* update the current absDirection - remember * means rotation around sth.*/
     373              this->absDirection = parent->getAbsDir () * this->relDirection;
     374            }
     375        }   
     376      // }
     377  PNode* pn = this->children->enumerate();
     378  while( pn != NULL)
     379    {
     380      /* if this node has changed, make sure, that all children are updated also */
     381      if( this->bRelCoorChanged || this->bAbsCoorChanged)
     382        pn->parentCoorChanged ();
     383      if( this->bRelDirChanged || this->bAbsDirChanged)
     384        pn->parentDirChanged ();
     385      pn->update(timeStamp);
     386      pn = this->children->nextElement();
     387    }
     388
     389  this->timeStamp = timeStamp;
     390  this->bRelCoorChanged = false;
     391  this->bAbsCoorChanged = false;
     392  this->bRelDirChanged = false;
     393  this->bAbsDirChanged = false;
     394}
     395
     396
     397/*
     398  \brief tick
     399*/
     400void PNode::processTick (float dt)
     401{
     402  this->tick (dt);
     403  PNode* pn = this->children->enumerate();
     404  while( pn != NULL)
     405    {
     406      pn->processTick (dt);
     407      pn = this->children->nextElement();
     408    }
     409}
     410
     411
     412void PNode::tick (float dt)
     413{}
     414
     415
     416void PNode::debug()
     417{
     418  printf("PNode::debug() - absCoord: (%f, %f, %f)\n",
     419         this->absCoordinate.x,
     420         this->absCoordinate.y,
     421         this->absCoordinate.z);
     422}
     423
     424
     425/*
     426  \brief set the name of the node
     427
     428  for debug purposes realy usefull, not used to work properly
     429*/
     430void PNode::setName (char* newName)
     431{
     432  this->objectName = newName;
     433}
     434
     435
     436/*
     437  \brief gets the name of the node
     438*/
     439char* PNode::getName ()
     440{
     441  return this->objectName;
     442}
  • orxonox/trunk/src/p_node.h

    r3246 r3365  
    1414    this conditions make it cheaper to recalculate the tree (reduces redundant work).
    1515
    16     remember: if you have to change the coordinates, because the object (point) did move,
    17     don't forget to reset both relCoor and absCoor (offset is the same)
     16    remember: if you have to change the coordinates or the directions, use the functions
     17    that are defined to execute this operation - otherwhise there will be big problems...
    1818*/
    1919
     
    2424#include "stdincl.h"
    2525
     26class PNode; /* forward decleration, so that parentEntry has access to PNode */
    2627
    27 class PNode {
     28typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL};
     29#define DEFAULT_MODE ALL
     30
     31class PNode : public BaseObject {
    2832
    2933 public:
    3034  PNode ();
    31   ~PNode ();
     35  PNode (Vector* absCoordinate, PNode* pNode);
     36  virtual ~PNode ();
     37
     38  void destroy ();
     39
     40  PNode* parent; //! a pointer to the parent node
     41  tList<PNode>* children; //! list of the children
     42
     43  parentingMode mode;
    3244
    3345  Vector getRelCoor ();
    34   void setRelCoor (Vector relCoord);
     46  void setRelCoor (Vector* relCoord);
     47  //void setRelCoor (Vector relCoord);
    3548  Vector getAbsCoor ();
    36   void setAbsCoor (Vector absCoord);
     49  void setAbsCoor (Vector* absCoord);
     50  //void setAbsCoor (Vector absCoord);
     51  void shiftCoor (Vector* shift);
     52  //void shiftCoor (Vector shift);
    3753
    3854  Quaternion getRelDir ();
    39   void setRelDir (Quaternion relDir);
     55  void setRelDir (Quaternion* relDir);
    4056  Quaternion getAbsDir ();
    41   void setAbsCoor (Quaternion absDir);
     57  void setAbsDir (Quaternion* absDir);
     58  void shiftDir (Quaternion* shift);
    4259
    4360  void addChild (PNode* pNode);
     61  void addChild (PNode* pNode, parentingMode mode);
    4462  void removeChild (PNode* pNode);
     63  void setParent (PNode* parent);
     64  void parentCoorChanged ();
     65  void parentDirChanged ();
     66  void setMode (parentingMode mode);
    4567
    46  private:
    47   long timeStamp; //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated
    48   bool bCoorChanged;
    49   bool bDirChanged;
     68  virtual void update (float timeStamp);
     69  void processTick (float dt);
     70  virtual void tick (float dt);
     71
     72  void setName (char* newName);
     73  char* getName ();
     74
     75
     76  void debug ();
     77
     78  float timeStamp;   //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated
     79  char* objectName;
     80  bool bAbsCoorChanged;
     81  bool bRelCoorChanged;
     82  bool bRelDirChanged;
     83  bool bAbsDirChanged;
    5084
    5185  Vector relCoordinate;  //! coordinates relative to the parent
     
    5488  Quaternion absDirection; //! absolute direvtion in the world ( from (0,0,1) )
    5589
    56   tList<PNode>* children; //! list of the children
    57 
    5890};
    5991
  • orxonox/trunk/src/player.cc

    r3233 r3365  
    1919#include "stdincl.h"
    2020#include "collision.h"
     21#include "importer/model.h"
    2122
    2223using namespace std;
     
    2627{
    2728
    28   this->obj = new Object("reaplow.obj");
     29  this->model = new Model("reaplow.obj");
    2930  /*
    3031  objectList = glGenLists(1);
     
    5455}
    5556
    56 Player::~Player()
     57Player::~Player ()
    5758{
    58   delete this->obj;
     59  delete this->model;
    5960}
    6061
    61 void Player::postSpawn()
     62void Player::postSpawn ()
    6263{
    6364  travelSpeed = 15.0;
     
    6970}
    7071
    71 void Player::tick(float time)
     72void Player::tick (float time)
    7273{
    7374  // movement
    74   move (time);
     75  this->move (time);
    7576}
    7677
    77 void Player::hit(WorldEntity* weapon, Vector loc)
     78void Player::hit (WorldEntity* weapon, Vector loc)
    7879{
    7980}
    8081
    81 void Player::destroy()
     82void Player::destroy ()
    8283{
    8384}
    8485
    85 void Player::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags)
     86void Player::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags)
    8687{
    8788}
    8889
    89 void Player::command(Command* cmd)
     90void Player::command (Command* cmd)
    9091{
    9192  //printf("Player|recieved command [%s]\n", cmd->cmd);
     
    9798}
    9899
    99 void Player::draw()
     100void Player::draw ()
    100101{
    101102  glMatrixMode(GL_MODELVIEW);
     
    103104  float matrix[4][4];
    104105 
    105   glTranslatef(getPlacement()->r.x, getPlacement()->r.y, getPlacement()->r.z);
    106   getPlacement()->w.matrix (matrix);
     106  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     107  //rotate
     108  this->getAbsDir ().matrix (matrix);
    107109  glMultMatrixf((float*)matrix);
    108110 
    109111  glMatrixMode(GL_MODELVIEW);
    110   glRotatef(-90, 0,1,0);
    111   obj->draw();
     112  this->model->draw();
    112113  // glCallList(objectList);
    113 
    114  
    115  
    116114}
    117115
     116
     117/*PN
    118118void Player::getLookat(Location* locbuf)
    119119{
     
    121121  //locbuf->dist += 5.0;
    122122}
     123*/
    123124
    124 void Player::leftWorld()
     125void Player::leftWorld ()
    125126{
    126127}
    127128
    128 void Player::move(float time)
     129void Player::move (float time)
    129130{
    130131  Vector accel(0.0, 0.0, 0.0);
    131132  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    132   Placement *pos = getPlacement();
     133  //Placement *pos = getPlacement();
     134 
    133135  /* calculate the direction in which the craft is heading  */
    134   Vector direction(0.0, 0.0, 1.0);
    135   direction = pos->w.apply(direction);
    136   Vector orthDirection(0.0, 0.0, 1.0);
    137   orthDirection = orthDirection.cross(direction);
     136  Vector direction (1.0, 0.0, 0.0);
     137  //direction = this->absDirection.apply (direction);
     138  Vector orthDirection (0.0, 0.0, 1.0);
     139  //orthDirection = orthDirection.cross (direction);
    138140
    139141  if( bUp) { accel = accel+(direction*acceleration); }
    140142  if( bDown) { accel = accel-(direction*acceleration); }
    141   if( bLeft ) { accel = accel + (orthDirection*acceleration); }
    142   if( bRight ) { accel = accel - (orthDirection*acceleration); }
     143  if( bLeft ) { accel = accel - (orthDirection*acceleration); }
     144  if( bRight ) { accel = accel + (orthDirection*acceleration); }
    143145  if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    144146  if( bDescend) {/* FIXME */} /* \todo up and down player movement */
    145147
    146   Location* l = getLocation();
     148  //Location* l = getLocation();
    147149 
    148150  // r(t) = r(0) + v(0)*t + 1/2*a*t^2
     
    152154
    153155  /* this the base-speed of the player: determines how fast and how the player follows the track*/
    154   l->dist = l->dist + travelSpeed * time;
    155 
     156  //l->dist = l->dist + travelSpeed * time;
     157 
     158  Vector* shift = new Vector (this->travelSpeed * time, 0, 0);
     159  this->shiftCoor (shift);
     160 
    156161  /* this updates the player position on the track - user interaction */
    157   l->pos = l->pos + accel*time;
     162  //l->pos = l->pos + accel*time;
     163  Vector move = accel * time;
     164  this->shiftCoor (&move);
    158165}
  • orxonox/trunk/src/player.h

    r3236 r3365  
    88
    99#include "world_entity.h"
    10 #include "importer/object.h"
     10
     11class Model;
    1112
    1213//! Basic controllable WorldEntity
     
    2728 
    2829  virtual void draw();
    29   virtual void getLookat(Location* locbuf);
     30  // virtual void getLookat(Location* locbuf);
    3031 
    3132  virtual void leftWorld();
     
    3839  float acceleration;
    3940  GLuint objectList;
    40   Object* obj;
    4141 
    4242  void move(float time);
  • orxonox/trunk/src/proto_class.cc

    r3329 r3365  
    2727   \todo this constructor is not jet implemented - do it
    2828*/
    29 ProtoClass::ProtoClass () {}
     29ProtoClass::ProtoClass ()
     30{
     31   this->setClassName ("ProtoClass");
     32}
    3033
    3134
  • orxonox/trunk/src/proto_class.h

    r3329 r3365  
    1919   here can be some longer description of this class
    2020*/
    21 class ProtoClass {
     21class ProtoClass : public BaseObject {
    2222
    2323 public:
  • orxonox/trunk/src/stdincl.h

    r3224 r3365  
    1010
    1111#define null 0   //!< null
     12
     13typedef unsigned char byte;
    1214
    1315// this includes the information from configure/makefiles
     
    3133
    3234#include "vector.h"
    33 #include "coordinates.h"
     35#include "matrix.h"
     36#include "curve.h"
     37//#include "coordinates.h"
    3438#include "list.h"
    3539#include "list_template.h"
     
    3842#include "message_structures.h"
    3943#include "orxonox.h"
     44#include "data_tank.h"
     45#include "base_object.h"
    4046
    4147#endif /* _STDINCL_H */
  • orxonox/trunk/src/story_entity.h

    r3224 r3365  
    1212
    1313//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
    14 class StoryEntity {
     14class StoryEntity : public BaseObject {
    1515
    1616 public:
  • orxonox/trunk/src/track.cc

    r3232 r3365  
    2929  this->end = NULL;
    3030  this->nextID = 0;
     31  this->setClassName ("Track");
    3132}
    3233
     
    4445  this->end = finish;
    4546  this->nextID = next;
     47  this->setClassName ("Track");
    4648}
    4749
     
    5961
    6062
    61 /**
    62    \brief calculate a camera Placement from a "look at"-Location
    63    \param lookat: the Location the camera should be centered on
    64    \param camplc: pointer to a buffer where the new camera Placement should be put into
    65    
    66    Theoretically you can place the camera wherever you want, but for the sake of
    67    common sense I suggest that you at least try to keep the thing that should be looked
    68    at inside camera boundaries.
    69 */
    70 void Track::mapCamera (Location* lookat, Placement* camplc)
    71 {
    72   Line trace(*offset, *end - *offset);
    73   float l = trace.len ();
    74  
    75   //    camplc->r = *offset + Vector(0,0,0.5);
    76   //    camplc->w = Quaternion (trace.a, Vector(0,0,1));
    77   float r = (lookat->dist)*PI / l;
    78   camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
    79  
    80   Vector w(0.0,0.0,0.0);
    81   w=Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r));
    82   //Vector up(0.0,sin(r),cos(r)); // corrupt...
    83   Vector up(0.0, 0.0, 1.0);
    8463
    85   camplc->w = Quaternion(w, up);
    86 
    87   //printf("\n------\nup vector: [%f, %f, %f]\n", up.x, up.y, up.z);
    88   //printf("direction: [%f, %f, %f]\n", w.x, w.y, w.z);
    89   //printf("quaternion: w[ %f ], v[ %f, %f, %f ]\n", camplc->w.w, camplc->w.v.x, camplc->w.v.y, camplc->w.v.z);
    90 }
    91 
    92 /**
    93    \brief calculate a Placement from a given Location
    94    \param loc: the Location the entity is in
    95    \param plc: a pointer to a buffer where the corresponding Placement should be put
    96    into
    97    \return: true if track changes - false if track stays
    98    
    99    There are no limitations to how you transform a Location into a Placement, but for
    100    the sake of placement compatibility between track parts you should make sure that
    101    the resulting Placement at dist == 0 is equal to the offset Vector and the Placement
    102    at dist == len() is equal to the end Vector. Elseway there will be ugly artifacts
    103    when transfering between track parts.
    104 */
    105 bool Track::mapCoords (Location* loc, Placement* plc)
    106 {
    107   Line trace(*offset, *end - *offset);
    108   float l = trace.len ();
    109  
    110   /* change to the next track? */
    111   if( loc->dist > l)
    112     {
    113       loc->dist -= l;
    114       loc->part = nextID;
    115       //FIXME: loc->track = this;
    116       return true;
    117     }
    118  
    119   /* this quaternion represents the rotation from start-vector (0,0,1) to the direction of
    120    * the track */
    121   Quaternion dir(trace.a, Vector(0,0,1));
    122  
    123   plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos);
    124   plc->w = dir * loc->rot;
    125  
    126   return false;
    127 }
    12864
    12965
  • orxonox/trunk/src/track.h

    r3232 r3365  
    1414   To create special levels with special camera movement, rules or whatever, derive from this base class.
    1515*/
    16 class Track
     16class Track : public BaseObject
    1717{
    1818 private:
     
    3535  virtual void postLeave (WorldEntity* entity);
    3636  virtual void tick (float deltaT);
    37   virtual void mapCamera (Location* lookat, Placement* camplc);
    38   virtual bool mapCoords (Location* loc, Placement* plc);       // this should return true if the entity left track boundaries
    3937};
    4038
  • orxonox/trunk/src/vector.cc

    r3234 r3365  
    844844}
    845845
    846 
    847 /**
    848    \brief Creates a new BezierCurve
    849 */
    850 BezierCurve::BezierCurve (void)
    851 {
    852   nodeCount = 0;
    853   firstNode = new PathNode;
    854   currentNode = firstNode;
    855 
    856   firstNode->position = Vector (.0, .0, .0);
    857   firstNode->number = 0;
    858   firstNode->next = 0; // not sure if this really points to NULL!!
    859 
    860   return;
    861 }
    862 
    863 /**
    864    \brief Deletes a BezierCurve.
    865    It does this by freeing all the space taken over from the nodes
    866 */
    867 BezierCurve::~BezierCurve (void)
    868 {
    869   PathNode* tmpNode;
    870   currentNode = firstNode;
    871   while (tmpNode != 0)
    872     {
    873       tmpNode = currentNode;
    874       currentNode = currentNode->next;
    875       delete tmpNode;
    876     }
    877 }
    878 
    879 /**
    880    \brief adds a new Node to the bezier Curve
    881    \param newNode a Vector to the position of the new node
    882 */
    883 void BezierCurve::addNode(const Vector& newNode)
    884 {
    885   PathNode* tmpNode;
    886   if (nodeCount == 0 )
    887     tmpNode = firstNode;
    888   else
    889     {
    890       tmpNode = new PathNode;
    891       currentNode = currentNode->next = tmpNode;
    892     }
    893   tmpNode->position = newNode;
    894   tmpNode->next = 0; // not sure if this really points to NULL!!
    895   tmpNode->number = (++nodeCount);
    896   return;
    897 }
    898 
    899 /**
    900    \brief calculates the Position on the curve
    901    \param t The position on the Curve (0<=t<=1)
    902    \return the Position on the Path
    903 */
    904 Vector BezierCurve::calcPos(float t)
    905 {
    906   if (nodeCount <=4)
    907     {
    908       //      if (verbose >= 1)
    909       //      printf ("Please define at least 4 nodes, until now you have only defined %i.\n", nodeCount);
    910       curvePoint = Vector(0,0,0);
    911     }
    912   PathNode* tmpNode = firstNode;
    913    
    914   int k,kn,nn,nkn;
    915   double blend,muk,munk;
    916   Vector b = Vector(0.0,0.0,0.0);
    917  
    918   muk = 1;
    919   munk = pow(1-t,(double)nodeCount);
    920  
    921   for (k=0; k<=nodeCount; k++) {
    922     nn = nodeCount;
    923     kn = k;
    924     nkn = nodeCount - k;
    925     blend = muk * munk;
    926     muk *= t;
    927     munk /= (1-t);
    928     while (nn >= 1) {
    929       blend *= nn;
    930       nn--;
    931       if (kn > 1) {
    932         blend /= (double)kn;
    933         kn--;
    934       }
    935       if (nkn > 1) {
    936         blend /= (double)nkn;
    937         nkn--;
    938       }
    939     }
    940     b.x += tmpNode->position.x * blend;
    941     b.y += tmpNode->position.y * blend;
    942     b.z += tmpNode->position.z * blend;
    943 
    944     tmpNode = tmpNode->next;
    945   }
    946   return b;
    947 }
    948 
    949 Vector BezierCurve::calcDirection (float t)
    950 {
    951   double diff = .00000000001;
    952  
    953   Vector diffV = ((calcPos(t+diff) - calcPos(t))/diff);
    954   diffV.normalize();
    955   return diffV;
    956 }
    957 
    958 /**
    959   \brief returns the Position of the point calculated on the Curve
    960   \return a Vector to the calculated position
    961 */
    962 Vector BezierCurve::getPos() const
    963 {
    964   return curvePoint;
    965 }
  • orxonox/trunk/src/vector.h

    r3228 r3365  
    149149};
    150150
    151 
    152 
    153 //! Bezier Curve
    154 /**
    155    Class to handle bezier curves in 3-dimesnsional space
    156    
    157    needed for  the Tracking system in OrxOnoX.
    158 */
    159 class BezierCurve
    160 {
    161  private:
    162   int nodeCount;
    163   Vector curvePoint;
    164  
    165   struct PathNode
    166   {
    167     int number;
    168     Vector position;
    169     PathNode* next;
    170   };
    171 
    172   PathNode* firstNode;
    173   PathNode* currentNode;
    174 
    175  public:
    176   BezierCurve (void);
    177   ~BezierCurve (void);
    178   void addNode (const Vector& newNode);
    179   Vector calcPos (float t);
    180   Vector calcDirection (float t);
    181  
    182   Vector getPos () const;
    183 };
    184 
    185 
    186 
    187151#endif /* _VECTOR_H */
  • orxonox/trunk/src/world.cc

    r3233 r3365  
    1818#include "world_entity.h"
    1919#include "collision.h"
     20#include "track_manager.h"
    2021#include "track.h"
    2122#include "player.h"
     
    2324#include "camera.h"
    2425#include "environment.h"
     26#include "p_node.h"
     27#include "null_parent.h"
     28#include "helper_parent.h"
     29#include "glmenu_imagescreen.h"
    2530
    2631using namespace std;
     
    3439World::World (char* name)
    3540{
     41  this->setClassName ("World");
    3642  this->worldName = name;
    3743  this->debugWorldNr = -1;
     
    4854/**
    4955    \brief remove the World from memory
     56   
     57    delete everything explicitly, that isn't contained in the parenting tree!
     58    things contained in the tree are deleted automaticaly
    5059*/
    5160World::~World ()
     
    5766  this->localCamera->destroy();
    5867
     68  this->nullParent->destroy ();
     69
     70  //delete this->trackManager;
     71
     72  /*
    5973  WorldEntity* entity = entities->enumerate(); 
    6074  while( entity != NULL )
     
    6478    }
    6579  this->entities->destroy();
    66 
    67   delete this->entities;
    68   delete this->localCamera;
     80  */
     81
     82  /* FIX the parent list has to be cleared - not possible if we got the old list also*/
     83
     84
     85  //delete this->entities;
     86  //delete this->localCamera;
    6987  /* this->localPlayer hasn't to be deleted explicitly, it is
    7088     contained in entities*/
    7189}
     90
     91GLfloat ctrlpoints[4][3] = {
     92  {20.0, 10.0, 5.0}, {40.0, -10.0, 0.0},
     93  {60.0, -10.0, 5.0}, {80.0, 10.0, 5.0}};
    7294
    7395
     
    78100  cn->addToWorld(this);
    79101  cn->enable(true);
    80 }
     102
     103  //glMap1f (GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]);
     104  //glEnable (GL_MAP1_VERTEX_3);
     105 
     106  //theNurb = gluNewNurbsRenderer ();
     107  //gluNurbsProperty (theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR);
     108  //gluNurbsProperty (theNurb, GLU_NURBS_VERTEX, vertexCallback );
     109
     110}
     111
     112
    81113
    82114ErrorMessage World::start()
     
    99131}
    100132
     133
    101134ErrorMessage World::resume()
    102135{
     
    104137}
    105138
     139
    106140void World::destroy()
    107141{
    108 
    109 }
     142}
     143
     144
     145void World::displayLoadScreen ()
     146{
     147  printf ("World::displayLoadScreen - start\n");
     148 
     149  //GLMenuImageScreen*
     150  glmis = new GLMenuImageScreen();
     151  glmis->init();
     152  glmis->draw();
     153 
     154  printf ("World::displayLoadScreen - end\n");
     155}
     156
     157
     158void World::releaseLoadScreen ()
     159{
     160  printf ("World::releaseLoadScreen - start\n");
     161
     162  printf ("World::releaseLoadScreen - end\n");
     163}
     164
    110165
    111166void World::load()
    112167{
     168  //  BezierCurve* tmpCurve = new BezierCurve();
    113169  if(this->debugWorldNr != -1)
    114170    {
     171      trackManager = TrackManager::getInstance();
     172      trackManager->addPoint(Vector(0,-5,0));
     173      trackManager->addPoint(Vector(10,0,5));
     174      trackManager->addPoint(Vector(20,0,-5));
     175      trackManager->addPoint(Vector(30,0,5));
     176      trackManager->addPoint(Vector(40,0,5));
     177      trackManager->setDuration(.5);
     178      trackManager->setSavePoint();
     179      trackManager->addPoint(Vector(50,10,10));
     180      trackManager->addPoint(Vector(60,0, 10));
     181      trackManager->addPoint(Vector(70,0, 10));
     182      trackManager->addPoint(Vector(80,0,-10));
     183      trackManager->addPoint(Vector(90,0,-10));
     184      trackManager->setDuration(.5);
     185      trackManager->setSavePoint();
     186      trackManager->addPoint(Vector(110,0,5));
     187      trackManager->addPoint(Vector(120,0, 10));
     188      trackManager->addPoint(Vector(130,0, 10));
     189      trackManager->addPoint(Vector(140,0,-10));
     190      trackManager->addPoint(Vector(150,0,-10));
     191      trackManager->setDuration(.5);
     192      int fork11, fork12, fork13, fork14;
     193      trackManager->fork(4, &fork11, &fork12, &fork13, &fork14);
     194      trackManager->workOn(fork11);
     195      trackManager->addPoint(Vector(170, 0, -15));
     196      trackManager->addPoint(Vector(180, 0, -15));
     197      trackManager->workOn(fork12);
     198      trackManager->addPoint(Vector(170, 0, 10));
     199      trackManager->addPoint(Vector(180, 0, 10));
     200      trackManager->addPoint(Vector(190,2,5));
     201      trackManager->addPoint(Vector(200,2,5));
     202      int fork21, fork22;
     203      trackManager->fork(2, &fork21, &fork22);
     204      trackManager->workOn(fork21);
     205      trackManager->addPoint(Vector(220, 10,-10));
     206      trackManager->addPoint(Vector(230, 0,-10));
     207      trackManager->addPoint(Vector(240, 0, 2));
     208      trackManager->addPoint(Vector(250, 0, 0));
     209      trackManager->addPoint(Vector(260, 0, 5));
     210      trackManager->join(2, fork12, fork11);
     211      trackManager->workOn(fork22);
     212      trackManager->addPoint(Vector(220, -10,10));
     213      trackManager->addPoint(Vector(230, 0, 10));
     214      trackManager->addPoint(Vector(240, 0, 10));
     215      trackManager->addPoint(Vector(250, 0, 5));
     216      trackManager->workOn(fork13);
     217      trackManager->addPoint(Vector(200,-10,5));
     218      trackManager->addPoint(Vector(250,-10,5));
     219      printf("fork14: %d\n", fork14);
     220      trackManager->workOn(fork14);
     221      trackManager->addPoint(Vector(200,15,0));
     222      trackManager->addPoint(Vector(210,0,10));
     223
     224
     225
     226      trackManager->join(4, fork21, fork22, fork13, fork14);
     227
     228      /*
     229      tmpCurve->addNode(Vector(10,0,-10));
     230      //tmpCurve->addNode(Vector(10,2,5));
     231      //tmpCurve->addNode(Vector(10,3,-5));
     232      //      tmpCurve->addNode(Vector(10,1,5));
     233      tmpCurve->addNode(Vector(10,0,5));
     234      */
    115235      switch(this->debugWorldNr)
    116236        {
     
    123243        case DEBUG_WORLD_0:
    124244          {
     245            this->nullParent = NullParent::getInstance ();
     246            this->nullParent->setName ("NullParent");
     247
    125248            // create some path nodes
    126249            this->pathnodes = new Vector[6];
     
    141264            // !\todo old track-system has to be removed
    142265
     266            //create helper for player
     267            HelperParent* hp = new HelperParent ();
     268            /* the player has to be added to this helper */
     269
    143270            // create a player
    144             WorldEntity* myPlayer = new Player();
    145             this->spawn(myPlayer);
     271            WorldEntity* myPlayer = new Player ();
     272            myPlayer->setName ("player");
     273            this->spawn (myPlayer);
    146274            this->localPlayer = myPlayer;           
    147275
    148276            // bind input
    149             Orxonox *orx = Orxonox::getInstance();
     277            Orxonox *orx = Orxonox::getInstance ();
    150278            orx->getLocalInput()->bind (myPlayer);
    151279           
    152280            // bind camera
    153281            this->localCamera = new Camera(this);
    154             this->getCamera()->bind (myPlayer);
    155 
    156             Placement* plc = new Placement;
    157             plc->r = Vector(100, 10, 10);
    158             plc->w = Quaternion();
     282            this->localCamera->setName ("camera");
     283            this->getCamera()->bind (myPlayer);
     284            this->localPlayer->addChild (this->localCamera);
     285           
     286
     287            Vector* es = new Vector (50, 2, 0);
     288            Quaternion* qs = new Quaternion ();
    159289            WorldEntity* env = new Environment();
    160             this->spawn(env, plc);
     290            env->setName ("env");
     291            this->spawn(env, es, qs);
     292
    161293
    162294            break;
     
    164296        case DEBUG_WORLD_1:
    165297          {
     298            /*
     299            this->testCurve = new UPointCurve();
     300            this->testCurve->addNode(Vector( 0, 0, 0));
     301            this->testCurve->addNode(Vector(10, 0, 5));
     302            this->testCurve->addNode(Vector(20, -5,-5));
     303            this->testCurve->addNode(Vector(30, 5, 10));
     304            this->testCurve->addNode(Vector(40, 0,-10));
     305            this->testCurve->addNode(Vector(50, 0,-10));
     306            */
     307
     308            this->nullParent = NullParent::getInstance ();
     309            this->nullParent->setName ("NullParent");
     310
    166311            // create some path nodes
    167312            this->pathnodes = new Vector[6];
     
    173318            this->pathnodes[5] = Vector(30, 50, 0);
    174319           
     320
     321
     322
    175323            // create the tracks
    176324            this->tracklen = 6;
     
    183331            // create a player
    184332            WorldEntity* myPlayer = new Player();
     333            myPlayer->setName ("player");
    185334            this->spawn(myPlayer);
    186335            this->localPlayer = myPlayer;           
     
    191340           
    192341            // bind camera
    193             this->localCamera = new Camera(this);
     342            this->localCamera = new Camera (this);
     343            this->localCamera->setName ("camera");
    194344            this->getCamera()->bind (myPlayer);
     345            this->localPlayer->addChild (this->localCamera);
    195346            break;
    196347          }
     
    212363
    213364  int sizeX = 100;
    214   int sizeY = 80;
     365  int sizeZ = 80;
    215366  float length = 1000;
    216367  float width = 200;
    217368  float widthX = float (length /sizeX);
    218   float widthY = float (width /sizeY);
    219  
    220   float height [sizeX][sizeY];
    221   Vector normal_vectors[sizeX][sizeY];
     369  float widthZ = float (width /sizeZ);
     370 
     371  float height [sizeX][sizeZ];
     372  Vector normal_vectors[sizeX][sizeZ];
    222373 
    223374 
    224375  for ( int i = 0; i<sizeX-1; i+=1)
    225     for (int j = 0; j<sizeY-1;j+=1)
     376    for (int j = 0; j<sizeZ-1;j+=1)
    226377      //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
    227378#ifdef __WIN32__
     
    231382#endif
    232383
    233   //Die Hügel ein wenig glätten
     384  //Die Huegel ein wenig glaetten
    234385  for (int h=1; h<2;h++)
    235386    for (int i=1;i<sizeX-2 ;i+=1 )
    236       for(int j=1;j<sizeY-2;j+=1)
     387      for(int j=1;j<sizeZ-2;j+=1)
    237388        height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4;
    238389 
    239390  //Berechnung von normalen Vektoren
    240 
    241391  for(int i=1;i<sizeX-2;i+=1)
    242     for(int j=1;j<sizeY-2 ;j+=1)
     392    for(int j=1;j<sizeZ-2 ;j+=1)
    243393      {
    244         Vector v1 = Vector (widthX*(1),      widthY*(j)  ,      height[i][j]);
    245         Vector v2 = Vector (widthX*(i-1),    widthY*(j)  ,      height[i-1][j]);
    246         Vector v3 = Vector (widthX*(i),      widthY*(j+1),      height[i][j+1]);
    247         Vector v4 = Vector (widthX*(i+1),    widthY*(j),        height[i+1][j]);
    248         Vector v5 = Vector (widthX*(i),      widthY*(j-1),      height[i][j-1]);
     394        Vector v1 = Vector (widthX*(1),      height[i][j],      widthZ*(j) );
     395        Vector v2 = Vector (widthX*(i-1),    height[i-1][j],    widthZ*(j));
     396        Vector v3 = Vector (widthX*(i),      height[i][j+1],    widthZ*(j+1));
     397        Vector v4 = Vector (widthX*(i+1),    height[i+1][j],    widthZ*(j));
     398        Vector v5 = Vector (widthX*(i),      height[i][j-1],    widthZ*(j-1));
    249399       
    250400        Vector c1 = v2 - v1;
     
    253403        Vector c4 = v5 - v1;
    254404        Vector zero = Vector (0,0,0);
    255         normal_vectors[i][j]=c1.cross(v4-v2)+c2.cross(v1-v3)+c3.cross(v2-v4)+c4.cross(v3-v1);
     405        normal_vectors[i][j]=c1.cross(v3-v5)+c2.cross(v4-v2)+c3.cross(v5-v3)+c4.cross(v2-v4);
    256406        normal_vectors[i][j].normalize();
    257407      }
     
    259409  int snowheight=3;
    260410  for ( int i = 0; i<sizeX; i+=1)
    261     for (int j = 0; j<sizeY;j+=1)
     411    for (int j = 0; j<sizeZ;j+=1)
    262412      {   
    263         Vector v1 = Vector (widthX*(i),      widthY*(j)  -width/2,      height[i][j]-20 );
    264         Vector v2 = Vector (widthX*(i+1),    widthY*(j)  -width/2,      height[i+1][j]-20);
    265         Vector v3 = Vector (widthX*(i+1),    widthY*(j+1)-width/2,    height[i+1][j+1]-20);
    266         Vector v4 = Vector (widthX*(i),      widthY*(j+1)-width/2,    height[i][j+1]-20);
     413        Vector v1 = Vector (widthX*(i),      height[i][j]-20,       widthZ*(j)  -width/2);
     414        Vector v2 = Vector (widthX*(i+1),    height[i+1][j]-20,     widthZ*(j)  -width/2);
     415        Vector v3 = Vector (widthX*(i+1),    height[i+1][j+1]-20,   widthZ*(j+1)-width/2);
     416        Vector v4 = Vector (widthX*(i),      height[i][j+1]-20,     widthZ*(j+1)-width/2);
    267417        float a[3];
    268418        if(height[i][j]<snowheight){
     
    371521  //draw track
    372522  glBegin(GL_LINES);
    373   glColor3f(0,1,1);
     523  glColor3f(0.0, 1.0, 1.0);
    374524  for( int i = 0; i < tracklen; i++)
    375525    {
     
    378528    }
    379529  glEnd();
     530 
     531  /*
     532  glBegin(GL_LINE_STRIP);
     533  glColor3f(1.0, 5.0, 1.0);
     534  for( int i = 0; i <= 30; i++)
     535    {
     536      glEvalCoord1f ((GLfloat) i/30.0);
     537    }
     538  glEnd();
     539  */
     540
     541  trackManager->drawGraph(.01);
     542  trackManager->debug(2);
     543  delete trackManager;
     544 
     545  /*
     546  glBegin(GL_LINES);
     547  float i;
     548  for(i = 0.0; i<1; i+=.01)
     549    {
     550      printf("%f, %f, %f\n",tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
     551      glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
     552    }
     553  glEnd();
     554  */
    380555  glEndList();
    381556}
     
    430605void World::draw ()
    431606{
    432   // draw geometry
    433  
    434607  // draw entities
    435608  WorldEntity* entity;
    436  
    437609  entity = this->entities->enumerate();
    438610  while( entity != NULL )
     
    440612      if( entity->bDraw ) entity->draw();
    441613      entity = this->entities->nextElement();
    442     }
    443  
    444  
     614    }
     615 
     616  //glmis = new GLMenuImageScreen();
     617  ///glmis->init();
     618
    445619  // draw debug coord system
    446620  glCallList (objectList);
    447 
    448621
    449622}
     
    459632void World::update ()
    460633{
     634  /*
    461635  //List<WorldEntity> *l;
    462636  WorldEntity* entity;
     
    477651          t = loc->part;
    478652         
    479           /* check if entity has still a legal track-id */
    480653          if( t >= tracklen )
    481654            {
     
    500673      else
    501674        {
    502           /* \todo: implement check whether this particular free entity
    503              is out of the game area
    504              \todo: call function to notify the entity that it left
    505              the game area
    506           */
    507675        }
    508676     
    509677      entity = entities->nextElement();
    510678    }
    511  
     679  */ 
    512680}
    513681
     
    522690  float seconds = deltaT / 1000.0;
    523691 
     692  this->nullParent->update (seconds);
     693  //this->nullParent->processTick (seconds);
     694
    524695  entity = entities->enumerate();
    525696  while( entity != NULL)
     
    542713
    543714
    544 
    545 /**
    546    \brief calls the correct mapping function to convert a given "look at"-Location to a
    547    Camera Placement
    548 */
    549 void World::calcCameraPos (Location* loc, Placement* plc)
    550 {
    551   track[loc->part].mapCamera (loc, plc);
    552 }
    553 
    554 
    555715void World::setTrackLen(Uint32 len)
    556716{
     
    571731void World::debug()
    572732{
    573   //List<WorldEntity> *l;
     733  printf ("World::debug() - starting debug\n");
     734  PNode* p1 = NullParent::getInstance ();
     735  PNode* p2 = new PNode (new Vector(2, 2, 2), p1);
     736  PNode* p3 = new PNode (new Vector(4, 4, 4), p1);
     737  PNode* p4 = new PNode (new Vector(6, 6, 6), p2);
     738
     739  p1->debug ();
     740  p2->debug ();
     741  p3->debug ();
     742  p4->debug ();
     743
     744  p1->shiftCoor (new Vector(-1, -1, -1));
     745
     746  printf("World::debug() - shift\n");
     747  p1->debug ();
     748  p2->debug ();
     749  p3->debug ();
     750  p4->debug ();
     751 
     752  p1->update (1);
     753
     754  printf ("World::debug() - update\n");
     755  p1->debug ();
     756  p2->debug ();
     757  p3->debug ();
     758  p4->debug ();
     759
     760  p2->shiftCoor (new Vector(-1, -1, -1));
     761  p1->update (2);
     762
     763  p1->debug ();
     764  p2->debug ();
     765  p3->debug ();
     766  p4->debug ();
     767
     768  p2->setAbsCoor (new Vector(1,2,3));
     769
     770
     771 p1->update (2);
     772
     773  p1->debug ();
     774  p2->debug ();
     775  p3->debug ();
     776  p4->debug ();
     777
     778  p1->destroy ();
     779 
     780 
     781  /*
    574782  WorldEntity* entity;
    575  
    576783  printf("counting all entities\n");
    577784  printf("World::debug() - enumerate()\n");
     
    582789      entity = entities->nextElement();
    583790    }
     791  */
    584792}
    585793
     
    594802void World::mainLoop()
    595803{
    596   this->lastFrame = SDL_GetTicks();
     804  this->lastFrame = SDL_GetTicks ();
    597805  printf("World::mainLoop() - Entering main loop\n");
    598806  while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */
    599807    {
    600808      // Network
    601       synchronize();
     809      this->synchronize ();
    602810      // Process input
    603       handleInput();
     811      this->handleInput ();
    604812      if( this->bQuitCurrentGame || this->bQuitOrxonox)
    605813        {
     
    608816        }
    609817      // Process time
    610       timeSlice();
     818      this->timeSlice ();
    611819      // Process collision
    612       collision();
     820      this->collision ();
    613821      // Draw
    614       display();
    615  
    616       for(int i = 0; i < 10000000; i++) {}
     822      this->display ();
     823 
     824      for( int i = 0; i < 5000000; i++) {}
     825      /* \todo this is to slow down the program for openGl Software emulator computers, reimplement*/
    617826    }
    618827  printf("World::mainLoop() - Exiting the main loop\n");
     
    701910  this->draw();
    702911  // draw HUD
     912  /* \todo draw HUD */
    703913  // flip buffers
    704914  SDL_GL_SwapBuffers();
     915  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
     916  //SDL_Flip (screen);
    705917}
    706918
     
    723935void World::spawn(WorldEntity* entity)
    724936{
    725   Location zeroloc;
    726   Location* loc = NULL;
    727   WorldEntity* owner;
    728 
    729   entities->add (entity);
    730   zeroloc.dist = 0;
    731   zeroloc.part = 0;
    732   zeroloc.pos = Vector();
    733   zeroloc.rot = Quaternion();
    734   loc = &zeroloc;
    735   entity->init (loc, owner);
    736   if (entity->bFree)
    737     {
    738       this->track[loc->part].mapCoords( loc, entity->getPlacement());
    739     }
     937  if( this->nullParent != NULL && entity->parent == NULL)
     938    this->nullParent->addChild (entity);
     939
     940  this->entities->add (entity);
     941
    740942  entity->postSpawn ();
    741943}
     
    747949   \param location where to add
    748950*/
    749 void World::spawn(WorldEntity* entity, Location* loc)
    750 {
    751   Location zeroLoc;
    752   WorldEntity* owner;
     951void World::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir)
     952{
     953  entity->setAbsCoor (absCoor);
     954  entity->setAbsDir (absDir);
     955 
     956  if( this->nullParent != NULL && entity->parent == NULL)
     957    this->nullParent->addChild (entity);
     958
    753959  this->entities->add (entity);
    754   if( loc == NULL)
    755     {
    756       zeroLoc.dist = 0;
    757       zeroLoc.part = 0;
    758       zeroLoc.pos = Vector();
    759       zeroLoc.rot = Quaternion();
    760       loc = &zeroLoc;
    761     }
    762   entity->init (loc, owner);
    763   if (entity->bFree)
    764     {
    765       this->track[loc->part].mapCoords( loc, entity->getPlacement());
    766     }
     960
    767961  entity->postSpawn ();
    768   //return entity;
    769 }
    770 
    771 
    772 /**
    773    \brief add and spawn a new entity to this world
    774    \param entity to be added
    775    \param place where to be added
    776 */
    777 void World::spawn(WorldEntity* entity, Placement* plc)
    778 {
    779   Placement zeroPlc;
    780   WorldEntity* owner;
    781   if( plc == NULL)
    782     {
    783       zeroPlc.r = Vector();
    784       zeroPlc.w = Quaternion();
    785       plc = &zeroPlc;
    786     }
    787   this->entities->add (entity);
    788   entity->init (plc, owner);
    789   entity->postSpawn ();
    790   //return entity;
    791 }
     962}
     963
    792964
    793965
     
    800972  return false;
    801973}
     974
     975
     976
     977
     978void World::swap (unsigned char &a, unsigned char &b)
     979{
     980  unsigned char temp;
     981  temp = a;
     982  a    = b;
     983  b    = temp;
     984}
  • orxonox/trunk/src/world.h

    r3236 r3365  
    1111
    1212
    13 
     13class TrackManager;
    1414class Track;
    1515class WorldEntity;
    1616class Camera;
     17class PNode;
     18class GLMenuImageScreen;
    1719
    1820//! The game environment
     
    2325  World (int worldID);
    2426  virtual ~World ();
    25 
    26   template<typename T>
    27     T* spawn (Location* loc, WorldEntity* owner);       // template to be able to spawn any derivation of WorldEntity
    28   template<typename T>
    29     T* spawn (Placement* plc, WorldEntity* owner);
    3027 
    3128  virtual ErrorMessage init ();
     
    3835  virtual void destroy ();
    3936
     37  //static void vertexCallback (GLfloat* vertex);
     38
    4039  void timeSlice (Uint32 deltaT);
    4140  void collide ();
    4241  void draw ();
    4342  void update ();       // maps Locations to Placements
    44   void calcCameraPos (Location* loc, Placement* plc);
     43  //void calcCameraPos (Location* loc, Placement* plc);
    4544       
    4645  void unload ();
    4746  bool command (Command* cmd);
     47  virtual void displayLoadScreen();
     48  virtual void releaseLoadScreen();
    4849 
    4950  void setTrackLen (Uint32 tracklen);
     
    5354
    5455  void spawn (WorldEntity* entity);
    55   void spawn (WorldEntity* entity, Location* loc);
    56   void spawn (WorldEntity* entity, Placement* plc);
     56  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
    5757
    5858  tList<WorldEntity>* entities;
    5959 
    6060  // base level data
     61  TrackManager* trackManager;
    6162  Track* track;
    6263  Uint32 tracklen;   // number of Tracks the World consist of
     
    6465  Camera* localCamera; 
    6566
     67
     68  UPointCurve* testCurve;
    6669 private:
    6770  Uint32 lastFrame; //!> last time of frame
     
    7073  bool bPause;
    7174
     75  GLMenuImageScreen* glmis;
     76
    7277  char* worldName;
    7378  int debugWorldNr;
    7479  GLuint objectList;
     80  SDL_Surface *loadImage;
    7581
    7682  WorldEntity* localPlayer;
    77  
     83 
     84  PNode* nullParent;
     85 
    7886  void mainLoop ();
    7987  void synchronize ();
     
    8391  void display ();
    8492  void debug ();
     93
     94  void swap (unsigned char &a, unsigned char &b); /* \todo: this function doesn't belong here, this should be part of a image class*/
    8595};
    8696
  • orxonox/trunk/src/world_entity.cc

    r3245 r3365  
    3636WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
    3737{
     38  this->setClassName ("WorldEntity");
    3839  this->bDraw = true;
    3940  collisioncluster = NULL;
    40   owner = NULL;
    4141}
    4242
     
    5353   \return a pointer to location
    5454*/
     55/*PN
    5556Location* WorldEntity::getLocation ()
    5657{
    5758  return &loc;
    5859}
     60*/
    5961
    6062/**
     
    6264   \return a pointer to placement
    6365*/
     66 /*PN
    6467Placement* WorldEntity::getPlacement ()
    6568{
    6669  return &place;
    6770}
    68 
     71 */
    6972/**
    7073   \brief query whether the WorldEntity in question is free
     
    8992}
    9093
     94
    9195/**
    9296   \brief this method is called every frame
     
    99103}
    100104
     105
     106/**
     107    \brief process draw function
     108*/
     109void WorldEntity::processDraw ()
     110{
     111  this->draw ();
     112  PNode* pn = this->children->enumerate ();
     113  while( pn != NULL)
     114    {
     115      ((WorldEntity*)pn)->processDraw ();
     116      pn = this->children->nextElement();
     117    }
     118}
     119
     120
     121void WorldEntity::setDrawable (bool bDraw)
     122{
     123  this->bDraw = bDraw;
     124}
     125
     126
    101127/**
    102128   \brief the entity is drawn onto the screen with this function
     
    105131*/
    106132void WorldEntity::draw()
    107 {
    108 }
     133{}
    109134
    110135/**
     
    134159void WorldEntity::destroy() {}
    135160
    136 
    137 /**
    138    \brief basic initialisation for bound Entities
    139 */
    140 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)
    141 {
    142   loc = *spawnloc;
    143   owner = spawnowner;
    144 }
    145 
    146 /**
    147    \brief basic initialisation for free Entities
    148 */
    149 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)
    150 {
    151   place = *spawnplc;
    152   owner = spawnowner;
    153 }
    154161
    155162/**
     
    181188   to look at the location you return with this.
    182189*/
     190/*PN
    183191void WorldEntity::getLookat (Location* locbuf)
    184192{
    185193}
     194*/
    186195
    187196/**
  • orxonox/trunk/src/world_entity.h

    r3229 r3365  
    88
    99#include "stdincl.h"
     10#include "p_node.h"
    1011
    1112class CollisionCluster;
     13class Model;
    1214
    1315//! Basic class from which all interactive stuff in the world is derived from
    14 class WorldEntity
     16class WorldEntity : public PNode
    1517{       
    1618  friend class World;
    17  
     19
    1820 public:
    1921  WorldEntity (bool isFree = false);
    2022  virtual ~WorldEntity ();
     23
     24  Model* model;
    2125 
    22   Location* getLocation ();
    23   Placement* getPlacement ();
    2426  void setCollision (CollisionCluster* newhull);
    2527 
     
    3537  virtual void collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags);
    3638  virtual void command (Command* cmd);
    37  
     39
     40  void processDraw ();
    3841  virtual void draw ();
    39   virtual void getLookat (Location* locbuf);
     42  void setDrawable (bool bDraw);
    4043 
    4144  virtual void leftWorld ();
     
    4548  bool bCollide;
    4649  bool bDraw;
    47  
    48   WorldEntity* owner;
     50
    4951  CollisionCluster* collisioncluster;
    50   Placement place;
    51   Location loc;
    52  
    53   void init( Location* spawnloc, WorldEntity* spawnowner);
    54   void init( Placement* spawnplc, WorldEntity* spawnowner);
    5552};
    5653
Note: See TracChangeset for help on using the changeset viewer.