- Timestamp:
- Feb 6, 2005, 11:27:25 PM (20 years ago)
- 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 38 38 $(srcdir)/Makefile.in $(srcdir)/config.h.in \ 39 39 $(srcdir)/doc/documentation.am $(top_srcdir)/configure AUTHORS \ 40 COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub\41 depcompinstall-sh missing mkinstalldirs40 COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \ 41 install-sh missing mkinstalldirs 42 42 subdir = . 43 43 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 … … 125 125 SHELL = @SHELL@ 126 126 STRIP = @STRIP@ 127 SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@ 128 SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@ 127 129 VERSION = @VERSION@ 128 130 ac_ct_CC = @ac_ct_CC@ -
orxonox/branches/nico/NEWS
r3238 r3399 5 5 Date: December 14, 2004 6 6 Topic: 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>.7 Body: Today we moved the repository. The new location of the repository is <A href="http://svn.orxonox.ethz.ch/reporx">http://svn.orxonox.ethz.ch/reporx</A>. 8 8 9 9 Date: November 16, 2004 -
orxonox/branches/nico/configure
r3391 r3399 1 1 #! /bin/sh 2 2 # 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. 4 4 # 5 # Report bugs to <orxonox-dev @mail.datacore.ch>.5 # Report bugs to <orxonox-dev at mail.datacore.ch>. 6 6 # 7 7 # Copyright (C) 2003 Free Software Foundation, Inc. … … 270 270 PACKAGE_NAME='orxonox' 271 271 PACKAGE_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'272 PACKAGE_VERSION='0.2.1-pre-alpha' 273 PACKAGE_STRING='orxonox 0.2.1-pre-alpha' 274 PACKAGE_BUGREPORT='orxonox-dev at mail.datacore.ch' 275 275 276 276 ac_unique_file="." … … 312 312 #endif" 313 313 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'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 SUB_PROJECTS_TRUE SUB_PROJECTS_FALSE DOXYGEN DOXYGEN_TRUE DOXYGEN_FALSE MSBITFIELDS GTK2_LIBS GTK2_CFLAGS HAVE_GTK2_TRUE HAVE_GTK2_FALSE LIBOBJS LTLIBOBJS' 315 315 ac_subst_files='' 316 316 … … 789 789 # This message is too long to be a string in the A/UX 3.1 sh. 790 790 cat <<_ACEOF 791 \`configure' configures orxonox 0.2. 0_alpha-r1to adapt to many kinds of systems.791 \`configure' configures orxonox 0.2.1-pre-alpha to adapt to many kinds of systems. 792 792 793 793 Usage: $0 [OPTION]... [VAR=VALUE]... … … 856 856 if test -n "$ac_init_help"; then 857 857 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:";; 859 859 esac 860 860 cat <<\_ACEOF … … 867 867 --enable-debug compiles in debug mode. Lots of debug info about the 868 868 game. 869 --enable-sub-projects also builds the subProjects by default 869 870 870 871 Optional Packages: … … 888 889 it to find libraries and programs with nonstandard names/locations. 889 890 890 Report bugs to <orxonox-dev @mail.datacore.ch>.891 Report bugs to <orxonox-dev at mail.datacore.ch>. 891 892 _ACEOF 892 893 fi … … 984 985 if $ac_init_version; then 985 986 cat <<\_ACEOF 986 orxonox configure 0.2. 0_alpha-r1987 orxonox configure 0.2.1-pre-alpha 987 988 generated by GNU Autoconf 2.59 988 989 … … 998 999 running configure, to aid debugging if configure makes a mistake. 999 1000 1000 It was created by orxonox $as_me 0.2. 0_alpha-r1, which was1001 It was created by orxonox $as_me 0.2.1-pre-alpha, which was 1001 1002 generated by GNU Autoconf 2.59. Invocation command line was 1002 1003 … … 1719 1720 # Define the identity of the package. 1720 1721 PACKAGE='orxonox' 1721 VERSION='0.2. 0_alpha-r1'1722 VERSION='0.2.1-pre-alpha' 1722 1723 1723 1724 … … 3903 3904 3904 3905 3906 ### SubProject-enable 3907 def_sdl_image=yes 3908 echo "$as_me:$LINENO: checking if the SubProjects should be built" >&5 3909 echo $ECHO_N "checking if the SubProjects should be built... $ECHO_C" >&6 3910 # Check whether --enable-sub-projects or --disable-sub-projects was given. 3911 if test "${enable_sub_projects+set}" = set; then 3912 enableval="$enable_sub_projects" 3913 def_sub_projects=yes 3914 fi; 3915 if test "$def_sub_projects" = yes; then 3916 echo "yes" 3917 fi 3918 if test "$def_sub_projects" = no; then 3919 echo "no" 3920 fi 3921 3922 3923 if test x$def_sub_projects = xyes; then 3924 SUB_PROJECTS_TRUE= 3925 SUB_PROJECTS_FALSE='#' 3926 else 3927 SUB_PROJECTS_TRUE='#' 3928 SUB_PROJECTS_FALSE= 3929 fi 3930 3931 3905 3932 ## PROGRAMM CHECKING 3906 3933 # checking for Doxygen … … 4167 4194 ( 4168 4195 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 ## ---------------------------------------------- ## 4172 4199 _ASBOX 4173 4200 ) | … … 4397 4424 ( 4398 4425 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 ## ---------------------------------------------- ## 4402 4429 _ASBOX 4403 4430 ) | … … 4692 4719 ( 4693 4720 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 ## ---------------------------------------------- ## 4697 4724 _ASBOX 4698 4725 ) | … … 4878 4905 4879 4906 CPPFLAGS="-I/usr/X11R6/include" 4880 LDFLAGS="-L/usr/ Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"4907 LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS" 4881 4908 # checking gl header 4882 4909 … … 5002 5029 ( 5003 5030 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 ## ---------------------------------------------- ## 5007 5034 _ASBOX 5008 5035 ) | … … 5036 5063 5037 5064 # checking for Unix GL 5038 echo "$as_me:$LINENO: checking for mainin -lGL" >&55039 echo $ECHO_N "checking for mainin -lGL... $ECHO_C" >&65040 if test "${ac_cv_lib_GL_ main+set}" = set; then5065 echo "$as_me:$LINENO: checking for glLoadIdentity in -lGL" >&5 5066 echo $ECHO_N "checking for glLoadIdentity in -lGL... $ECHO_C" >&6 5067 if test "${ac_cv_lib_GL_glLoadIdentity+set}" = set; then 5041 5068 echo $ECHO_N "(cached) $ECHO_C" >&6 5042 5069 else … … 5050 5077 /* end confdefs.h. */ 5051 5078 5052 5079 /* Override any gcc2 internal prototype to avoid an error. */ 5080 #ifdef __cplusplus 5081 extern "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. */ 5085 char glLoadIdentity (); 5053 5086 int 5054 5087 main () 5055 5088 { 5056 main();5089 glLoadIdentity (); 5057 5090 ; 5058 5091 return 0; … … 5081 5114 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5082 5115 (exit $ac_status); }; }; then 5083 ac_cv_lib_GL_ main=yes5116 ac_cv_lib_GL_glLoadIdentity=yes 5084 5117 else 5085 5118 echo "$as_me: failed program was:" >&5 5086 5119 sed 's/^/| /' conftest.$ac_ext >&5 5087 5120 5088 ac_cv_lib_GL_ main=no5121 ac_cv_lib_GL_glLoadIdentity=no 5089 5122 fi 5090 5123 rm -f conftest.err conftest.$ac_objext \ … … 5092 5125 LIBS=$ac_check_lib_save_LIBS 5093 5126 fi 5094 echo "$as_me:$LINENO: result: $ac_cv_lib_GL_ main" >&55095 echo "${ECHO_T}$ac_cv_lib_GL_ main" >&65096 if test $ac_cv_lib_GL_ main= yes; then5127 echo "$as_me:$LINENO: result: $ac_cv_lib_GL_glLoadIdentity" >&5 5128 echo "${ECHO_T}$ac_cv_lib_GL_glLoadIdentity" >&6 5129 if test $ac_cv_lib_GL_glLoadIdentity = yes; then 5097 5130 FOUND_GL=yes 5098 5131 fi … … 5231 5264 ( 5232 5265 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 ## ---------------------------------------------- ## 5236 5269 _ASBOX 5237 5270 ) | … … 5465 5498 ( 5466 5499 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 ## ---------------------------------------------- ## 5470 5503 _ASBOX 5471 5504 ) | … … 5712 5745 ( 5713 5746 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 ## ---------------------------------------------- ## 5717 5750 _ASBOX 5718 5751 ) | … … 5867 5900 ( 5868 5901 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 ## ---------------------------------------------- ## 5872 5905 _ASBOX 5873 5906 ) | … … 6051 6084 ( 6052 6085 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 ## ---------------------------------------------- ## 6056 6089 _ASBOX 6057 6090 ) | … … 6282 6315 ( 6283 6316 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 ## ---------------------------------------------- ## 6287 6320 _ASBOX 6288 6321 ) | … … 6511 6544 ( 6512 6545 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 ## ---------------------------------------------- ## 6516 6549 _ASBOX 6517 6550 ) | … … 7022 7055 ( 7023 7056 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 ## ---------------------------------------------- ## 7027 7060 _ASBOX 7028 7061 ) | … … 7334 7367 ( 7335 7368 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 ## ---------------------------------------------- ## 7339 7372 _ASBOX 7340 7373 ) | … … 7547 7580 7548 7581 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 7550 7584 7551 7585 cat >confcache <<\_ACEOF … … 7658 7692 Usually this means the macro was only invoked conditionally." >&5 7659 7693 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. 7694 Usually this means the macro was only invoked conditionally." >&2;} 7695 { (exit 1); exit 1; }; } 7696 fi 7697 if test -z "${SUB_PROJECTS_TRUE}" && test -z "${SUB_PROJECTS_FALSE}"; then 7698 { { echo "$as_me:$LINENO: error: conditional \"SUB_PROJECTS\" was never defined. 7699 Usually this means the macro was only invoked conditionally." >&5 7700 echo "$as_me: error: conditional \"SUB_PROJECTS\" was never defined. 7660 7701 Usually this means the macro was only invoked conditionally." >&2;} 7661 7702 { (exit 1); exit 1; }; } … … 7946 7987 cat >&5 <<_CSEOF 7947 7988 7948 This file was extended by orxonox $as_me 0.2. 0_alpha-r1, which was7989 This file was extended by orxonox $as_me 0.2.1-pre-alpha, which was 7949 7990 generated by GNU Autoconf 2.59. Invocation command line was 7950 7991 … … 8009 8050 cat >>$CONFIG_STATUS <<_ACEOF 8010 8051 ac_cs_version="\\ 8011 orxonox config.status 0.2. 0_alpha-r18052 orxonox config.status 0.2.1-pre-alpha 8012 8053 configured by $0, generated by GNU Autoconf 2.59, 8013 8054 with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" … … 8120 8161 # Handling of arguments. 8121 8162 "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" ;; 8122 8165 "src/console/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/console/Makefile" ;; 8123 8166 "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" ;;8126 8167 "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; 8127 8168 "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; … … 8268 8309 s,@EGREP@,$EGREP,;t t 8269 8310 s,@DEBUG@,$DEBUG,;t t 8311 s,@SUB_PROJECTS_TRUE@,$SUB_PROJECTS_TRUE,;t t 8312 s,@SUB_PROJECTS_FALSE@,$SUB_PROJECTS_FALSE,;t t 8270 8313 s,@DOXYGEN@,$DOXYGEN,;t t 8271 8314 s,@DOXYGEN_TRUE@,$DOXYGEN_TRUE,;t t -
orxonox/branches/nico/configure.ac
r3391 r3399 3 3 4 4 AC_PREREQ(2.56) 5 AC_INIT(orxonox, 0.2. 0_alpha-r1, orxonox-dev@mail.datacore.ch)5 AC_INIT(orxonox, 0.2.1-pre-alpha, [orxonox-dev at mail.datacore.ch]) 6 6 7 7 # Detect the canonical host and target build environment. … … 69 69 70 70 71 ### SubProject-enable 72 def_sdl_image=yes 73 AC_MSG_CHECKING([if the SubProjects should be built]) 74 AC_ARG_ENABLE([sub-projects], 75 AC_HELP_STRING( [--enable-sub-projects], 76 [also builds the subProjects by default]), [def_sub_projects=yes]) 77 if test "$def_sub_projects" = yes; then 78 echo "yes" 79 fi 80 if test "$def_sub_projects" = no; then 81 echo "no" 82 fi 83 AM_CONDITIONAL(SUB_PROJECTS, test x$def_sub_projects = xyes) 84 71 85 ## PROGRAMM CHECKING 72 86 # checking for Doxygen … … 161 175 162 176 CPPFLAGS="-I/usr/X11R6/include" 163 LDFLAGS="-L/usr/ Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"177 LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS" 164 178 # checking gl header 165 179 AC_CHECK_HEADERS(GL/gl.h ,, … … 167 181 168 182 # checking for Unix GL 169 AC_CHECK_LIB([GL], [ main], FOUND_GL=yes)183 AC_CHECK_LIB([GL], [glLoadIdentity], FOUND_GL=yes) 170 184 if test "$FOUND_GL" = "yes" ; then 171 185 LIBS="$LIBS -lGL" … … 364 378 365 379 AC_CONFIG_FILES([Makefile 380 src/Makefile 381 src/importer/Makefile 366 382 src/console/Makefile 367 src/gui/Makefile 368 src/Makefile 369 src/importer/Makefile]) 383 src/gui/Makefile]) 384 370 385 AC_OUTPUT -
orxonox/branches/nico/doc/orxodox.src
r2710 r3399 7 7 PROJECT_NAME = Orxonox 8 8 PROJECT_NUMBER = 1 9 OUTPUT_DIRECTORY = do c/doxygen/9 OUTPUT_DIRECTORY = doxygen/ 10 10 CREATE_SUBDIRS = YES 11 11 OUTPUT_LANGUAGE = English … … 34 34 #--------------------------------------------------------------------------- 35 35 EXTRACT_ALL = NO 36 EXTRACT_PRIVATE = NO37 EXTRACT_STATIC = NO36 EXTRACT_PRIVATE = YES 37 EXTRACT_STATIC = YES 38 38 EXTRACT_LOCAL_CLASSES = YES 39 39 EXTRACT_LOCAL_METHODS = NO … … 69 69 # configuration options related to the input files 70 70 #--------------------------------------------------------------------------- 71 INPUT = src/71 INPUT = . 72 72 FILE_PATTERNS = 73 RECURSIVE = YES73 RECURSIVE = NO 74 74 EXCLUDE = 75 75 EXCLUDE_SYMLINKS = NO -
orxonox/branches/nico/doc/orxonox.1
r1861 r3399 14 14 .\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 15 15 .\" 16 .TH ORXONOX 1 " April 13, 2004"16 .TH ORXONOX 1 "March 2, 2004" 17 17 .\" Please update the above date whenever this man page is modified. 18 18 .\" … … 28 28 .\" for manpage-specific macros, see man(7) 29 29 .SH NAME 30 orxonox \- the future of 3D-vertical-scrollers30 orxonox \- High-End Vertical Scroller 31 31 .SH SYNOPSIS 32 32 .B orxonox 33 33 .RI [ options ] 34 34 .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. 36 36 .PP 37 It also...37 It washes your windows, mends your fences, mows your lawn... 38 38 .SH OPTIONS 39 39 \fBorxonox\fP accepts the following options: 40 .TP41 .BR -q , " --quiet" , " --silent"42 Inhibit usual output.43 .TP44 .B -v, --verbose45 Print more information.46 40 .TP 47 41 .B \-h, \-\-help 48 42 Show summary of options. 49 43 .TP 50 .B \-V, \-\-version 51 Show version of program. 44 .B \-v=<i>, \-\-verbose=\<i\> 45 Prints out: 0: nothing, 1: error, 2: warnings, 3: information, 4+: debug 46 .TP 47 .B \-g, \-\-gui 48 displays 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 51 starts orxonox in windowed mode. (not fullscreen) 52 .TP 53 .B \-\-no\-sound 54 Disables audio completely 55 .TP 56 .B \-w, \-\-wireframe 57 Renders everything in Wireframe mode. 58 .TP 52 59 .\" .SH "SEE ALSO" 53 60 .\" .BR foo (1), 54 61 .\" .BR bar (1). 55 62 .SH AUTHOR 56 orx <orxonox-announce@mail.datacore.ch>.63 orx-crew <orxonox@orxonox.ethz.ch>. -
orxonox/branches/nico/src/Makefile.am
r3383 r3399 24 24 story_entity.cc \ 25 25 environment.cc \ 26 importer/object.cc \ 26 importer/model.cc \ 27 importer/objModel.cc \ 27 28 importer/array.cc \ 28 29 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 30 41 31 42 noinst_HEADERS = ability.h \ … … 53 64 shoot_laser.h \ 54 65 world_entity.h \ 55 coordinates.h \56 66 message_structures.h \ 57 67 shoot_rocket.h \ … … 60 70 story_def.h \ 61 71 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 63 83 64 84 ## orxonox.conf will be used from home-dir instead. … … 71 91 GTK_PROGS = 72 92 endif 93 if SUB_PROJECTS 94 SUB_PROGS = importer \ 95 gui \ 96 $(GTK_PROGS) 97 else 98 SUB_PROGS = 99 endif 73 100 74 101 SUBDIRS = . \ 75 importer \ 76 heightmap \ 77 gui \ 78 $(GTK_PROGS) 102 $(SUB_PROGS) 79 103 80 104 # uncomment the following if orxonox requires the math library -
orxonox/branches/nico/src/Makefile.in
r3391 r3399 59 59 track.$(OBJEXT) base_entity.$(OBJEXT) game_loader.$(OBJEXT) \ 60 60 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) 63 67 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 64 68 orxonox_LDADD = $(LDADD) … … 67 71 am__depfiles_maybe = depfiles 68 72 @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 \ 70 75 @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 \ 72 77 @AMDEP_TRUE@ ./$(DEPDIR)/data_tank.Po \ 73 78 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po \ 74 79 @AMDEP_TRUE@ ./$(DEPDIR)/game_loader.Po \ 80 @AMDEP_TRUE@ ./$(DEPDIR)/glmenu_imagescreen.Po \ 81 @AMDEP_TRUE@ ./$(DEPDIR)/helper_parent.Po \ 75 82 @AMDEP_TRUE@ ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \ 76 83 @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 \ 78 87 @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 \ 80 90 @AMDEP_TRUE@ ./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po 81 91 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ … … 95 105 ETAGS = etags 96 106 CTAGS = ctags 97 DIST_SUBDIRS = . importer heightmapgui console107 DIST_SUBDIRS = . importer gui console 98 108 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 99 109 ACLOCAL = @ACLOCAL@ … … 150 160 SHELL = @SHELL@ 151 161 STRIP = @STRIP@ 162 SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@ 163 SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@ 152 164 VERSION = @VERSION@ 153 165 ac_ct_CC = @ac_ct_CC@ … … 213 225 story_entity.cc \ 214 226 environment.cc \ 215 importer/object.cc \ 227 importer/model.cc \ 228 importer/objModel.cc \ 216 229 importer/array.cc \ 217 230 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 219 241 220 242 noinst_HEADERS = ability.h \ … … 242 264 shoot_laser.h \ 243 265 world_entity.h \ 244 coordinates.h \245 266 message_structures.h \ 246 267 shoot_rocket.h \ … … 249 270 story_def.h \ 250 271 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 252 282 253 283 EXTRA_DIST = orxonox.conf … … 256 286 ### GTK_RELATED 257 287 @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 258 293 SUBDIRS = . \ 259 importer \ 260 heightmap \ 261 gui \ 262 $(GTK_PROGS) 294 $(SUB_PROGS) 263 295 264 296 all: all-recursive … … 275 307 esac; \ 276 308 done; \ 277 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/Makefile'; \309 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ 278 310 cd $(top_srcdir) && \ 279 $(AUTOMAKE) -- gnusrc/Makefile311 $(AUTOMAKE) --foreign src/Makefile 280 312 .PRECIOUS: Makefile 281 313 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 330 362 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 331 363 @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@ 332 365 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@ 333 366 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/campaign.Po@am__quote@ 334 367 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collision.Po@am__quote@ 335 368 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_node.Po@am__quote@ 369 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Po@am__quote@ 336 370 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@ 337 371 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@ 338 372 @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@ 339 375 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@ 340 376 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@ 341 377 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ 342 378 @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@ 344 383 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@ 384 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@ 345 385 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@ 346 386 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@ 387 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 347 388 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track.Po@am__quote@ 389 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_manager.Po@am__quote@ 348 390 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ 349 391 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world.Po@am__quote@ … … 366 408 @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 367 409 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` 410 model.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 418 model.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 426 objModel.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 434 objModel.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` 383 441 384 442 array.o: importer/array.cc … … 413 471 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 414 472 @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 474 texture.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 482 texture.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` 415 489 uninstall-info-am: 416 490 -
orxonox/branches/nico/src/camera.cc
r3238 r3399 42 42 this->t = 0.0; 43 43 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); 47 46 } 48 47 … … 67 66 //printf("time is: t=%f\n", t ); 68 67 updateDesiredPlace(); 69 jump(NULL);68 //jump(NULL); 70 69 } 71 70 … … 83 82 case ELLIPTICAL: 84 83 { 84 /* 85 85 //r = actual_place.r 86 86 Orxonox *orx = Orxonox::getInstance(); … … 95 95 { 96 96 Vector *start = new Vector(0.0, 1.0, 0.0); 97 //r = /*actual_place.r*/ *start - plFocus.r;98 97 r = *(new Vector(0.0, 5.0, 0.0)); 99 98 … … 120 119 //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z ); 121 120 rAbs = r.len(); 122 if(t < 30 .0) /* FIXME!!*/121 if(t < 30) 123 122 { 124 123 ka = rAbs / deltaTime*deltaTime; 125 124 } 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 143 126 res->quatSlerp(to, from, t/deltaTime, res); 144 127 145 128 Vector ursp(0.0, 0.0, 0.0); 146 desiredPlace.r = /*plFocus.r -*/ursp - res->apply(r);129 desiredPlace.r = ursp - res->apply(r); 147 130 148 131 printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z); 149 132 //plLastBPlace = *bound->get_placement(); 133 150 134 } 135 */ 151 136 } 152 137 break; 153 138 case SMOTH_FOLLOW: 154 139 { 140 /* 155 141 Placement *plBound = bound->getPlacement(); 156 142 Location lcBound; … … 160 146 Vector vDirection(0.0, 0.0, 1.0); 161 147 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); 163 149 } 150 */ 164 151 break; 165 152 } … … 167 154 case STICKY: 168 155 { 156 /* 169 157 if(bound != null) 170 158 { … … 175 163 desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset; 176 164 } 165 */ 177 166 break; 178 167 } 179 168 /* the camera is handled like an entity and rolls on the track */ 180 169 case NORMAL: 181 Location lookat;182 170 if( bound != NULL && world != NULL ) 183 171 { 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); 186 175 } 187 176 else 188 177 { 178 /* 189 179 desiredPlace.r = Vector (0,0,0); 190 180 desiredPlace.w = Quaternion (); 181 */ 191 182 } 192 183 break; … … 237 228 // rotation 238 229 float matrix[4][4]; 239 actualPlace.w.conjugate().matrix (matrix);230 //this->absDirection.conjugate().matrix (matrix); 240 231 /* orientation and */ 241 glMultMatrixf ((float*)matrix); 232 //glMultMatrixf ((float*)matrix); 233 242 234 /* 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 245 237 246 238 // ===== 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 252 244 253 245 glMatrixMode (GL_MODELVIEW); … … 255 247 } 256 248 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 276 250 277 251 /** -
orxonox/branches/nico/src/camera.h
r3238 r3399 8 8 9 9 #include "stdincl.h" 10 #include "world_entity.h" 10 11 11 class WorldEntity; 12 12 13 class World; 13 14 … … 23 24 enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL}; 24 25 25 class Camera {26 class Camera : public WorldEntity { 26 27 private: 27 28 WorldEntity* bound; //!< the WorldEntity the Camera is bound to 28 Placement actualPlace; //!< the Camera's current position29 Placement desiredPlace; //!< where the Camera should be according to calculations30 29 World* world; 31 30 … … 37 36 38 37 /* elliptical camera mode variables */ 39 Placement plLastBPlace;40 38 float cameraOffset; 41 39 float cameraOffsetZ; … … 63 61 void apply (); 64 62 void bind (WorldEntity* entity); 65 void jump (Placement* plc);66 63 void destroy(); 67 64 -
orxonox/branches/nico/src/console/Makefile.in
r3391 r3399 128 128 SHELL = @SHELL@ 129 129 STRIP = @STRIP@ 130 SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@ 131 SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@ 130 132 VERSION = @VERSION@ 131 133 ac_ct_CC = @ac_ct_CC@ … … 193 195 esac; \ 194 196 done; \ 195 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/console/Makefile'; \197 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/console/Makefile'; \ 196 198 cd $(top_srcdir) && \ 197 $(AUTOMAKE) -- gnusrc/console/Makefile199 $(AUTOMAKE) --foreign src/console/Makefile 198 200 .PRECIOUS: Makefile 199 201 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/nico/src/curve.cc
r3238 r3399 11 11 ### File Specific: 12 12 main-programmer: Benjamin Grauer 13 co-programmer: ... 13 co-programmer: Patrick Boenzli 14 15 ADD: Patrick Boenzli B-Spline 16 14 17 15 18 TODO: 16 19 local-Time implementation 17 closed Bezier Curve18 20 NURBS 19 21 … … 21 23 22 24 #include "curve.h" 23 24 25 #include "matrix.h" 26 #include "debug.h" 27 28 #include <math.h> 29 #include <stdio.h> 25 30 26 31 /** … … 37 42 currentNode->next = 0; // not sure if this really points to NULL!! 38 43 currentNode->number = (++nodeCount); 44 this->rebuild(); 39 45 return; 40 46 } 41 47 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 */ 53 Vector 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 /////////////////////////////////// 42 66 43 67 /** … … 45 69 */ 46 70 BezierCurve::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 */ 80 BezierCurve::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 */ 92 BezierCurve::~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 */ 109 void BezierCurve::init(void) 47 110 { 48 111 nodeCount = 0; … … 58 121 59 122 /** 60 \brief Deletes a BezierCurve. 123 \brief Rebuilds a Curve 124 */ 125 void 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 */ 167 Vector 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 */ 199 Vector 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 */ 209 Quaternion 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 */ 219 Vector 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 */ 232 UPointCurve::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 */ 241 UPointCurve::UPointCurve (int derivation) 242 { 243 this->derivation = derivation; 244 dirCurve=NULL; 245 this->init(); 246 } 247 248 /** 249 \brief Deletes a UPointCurve. 61 250 62 251 It does this by freeing all the space taken over from the nodes 63 252 */ 64 BezierCurve::~BezierCurve(void)253 UPointCurve::~UPointCurve(void) 65 254 { 66 255 PathNode* tmpNode; … … 72 261 delete tmpNode; 73 262 } 263 if (dirCurve) 264 delete dirCurve; 265 } 266 267 /** 268 \brief Initializes a UPointCurve 269 */ 270 void 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 */ 288 void 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 } 74 328 } 75 329 … … 79 333 \return the Position on the Path 80 334 */ 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 } 335 Vector UPointCurve::calcPos(float t) 336 { 89 337 PathNode* tmpNode = firstNode; 90 91 338 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 107 347 tmpNode = tmpNode->next; 108 109 348 } 110 349 return ret; … … 116 355 \returns The vvaluated Vector. 117 356 */ 118 Vector BezierCurve::calcDir (float t)357 Vector UPointCurve::calcDir (float t) 119 358 { 120 359 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++; 133 370 tmpNode = tmpNode->next; 134 371 } 135 ret = tmpCurve->calcPos(t);136 372 ret.normalize(); 137 138 373 return ret; 139 374 } … … 144 379 \returns The evaluated Quaternion. 145 380 */ 146 Quaternion BezierCurve::calcQuat (float t)381 Quaternion UPointCurve::calcQuat (float t) 147 382 { 148 383 return Quaternion (calcDir(t), Vector(0,0,1)); … … 154 389 \return a Vector to the calculated position 155 390 */ 156 Vector BezierCurve::getPos() const391 Vector UPointCurve::getPos(void) const 157 392 { 158 393 return curvePoint; 159 394 } 160 161 /**162 \brief ncr-calculator, did not find an other method163 \todo a c++ variante to do this164 */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 1 2 /*! 2 3 \file curve.h … … 11 12 #include "vector.h" 12 13 14 //! An Enumerator that defines what sort of Curves are availible 15 enum CurveType {BEZIERCURVE, UPOINTCURVE}; 13 16 14 //! An abstract class to handle curves. 17 18 //! An abstract class to handle curves. Needed for the Tracking system in orxonox. 15 19 class Curve 16 20 { … … 19 23 Vector curvePoint; //!< The point on the Cureve at a local Time. 20 24 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. 21 27 22 28 //! Handles the curve-points (dynamic List) … … 24 30 { 25 31 int number; //!< The N-th node of this curve. 32 float factor; //!< Curve specific multiplier factor. 33 Vector vFactor; //!< A Vector-factor for multipliing. 26 34 Vector position; //!< Vector Pointung to this curve-point. 27 35 PathNode* next; //!< Pointer to the next Node. … … 31 39 PathNode* currentNode; //!< The node we are working with (the Last node). 32 40 41 private: 42 virtual void rebuild(void) = 0; 33 43 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;} 35 47 48 virtual Vector calcPos(float t) = 0; 49 virtual Vector calcDir(float t) = 0; 50 virtual Quaternion calcQuat(float t) = 0; 51 36 52 }; 37 53 38 //! Bezier Curve54 //! Class to handle bezier curves in 3-dimesnsional space 39 55 /** 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. 43 58 */ 44 59 class BezierCurve : public Curve 45 60 { 46 61 private: 47 // all from Curve-Class62 void rebuild(void); 48 63 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); 54 72 55 73 56 Vector getPos () const;74 Vector getPos(void) const; 57 75 }; 58 76 59 int ncr(int n, int i); 77 78 //! B-Spline 79 /** 80 class to handle b-spline in 3d space 81 */ 82 class BSplieCurve : public Curve 83 { 60 84 61 85 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 */ 95 class 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 62 112 #endif /* _CURVE_H */ -
orxonox/branches/nico/src/data_tank.cc
r2190 r3399 19 19 using namespace std; 20 20 21 long DataTank::timeStamp = 0; 22 21 23 DataTank::DataTank () {} 22 24 DataTank::~DataTank () {} -
orxonox/branches/nico/src/data_tank.h
r3238 r3399 10 10 ~DataTank (); 11 11 12 static long timeStamp; 13 12 14 }; 13 15 -
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 1 21 #ifndef _DEBUG_H 2 22 #define _DEBUG_H 3 23 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 4 36 #ifdef DEBUG 37 extern int verbose; 5 38 #define PRINTF(x) \ 6 39 PRINTF ## x 7 40 8 #if DEBUG >= 141 #if DEBUG >= ERROR 9 42 #define PRINTF1 \ 10 if (verbose >= 1) \43 if (verbose >= ERROR) \ 11 44 printf("%s:%d::", __FILE__, __LINE__) && printf 12 45 #else 13 #define PRINTF1 //46 #define PRINTF1 if (NO) 14 47 #endif 15 48 16 #if DEBUG >= 249 #if DEBUG >= WARNING 17 50 #define PRINTF2 \ 18 if (verbose >= 2) \51 if (verbose >= WARNING) \ 19 52 printf("%s:%d::", __FILE__, __LINE__) && printf 20 53 21 54 #else 22 #define PRINTF2 //55 #define PRINTF2 if (NO) 23 56 #endif 24 57 25 #if DEBUG >= 358 #if DEBUG >= INFORMATION 26 59 #define PRINTF3 \ 27 if (verbose >= 3) \60 if (verbose >= INFORMATION) \ 28 61 printf("%s:%d::", __FILE__, __LINE__) && printf 29 62 #else 30 #define PRINTF3 //63 #define PRINTF3 if (NO) 31 64 #endif 32 65 33 #if DEBUG >= 466 #if DEBUG >= DEBUGING 34 67 #define PRINTF4 \ 35 if (verbose >= 4) \68 if (verbose >= DEBUGING) \ 36 69 printf("%s:%d::", __FILE__, __LINE__) && printf 37 70 #else 38 #define PRINTF4 //71 #define PRINTF4 if (NO) 39 72 #endif 40 73 41 74 42 75 #else 43 #define PRINTF(x) //76 #define PRINTF(x) if (NO) 44 77 #endif 45 78 … … 47 80 printf("%s:%d::", __FILE__, __LINE__) && printf 48 81 82 83 /////////////////////////////////////////////////// 84 /// PRINT: just prints output as is /// 85 /////////////////////////////////////////////////// 86 #ifdef DEBUG 87 extern 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 49 180 #endif /* _DEBUG_H */ -
orxonox/branches/nico/src/environment.cc
r3238 r3399 21 21 #include "world_entity.h" 22 22 #include "vector.h" 23 #include "importer/objModel.h" 23 24 24 25 using namespace std; 25 26 26 27 27 //Sorry Bensch28 #define LEVEL_LENGTH 50029 28 30 29 Environment::Environment () : WorldEntity() 31 30 { 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"); 53 32 } 54 33 55 34 56 35 57 Environment::~Environment () {} 36 Environment::~Environment () 37 { 38 delete this->model; 39 } 58 40 59 41 void Environment::tick (float time) {} … … 71 53 float matrix[4][4]; 72 54 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); 82 59 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(); 95 62 } 96 63 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 135 135 SHELL = @SHELL@ 136 136 STRIP = @STRIP@ 137 SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@ 138 SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@ 137 139 VERSION = @VERSION@ 138 140 ac_ct_CC = @ac_ct_CC@ … … 220 222 esac; \ 221 223 done; \ 222 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/gui/Makefile'; \224 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/gui/Makefile'; \ 223 225 cd $(top_srcdir) && \ 224 $(AUTOMAKE) -- gnusrc/gui/Makefile226 $(AUTOMAKE) --foreign src/gui/Makefile 225 227 .PRECIOUS: Makefile 226 228 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/nico/src/importer/Makefile.am
r3390 r3399 8 8 importer_SOURCES= framework.cc \ 9 9 windowHandler.cc \ 10 object.cc \ 10 model.cc \ 11 objModel.cc \ 11 12 array.cc \ 12 13 material.cc \ 13 vector.cc 14 texture.cc \ 15 vector.cc 14 16 15 17 heightmap_SOURCES= main.cc \ … … 21 23 noinst_HEADERS= framework.h \ 22 24 windowHandler.h \ 23 object.h \ 25 model.h \ 26 objModel.h \ 24 27 array.h \ 25 material.h 28 material.h \ 29 texture.h 26 30 27 31 -
orxonox/branches/nico/src/importer/Makefile.in
r3391 r3399 42 42 subdir = src/importer 43 43 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ 44 $(srcdir)/Makefile.in TODO44 $(srcdir)/Makefile.in 45 45 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 46 46 am__aclocal_m4_deps = $(top_srcdir)/configure.ac … … 59 59 heightmap_LDADD = $(LDADD) 60 60 am_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) 63 63 importer_OBJECTS = $(am_importer_OBJECTS) 64 64 importer_LDADD = $(LDADD) … … 69 69 @AMDEP_TRUE@ ./$(DEPDIR)/heightMapTerrain.Po \ 70 70 @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 \ 72 73 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po 73 74 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ … … 135 136 SHELL = @SHELL@ 136 137 STRIP = @STRIP@ 138 SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@ 139 SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@ 137 140 VERSION = @VERSION@ 138 141 ac_ct_CC = @ac_ct_CC@ … … 183 186 importer_SOURCES = framework.cc \ 184 187 windowHandler.cc \ 185 object.cc \ 188 model.cc \ 189 objModel.cc \ 186 190 array.cc \ 187 191 material.cc \ 188 vector.cc 192 texture.cc \ 193 vector.cc 189 194 190 195 heightmap_SOURCES = main.cc \ … … 196 201 noinst_HEADERS = framework.h \ 197 202 windowHandler.h \ 198 object.h \ 203 model.h \ 204 objModel.h \ 199 205 array.h \ 200 material.h 206 material.h \ 207 texture.h 201 208 202 209 all: all-am … … 213 220 esac; \ 214 221 done; \ 215 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/importer/Makefile'; \222 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/importer/Makefile'; \ 216 223 cd $(top_srcdir) && \ 217 $(AUTOMAKE) -- gnusrc/importer/Makefile224 $(AUTOMAKE) --foreign src/importer/Makefile 218 225 .PRECIOUS: Makefile 219 226 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 275 282 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ 276 283 @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@ 278 287 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ 279 288 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@ -
orxonox/branches/nico/src/importer/framework.cc
r3238 r3399 15 15 16 16 #include "framework.h" 17 17 int verbose; 18 18 void DrawGLScene() 19 19 { … … 52 52 int main(int argc, char *argv[]) 53 53 { 54 int verbose = 3; 55 56 PRINTF(2)("This is The big verbose-Test %i, %s\n", 1, "cool"); 54 verbose = 2; 57 55 58 56 Uint8* keys; // This variable will be used in the keyboard routine … … 71 69 PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h); 72 70 if (argc>=3) 73 obj = new O bject(argv[1], atof(argv[2]));71 obj = new OBJModel (argv[1], atof(argv[2])); 74 72 else if (argc>=2) 75 obj = new O bject(argv[1]);73 obj = new OBJModel(argv[1]); 76 74 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 } 79 114 M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); 80 115 rotAxis = Vector (0.0,1.0,0.0); … … 215 250 case SDLK_c: 216 251 if (!obj) 217 obj = new O bject(argv[1]);252 obj = new OBJModel(argv[1]); 218 253 break; 219 254 } -
orxonox/branches/nico/src/importer/framework.h
r3238 r3399 3 3 4 4 #include "windowHandler.h" // Include the Whandler Basecode 5 #include "obj ect.h"5 #include "objModel.h" 6 6 #include "vector.h" 7 7 … … 33 33 34 34 WindowHandler wHandler; // Create an instance of the whandler basecode class 35 O bject* obj;35 OBJModel* obj; 36 36 37 37 -
orxonox/branches/nico/src/importer/material.cc
r3238 r3399 13 13 co-programmer: ... 14 14 15 TGA-code: borrowed from nehe-Tutorials16 17 15 */ 18 16 19 17 #include "material.h" 20 18 21 // headers only for PathList22 #include <unistd.h>23 #include <sys/types.h>24 #include <sys/stat.h>25 #include <stdlib.h>26 #include <fstream>27 28 19 using namespace std; 29 20 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 PathList57 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 pName71 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 else98 PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName);99 }100 else101 PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName);102 delete []tmpPName;103 }104 21 105 22 /** … … 133 50 if (this->name) 134 51 delete []this->name; 135 if (this->diffuseTexture Set)136 glDeleteTextures (1, &this->diffuseTexture);52 if (this->diffuseTexture) 53 this->diffuseTexture; 137 54 if (this->nextMat) 138 55 delete this->nextMat; … … 172 89 this->setTransparency(0.0); 173 90 174 if (!this->pathList) 175 this->pathList = new PathList(""); 176 91 92 this->diffuseTexture = NULL; 93 this->ambientTexture = NULL; 94 this->specularTexture = NULL; 177 95 178 96 this->diffuseTextureSet = false; … … 182 100 183 101 } 184 185 PathList *Material::pathList = NULL;186 102 187 103 /** … … 196 112 while (searcher != NULL) 197 113 { 198 PRINT F(2)(".");114 PRINT(2)("."); 199 115 if (!strcmp (searcher->getName(), mtlName)) 200 116 { 201 PRINT F(2)("found.\n");117 PRINT(2)("found.\n"); 202 118 return searcher; 203 119 } 204 120 searcher = searcher->nextMat; 205 121 } 206 PRINT F(2)("not found\n");122 PRINT(2)("not found\n"); 207 123 return NULL; 208 124 } … … 233 149 234 150 if (this->diffuseTextureSet) 235 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture );151 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture()); 236 152 else 237 153 glBindTexture(GL_TEXTURE_2D, 0); … … 394 310 void Material::addTexturePath(char* pathName) 395 311 { 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 } 432 314 433 315 // MAPPING // … … 440 322 { 441 323 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); 445 326 446 327 } … … 477 358 478 359 } 479 480 /**481 \brief Loads a Texture to the openGL-environment.482 \param pImage The Image to load to openGL483 \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_H503 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 else529 {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-File539 1. Checks what type of Image should be imported540 2. ToDO: Checks where to find the Image541 */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 else569 {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 else575 {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 width606 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 height612 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 planes622 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 bpp634 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-file688 \param jpgName the Name of the Image to load689 \param texture a reference to the Texture to write the image to690 */691 bool Material::loadJPG (char* jpgName, GLuint* texture)692 {693 #ifdef HAVE_JPEGLIB_H694 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 opened699 if((pFile = fopen(jpgName, "rb")) == NULL)700 {701 // Display an error message saying the file was not found, then return NULL702 PRINTF(1)("Unable to load JPG File %s.\n", jpgName);703 return false;704 }705 706 // Create an error handler707 jpeg_error_mgr jerr;708 709 // Have our compression info object point to the error handler address710 cinfo.err = jpeg_std_error(&jerr);711 712 // Initialize the decompression object713 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 // DECOFING722 // Read in the header of the jpeg file723 jpeg_read_header(&cinfo, TRUE);724 725 // Start to decompress the jpeg file with our compression info726 jpeg_start_decompress(&cinfo);727 728 // Get the image dimensions and row span to read in the pixel data729 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 buffer734 pImage->data = new unsigned char[pImage->rowSpan * pImage->height];735 736 // Here we use the library's state variable cinfo.output_scanline as the737 // loop counter, so that we don't have to keep track ourselves.738 739 // Create an array of row pointers740 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 data745 int rowsRead = 0;746 while (cinfo.output_scanline < cinfo.output_height)747 {748 // Read in the current row of pixels and increase the rowsRead count749 rowsRead += jpeg_read_scanlines(&cinfo, &rowPtr[rowsRead], cinfo.output_height - rowsRead);750 }751 752 // Delete the temporary row pointers753 delete [] rowPtr;754 755 // Finish decompressing the data756 jpeg_finish_decompress(&cinfo);// decodeJPG(&cinfo, pImage);757 758 // This releases all the stored memory for reading and decoding the jpeg759 jpeg_destroy_decompress(&cinfo);760 761 // Close the file pointer that opened the file762 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-file788 \param tgaName the Name of the Image to load789 \param texture a reference to the Texture to write the image to790 */791 bool Material::loadTGA(const char * tgaName, GLuint* texture)792 {793 typedef struct794 {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 Header800 GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header801 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 else833 {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-file844 \param filename the Name of the Image to load845 \param fTGA a Pointer to a File, that should be read846 \param texture a reference to the Texture to write the image to847 */848 bool Material::loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)849 {850 GLubyte header[6]; // First 6 Useful Bytes From The Header851 GLuint bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File852 GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram853 GLuint temp; // Temporary Variable854 GLuint type;855 GLuint Height; // Height of Image856 GLuint Width; // Width of Image857 GLuint Bpp; // Bits Per Pixel858 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 valid871 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 else882 {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-file919 \param filename the Name of the Image to load920 \param fTGA a Pointer to a File, that should be read921 \param texture a reference to the Texture to write the image to922 */923 bool Material::loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture)924 {925 GLubyte header[6]; // First 6 Useful Bytes From The Header926 GLuint bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File927 GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram928 GLuint temp; // Temporary Variable929 GLuint type;930 GLuint Height; // Height of Image931 GLuint Width; // Width of Image932 GLuint Bpp; // Bits Per Pixel933 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 ok953 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 do970 {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 1983 if(chunkheader < 128)984 {985 short counter;986 chunkheader++;987 // Read RAW color values988 for(counter = 0; counter < chunkheader; counter++)989 {990 // Try to read 1 pixel991 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 memory1007 // Flip R and B vcolor values around in the process1008 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 image1013 {1014 pImage->data[currentbyte + 3] = colorbuffer[3];// copy the 4th byte1015 }1016 1017 currentbyte += bytesPerPixel;1018 currentpixel++;1019 1020 // Make sure we haven't read too many pixels1021 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 times1039 else1040 {1041 short counter;1042 chunkheader -= 127; // Subteact 127 to get rid of the ID bit1043 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values1044 {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 dictated1060 {1061 // switch R and B bytes areound while copying1062 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 left1094 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-file1110 \param pngName the Name of the Image to load1111 \param texture a reference to the Texture to write the image to1112 */1113 bool Material::loadPNG(const char* pngName, GLuint* texture)1114 {1115 #ifdef HAVE_PNG_H1116 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 else1196 {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 14 14 15 15 #include "../stdincl.h" 16 #include "texture.h" 16 17 17 18 #if HAVE_CONFIG_H … … 19 20 #endif /* HAVE_CONFIG_H */ 20 21 21 #ifdef HAVE_SDL_SDL_IMAGE_H22 #include <SDL/SDL_image.h>23 #else24 // IMAGE LIBS //25 #ifdef HAVE_JPEGLIB_H26 extern "C"{ // This has to be done, because not a c++ lib27 #include <jpeglib.h>28 }29 #endif /* HAVE_JPEGLIB_H */30 #ifdef HAVE_PNG_H31 #include <png.h>32 #endif /* HAVE_PNG_H */33 #endif /* HAVE_SDL_SDL_IMAGE_H */34 22 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 PathList43 {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 };53 23 54 24 … … 92 62 93 63 private: 94 //! Struct to handle Infos about an Image95 struct Image96 {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; //!< BitsPerPixel101 GLuint type; //!< Type of the Image.102 GLubyte *data; //!< The Image Data comes here! DANGER: uncompressed data.103 };104 105 106 64 char* name; //!< The Name of the Material. 107 65 int illumModel; //!< The IlluminationModel is either flat or smooth. … … 112 70 float transparency;//!< The transperency of the Material. 113 71 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. 119 75 120 76 bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set. … … 124 80 Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. 125 81 126 // TEXTURING127 bool loadTexToGL (Image* pImage, GLuint* texture);128 82 129 bool loadImage(char* imageName, GLuint* texture);130 #ifndef HAVE_SDL_SDL_IMAGE_H131 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 #endif144 83 }; 145 84 #endif -
orxonox/branches/nico/src/list.h
r3238 r3399 78 78 79 79 80 void add( WorldEntity* entity);81 void remove( WorldEntity* entity);80 void add(T* entity); 81 void remove(T* entity); 82 82 void destroy(); 83 83 T* firstElement(); … … 104 104 105 105 template<class T> 106 void tList<T>::add( WorldEntity* entity)106 void tList<T>::add(T* entity) 107 107 { 108 108 listElement* el = new listElement; … … 120 120 121 121 template<class T> 122 void tList<T>::remove( WorldEntity* entity)122 void tList<T>::remove(T* entity) 123 123 { 124 124 this->currentEl = this->first; -
orxonox/branches/nico/src/orxonox.cc
r3238 r3399 31 31 #include "game_loader.h" 32 32 #include <string.h> 33 int verbose; 33 34 34 35 using namespace std; … … 115 116 // Set video mode 116 117 // 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 122 134 int bpp = 16; 123 135 int width = 640; 124 136 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) 128 160 { 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()); 130 162 SDL_Quit(); 131 163 return -1; … … 133 165 134 166 // Set window labeling 135 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);167 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 136 168 137 169 // TO DO: Create a cool icon and use it here … … 139 171 140 172 // 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); 144 175 145 176 // LIGHTING … … 148 179 GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0}; 149 180 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); 157 188 189 //glEnable (GL_TEXTURE_2D); 158 190 // glEnable(GL_COLOR); 159 191 // glShadeModel(GL_SMOOTH); … … 311 343 312 344 345 SDL_Surface* Orxonox::getScreen () 346 { 347 return this->screen; 348 } 313 349 314 350 -
orxonox/branches/nico/src/orxonox.h
r3238 r3399 68 68 Camera* getCamera(); 69 69 World* getWorld(); 70 SDL_Surface* getScreen (); 70 71 71 72 //void mainLoop(); -
orxonox/branches/nico/src/player.cc
r3238 r3399 19 19 #include "stdincl.h" 20 20 #include "collision.h" 21 #include "importer/objModel.h" 21 22 22 23 using namespace std; … … 26 27 { 27 28 28 this-> obj = new Object("reaplow.obj");29 this->model = new OBJModel("../data/models/reaplow.obj"); 29 30 /* 30 31 objectList = glGenLists(1); … … 54 55 } 55 56 56 Player::~Player ()57 Player::~Player () 57 58 { 58 delete this-> obj;59 delete this->model; 59 60 } 60 61 61 void Player::postSpawn ()62 void Player::postSpawn () 62 63 { 63 64 travelSpeed = 15.0; … … 69 70 } 70 71 71 void Player::tick (float time)72 void Player::tick (float time) 72 73 { 73 74 // movement 74 move (time);75 this->move (time); 75 76 } 76 77 77 void Player::hit (WorldEntity* weapon, Vector loc)78 void Player::hit (WorldEntity* weapon, Vector loc) 78 79 { 79 80 } 80 81 81 void Player::destroy ()82 void Player::destroy () 82 83 { 83 84 } 84 85 85 void Player::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags)86 void Player::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) 86 87 { 87 88 } 88 89 89 void Player::command (Command* cmd)90 void Player::command (Command* cmd) 90 91 { 91 92 //printf("Player|recieved command [%s]\n", cmd->cmd); … … 97 98 } 98 99 99 void Player::draw ()100 void Player::draw () 100 101 { 101 102 glMatrixMode(GL_MODELVIEW); … … 103 104 float matrix[4][4]; 104 105 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); 107 112 glMultMatrixf((float*)matrix); 108 113 109 114 glMatrixMode(GL_MODELVIEW); 110 glRotatef(-90, 0,1,0); 111 obj->draw(); 115 this->model->draw(); 112 116 // glCallList(objectList); 113 114 115 116 117 } 117 118 119 120 /*PN 118 121 void Player::getLookat(Location* locbuf) 119 122 { … … 121 124 //locbuf->dist += 5.0; 122 125 } 126 */ 123 127 124 void Player::leftWorld ()128 void Player::leftWorld () 125 129 { 126 130 } 127 131 128 void Player::move (float time)132 void Player::move (float time) 129 133 { 130 134 Vector accel(0.0, 0.0, 0.0); 131 135 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 132 Placement *pos = getPlacement(); 136 //Placement *pos = getPlacement(); 137 133 138 /* 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); 138 143 139 144 if( bUp) { accel = accel+(direction*acceleration); } 140 145 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); } 143 148 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 144 149 if( bDescend) {/* FIXME */} /* \todo up and down player movement */ 145 150 146 Location* l = getLocation();151 //Location* l = getLocation(); 147 152 148 153 // r(t) = r(0) + v(0)*t + 1/2*a*t^2 … … 152 157 153 158 /* 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 156 164 /* 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); 158 168 } -
orxonox/branches/nico/src/player.h
r3238 r3399 8 8 9 9 #include "world_entity.h" 10 #include "importer/object.h" 10 11 class OBJModel; 11 12 12 13 //! Basic controllable WorldEntity … … 27 28 28 29 virtual void draw(); 29 virtual void getLookat(Location* locbuf);30 // virtual void getLookat(Location* locbuf); 30 31 31 32 virtual void leftWorld(); … … 38 39 float acceleration; 39 40 GLuint objectList; 40 Object* obj;41 41 42 42 void move(float time); -
orxonox/branches/nico/src/proto_class.cc
r1956 r3399 23 23 24 24 25 26 ProtoClass::ProtoClass () {} 25 /** 26 \brief standard constructor 27 \todo this constructor is not jet implemented - do it 28 */ 29 ProtoClass::ProtoClass () 30 { 31 this->setClassName ("ProtoClass"); 32 } 27 33 28 34 35 /** 36 \brief standard deconstructor 37 \todo this deconstructor is not jet implemented - do it 29 38 39 */ 30 40 ProtoClass::~ProtoClass () {} 31 41 32 42 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 */ 50 bool 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 */ 1 9 2 10 #ifndef _PROTO_CLASS_H 3 11 #define _PROTO_CLASS_H 4 12 5 #include " data_tank.h"13 #include "stdincl.h" 6 14 15 /*class Test;*/ /* forward definition of class Test (without including it here!)*/ 7 16 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 */ 21 class ProtoClass : public BaseObject { 9 22 10 23 public: … … 12 25 ~ProtoClass (); 13 26 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 14 32 }; 15 33 -
orxonox/branches/nico/src/stdincl.h
r3238 r3399 10 10 11 11 #define null 0 //!< null 12 13 typedef unsigned char byte; 12 14 13 15 // this includes the information from configure/makefiles … … 31 33 32 34 #include "vector.h" 33 #include "coordinates.h" 35 #include "matrix.h" 36 #include "curve.h" 37 //#include "coordinates.h" 34 38 #include "list.h" 35 39 #include "list_template.h" … … 38 42 #include "message_structures.h" 39 43 #include "orxonox.h" 44 #include "data_tank.h" 45 #include "base_object.h" 40 46 41 47 #endif /* _STDINCL_H */ -
orxonox/branches/nico/src/story_entity.h
r3238 r3399 12 12 13 13 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... 14 class StoryEntity {14 class StoryEntity : public BaseObject { 15 15 16 16 public: -
orxonox/branches/nico/src/track.cc
r3238 r3399 29 29 this->end = NULL; 30 30 this->nextID = 0; 31 this->setClassName ("Track"); 31 32 } 32 33 … … 44 45 this->end = finish; 45 46 this->nextID = next; 47 this->setClassName ("Track"); 46 48 } 47 49 … … 59 61 60 62 61 /**62 \brief calculate a camera Placement from a "look at"-Location63 \param lookat: the Location the camera should be centered on64 \param camplc: pointer to a buffer where the new camera Placement should be put into65 66 Theoretically you can place the camera wherever you want, but for the sake of67 common sense I suggest that you at least try to keep the thing that should be looked68 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);84 63 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 Location94 \param loc: the Location the entity is in95 \param plc: a pointer to a buffer where the corresponding Placement should be put96 into97 \return: true if track changes - false if track stays98 99 There are no limitations to how you transform a Location into a Placement, but for100 the sake of placement compatibility between track parts you should make sure that101 the resulting Placement at dist == 0 is equal to the offset Vector and the Placement102 at dist == len() is equal to the end Vector. Elseway there will be ugly artifacts103 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 of120 * 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 }128 64 129 65 -
orxonox/branches/nico/src/track.h
r3238 r3399 14 14 To create special levels with special camera movement, rules or whatever, derive from this base class. 15 15 */ 16 class Track 16 class Track : public BaseObject 17 17 { 18 18 private: … … 35 35 virtual void postLeave (WorldEntity* entity); 36 36 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 boundaries39 37 }; 40 38 -
orxonox/branches/nico/src/vector.cc
r3238 r3399 844 844 } 845 845 846 847 /**848 \brief Creates a new BezierCurve849 */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 nodes866 */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 Curve881 \param newNode a Vector to the position of the new node882 */883 void BezierCurve::addNode(const Vector& newNode)884 {885 PathNode* tmpNode;886 if (nodeCount == 0 )887 tmpNode = firstNode;888 else889 {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 curve901 \param t The position on the Curve (0<=t<=1)902 \return the Position on the Path903 */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 Curve960 \return a Vector to the calculated position961 */962 Vector BezierCurve::getPos() const963 {964 return curvePoint;965 } -
orxonox/branches/nico/src/vector.h
r3238 r3399 149 149 }; 150 150 151 152 153 //! Bezier Curve154 /**155 Class to handle bezier curves in 3-dimesnsional space156 157 needed for the Tracking system in OrxOnoX.158 */159 class BezierCurve160 {161 private:162 int nodeCount;163 Vector curvePoint;164 165 struct PathNode166 {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 187 151 #endif /* _VECTOR_H */ -
orxonox/branches/nico/src/world.cc
r3238 r3399 18 18 #include "world_entity.h" 19 19 #include "collision.h" 20 #include "track_manager.h" 20 21 #include "track.h" 21 22 #include "player.h" … … 23 24 #include "camera.h" 24 25 #include "environment.h" 26 #include "p_node.h" 27 #include "null_parent.h" 28 #include "helper_parent.h" 29 #include "glmenu_imagescreen.h" 25 30 26 31 using namespace std; … … 34 39 World::World (char* name) 35 40 { 41 this->setClassName ("World"); 36 42 this->worldName = name; 37 43 this->debugWorldNr = -1; … … 48 54 /** 49 55 \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 50 59 */ 51 60 World::~World () … … 57 66 this->localCamera->destroy(); 58 67 68 this->nullParent->destroy (); 69 70 //delete this->trackManager; 71 72 /* 59 73 WorldEntity* entity = entities->enumerate(); 60 74 while( entity != NULL ) … … 64 78 } 65 79 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; 69 87 /* this->localPlayer hasn't to be deleted explicitly, it is 70 88 contained in entities*/ 71 89 } 90 91 GLfloat 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}}; 72 94 73 95 … … 78 100 cn->addToWorld(this); 79 101 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 81 113 82 114 ErrorMessage World::start() … … 99 131 } 100 132 133 101 134 ErrorMessage World::resume() 102 135 { … … 104 137 } 105 138 139 106 140 void World::destroy() 107 141 { 108 109 } 142 } 143 144 145 void 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 159 void 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 110 167 111 168 void World::load() 112 169 { 170 // BezierCurve* tmpCurve = new BezierCurve(); 113 171 if(this->debugWorldNr != -1) 114 172 { 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 */ 115 240 switch(this->debugWorldNr) 116 241 { … … 123 248 case DEBUG_WORLD_0: 124 249 { 250 this->nullParent = NullParent::getInstance (); 251 this->nullParent->setName ("NullParent"); 252 125 253 // create some path nodes 126 254 this->pathnodes = new Vector[6]; … … 141 269 // !\todo old track-system has to be removed 142 270 271 //create helper for player 272 HelperParent* hp = new HelperParent (); 273 /* the player has to be added to this helper */ 274 143 275 // 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(); 147 283 148 284 // bind input 149 Orxonox *orx = Orxonox::getInstance ();285 Orxonox *orx = Orxonox::getInstance (); 150 286 orx->getLocalInput()->bind (myPlayer); 151 287 152 288 // bind camera 153 289 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 (); 159 299 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(); 161 305 162 306 break; … … 164 308 case DEBUG_WORLD_1: 165 309 { 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 166 323 // create some path nodes 167 324 this->pathnodes = new Vector[6]; … … 173 330 this->pathnodes[5] = Vector(30, 50, 0); 174 331 332 333 334 175 335 // create the tracks 176 336 this->tracklen = 6; … … 183 343 // create a player 184 344 WorldEntity* myPlayer = new Player(); 345 myPlayer->setName ("player"); 185 346 this->spawn(myPlayer); 186 347 this->localPlayer = myPlayer; … … 191 352 192 353 // bind camera 193 this->localCamera = new Camera(this); 354 this->localCamera = new Camera (this); 355 this->localCamera->setName ("camera"); 194 356 this->getCamera()->bind (myPlayer); 357 this->localPlayer->addChild (this->localCamera); 195 358 break; 196 359 } … … 212 375 213 376 int sizeX = 100; 214 int size Y= 80;377 int sizeZ = 80; 215 378 float length = 1000; 216 379 float width = 200; 217 380 float widthX = float (length /sizeX); 218 float width Y = float (width /sizeY);219 220 float height [sizeX][size Y];221 Vector normal_vectors[sizeX][size Y];381 float widthZ = float (width /sizeZ); 382 383 float height [sizeX][sizeZ]; 384 Vector normal_vectors[sizeX][sizeZ]; 222 385 223 386 224 387 for ( int i = 0; i<sizeX-1; i+=1) 225 for (int j = 0; j<size Y-1;j+=1)388 for (int j = 0; j<sizeZ-1;j+=1) 226 389 //height[i][j] = rand()/20046 + (j-25)*(j-25)/30; 227 390 #ifdef __WIN32__ … … 231 394 #endif 232 395 233 //Die H ügel ein wenig glätten396 //Die Huegel ein wenig glaetten 234 397 for (int h=1; h<2;h++) 235 398 for (int i=1;i<sizeX-2 ;i+=1 ) 236 for(int j=1;j<size Y-2;j+=1)399 for(int j=1;j<sizeZ-2;j+=1) 237 400 height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4; 238 401 239 402 //Berechnung von normalen Vektoren 240 241 403 for(int i=1;i<sizeX-2;i+=1) 242 for(int j=1;j<size Y-2 ;j+=1)404 for(int j=1;j<sizeZ-2 ;j+=1) 243 405 { 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)); 249 411 250 412 Vector c1 = v2 - v1; … … 253 415 Vector c4 = v5 - v1; 254 416 Vector zero = Vector (0,0,0); 255 normal_vectors[i][j]=c1.cross(v 4-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); 256 418 normal_vectors[i][j].normalize(); 257 419 } … … 259 421 int snowheight=3; 260 422 for ( int i = 0; i<sizeX; i+=1) 261 for (int j = 0; j<size Y;j+=1)423 for (int j = 0; j<sizeZ;j+=1) 262 424 { 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); 267 429 float a[3]; 268 430 if(height[i][j]<snowheight){ … … 371 533 //draw track 372 534 glBegin(GL_LINES); 373 glColor3f(0 ,1,1);535 glColor3f(0.0, 1.0, 1.0); 374 536 for( int i = 0; i < tracklen; i++) 375 537 { … … 378 540 } 379 541 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 */ 380 567 glEndList(); 381 568 } … … 430 617 void World::draw () 431 618 { 432 // draw geometry433 434 619 // draw entities 435 620 WorldEntity* entity; 436 437 621 entity = this->entities->enumerate(); 438 622 while( entity != NULL ) … … 440 624 if( entity->bDraw ) entity->draw(); 441 625 entity = this->entities->nextElement(); 442 } 443 444 626 } 627 628 //glmis = new GLMenuImageScreen(); 629 ///glmis->init(); 630 445 631 // draw debug coord system 446 632 glCallList (objectList); 447 448 633 449 634 } … … 459 644 void World::update () 460 645 { 646 /* 461 647 //List<WorldEntity> *l; 462 648 WorldEntity* entity; … … 477 663 t = loc->part; 478 664 479 /* check if entity has still a legal track-id */480 665 if( t >= tracklen ) 481 666 { … … 500 685 else 501 686 { 502 /* \todo: implement check whether this particular free entity503 is out of the game area504 \todo: call function to notify the entity that it left505 the game area506 */507 687 } 508 688 509 689 entity = entities->nextElement(); 510 690 } 511 691 */ 512 692 } 513 693 … … 522 702 float seconds = deltaT / 1000.0; 523 703 704 this->nullParent->update (seconds); 705 //this->nullParent->processTick (seconds); 706 524 707 entity = entities->enumerate(); 525 708 while( entity != NULL) … … 542 725 543 726 544 545 /**546 \brief calls the correct mapping function to convert a given "look at"-Location to a547 Camera Placement548 */549 void World::calcCameraPos (Location* loc, Placement* plc)550 {551 track[loc->part].mapCamera (loc, plc);552 }553 554 555 727 void World::setTrackLen(Uint32 len) 556 728 { … … 571 743 void World::debug() 572 744 { 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 /* 574 794 WorldEntity* entity; 575 576 795 printf("counting all entities\n"); 577 796 printf("World::debug() - enumerate()\n"); … … 582 801 entity = entities->nextElement(); 583 802 } 803 */ 584 804 } 585 805 … … 594 814 void World::mainLoop() 595 815 { 596 this->lastFrame = SDL_GetTicks ();816 this->lastFrame = SDL_GetTicks (); 597 817 printf("World::mainLoop() - Entering main loop\n"); 598 818 while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */ 599 819 { 600 820 // Network 601 synchronize();821 this->synchronize (); 602 822 // Process input 603 handleInput();823 this->handleInput (); 604 824 if( this->bQuitCurrentGame || this->bQuitOrxonox) 605 825 { … … 608 828 } 609 829 // Process time 610 t imeSlice();830 this->timeSlice (); 611 831 // Process collision 612 collision();832 this->collision (); 613 833 // 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*/ 617 838 } 618 839 printf("World::mainLoop() - Exiting the main loop\n"); … … 701 922 this->draw(); 702 923 // draw HUD 924 /* \todo draw HUD */ 703 925 // flip buffers 704 926 SDL_GL_SwapBuffers(); 927 //SDL_Surface* screen = Orxonox::getInstance()->getScreen (); 928 //SDL_Flip (screen); 705 929 } 706 930 … … 723 947 void World::spawn(WorldEntity* entity) 724 948 { 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 740 954 entity->postSpawn (); 741 955 } … … 747 961 \param location where to add 748 962 */ 749 void World::spawn(WorldEntity* entity, Location* loc) 750 { 751 Location zeroLoc; 752 WorldEntity* owner; 963 void 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 753 971 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 767 973 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 792 976 793 977 … … 800 984 return false; 801 985 } 986 987 988 989 990 void 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 11 11 12 12 13 13 class TrackManager; 14 14 class Track; 15 15 class WorldEntity; 16 16 class Camera; 17 class PNode; 18 class GLMenuImageScreen; 17 19 18 20 //! The game environment … … 23 25 World (int worldID); 24 26 virtual ~World (); 25 26 template<typename T>27 T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity28 template<typename T>29 T* spawn (Placement* plc, WorldEntity* owner);30 27 31 28 virtual ErrorMessage init (); … … 38 35 virtual void destroy (); 39 36 37 //static void vertexCallback (GLfloat* vertex); 38 40 39 void timeSlice (Uint32 deltaT); 41 40 void collide (); 42 41 void draw (); 43 42 void update (); // maps Locations to Placements 44 void calcCameraPos (Location* loc, Placement* plc);43 //void calcCameraPos (Location* loc, Placement* plc); 45 44 46 45 void unload (); 47 46 bool command (Command* cmd); 47 virtual void displayLoadScreen(); 48 virtual void releaseLoadScreen(); 48 49 49 50 void setTrackLen (Uint32 tracklen); … … 53 54 54 55 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); 57 57 58 58 tList<WorldEntity>* entities; 59 59 60 60 // base level data 61 TrackManager* trackManager; 61 62 Track* track; 62 63 Uint32 tracklen; // number of Tracks the World consist of … … 64 65 Camera* localCamera; 65 66 67 68 UPointCurve* testCurve; 66 69 private: 67 70 Uint32 lastFrame; //!> last time of frame … … 70 73 bool bPause; 71 74 75 GLMenuImageScreen* glmis; 76 72 77 char* worldName; 73 78 int debugWorldNr; 74 79 GLuint objectList; 80 SDL_Surface *loadImage; 75 81 76 82 WorldEntity* localPlayer; 77 83 84 PNode* nullParent; 85 78 86 void mainLoop (); 79 87 void synchronize (); … … 83 91 void display (); 84 92 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*/ 85 95 }; 86 96 -
orxonox/branches/nico/src/world_entity.cc
r3238 r3399 36 36 WorldEntity::WorldEntity (bool isFree) : bFree(isFree) 37 37 { 38 this->setClassName ("WorldEntity"); 38 39 this->bDraw = true; 39 40 collisioncluster = NULL; 40 owner = NULL; 41 } 42 43 /** 44 \brief standard destructor 41 } 42 43 /** 44 \brief standard destructor 45 45 */ 46 46 WorldEntity::~WorldEntity () … … 53 53 \return a pointer to location 54 54 */ 55 /*PN 55 56 Location* WorldEntity::getLocation () 56 57 { 57 58 return &loc; 58 59 } 60 */ 59 61 60 62 /** … … 62 64 \return a pointer to placement 63 65 */ 66 /*PN 64 67 Placement* WorldEntity::getPlacement () 65 68 { 66 69 return &place; 67 70 } 68 71 */ 69 72 /** 70 73 \brief query whether the WorldEntity in question is free … … 89 92 } 90 93 94 91 95 /** 92 96 \brief this method is called every frame … … 99 103 } 100 104 105 106 /** 107 \brief process draw function 108 */ 109 void 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 121 void WorldEntity::setDrawable (bool bDraw) 122 { 123 this->bDraw = bDraw; 124 } 125 126 101 127 /** 102 128 \brief the entity is drawn onto the screen with this function … … 105 131 */ 106 132 void WorldEntity::draw() 107 { 108 } 133 {} 109 134 110 135 /** … … 134 159 void WorldEntity::destroy() {} 135 160 136 137 /**138 \brief basic initialisation for bound Entities139 */140 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)141 {142 loc = *spawnloc;143 owner = spawnowner;144 }145 146 /**147 \brief basic initialisation for free Entities148 */149 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)150 {151 place = *spawnplc;152 owner = spawnowner;153 }154 161 155 162 /** … … 181 188 to look at the location you return with this. 182 189 */ 190 /*PN 183 191 void WorldEntity::getLookat (Location* locbuf) 184 192 { 185 193 } 194 */ 186 195 187 196 /** -
orxonox/branches/nico/src/world_entity.h
r3238 r3399 8 8 9 9 #include "stdincl.h" 10 #include "p_node.h" 10 11 11 12 class CollisionCluster; 13 class OBJModel; 12 14 13 15 //! Basic class from which all interactive stuff in the world is derived from 14 class WorldEntity 16 class WorldEntity : public PNode 15 17 { 16 18 friend class World; 17 19 18 20 public: 19 21 WorldEntity (bool isFree = false); 20 22 virtual ~WorldEntity (); 23 24 OBJModel* model; 21 25 22 Location* getLocation ();23 Placement* getPlacement ();24 26 void setCollision (CollisionCluster* newhull); 25 27 … … 35 37 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 36 38 virtual void command (Command* cmd); 37 39 40 void processDraw (); 38 41 virtual void draw (); 39 v irtual void getLookat (Location* locbuf);42 void setDrawable (bool bDraw); 40 43 41 44 virtual void leftWorld (); … … 45 48 bool bCollide; 46 49 bool bDraw; 47 48 WorldEntity* owner; 50 49 51 CollisionCluster* collisioncluster; 50 Placement place;51 Location loc;52 53 void init( Location* spawnloc, WorldEntity* spawnowner);54 void init( Placement* spawnplc, WorldEntity* spawnowner);55 52 }; 56 53
Note: See TracChangeset
for help on using the changeset viewer.