Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3399 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Feb 6, 2005, 11:27:25 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/nico: merged trunk into branches/nico
merged with command:
svn merge ../trunk/ nico/ -r 3238:HEAD
resolved conflict in favor of branches/nico.

Location:
orxonox/branches/nico
Files:
2 deleted
42 edited
24 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico

    • Property svn:externals set to
  • orxonox/branches/nico/Makefile.in

    r3391 r3399  
    3838        $(srcdir)/Makefile.in $(srcdir)/config.h.in \
    3939        $(srcdir)/doc/documentation.am $(top_srcdir)/configure AUTHORS \
    40         COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \
    41         depcomp install-sh missing mkinstalldirs
     40        COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \
     41        install-sh missing mkinstalldirs
    4242subdir = .
    4343ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    125125SHELL = @SHELL@
    126126STRIP = @STRIP@
     127SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@
     128SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@
    127129VERSION = @VERSION@
    128130ac_ct_CC = @ac_ct_CC@
  • orxonox/branches/nico/NEWS

    r3238 r3399  
    55Date: December 14, 2004
    66Topic: Repository Moved
    7 Body: Today we moved the repository. The new location of the repository is <A href="http://orxonox.ethz.ch/repos/reporx">http://orxonox.ethz.ch/repos/reporx</A>.
     7Body: Today we moved the repository. The new location of the repository is <A href="http://svn.orxonox.ethz.ch/reporx">http://svn.orxonox.ethz.ch/reporx</A>.
    88
    99Date:   November 16, 2004
  • orxonox/branches/nico/configure

    r3391 r3399  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.59 for orxonox 0.2.0_alpha-r1.
     3# Generated by GNU Autoconf 2.59 for orxonox 0.2.1-pre-alpha.
    44#
    5 # Report bugs to <orxonox-dev@mail.datacore.ch>.
     5# Report bugs to <orxonox-dev at mail.datacore.ch>.
    66#
    77# Copyright (C) 2003 Free Software Foundation, Inc.
     
    270270PACKAGE_NAME='orxonox'
    271271PACKAGE_TARNAME='orxonox'
    272 PACKAGE_VERSION='0.2.0_alpha-r1'
    273 PACKAGE_STRING='orxonox 0.2.0_alpha-r1'
    274 PACKAGE_BUGREPORT='orxonox-dev@mail.datacore.ch'
     272PACKAGE_VERSION='0.2.1-pre-alpha'
     273PACKAGE_STRING='orxonox 0.2.1-pre-alpha'
     274PACKAGE_BUGREPORT='orxonox-dev at mail.datacore.ch'
    275275
    276276ac_unique_file="."
     
    312312#endif"
    313313
    314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP DEBUG DOXYGEN DOXYGEN_TRUE DOXYGEN_FALSE MSBITFIELDS GTK2_LIBS GTK2_CFLAGS HAVE_GTK2_TRUE HAVE_GTK2_FALSE LIBOBJS LTLIBOBJS'
     314ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP DEBUG SUB_PROJECTS_TRUE SUB_PROJECTS_FALSE DOXYGEN DOXYGEN_TRUE DOXYGEN_FALSE MSBITFIELDS GTK2_LIBS GTK2_CFLAGS HAVE_GTK2_TRUE HAVE_GTK2_FALSE LIBOBJS LTLIBOBJS'
    315315ac_subst_files=''
    316316
     
    789789  # This message is too long to be a string in the A/UX 3.1 sh.
    790790  cat <<_ACEOF
    791 \`configure' configures orxonox 0.2.0_alpha-r1 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 0.2.0_alpha-r1:";;
     858     short | recursive ) echo "Configuration of orxonox 0.2.1-pre-alpha:";;
    859859   esac
    860860  cat <<\_ACEOF
     
    867867  --enable-debug          compiles in debug mode. Lots of debug info about the
    868868                          game.
     869  --enable-sub-projects   also builds the subProjects by default
    869870
    870871Optional Packages:
     
    888889it to find libraries and programs with nonstandard names/locations.
    889890
    890 Report bugs to <orxonox-dev@mail.datacore.ch>.
     891Report bugs to <orxonox-dev at mail.datacore.ch>.
    891892_ACEOF
    892893fi
     
    984985if $ac_init_version; then
    985986  cat <<\_ACEOF
    986 orxonox configure 0.2.0_alpha-r1
     987orxonox configure 0.2.1-pre-alpha
    987988generated by GNU Autoconf 2.59
    988989
     
    998999running configure, to aid debugging if configure makes a mistake.
    9991000
    1000 It was created by orxonox $as_me 0.2.0_alpha-r1, which was
     1001It was created by orxonox $as_me 0.2.1-pre-alpha, which was
    10011002generated by GNU Autoconf 2.59.  Invocation command line was
    10021003
     
    17191720# Define the identity of the package.
    17201721 PACKAGE='orxonox'
    1721  VERSION='0.2.0_alpha-r1'
     1722 VERSION='0.2.1-pre-alpha'
    17221723
    17231724
     
    39033904
    39043905
     3906### SubProject-enable
     3907def_sdl_image=yes
     3908echo "$as_me:$LINENO: checking if the SubProjects should be built" >&5
     3909echo $ECHO_N "checking if the SubProjects should be built... $ECHO_C" >&6
     3910# Check whether --enable-sub-projects or --disable-sub-projects was given.
     3911if test "${enable_sub_projects+set}" = set; then
     3912  enableval="$enable_sub_projects"
     3913  def_sub_projects=yes
     3914fi;
     3915if test "$def_sub_projects" = yes; then
     3916  echo "yes"
     3917fi
     3918if test "$def_sub_projects" = no; then
     3919  echo "no"
     3920fi
     3921
     3922
     3923if test x$def_sub_projects = xyes; then
     3924  SUB_PROJECTS_TRUE=
     3925  SUB_PROJECTS_FALSE='#'
     3926else
     3927  SUB_PROJECTS_TRUE='#'
     3928  SUB_PROJECTS_FALSE=
     3929fi
     3930
     3931
    39053932## PROGRAMM CHECKING
    39063933# checking for Doxygen
     
    41674194    (
    41684195      cat <<\_ASBOX
    4169 ## ------------------------------------------- ##
    4170 ## Report this to orxonox-dev@mail.datacore.ch ##
    4171 ## ------------------------------------------- ##
     4196## ---------------------------------------------- ##
     4197## Report this to orxonox-dev at mail.datacore.ch ##
     4198## ---------------------------------------------- ##
    41724199_ASBOX
    41734200    ) |
     
    43974424    (
    43984425      cat <<\_ASBOX
    4399 ## ------------------------------------------- ##
    4400 ## Report this to orxonox-dev@mail.datacore.ch ##
    4401 ## ------------------------------------------- ##
     4426## ---------------------------------------------- ##
     4427## Report this to orxonox-dev at mail.datacore.ch ##
     4428## ---------------------------------------------- ##
    44024429_ASBOX
    44034430    ) |
     
    46924719    (
    46934720      cat <<\_ASBOX
    4694 ## ------------------------------------------- ##
    4695 ## Report this to orxonox-dev@mail.datacore.ch ##
    4696 ## ------------------------------------------- ##
     4721## ---------------------------------------------- ##
     4722## Report this to orxonox-dev at mail.datacore.ch ##
     4723## ---------------------------------------------- ##
    46974724_ASBOX
    46984725    ) |
     
    48784905
    48794906CPPFLAGS="-I/usr/X11R6/include"
    4880 LDFLAGS="-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
     4907LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
    48814908# checking gl header
    48824909
     
    50025029    (
    50035030      cat <<\_ASBOX
    5004 ## ------------------------------------------- ##
    5005 ## Report this to orxonox-dev@mail.datacore.ch ##
    5006 ## ------------------------------------------- ##
     5031## ---------------------------------------------- ##
     5032## Report this to orxonox-dev at mail.datacore.ch ##
     5033## ---------------------------------------------- ##
    50075034_ASBOX
    50085035    ) |
     
    50365063
    50375064#  checking for Unix GL
    5038    echo "$as_me:$LINENO: checking for main in -lGL" >&5
    5039 echo $ECHO_N "checking for main in -lGL... $ECHO_C" >&6
    5040 if test "${ac_cv_lib_GL_main+set}" = set; then
     5065   echo "$as_me:$LINENO: checking for glLoadIdentity in -lGL" >&5
     5066echo $ECHO_N "checking for glLoadIdentity in -lGL... $ECHO_C" >&6
     5067if test "${ac_cv_lib_GL_glLoadIdentity+set}" = set; then
    50415068  echo $ECHO_N "(cached) $ECHO_C" >&6
    50425069else
     
    50505077/* end confdefs.h.  */
    50515078
    5052 
     5079/* Override any gcc2 internal prototype to avoid an error.  */
     5080#ifdef __cplusplus
     5081extern "C"
     5082#endif
     5083/* We use char because int might match the return type of a gcc2
     5084   builtin and then its argument prototype would still apply.  */
     5085char glLoadIdentity ();
    50535086int
    50545087main ()
    50555088{
    5056 main ();
     5089glLoadIdentity ();
    50575090  ;
    50585091  return 0;
     
    50815114  echo "$as_me:$LINENO: \$? = $ac_status" >&5
    50825115  (exit $ac_status); }; }; then
    5083   ac_cv_lib_GL_main=yes
     5116  ac_cv_lib_GL_glLoadIdentity=yes
    50845117else
    50855118  echo "$as_me: failed program was:" >&5
    50865119sed 's/^/| /' conftest.$ac_ext >&5
    50875120
    5088 ac_cv_lib_GL_main=no
     5121ac_cv_lib_GL_glLoadIdentity=no
    50895122fi
    50905123rm -f conftest.err conftest.$ac_objext \
     
    50925125LIBS=$ac_check_lib_save_LIBS
    50935126fi
    5094 echo "$as_me:$LINENO: result: $ac_cv_lib_GL_main" >&5
    5095 echo "${ECHO_T}$ac_cv_lib_GL_main" >&6
    5096 if test $ac_cv_lib_GL_main = yes; then
     5127echo "$as_me:$LINENO: result: $ac_cv_lib_GL_glLoadIdentity" >&5
     5128echo "${ECHO_T}$ac_cv_lib_GL_glLoadIdentity" >&6
     5129if test $ac_cv_lib_GL_glLoadIdentity = yes; then
    50975130  FOUND_GL=yes
    50985131fi
     
    52315264    (
    52325265      cat <<\_ASBOX
    5233 ## ------------------------------------------- ##
    5234 ## Report this to orxonox-dev@mail.datacore.ch ##
    5235 ## ------------------------------------------- ##
     5266## ---------------------------------------------- ##
     5267## Report this to orxonox-dev at mail.datacore.ch ##
     5268## ---------------------------------------------- ##
    52365269_ASBOX
    52375270    ) |
     
    54655498    (
    54665499      cat <<\_ASBOX
    5467 ## ------------------------------------------- ##
    5468 ## Report this to orxonox-dev@mail.datacore.ch ##
    5469 ## ------------------------------------------- ##
     5500## ---------------------------------------------- ##
     5501## Report this to orxonox-dev at mail.datacore.ch ##
     5502## ---------------------------------------------- ##
    54705503_ASBOX
    54715504    ) |
     
    57125745    (
    57135746      cat <<\_ASBOX
    5714 ## ------------------------------------------- ##
    5715 ## Report this to orxonox-dev@mail.datacore.ch ##
    5716 ## ------------------------------------------- ##
     5747## ---------------------------------------------- ##
     5748## Report this to orxonox-dev at mail.datacore.ch ##
     5749## ---------------------------------------------- ##
    57175750_ASBOX
    57185751    ) |
     
    58675900    (
    58685901      cat <<\_ASBOX
    5869 ## ------------------------------------------- ##
    5870 ## Report this to orxonox-dev@mail.datacore.ch ##
    5871 ## ------------------------------------------- ##
     5902## ---------------------------------------------- ##
     5903## Report this to orxonox-dev at mail.datacore.ch ##
     5904## ---------------------------------------------- ##
    58725905_ASBOX
    58735906    ) |
     
    60516084    (
    60526085      cat <<\_ASBOX
    6053 ## ------------------------------------------- ##
    6054 ## Report this to orxonox-dev@mail.datacore.ch ##
    6055 ## ------------------------------------------- ##
     6086## ---------------------------------------------- ##
     6087## Report this to orxonox-dev at mail.datacore.ch ##
     6088## ---------------------------------------------- ##
    60566089_ASBOX
    60576090    ) |
     
    62826315    (
    62836316      cat <<\_ASBOX
    6284 ## ------------------------------------------- ##
    6285 ## Report this to orxonox-dev@mail.datacore.ch ##
    6286 ## ------------------------------------------- ##
     6317## ---------------------------------------------- ##
     6318## Report this to orxonox-dev at mail.datacore.ch ##
     6319## ---------------------------------------------- ##
    62876320_ASBOX
    62886321    ) |
     
    65116544    (
    65126545      cat <<\_ASBOX
    6513 ## ------------------------------------------- ##
    6514 ## Report this to orxonox-dev@mail.datacore.ch ##
    6515 ## ------------------------------------------- ##
     6546## ---------------------------------------------- ##
     6547## Report this to orxonox-dev at mail.datacore.ch ##
     6548## ---------------------------------------------- ##
    65166549_ASBOX
    65176550    ) |
     
    70227055    (
    70237056      cat <<\_ASBOX
    7024 ## ------------------------------------------- ##
    7025 ## Report this to orxonox-dev@mail.datacore.ch ##
    7026 ## ------------------------------------------- ##
     7057## ---------------------------------------------- ##
     7058## Report this to orxonox-dev at mail.datacore.ch ##
     7059## ---------------------------------------------- ##
    70277060_ASBOX
    70287061    ) |
     
    73347367    (
    73357368      cat <<\_ASBOX
    7336 ## ------------------------------------------- ##
    7337 ## Report this to orxonox-dev@mail.datacore.ch ##
    7338 ## ------------------------------------------- ##
     7369## ---------------------------------------------- ##
     7370## Report this to orxonox-dev at mail.datacore.ch ##
     7371## ---------------------------------------------- ##
    73397372_ASBOX
    73407373    ) |
     
    75477580
    75487581
    7549                                                   ac_config_files="$ac_config_files Makefile src/console/Makefile src/gui/Makefile src/Makefile src/importer/Makefile"
     7582                                                  ac_config_files="$ac_config_files Makefile src/Makefile src/importer/Makefile src/console/Makefile src/gui/Makefile"
     7583
    75507584
    75517585cat >confcache <<\_ACEOF
     
    76587692Usually this means the macro was only invoked conditionally." >&5
    76597693echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
     7694Usually this means the macro was only invoked conditionally." >&2;}
     7695   { (exit 1); exit 1; }; }
     7696fi
     7697if test -z "${SUB_PROJECTS_TRUE}" && test -z "${SUB_PROJECTS_FALSE}"; then
     7698  { { echo "$as_me:$LINENO: error: conditional \"SUB_PROJECTS\" was never defined.
     7699Usually this means the macro was only invoked conditionally." >&5
     7700echo "$as_me: error: conditional \"SUB_PROJECTS\" was never defined.
    76607701Usually this means the macro was only invoked conditionally." >&2;}
    76617702   { (exit 1); exit 1; }; }
     
    79467987cat >&5 <<_CSEOF
    79477988
    7948 This file was extended by orxonox $as_me 0.2.0_alpha-r1, which was
     7989This file was extended by orxonox $as_me 0.2.1-pre-alpha, which was
    79497990generated by GNU Autoconf 2.59.  Invocation command line was
    79507991
     
    80098050cat >>$CONFIG_STATUS <<_ACEOF
    80108051ac_cs_version="\\
    8011 orxonox config.status 0.2.0_alpha-r1
     8052orxonox config.status 0.2.1-pre-alpha
    80128053configured by $0, generated by GNU Autoconf 2.59,
    80138054  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
     
    81208161  # Handling of arguments.
    81218162  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     8163  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     8164  "src/importer/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/importer/Makefile" ;;
    81228165  "src/console/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/console/Makefile" ;;
    81238166  "src/gui/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gui/Makefile" ;;
    8124   "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
    8125   "src/importer/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/importer/Makefile" ;;
    81268167  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
    81278168  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
     
    82688309s,@EGREP@,$EGREP,;t t
    82698310s,@DEBUG@,$DEBUG,;t t
     8311s,@SUB_PROJECTS_TRUE@,$SUB_PROJECTS_TRUE,;t t
     8312s,@SUB_PROJECTS_FALSE@,$SUB_PROJECTS_FALSE,;t t
    82708313s,@DOXYGEN@,$DOXYGEN,;t t
    82718314s,@DOXYGEN_TRUE@,$DOXYGEN_TRUE,;t t
  • orxonox/branches/nico/configure.ac

    r3391 r3399  
    33
    44AC_PREREQ(2.56)
    5 AC_INIT(orxonox, 0.2.0_alpha-r1, orxonox-dev@mail.datacore.ch)
     5AC_INIT(orxonox, 0.2.1-pre-alpha, [orxonox-dev at mail.datacore.ch])
    66
    77# Detect the canonical host and target build environment.
     
    6969
    7070
     71### SubProject-enable
     72def_sdl_image=yes
     73AC_MSG_CHECKING([if the SubProjects should be built])
     74AC_ARG_ENABLE([sub-projects],
     75        AC_HELP_STRING( [--enable-sub-projects],
     76        [also builds the subProjects by default]), [def_sub_projects=yes])
     77if test "$def_sub_projects" = yes; then
     78  echo "yes"
     79fi
     80if test "$def_sub_projects" = no; then
     81  echo "no"
     82fi
     83AM_CONDITIONAL(SUB_PROJECTS, test x$def_sub_projects = xyes)
     84
    7185## PROGRAMM CHECKING
    7286# checking for Doxygen
     
    161175
    162176CPPFLAGS="-I/usr/X11R6/include"
    163 LDFLAGS="-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
     177LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
    164178# checking gl header
    165179   AC_CHECK_HEADERS(GL/gl.h ,,
     
    167181
    168182#  checking for Unix GL
    169    AC_CHECK_LIB([GL], [main], FOUND_GL=yes)
     183   AC_CHECK_LIB([GL], [glLoadIdentity], FOUND_GL=yes)
    170184   if test "$FOUND_GL" = "yes" ; then
    171185     LIBS="$LIBS -lGL"
     
    364378
    365379AC_CONFIG_FILES([Makefile
     380                 src/Makefile
     381                 src/importer/Makefile
    366382                 src/console/Makefile
    367                  src/gui/Makefile
    368                  src/Makefile
    369                  src/importer/Makefile])
     383                 src/gui/Makefile])
     384
    370385AC_OUTPUT
  • orxonox/branches/nico/doc/orxodox.src

    r2710 r3399  
    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/branches/nico/doc/orxonox.1

    r1861 r3399  
    1414.\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    1515.\"
    16 .TH ORXONOX 1 "April 13, 2004"
     16.TH ORXONOX 1 "March 2, 2004"
    1717.\" Please update the above date whenever this man page is modified.
    1818.\"
     
    2828.\" for manpage-specific macros, see man(7)
    2929.SH NAME
    30 orxonox \- the future of 3D-vertical-scrollers
     30orxonox \-  High-End Vertical Scroller
    3131.SH SYNOPSIS
    3232.B orxonox
    3333.RI [ options ]
    3434.SH DESCRIPTION
    35 \fBorxonox\fP washes your windows, mends your fences, mows your lawn...
     35\fBorxonox\fP is an open-source vertical scroller game programmed in C++,OpenGL and SDL. It's designed to run on all important platforms like Linux, MacOS X, Windows.
    3636.PP
    37 It also...
     37It washes your windows, mends your fences, mows your lawn...
    3838.SH OPTIONS
    3939\fBorxonox\fP accepts the following options:
    40 .TP
    41 .BR  -q , " --quiet" , " --silent"
    42 Inhibit usual output.
    43 .TP
    44 .B  -v, --verbose
    45 Print more information.
    4640.TP
    4741.B \-h, \-\-help
    4842Show summary of options.
    4943.TP
    50 .B \-V, \-\-version
    51 Show version of program.
     44.B \-v=<i>, \-\-verbose=\<i\>
     45Prints out: 0: nothing, 1: error, 2: warnings, 3: information, 4+: debug
     46.TP
     47.B \-g, \-\-gui
     48displays the gui prior to starting orxonox. (this is also the case, if the configuration-files do not exist in your home).
     49.TP
     50.B \-q, \-\-windowed
     51starts orxonox in windowed mode. (not fullscreen)
     52.TP
     53.B \-\-no\-sound
     54Disables audio completely
     55.TP
     56.B \-w, \-\-wireframe
     57Renders everything in Wireframe mode.
     58.TP
    5259.\" .SH "SEE ALSO"
    5360.\" .BR foo (1),
    5461.\" .BR bar (1).
    5562.SH AUTHOR
    56 orx <orxonox-announce@mail.datacore.ch>.
     63orx-crew <orxonox@orxonox.ethz.ch>.
  • orxonox/branches/nico/src/Makefile.am

    r3383 r3399  
    2424                 story_entity.cc \
    2525                 environment.cc \
    26                  importer/object.cc \
     26                 importer/model.cc \
     27                 importer/objModel.cc \
    2728                 importer/array.cc \
    2829                 importer/material.cc \
    29                  list.cc
     30                 importer/texture.cc \
     31                 list.cc \
     32                 p_node.cc \
     33                 null_parent.cc \
     34                 base_object.cc \
     35                 helper_parent.cc \
     36                 track_manager.cc \
     37                 matrix.cc \
     38                 curve.cc \
     39                 glmenu_imagescreen.cc
     40
    3041
    3142noinst_HEADERS = ability.h \
     
    5364                 shoot_laser.h \
    5465                 world_entity.h \
    55                  coordinates.h \
    5666                 message_structures.h \
    5767                 shoot_rocket.h \
     
    6070                 story_def.h \
    6171                 game_loader.h \
    62                  campaign.h
     72                 campaign.h \
     73                 p_node.h \
     74                 null_parent.h \
     75                 base_object.h \
     76                 helper_parent.h \
     77                 track_manager.h \
     78                 matrix.h \
     79                 curve.h \
     80                 glmenu_imagescreen.h \
     81                 debug.h
     82
    6383
    6484## orxonox.conf will be used from home-dir instead.
     
    7191  GTK_PROGS =
    7292endif
     93if SUB_PROJECTS
     94  SUB_PROGS = importer \
     95              gui \
     96              $(GTK_PROGS)
     97else
     98  SUB_PROGS =
     99endif
    73100
    74101SUBDIRS = . \
    75           importer \
    76           heightmap \
    77           gui \
    78           $(GTK_PROGS)
     102          $(SUB_PROGS)
    79103
    80104#  uncomment the following if orxonox requires the math library
  • orxonox/branches/nico/src/Makefile.in

    r3391 r3399  
    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)
     61        environment.$(OBJEXT) model.$(OBJEXT) objModel.$(OBJEXT) \
     62        array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
     63        list.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT) \
     64        base_object.$(OBJEXT) helper_parent.$(OBJEXT) \
     65        track_manager.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \
     66        glmenu_imagescreen.$(OBJEXT)
    6367orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    6468orxonox_LDADD = $(LDADD)
     
    6771am__depfiles_maybe = depfiles
    6872@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \
    69 @AMDEP_TRUE@    ./$(DEPDIR)/base_entity.Po ./$(DEPDIR)/camera.Po \
     73@AMDEP_TRUE@    ./$(DEPDIR)/base_entity.Po \
     74@AMDEP_TRUE@    ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \
    7075@AMDEP_TRUE@    ./$(DEPDIR)/campaign.Po ./$(DEPDIR)/collision.Po \
    71 @AMDEP_TRUE@    ./$(DEPDIR)/command_node.Po \
     76@AMDEP_TRUE@    ./$(DEPDIR)/command_node.Po ./$(DEPDIR)/curve.Po \
    7277@AMDEP_TRUE@    ./$(DEPDIR)/data_tank.Po \
    7378@AMDEP_TRUE@    ./$(DEPDIR)/environment.Po \
    7479@AMDEP_TRUE@    ./$(DEPDIR)/game_loader.Po \
     80@AMDEP_TRUE@    ./$(DEPDIR)/glmenu_imagescreen.Po \
     81@AMDEP_TRUE@    ./$(DEPDIR)/helper_parent.Po \
    7582@AMDEP_TRUE@    ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
    7683@AMDEP_TRUE@    ./$(DEPDIR)/list.Po ./$(DEPDIR)/material.Po \
    77 @AMDEP_TRUE@    ./$(DEPDIR)/object.Po ./$(DEPDIR)/orxonox.Po \
     84@AMDEP_TRUE@    ./$(DEPDIR)/matrix.Po ./$(DEPDIR)/model.Po \
     85@AMDEP_TRUE@    ./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/objModel.Po \
     86@AMDEP_TRUE@    ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/p_node.Po \
    7887@AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/story_entity.Po \
    79 @AMDEP_TRUE@    ./$(DEPDIR)/track.Po ./$(DEPDIR)/vector.Po \
     88@AMDEP_TRUE@    ./$(DEPDIR)/texture.Po ./$(DEPDIR)/track.Po \
     89@AMDEP_TRUE@    ./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \
    8090@AMDEP_TRUE@    ./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po
    8191CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
     
    95105ETAGS = etags
    96106CTAGS = ctags
    97 DIST_SUBDIRS = . importer heightmap gui console
     107DIST_SUBDIRS = . importer gui console
    98108DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    99109ACLOCAL = @ACLOCAL@
     
    150160SHELL = @SHELL@
    151161STRIP = @STRIP@
     162SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@
     163SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@
    152164VERSION = @VERSION@
    153165ac_ct_CC = @ac_ct_CC@
     
    213225                 story_entity.cc \
    214226                 environment.cc \
    215                  importer/object.cc \
     227                 importer/model.cc \
     228                 importer/objModel.cc \
    216229                 importer/array.cc \
    217230                 importer/material.cc \
    218                  list.cc
     231                 importer/texture.cc \
     232                 list.cc \
     233                 p_node.cc \
     234                 null_parent.cc \
     235                 base_object.cc \
     236                 helper_parent.cc \
     237                 track_manager.cc \
     238                 matrix.cc \
     239                 curve.cc \
     240                 glmenu_imagescreen.cc
    219241
    220242noinst_HEADERS = ability.h \
     
    242264                 shoot_laser.h \
    243265                 world_entity.h \
    244                  coordinates.h \
    245266                 message_structures.h \
    246267                 shoot_rocket.h \
     
    249270                 story_def.h \
    250271                 game_loader.h \
    251                  campaign.h
     272                 campaign.h \
     273                 p_node.h \
     274                 null_parent.h \
     275                 base_object.h \
     276                 helper_parent.h \
     277                 track_manager.h \
     278                 matrix.h \
     279                 curve.h \
     280                 glmenu_imagescreen.h \
     281                 debug.h
    252282
    253283EXTRA_DIST = orxonox.conf
     
    256286### GTK_RELATED
    257287@HAVE_GTK2_TRUE@GTK_PROGS = console
     288@SUB_PROJECTS_FALSE@SUB_PROGS =
     289@SUB_PROJECTS_TRUE@SUB_PROGS = importer \
     290@SUB_PROJECTS_TRUE@           gui \
     291@SUB_PROJECTS_TRUE@           $(GTK_PROGS)
     292
    258293SUBDIRS = . \
    259           importer \
    260           heightmap \
    261           gui \
    262           $(GTK_PROGS)
     294          $(SUB_PROGS)
    263295
    264296all: all-recursive
     
    275307          esac; \
    276308        done; \
    277         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
     309        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
    278310        cd $(top_srcdir) && \
    279           $(AUTOMAKE) --gnu  src/Makefile
     311          $(AUTOMAKE) --foreign  src/Makefile
    280312.PRECIOUS: Makefile
    281313Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    330362@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    331363@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@
     364@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@
    332365@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@
    333366@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/campaign.Po@am__quote@
    334367@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collision.Po@am__quote@
    335368@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_node.Po@am__quote@
     369@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Po@am__quote@
    336370@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@
    337371@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@
    338372@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
     373@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@
     374@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@
    339375@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
    340376@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@
    341377@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
    342378@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
    343 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
     379@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Po@am__quote@
     380@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
     381@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null_parent.Po@am__quote@
     382@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
    344383@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@
     384@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
    345385@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
    346386@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
     387@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    347388@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track.Po@am__quote@
     389@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_manager.Po@am__quote@
    348390@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
    349391@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world.Po@am__quote@
     
    366408@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    367409
    368 object.o: importer/object.cc
    369 @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; \
    370 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi
    371 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/object.cc' object='object.o' libtool=no @AMDEPBACKSLASH@
    372 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@
    373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    374 @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
    375 
    376 object.obj: importer/object.cc
    377 @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`; \
    378 @am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi
    379 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/object.cc' object='object.obj' libtool=no @AMDEPBACKSLASH@
    380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@
    381 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    382 @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`
     410model.o: importer/model.cc
     411@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; \
     412@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/model.Tpo" "$(DEPDIR)/model.Po"; else rm -f "$(DEPDIR)/model.Tpo"; exit 1; fi
     413@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/model.cc' object='model.o' libtool=no @AMDEPBACKSLASH@
     414@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/model.Po' tmpdepfile='$(DEPDIR)/model.TPo' @AMDEPBACKSLASH@
     415@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     416@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
     417
     418model.obj: importer/model.cc
     419@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`; \
     420@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/model.Tpo" "$(DEPDIR)/model.Po"; else rm -f "$(DEPDIR)/model.Tpo"; exit 1; fi
     421@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/model.cc' object='model.obj' libtool=no @AMDEPBACKSLASH@
     422@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/model.Po' tmpdepfile='$(DEPDIR)/model.TPo' @AMDEPBACKSLASH@
     423@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     424@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`
     425
     426objModel.o: importer/objModel.cc
     427@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT objModel.o -MD -MP -MF "$(DEPDIR)/objModel.Tpo" -c -o objModel.o `test -f 'importer/objModel.cc' || echo '$(srcdir)/'`importer/objModel.cc; \
     428@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/objModel.Tpo" "$(DEPDIR)/objModel.Po"; else rm -f "$(DEPDIR)/objModel.Tpo"; exit 1; fi
     429@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/objModel.cc' object='objModel.o' libtool=no @AMDEPBACKSLASH@
     430@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/objModel.Po' tmpdepfile='$(DEPDIR)/objModel.TPo' @AMDEPBACKSLASH@
     431@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     432@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o objModel.o `test -f 'importer/objModel.cc' || echo '$(srcdir)/'`importer/objModel.cc
     433
     434objModel.obj: importer/objModel.cc
     435@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT objModel.obj -MD -MP -MF "$(DEPDIR)/objModel.Tpo" -c -o objModel.obj `if test -f 'importer/objModel.cc'; then $(CYGPATH_W) 'importer/objModel.cc'; else $(CYGPATH_W) '$(srcdir)/importer/objModel.cc'; fi`; \
     436@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/objModel.Tpo" "$(DEPDIR)/objModel.Po"; else rm -f "$(DEPDIR)/objModel.Tpo"; exit 1; fi
     437@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/objModel.cc' object='objModel.obj' libtool=no @AMDEPBACKSLASH@
     438@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/objModel.Po' tmpdepfile='$(DEPDIR)/objModel.TPo' @AMDEPBACKSLASH@
     439@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     440@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o objModel.obj `if test -f 'importer/objModel.cc'; then $(CYGPATH_W) 'importer/objModel.cc'; else $(CYGPATH_W) '$(srcdir)/importer/objModel.cc'; fi`
    383441
    384442array.o: importer/array.cc
     
    413471@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    414472@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`
     473
     474texture.o: importer/texture.cc
     475@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; \
     476@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/texture.Tpo" "$(DEPDIR)/texture.Po"; else rm -f "$(DEPDIR)/texture.Tpo"; exit 1; fi
     477@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/texture.cc' object='texture.o' libtool=no @AMDEPBACKSLASH@
     478@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/texture.Po' tmpdepfile='$(DEPDIR)/texture.TPo' @AMDEPBACKSLASH@
     479@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     480@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
     481
     482texture.obj: importer/texture.cc
     483@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`; \
     484@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/texture.Tpo" "$(DEPDIR)/texture.Po"; else rm -f "$(DEPDIR)/texture.Tpo"; exit 1; fi
     485@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='importer/texture.cc' object='texture.obj' libtool=no @AMDEPBACKSLASH@
     486@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/texture.Po' tmpdepfile='$(DEPDIR)/texture.TPo' @AMDEPBACKSLASH@
     487@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     488@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`
    415489uninstall-info-am:
    416490
  • orxonox/branches/nico/src/camera.cc

    r3238 r3399  
    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/branches/nico/src/camera.h

    r3238 r3399  
    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/branches/nico/src/console/Makefile.in

    r3391 r3399  
    128128SHELL = @SHELL@
    129129STRIP = @STRIP@
     130SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@
     131SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@
    130132VERSION = @VERSION@
    131133ac_ct_CC = @ac_ct_CC@
     
    193195          esac; \
    194196        done; \
    195         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/console/Makefile'; \
     197        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/console/Makefile'; \
    196198        cd $(top_srcdir) && \
    197           $(AUTOMAKE) --gnu  src/console/Makefile
     199          $(AUTOMAKE) --foreign  src/console/Makefile
    198200.PRECIOUS: Makefile
    199201Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/nico/src/curve.cc

    r3238 r3399  
    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/branches/nico/src/curve.h

    r3238 r3399  
     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/branches/nico/src/data_tank.cc

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

    r3238 r3399  
    1010  ~DataTank ();
    1111
     12  static long timeStamp;
     13
    1214};
    1315
  • orxonox/branches/nico/src/debug.h

    r3238 r3399  
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
     3
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11   ### File Specific:
     12   main-programmer: Benjamin Grauer
     13   co-programmer: ...
     14*/
     15
     16/*!
     17    \file debug.h
     18    \brief Handles output to console for different Verbose-Modes.
     19*/
     20
    121#ifndef _DEBUG_H
    222#define _DEBUG_H
    323
     24#define NO              0
     25#define ERROR           1
     26#define WARNING         2
     27#define INFORMATION     3
     28#define DEBUGING        4
     29
     30#include <stdio.h>
     31
     32///////////////////////////////////////////////////
     33/// PRINTF: prints with filename and linenumber ///
     34///////////////////////////////////////////////////
     35
    436#ifdef  DEBUG
     37extern int verbose;
    538#define PRINTF(x) \
    639           PRINTF ## x
    740
    8 #if DEBUG >= 1
     41#if DEBUG >= ERROR
    942#define PRINTF1 \
    10     if (verbose >= 1 ) \
     43    if (verbose >= ERROR) \
    1144      printf("%s:%d::", __FILE__, __LINE__) && printf
    1245#else
    13 #define PRINTF1 //
     46#define PRINTF1 if (NO)
    1447#endif
    1548     
    16 #if DEBUG >= 2
     49#if DEBUG >= WARNING
    1750#define PRINTF2 \
    18      if (verbose >= 2 ) \
     51     if (verbose >= WARNING) \
    1952       printf("%s:%d::", __FILE__, __LINE__) && printf
    2053         
    2154#else
    22 #define PRINTF2 //
     55#define PRINTF2 if (NO)
    2356#endif
    2457     
    25 #if DEBUG >= 3
     58#if DEBUG >= INFORMATION
    2659#define PRINTF3 \
    27      if (verbose >= 3 ) \
     60     if (verbose >= INFORMATION) \
    2861       printf("%s:%d::", __FILE__, __LINE__) && printf
    2962#else
    30 #define PRINTF3 //
     63#define PRINTF3 if (NO)
    3164#endif
    3265     
    33 #if DEBUG >= 4
     66#if DEBUG >= DEBUGING
    3467#define PRINTF4 \
    35      if (verbose >= 4 ) \
     68     if (verbose >= DEBUGING) \
    3669       printf("%s:%d::", __FILE__, __LINE__) && printf
    3770#else
    38 #define PRINTF4 //
     71#define PRINTF4 if (NO)
    3972#endif
    4073     
    4174     
    4275#else 
    43 #define PRINTF(x) //
     76#define PRINTF(x) if (NO)
    4477#endif
    4578
     
    4780    printf("%s:%d::", __FILE__, __LINE__) && printf
    4881
     82
     83///////////////////////////////////////////////////
     84///  PRINT: just prints output as is            ///
     85///////////////////////////////////////////////////
     86#ifdef  DEBUG
     87extern int verbose;
     88#define PRINT(x) \
     89  PRINT ## x
     90
     91#if DEBUG >= ERROR
     92#define PRINT1  \
     93  if (verbose >= ERROR) \
     94    printf
     95#else
     96#define PRINT1 if (NO)
     97#endif
     98
     99#if DEBUG >= WARNING
     100#define PRINT2 \
     101  if (verbose >= WARNING) \
     102    printf
     103
     104#else
     105#define PRINT2 if (NO)
     106#endif
     107
     108#if DEBUG >= INFORMATION
     109#define PRINT3 \
     110  if (verbose >= INFORMATION) \
     111    printf
     112#else
     113#define PRINT3 if (NO)
     114#endif
     115
     116#if DEBUG >= DEBUGING
     117#define PRINT4 \
     118  if (verbose >= DEBUGING) \
     119    printf
     120#else
     121#define PRINT4 if (NO)
     122#endif
     123
     124
     125#else 
     126#define PRINT(x) if (NO)
     127#endif
     128
     129#define PRINT0 \
     130  printf
     131
     132///////////////////////////////////////////////////
     133/// COUT: simple cout print with verbose-check  ///
     134///////////////////////////////////////////////////
     135#ifdef  DEBUG
     136#define COUT(x) \
     137           COUT ## x
     138
     139#if DEBUG >= 1
     140#define COUT1 \
     141    if (verbose >= 1 ) \
     142      cout
     143#else
     144#define COUT1 if (NO) cout
     145#endif
     146     
     147#if DEBUG >= 2
     148#define COUT2 \
     149     if (verbose >= 2 ) \
     150       cout
     151
     152#else
     153#define COUT2 if (NO) cout
     154#endif
     155     
     156#if DEBUG >= 3
     157#define COUT3 \
     158     if (verbose >= 3 ) \
     159       cout
     160#else
     161#define COUT3 if (NO) cout
     162#endif
     163     
     164#if DEBUG >= 4
     165#define COUT4 \
     166     if (verbose >= 4 ) \
     167       cout
     168#else
     169#define COUT4 if (NO) cout
     170#endif
     171     
     172     
     173#else 
     174#define COUT(x) if (NO) cout
     175#endif
     176
     177#define COUT0 \
     178           cout
     179
    49180#endif /* _DEBUG_H */
  • orxonox/branches/nico/src/environment.cc

    r3238 r3399  
    2121#include "world_entity.h"
    2222#include "vector.h"
     23#include "importer/objModel.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 OBJModel("../data/models/fighter.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/branches/nico/src/gui/Makefile.in

    r3391 r3399  
    135135SHELL = @SHELL@
    136136STRIP = @STRIP@
     137SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@
     138SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@
    137139VERSION = @VERSION@
    138140ac_ct_CC = @ac_ct_CC@
     
    220222          esac; \
    221223        done; \
    222         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/gui/Makefile'; \
     224        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/gui/Makefile'; \
    223225        cd $(top_srcdir) && \
    224           $(AUTOMAKE) --gnu  src/gui/Makefile
     226          $(AUTOMAKE) --foreign  src/gui/Makefile
    225227.PRECIOUS: Makefile
    226228Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/nico/src/importer/Makefile.am

    r3390 r3399  
    88importer_SOURCES= framework.cc \
    99                  windowHandler.cc \
    10                   object.cc \
     10                  model.cc \
     11                  objModel.cc \
    1112                  array.cc \
    1213                  material.cc \
    13                   vector.cc
     14                  texture.cc \
     15                  vector.cc
    1416
    1517heightmap_SOURCES= main.cc \
     
    2123noinst_HEADERS= framework.h \
    2224                windowHandler.h \
    23                 object.h \
     25                model.h \
     26                objModel.h \
    2427                array.h \
    25                 material.h
     28                material.h \
     29                texture.h
    2630
    2731
  • orxonox/branches/nico/src/importer/Makefile.in

    r3391 r3399  
    4242subdir = src/importer
    4343DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
    44         $(srcdir)/Makefile.in TODO
     44        $(srcdir)/Makefile.in
    4545ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    4646am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     
    5959heightmap_LDADD = $(LDADD)
    6060am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \
    61         object.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \
    62         vector.$(OBJEXT)
     61        model.$(OBJEXT) objModel.$(OBJEXT) array.$(OBJEXT) \
     62        material.$(OBJEXT) texture.$(OBJEXT) vector.$(OBJEXT)
    6363importer_OBJECTS = $(am_importer_OBJECTS)
    6464importer_LDADD = $(LDADD)
     
    6969@AMDEP_TRUE@    ./$(DEPDIR)/heightMapTerrain.Po \
    7070@AMDEP_TRUE@    ./$(DEPDIR)/heightMapViewer.Po ./$(DEPDIR)/main.Po \
    71 @AMDEP_TRUE@    ./$(DEPDIR)/material.Po ./$(DEPDIR)/object.Po \
     71@AMDEP_TRUE@    ./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \
     72@AMDEP_TRUE@    ./$(DEPDIR)/objModel.Po ./$(DEPDIR)/texture.Po \
    7273@AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po
    7374CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
     
    135136SHELL = @SHELL@
    136137STRIP = @STRIP@
     138SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@
     139SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@
    137140VERSION = @VERSION@
    138141ac_ct_CC = @ac_ct_CC@
     
    183186importer_SOURCES = framework.cc \
    184187                  windowHandler.cc \
    185                   object.cc \
     188                  model.cc \
     189                  objModel.cc \
    186190                  array.cc \
    187191                  material.cc \
    188                   vector.cc
     192                  texture.cc \
     193                  vector.cc
    189194
    190195heightmap_SOURCES = main.cc \
     
    196201noinst_HEADERS = framework.h \
    197202                windowHandler.h \
    198                 object.h \
     203                model.h \
     204                objModel.h \
    199205                array.h \
    200                 material.h
     206                material.h \
     207                texture.h
    201208
    202209all: all-am
     
    213220          esac; \
    214221        done; \
    215         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/importer/Makefile'; \
     222        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/importer/Makefile'; \
    216223        cd $(top_srcdir) && \
    217           $(AUTOMAKE) --gnu  src/importer/Makefile
     224          $(AUTOMAKE) --foreign  src/importer/Makefile
    218225.PRECIOUS: Makefile
    219226Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    275282@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
    276283@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@
    277 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
     284@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@
     285@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@
     286@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
    278287@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@
    279288@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@
  • orxonox/branches/nico/src/importer/framework.cc

    r3238 r3399  
    1515
    1616#include "framework.h"
    17 
     17int verbose;
    1818void DrawGLScene()
    1919{
     
    5252int main(int argc, char *argv[])
    5353{
    54   int verbose = 3;
    55 
    56   PRINTF(2)("This is The big verbose-Test %i, %s\n", 1, "cool");
     54  verbose = 2;
    5755
    5856  Uint8* keys; // This variable will be used in the keyboard routine
     
    7169  PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h);
    7270  if (argc>=3)
    73     obj = new Object (argv[1], atof(argv[2]));
     71    obj = new OBJModel (argv[1], atof(argv[2]));
    7472  else if (argc>=2)
    75     obj = new Object(argv[1]);
     73    obj = new OBJModel(argv[1]);
    7674  else
    77     obj = new Object();
    78  
     75    {
     76      // This is an example, of how it is possible, to create a new Model, and adding some vertex-information.
     77      // This also packs everything into a DisplayList, and can be handled exactly as any other model.
     78      // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created).
     79
     80      obj = (OBJModel*) new Model();
     81      obj->setName("CUBE");
     82      obj->addVertex ("-0.5 -0.5 0.5");
     83      obj->addVertex ("0.5 -0.5 0.5");
     84      obj->addVertex ("-0.5 0.5 0.5");
     85      obj->addVertex ("0.5 0.5 0.5");
     86      obj->addVertex ("-0.5 0.5 -0.5");
     87      obj->addVertex ("0.5 0.5 -0.5");
     88      obj->addVertex ("-0.5 -0.5 -0.5");
     89      obj->addVertex ("0.5 -0.5 -0.5");
     90     
     91      obj->addVertexTexture ("0.0 0.0");
     92      obj->addVertexTexture ("1.0 0.0");
     93      obj->addVertexTexture ("0.0 1.0");
     94      obj->addVertexTexture ("1.0 1.0");
     95      obj->addVertexTexture ("0.0 2.0");
     96      obj->addVertexTexture ("1.0 2.0");
     97      obj->addVertexTexture ("0.0 3.0");
     98      obj->addVertexTexture ("1.0 3.0");
     99      obj->addVertexTexture ("0.0 4.0");
     100      obj->addVertexTexture ("1.0 4.0");
     101      obj->addVertexTexture ("2.0 0.0");
     102      obj->addVertexTexture ("2.0 1.0");
     103      obj->addVertexTexture ("-1.0 0.0");
     104      obj->addVertexTexture ("-1.0 1.0");
     105
     106      obj->addFace ("1 2 4 3");
     107      obj->addFace ("3 4 6 5");
     108      obj->addFace ("5 6 8 7");
     109      obj->addFace ("7 8 2 1");
     110      obj->addFace ("2 8 6 4");
     111      obj->addFace ("7 1 3 5");
     112      obj->finalize();
     113    }
    79114  M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0);
    80115  rotAxis = Vector (0.0,1.0,0.0);
     
    215250          case SDLK_c:
    216251            if (!obj)
    217               obj = new Object(argv[1]);
     252              obj = new OBJModel(argv[1]);
    218253            break;
    219254          }
  • orxonox/branches/nico/src/importer/framework.h

    r3238 r3399  
    33 
    44#include "windowHandler.h" // Include the Whandler Basecode
    5 #include "object.h"
     5#include "objModel.h"
    66#include "vector.h"
    77
     
    3333
    3434WindowHandler wHandler;  // Create an instance of the whandler basecode class
    35 Object* obj;
     35OBJModel* obj;
    3636
    3737
  • orxonox/branches/nico/src/importer/material.cc

    r3238 r3399  
    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/**
     
    196112  while (searcher != NULL)
    197113    {
    198       PRINTF(2)(".");
     114      PRINT(2)(".");
    199115      if (!strcmp (searcher->getName(), mtlName))
    200116        {
    201           PRINTF(2)("found.\n");
     117          PRINT(2)("found.\n");
    202118          return searcher;
    203119        }
    204120      searcher = searcher->nextMat;
    205121    }
    206   PRINTF(2)("not found\n");
     122  PRINT(2)("not found\n");
    207123  return NULL;
    208124}
     
    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/branches/nico/src/importer/material.h

    r3238 r3399  
    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/branches/nico/src/list.h

    r3238 r3399  
    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/branches/nico/src/orxonox.cc

    r3238 r3399  
    3131#include "game_loader.h"
    3232#include <string.h>
     33int verbose;
    3334
    3435using namespace std;
     
    115116  // Set video mode
    116117  // 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  
     118  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
     119  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
     120  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
     121  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
     122 
     123
     124  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
     125  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
     126  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
     127  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
     128  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
     129  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
     130  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
     131
     132
     133
    122134  int bpp = 16;
    123135  int width = 640;
    124136  int height = 480;
    125   Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
    126  
    127   if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL)
     137  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
     138  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
     139
     140  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
     141
     142  /* query SDL for information about our video hardware */
     143  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
     144 
     145  if( videoInfo == NULL)
     146    {
     147      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());
     148      SDL_Quit ();
     149    }
     150  if( videoInfo->hw_available)
     151    videoFlags |= SDL_HWSURFACE;
     152  else
     153    videoFlags |= SDL_SWSURFACE;
     154  /*
     155  if(VideoInfo -> blit_hw)                           
     156    VideoFlags |= SDL_HWACCEL;
     157  */
     158 
     159  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
    128160  {
    129     printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());
     161    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
    130162    SDL_Quit();
    131163    return -1;
     
    133165 
    134166  // Set window labeling
    135   SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
     167  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    136168 
    137169  // TO DO: Create a cool icon and use it here
     
    139171
    140172  // OpenGL stuff
    141   // (Is this all we initialize globally???)
    142   glClearColor(0.0, 0.0, 0.0, 0.0);
    143   glEnable(GL_DEPTH_TEST);
     173  glClearColor (0.0, 0.0, 0.0, 0.0);
     174  glEnable (GL_DEPTH_TEST);
    144175 
    145176  // LIGHTING
     
    148179  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
    149180
    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);
     181  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
     182  glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight);
     183  glEnable (GL_LIGHTING);
     184  glEnable (GL_LIGHT0);
     185  glEnable (GL_DEPTH_TEST);
     186  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
     187  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
    157188   
     189  //glEnable (GL_TEXTURE_2D);
    158190  //  glEnable(GL_COLOR);
    159191  //  glShadeModel(GL_SMOOTH);
     
    311343
    312344
     345SDL_Surface* Orxonox::getScreen ()
     346{
     347  return this->screen;
     348}
    313349
    314350
  • orxonox/branches/nico/src/orxonox.h

    r3238 r3399  
    6868  Camera* getCamera();
    6969  World* getWorld();
     70  SDL_Surface* getScreen ();
    7071 
    7172  //void mainLoop();
  • orxonox/branches/nico/src/player.cc

    r3238 r3399  
    1919#include "stdincl.h"
    2020#include "collision.h"
     21#include "importer/objModel.h"
    2122
    2223using namespace std;
     
    2627{
    2728
    28   this->obj = new Object("reaplow.obj");
     29  this->model = new OBJModel("../data/models/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  /* translate */
     107  glTranslatef (this->getAbsCoor ().x,
     108                this->getAbsCoor ().y,
     109                this->getAbsCoor ().z);
     110  /* rotate */
     111  this->getAbsDir ().matrix (matrix);
    107112  glMultMatrixf((float*)matrix);
    108113 
    109114  glMatrixMode(GL_MODELVIEW);
    110   glRotatef(-90, 0,1,0);
    111   obj->draw();
     115  this->model->draw();
    112116  // glCallList(objectList);
    113 
    114  
    115  
    116117}
    117118
     119
     120/*PN
    118121void Player::getLookat(Location* locbuf)
    119122{
     
    121124  //locbuf->dist += 5.0;
    122125}
     126*/
    123127
    124 void Player::leftWorld()
     128void Player::leftWorld ()
    125129{
    126130}
    127131
    128 void Player::move(float time)
     132void Player::move (float time)
    129133{
    130134  Vector accel(0.0, 0.0, 0.0);
    131135  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    132   Placement *pos = getPlacement();
     136  //Placement *pos = getPlacement();
     137 
    133138  /* 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);
     139  Vector direction (1.0, 0.0, 0.0);
     140  //direction = this->absDirection.apply (direction);
     141  Vector orthDirection (0.0, 0.0, 1.0);
     142  //orthDirection = orthDirection.cross (direction);
    138143
    139144  if( bUp) { accel = accel+(direction*acceleration); }
    140145  if( bDown) { accel = accel-(direction*acceleration); }
    141   if( bLeft ) { accel = accel + (orthDirection*acceleration); }
    142   if( bRight ) { accel = accel - (orthDirection*acceleration); }
     146  if( bLeft ) { accel = accel - (orthDirection*acceleration); }
     147  if( bRight ) { accel = accel + (orthDirection*acceleration); }
    143148  if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    144149  if( bDescend) {/* FIXME */} /* \todo up and down player movement */
    145150
    146   Location* l = getLocation();
     151  //Location* l = getLocation();
    147152 
    148153  // r(t) = r(0) + v(0)*t + 1/2*a*t^2
     
    152157
    153158  /* 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 
     159  //l->dist = l->dist + travelSpeed * time;
     160 
     161  Vector* shift = new Vector (this->travelSpeed * time, 0, 0);
     162  this->shiftCoor (shift);
     163 
    156164  /* this updates the player position on the track - user interaction */
    157   l->pos = l->pos + accel*time;
     165  //l->pos = l->pos + accel*time;
     166  Vector move = accel * time;
     167  this->shiftCoor (&move);
    158168}
  • orxonox/branches/nico/src/player.h

    r3238 r3399  
    88
    99#include "world_entity.h"
    10 #include "importer/object.h"
     10
     11class OBJModel;
    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/branches/nico/src/proto_class.cc

    r1956 r3399  
    2323
    2424
    25 
    26 ProtoClass::ProtoClass () {}
     25/**
     26   \brief standard constructor
     27   \todo this constructor is not jet implemented - do it
     28*/
     29ProtoClass::ProtoClass ()
     30{
     31   this->setClassName ("ProtoClass");
     32}
    2733
    2834
     35/**
     36   \brief standard deconstructor
     37   \todo this deconstructor is not jet implemented - do it
    2938
     39*/
    3040ProtoClass::~ProtoClass () {}
    3141
    3242
     43/**
     44   \brief nonsense - delete this method
     45   \param realy nothing to give
     46   \returns true or false - probably nothing?
     47
     48   this is just to show the doxygen abilities (this for example is an extension for a long comment)
     49*/
     50bool ProtoClass::doNonSense (int nothing) {}
  • orxonox/branches/nico/src/proto_class.h

    r3238 r3399  
     1/*!
     2    \file proto_class.h
     3    \brief Definition of the proto class template, used quickly start work
     4    \todo Example: this shows how to use simply add a Marker that here has to be done something.
     5
     6    The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
     7    It is an example for the CODING-CONVENTION, and a starting-point for every class.
     8*/
    19
    210#ifndef _PROTO_CLASS_H
    311#define _PROTO_CLASS_H
    412
    5 #include "data_tank.h"
     13#include "stdincl.h"
    614
     15/*class Test;*/ /* forward definition of class Test (without including it here!)*/
    716
    8 class ProtoClass {
     17//! A default class that aids you to start creating a new class
     18/**
     19   here can be some longer description of this class
     20*/
     21class ProtoClass : public BaseObject {
    922
    1023 public:
     
    1225  ~ProtoClass ();
    1326
     27  bool doNonSense (int nothing);
     28
     29 private:
     30  int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
     31
    1432};
    1533
  • orxonox/branches/nico/src/stdincl.h

    r3238 r3399  
    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/branches/nico/src/story_entity.h

    r3238 r3399  
    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/branches/nico/src/track.cc

    r3238 r3399  
    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/branches/nico/src/track.h

    r3238 r3399  
    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/branches/nico/src/vector.cc

    r3238 r3399  
    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/branches/nico/src/vector.h

    r3238 r3399  
    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/branches/nico/src/world.cc

    r3238 r3399  
    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  this->glmis = new GLMenuImageScreen();
     151  this->glmis->init();
     152  this->glmis->setMaximum(10);
     153  this->glmis->draw();
     154 
     155  printf ("World::displayLoadScreen - end\n");
     156}
     157
     158
     159void World::releaseLoadScreen ()
     160{
     161  printf ("World::releaseLoadScreen - start\n");
     162  this->glmis->setValue(this->glmis->getMaximum());
     163  SDL_Delay(500);
     164  printf ("World::releaseLoadScreen - end\n");
     165}
     166
    110167
    111168void World::load()
    112169{
     170  //  BezierCurve* tmpCurve = new BezierCurve();
    113171  if(this->debugWorldNr != -1)
    114172    {
     173      trackManager = TrackManager::getInstance();
     174      trackManager->addPoint(Vector(0,-5,0));
     175      trackManager->addPoint(Vector(10,0,5));
     176      trackManager->addPoint(Vector(20,0,-5));
     177      trackManager->addPoint(Vector(30,0,5));
     178      trackManager->addPoint(Vector(40,0,5));
     179      trackManager->setDuration(.5);
     180      trackManager->setSavePoint();
     181      trackManager->addPoint(Vector(50,10,10));
     182      trackManager->addPoint(Vector(60,0, 10));
     183      trackManager->addPoint(Vector(70,0, 10));
     184      trackManager->addPoint(Vector(80,0,-10));
     185      trackManager->addPoint(Vector(90,0,-10));
     186      trackManager->setDuration(.5);
     187      trackManager->setSavePoint();
     188      trackManager->addPoint(Vector(110,0,5));
     189      trackManager->addPoint(Vector(120,0, 10));
     190      trackManager->addPoint(Vector(130,0, 10));
     191      trackManager->addPoint(Vector(140,0,-10));
     192      trackManager->addPoint(Vector(150,0,-10));
     193      trackManager->setDuration(.5);
     194      int fork11, fork12, fork13, fork14;
     195      trackManager->fork(4, &fork11, &fork12, &fork13, &fork14);
     196      trackManager->workOn(fork11);
     197      trackManager->addPoint(Vector(170, 0, -15));
     198      trackManager->addPoint(Vector(180, 0, -15));
     199      trackManager->workOn(fork12);
     200      trackManager->addPoint(Vector(170, 0, 10));
     201      trackManager->addPoint(Vector(180, 0, 10));
     202      trackManager->addPoint(Vector(190,2,5));
     203      trackManager->addPoint(Vector(200,2,5));
     204      int fork21, fork22;
     205      trackManager->fork(2, &fork21, &fork22);
     206      trackManager->workOn(fork21);
     207      trackManager->addPoint(Vector(220, 10,-10));
     208      trackManager->addPoint(Vector(230, 0,-10));
     209      trackManager->addPoint(Vector(240, 0, 2));
     210      trackManager->addPoint(Vector(250, 0, 0));
     211      trackManager->addPoint(Vector(260, 0, 5));
     212      trackManager->join(2, fork12, fork11);
     213      trackManager->workOn(fork22);
     214      trackManager->addPoint(Vector(220, -10,10));
     215      trackManager->addPoint(Vector(230, 0, 10));
     216      trackManager->addPoint(Vector(240, 0, 10));
     217      trackManager->addPoint(Vector(250, 0, 5));
     218      trackManager->workOn(fork13);
     219      trackManager->addPoint(Vector(200,-10,5));
     220      trackManager->addPoint(Vector(250,-10,5));
     221      printf("fork14: %d\n", fork14);
     222      trackManager->workOn(fork14);
     223      trackManager->addPoint(Vector(200,15,0));
     224      trackManager->addPoint(Vector(210,0,10));
     225
     226
     227
     228      trackManager->join(4, fork21, fork22, fork13, fork14);
     229
     230      /*monitor progress*/
     231      this->glmis->step();
     232
     233      /*
     234      tmpCurve->addNode(Vector(10,0,-10));
     235      //tmpCurve->addNode(Vector(10,2,5));
     236      //tmpCurve->addNode(Vector(10,3,-5));
     237      //      tmpCurve->addNode(Vector(10,1,5));
     238      tmpCurve->addNode(Vector(10,0,5));
     239      */
    115240      switch(this->debugWorldNr)
    116241        {
     
    123248        case DEBUG_WORLD_0:
    124249          {
     250            this->nullParent = NullParent::getInstance ();
     251            this->nullParent->setName ("NullParent");
     252
    125253            // create some path nodes
    126254            this->pathnodes = new Vector[6];
     
    141269            // !\todo old track-system has to be removed
    142270
     271            //create helper for player
     272            HelperParent* hp = new HelperParent ();
     273            /* the player has to be added to this helper */
     274
    143275            // create a player
    144             WorldEntity* myPlayer = new Player();
    145             this->spawn(myPlayer);
    146             this->localPlayer = myPlayer;           
     276            WorldEntity* myPlayer = new Player ();
     277            myPlayer->setName ("player");
     278            this->spawn (myPlayer);
     279            this->localPlayer = myPlayer;
     280
     281            /*monitor progress*/
     282            this->glmis->step();           
    147283
    148284            // bind input
    149             Orxonox *orx = Orxonox::getInstance();
     285            Orxonox *orx = Orxonox::getInstance ();
    150286            orx->getLocalInput()->bind (myPlayer);
    151287           
    152288            // bind camera
    153289            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();
     290            this->localCamera->setName ("camera");
     291            this->getCamera()->bind (myPlayer);
     292            this->localPlayer->addChild (this->localCamera);
     293
     294            /*monitor progress*/
     295            this->glmis->step();
     296
     297            Vector* es = new Vector (50, 2, 0);
     298            Quaternion* qs = new Quaternion ();
    159299            WorldEntity* env = new Environment();
    160             this->spawn(env, plc);
     300            env->setName ("env");
     301            this->spawn(env, es, qs);
     302           
     303            /*monitor progress*/
     304            this->glmis->step();
    161305
    162306            break;
     
    164308        case DEBUG_WORLD_1:
    165309          {
     310            /*
     311            this->testCurve = new UPointCurve();
     312            this->testCurve->addNode(Vector( 0, 0, 0));
     313            this->testCurve->addNode(Vector(10, 0, 5));
     314            this->testCurve->addNode(Vector(20, -5,-5));
     315            this->testCurve->addNode(Vector(30, 5, 10));
     316            this->testCurve->addNode(Vector(40, 0,-10));
     317            this->testCurve->addNode(Vector(50, 0,-10));
     318            */
     319
     320            this->nullParent = NullParent::getInstance ();
     321            this->nullParent->setName ("NullParent");
     322
    166323            // create some path nodes
    167324            this->pathnodes = new Vector[6];
     
    173330            this->pathnodes[5] = Vector(30, 50, 0);
    174331           
     332
     333
     334
    175335            // create the tracks
    176336            this->tracklen = 6;
     
    183343            // create a player
    184344            WorldEntity* myPlayer = new Player();
     345            myPlayer->setName ("player");
    185346            this->spawn(myPlayer);
    186347            this->localPlayer = myPlayer;           
     
    191352           
    192353            // bind camera
    193             this->localCamera = new Camera(this);
     354            this->localCamera = new Camera (this);
     355            this->localCamera->setName ("camera");
    194356            this->getCamera()->bind (myPlayer);
     357            this->localPlayer->addChild (this->localCamera);
    195358            break;
    196359          }
     
    212375
    213376  int sizeX = 100;
    214   int sizeY = 80;
     377  int sizeZ = 80;
    215378  float length = 1000;
    216379  float width = 200;
    217380  float widthX = float (length /sizeX);
    218   float widthY = float (width /sizeY);
    219  
    220   float height [sizeX][sizeY];
    221   Vector normal_vectors[sizeX][sizeY];
     381  float widthZ = float (width /sizeZ);
     382 
     383  float height [sizeX][sizeZ];
     384  Vector normal_vectors[sizeX][sizeZ];
    222385 
    223386 
    224387  for ( int i = 0; i<sizeX-1; i+=1)
    225     for (int j = 0; j<sizeY-1;j+=1)
     388    for (int j = 0; j<sizeZ-1;j+=1)
    226389      //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
    227390#ifdef __WIN32__
     
    231394#endif
    232395
    233   //Die Hügel ein wenig glätten
     396  //Die Huegel ein wenig glaetten
    234397  for (int h=1; h<2;h++)
    235398    for (int i=1;i<sizeX-2 ;i+=1 )
    236       for(int j=1;j<sizeY-2;j+=1)
     399      for(int j=1;j<sizeZ-2;j+=1)
    237400        height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4;
    238401 
    239402  //Berechnung von normalen Vektoren
    240 
    241403  for(int i=1;i<sizeX-2;i+=1)
    242     for(int j=1;j<sizeY-2 ;j+=1)
     404    for(int j=1;j<sizeZ-2 ;j+=1)
    243405      {
    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]);
     406        Vector v1 = Vector (widthX*(1),      height[i][j],      widthZ*(j) );
     407        Vector v2 = Vector (widthX*(i-1),    height[i-1][j],    widthZ*(j));
     408        Vector v3 = Vector (widthX*(i),      height[i][j+1],    widthZ*(j+1));
     409        Vector v4 = Vector (widthX*(i+1),    height[i+1][j],    widthZ*(j));
     410        Vector v5 = Vector (widthX*(i),      height[i][j-1],    widthZ*(j-1));
    249411       
    250412        Vector c1 = v2 - v1;
     
    253415        Vector c4 = v5 - v1;
    254416        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);
     417        normal_vectors[i][j]=c1.cross(v3-v5)+c2.cross(v4-v2)+c3.cross(v5-v3)+c4.cross(v2-v4);
    256418        normal_vectors[i][j].normalize();
    257419      }
     
    259421  int snowheight=3;
    260422  for ( int i = 0; i<sizeX; i+=1)
    261     for (int j = 0; j<sizeY;j+=1)
     423    for (int j = 0; j<sizeZ;j+=1)
    262424      {   
    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);
     425        Vector v1 = Vector (widthX*(i),      height[i][j]-20,       widthZ*(j)  -width/2);
     426        Vector v2 = Vector (widthX*(i+1),    height[i+1][j]-20,     widthZ*(j)  -width/2);
     427        Vector v3 = Vector (widthX*(i+1),    height[i+1][j+1]-20,   widthZ*(j+1)-width/2);
     428        Vector v4 = Vector (widthX*(i),      height[i][j+1]-20,     widthZ*(j+1)-width/2);
    267429        float a[3];
    268430        if(height[i][j]<snowheight){
     
    371533  //draw track
    372534  glBegin(GL_LINES);
    373   glColor3f(0,1,1);
     535  glColor3f(0.0, 1.0, 1.0);
    374536  for( int i = 0; i < tracklen; i++)
    375537    {
     
    378540    }
    379541  glEnd();
     542 
     543  /*
     544  glBegin(GL_LINE_STRIP);
     545  glColor3f(1.0, 5.0, 1.0);
     546  for( int i = 0; i <= 30; i++)
     547    {
     548      glEvalCoord1f ((GLfloat) i/30.0);
     549    }
     550  glEnd();
     551  */
     552
     553  trackManager->drawGraph(.01);
     554  trackManager->debug(2);
     555  delete trackManager;
     556 
     557  /*
     558  glBegin(GL_LINES);
     559  float i;
     560  for(i = 0.0; i<1; i+=.01)
     561    {
     562      printf("%f, %f, %f\n",tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
     563      glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
     564    }
     565  glEnd();
     566  */
    380567  glEndList();
    381568}
     
    430617void World::draw ()
    431618{
    432   // draw geometry
    433  
    434619  // draw entities
    435620  WorldEntity* entity;
    436  
    437621  entity = this->entities->enumerate();
    438622  while( entity != NULL )
     
    440624      if( entity->bDraw ) entity->draw();
    441625      entity = this->entities->nextElement();
    442     }
    443  
    444  
     626    }
     627 
     628  //glmis = new GLMenuImageScreen();
     629  ///glmis->init();
     630
    445631  // draw debug coord system
    446632  glCallList (objectList);
    447 
    448633
    449634}
     
    459644void World::update ()
    460645{
     646  /*
    461647  //List<WorldEntity> *l;
    462648  WorldEntity* entity;
     
    477663          t = loc->part;
    478664         
    479           /* check if entity has still a legal track-id */
    480665          if( t >= tracklen )
    481666            {
     
    500685      else
    501686        {
    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           */
    507687        }
    508688     
    509689      entity = entities->nextElement();
    510690    }
    511  
     691  */ 
    512692}
    513693
     
    522702  float seconds = deltaT / 1000.0;
    523703 
     704  this->nullParent->update (seconds);
     705  //this->nullParent->processTick (seconds);
     706
    524707  entity = entities->enumerate();
    525708  while( entity != NULL)
     
    542725
    543726
    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 
    555727void World::setTrackLen(Uint32 len)
    556728{
     
    571743void World::debug()
    572744{
    573   //List<WorldEntity> *l;
     745  printf ("World::debug() - starting debug\n");
     746  PNode* p1 = NullParent::getInstance ();
     747  PNode* p2 = new PNode (new Vector(2, 2, 2), p1);
     748  PNode* p3 = new PNode (new Vector(4, 4, 4), p1);
     749  PNode* p4 = new PNode (new Vector(6, 6, 6), p2);
     750
     751  p1->debug ();
     752  p2->debug ();
     753  p3->debug ();
     754  p4->debug ();
     755
     756  p1->shiftCoor (new Vector(-1, -1, -1));
     757
     758  printf("World::debug() - shift\n");
     759  p1->debug ();
     760  p2->debug ();
     761  p3->debug ();
     762  p4->debug ();
     763 
     764  p1->update (1);
     765
     766  printf ("World::debug() - update\n");
     767  p1->debug ();
     768  p2->debug ();
     769  p3->debug ();
     770  p4->debug ();
     771
     772  p2->shiftCoor (new Vector(-1, -1, -1));
     773  p1->update (2);
     774
     775  p1->debug ();
     776  p2->debug ();
     777  p3->debug ();
     778  p4->debug ();
     779
     780  p2->setAbsCoor (new Vector(1,2,3));
     781
     782
     783 p1->update (2);
     784
     785  p1->debug ();
     786  p2->debug ();
     787  p3->debug ();
     788  p4->debug ();
     789
     790  p1->destroy ();
     791 
     792 
     793  /*
    574794  WorldEntity* entity;
    575  
    576795  printf("counting all entities\n");
    577796  printf("World::debug() - enumerate()\n");
     
    582801      entity = entities->nextElement();
    583802    }
     803  */
    584804}
    585805
     
    594814void World::mainLoop()
    595815{
    596   this->lastFrame = SDL_GetTicks();
     816  this->lastFrame = SDL_GetTicks ();
    597817  printf("World::mainLoop() - Entering main loop\n");
    598818  while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */
    599819    {
    600820      // Network
    601       synchronize();
     821      this->synchronize ();
    602822      // Process input
    603       handleInput();
     823      this->handleInput ();
    604824      if( this->bQuitCurrentGame || this->bQuitOrxonox)
    605825        {
     
    608828        }
    609829      // Process time
    610       timeSlice();
     830      this->timeSlice ();
    611831      // Process collision
    612       collision();
     832      this->collision ();
    613833      // Draw
    614       display();
    615  
    616       for(int i = 0; i < 10000000; i++) {}
     834      this->display ();
     835 
     836      for( int i = 0; i < 5000000; i++) {}
     837      /* \todo this is to slow down the program for openGl Software emulator computers, reimplement*/
    617838    }
    618839  printf("World::mainLoop() - Exiting the main loop\n");
     
    701922  this->draw();
    702923  // draw HUD
     924  /* \todo draw HUD */
    703925  // flip buffers
    704926  SDL_GL_SwapBuffers();
     927  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
     928  //SDL_Flip (screen);
    705929}
    706930
     
    723947void World::spawn(WorldEntity* entity)
    724948{
    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     }
     949  if( this->nullParent != NULL && entity->parent == NULL)
     950    this->nullParent->addChild (entity);
     951
     952  this->entities->add (entity);
     953
    740954  entity->postSpawn ();
    741955}
     
    747961   \param location where to add
    748962*/
    749 void World::spawn(WorldEntity* entity, Location* loc)
    750 {
    751   Location zeroLoc;
    752   WorldEntity* owner;
     963void World::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir)
     964{
     965  entity->setAbsCoor (absCoor);
     966  entity->setAbsDir (absDir);
     967 
     968  if( this->nullParent != NULL && entity->parent == NULL)
     969    this->nullParent->addChild (entity);
     970
    753971  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     }
     972
    767973  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 }
     974}
     975
    792976
    793977
     
    800984  return false;
    801985}
     986
     987
     988
     989
     990void World::swap (unsigned char &a, unsigned char &b)
     991{
     992  unsigned char temp;
     993  temp = a;
     994  a    = b;
     995  b    = temp;
     996}
  • orxonox/branches/nico/src/world.h

    r3238 r3399  
    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/branches/nico/src/world_entity.cc

    r3238 r3399  
    3636WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
    3737{
     38  this->setClassName ("WorldEntity");
    3839  this->bDraw = true;
    3940  collisioncluster = NULL;
    40   owner = NULL;
    41 }
    42 
    43 /**
    44         \brief standard destructor
     41}
     42
     43/**
     44   \brief standard destructor
    4545*/
    4646WorldEntity::~WorldEntity ()
     
    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/branches/nico/src/world_entity.h

    r3238 r3399  
    88
    99#include "stdincl.h"
     10#include "p_node.h"
    1011
    1112class CollisionCluster;
     13class OBJModel;
    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  OBJModel* 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.