- Timestamp:
- Jan 7, 2005, 1:14:33 AM (20 years ago)
- Location:
- orxonox/trunk
- Files:
-
- 2 deleted
- 37 edited
- 16 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/configure
r3240 r3365 1 1 #! /bin/sh 2 2 # Guess values for system-dependent variables and create Makefiles. 3 # Generated by GNU Autoconf 2.59 for orxonox 2.0.1-pre-alpha.3 # Generated by GNU Autoconf 2.59 for orxonox 0.2.1-pre-alpha. 4 4 # 5 5 # Report bugs to <orxonox-dev at mail.datacore.ch>. … … 270 270 PACKAGE_NAME='orxonox' 271 271 PACKAGE_TARNAME='orxonox' 272 PACKAGE_VERSION=' 2.0.1-pre-alpha'273 PACKAGE_STRING='orxonox 2.0.1-pre-alpha'272 PACKAGE_VERSION='0.2.1-pre-alpha' 273 PACKAGE_STRING='orxonox 0.2.1-pre-alpha' 274 274 PACKAGE_BUGREPORT='orxonox-dev at mail.datacore.ch' 275 275 … … 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 2.0.1-pre-alpha to adapt to many kinds of systems.791 \`configure' configures orxonox 0.2.1-pre-alpha to adapt to many kinds of systems. 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 2.0.1-pre-alpha:";;858 short | recursive ) echo "Configuration of orxonox 0.2.1-pre-alpha:";; 859 859 esac 860 860 cat <<\_ACEOF … … 984 984 if $ac_init_version; then 985 985 cat <<\_ACEOF 986 orxonox configure 2.0.1-pre-alpha986 orxonox configure 0.2.1-pre-alpha 987 987 generated by GNU Autoconf 2.59 988 988 … … 998 998 running configure, to aid debugging if configure makes a mistake. 999 999 1000 It was created by orxonox $as_me 2.0.1-pre-alpha, which was1000 It was created by orxonox $as_me 0.2.1-pre-alpha, which was 1001 1001 generated by GNU Autoconf 2.59. Invocation command line was 1002 1002 … … 1719 1719 # Define the identity of the package. 1720 1720 PACKAGE='orxonox' 1721 VERSION=' 2.0.1-pre-alpha'1721 VERSION='0.2.1-pre-alpha' 1722 1722 1723 1723 … … 7946 7946 cat >&5 <<_CSEOF 7947 7947 7948 This file was extended by orxonox $as_me 2.0.1-pre-alpha, which was7948 This file was extended by orxonox $as_me 0.2.1-pre-alpha, which was 7949 7949 generated by GNU Autoconf 2.59. Invocation command line was 7950 7950 … … 8009 8009 cat >>$CONFIG_STATUS <<_ACEOF 8010 8010 ac_cs_version="\\ 8011 orxonox config.status 2.0.1-pre-alpha8011 orxonox config.status 0.2.1-pre-alpha 8012 8012 configured by $0, generated by GNU Autoconf 2.59, 8013 8013 with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -
orxonox/trunk/doc/orxodox.src
r2710 r3365 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/trunk/src/Makefile.am
r3246 r3365 24 24 story_entity.cc \ 25 25 environment.cc \ 26 importer/ object.cc \26 importer/model.cc \ 27 27 importer/array.cc \ 28 28 importer/material.cc \ 29 importer/texture.cc \ 29 30 list.cc \ 30 p_node.cc 31 p_node.cc \ 32 null_parent.cc \ 33 base_object.cc \ 34 helper_parent.cc \ 35 track_manager.cc \ 36 matrix.cc \ 37 curve.cc \ 38 glmenu_imagescreen.cc 39 31 40 32 41 noinst_HEADERS = ability.h \ … … 54 63 shoot_laser.h \ 55 64 world_entity.h \ 56 coordinates.h \57 65 message_structures.h \ 58 66 shoot_rocket.h \ … … 62 70 game_loader.h \ 63 71 campaign.h \ 64 p_node.h 72 p_node.h \ 73 null_parent.h \ 74 base_object.h \ 75 helper_parent.h \ 76 track_manager.h \ 77 matrix.h \ 78 curve.h \ 79 glmenu_imagescreen.h 80 65 81 66 82 ## orxonox.conf will be used from home-dir instead. -
orxonox/trunk/src/Makefile.in
r3246 r3365 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) p_node.$(OBJEXT) 61 environment.$(OBJEXT) model.$(OBJEXT) array.$(OBJEXT) \ 62 material.$(OBJEXT) texture.$(OBJEXT) list.$(OBJEXT) \ 63 p_node.$(OBJEXT) null_parent.$(OBJEXT) base_object.$(OBJEXT) \ 64 helper_parent.$(OBJEXT) track_manager.$(OBJEXT) \ 65 matrix.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT) 63 66 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 64 67 orxonox_LDADD = $(LDADD) … … 67 70 am__depfiles_maybe = depfiles 68 71 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \ 69 @AMDEP_TRUE@ ./$(DEPDIR)/base_entity.Po ./$(DEPDIR)/camera.Po \ 72 @AMDEP_TRUE@ ./$(DEPDIR)/base_entity.Po \ 73 @AMDEP_TRUE@ ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \ 70 74 @AMDEP_TRUE@ ./$(DEPDIR)/campaign.Po ./$(DEPDIR)/collision.Po \ 71 @AMDEP_TRUE@ ./$(DEPDIR)/command_node.Po \75 @AMDEP_TRUE@ ./$(DEPDIR)/command_node.Po ./$(DEPDIR)/curve.Po \ 72 76 @AMDEP_TRUE@ ./$(DEPDIR)/data_tank.Po \ 73 77 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po \ 74 78 @AMDEP_TRUE@ ./$(DEPDIR)/game_loader.Po \ 79 @AMDEP_TRUE@ ./$(DEPDIR)/glmenu_imagescreen.Po \ 80 @AMDEP_TRUE@ ./$(DEPDIR)/helper_parent.Po \ 75 81 @AMDEP_TRUE@ ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \ 76 82 @AMDEP_TRUE@ ./$(DEPDIR)/list.Po ./$(DEPDIR)/material.Po \ 77 @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/orxonox.Po \ 83 @AMDEP_TRUE@ ./$(DEPDIR)/matrix.Po ./$(DEPDIR)/model.Po \ 84 @AMDEP_TRUE@ ./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/orxonox.Po \ 78 85 @AMDEP_TRUE@ ./$(DEPDIR)/p_node.Po ./$(DEPDIR)/player.Po \ 79 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/track.Po \ 86 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \ 87 @AMDEP_TRUE@ ./$(DEPDIR)/track.Po ./$(DEPDIR)/track_manager.Po \ 80 88 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \ 81 89 @AMDEP_TRUE@ ./$(DEPDIR)/world_entity.Po … … 214 222 story_entity.cc \ 215 223 environment.cc \ 216 importer/ object.cc \224 importer/model.cc \ 217 225 importer/array.cc \ 218 226 importer/material.cc \ 227 importer/texture.cc \ 219 228 list.cc \ 220 p_node.cc 229 p_node.cc \ 230 null_parent.cc \ 231 base_object.cc \ 232 helper_parent.cc \ 233 track_manager.cc \ 234 matrix.cc \ 235 curve.cc \ 236 glmenu_imagescreen.cc 221 237 222 238 noinst_HEADERS = ability.h \ … … 244 260 shoot_laser.h \ 245 261 world_entity.h \ 246 coordinates.h \247 262 message_structures.h \ 248 263 shoot_rocket.h \ … … 252 267 game_loader.h \ 253 268 campaign.h \ 254 p_node.h 269 p_node.h \ 270 null_parent.h \ 271 base_object.h \ 272 helper_parent.h \ 273 track_manager.h \ 274 matrix.h \ 275 curve.h \ 276 glmenu_imagescreen.h 255 277 256 278 EXTRA_DIST = orxonox.conf … … 332 354 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 333 355 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@ 356 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@ 334 357 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@ 335 358 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/campaign.Po@am__quote@ 336 359 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collision.Po@am__quote@ 337 360 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_node.Po@am__quote@ 361 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Po@am__quote@ 338 362 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@ 339 363 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@ 340 364 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@ 365 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@ 366 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@ 341 367 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@ 342 368 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@ 343 369 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ 344 370 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ 345 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@ 371 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Po@am__quote@ 372 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@ 373 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null_parent.Po@am__quote@ 346 374 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@ 347 375 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@ 348 376 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@ 349 377 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@ 378 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 350 379 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track.Po@am__quote@ 380 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_manager.Po@am__quote@ 351 381 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ 352 382 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world.Po@am__quote@ … … 369 399 @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 370 400 371 object.o: importer/object.cc372 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.o -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc; \373 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/ object.cc' object='object.o' libtool=no @AMDEPBACKSLASH@375 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/ object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@376 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 377 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.o `test -f 'importer/object.cc' || echo '$(srcdir)/'`importer/object.cc378 379 object.obj: importer/object.cc380 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT object.obj -MD -MP -MF "$(DEPDIR)/object.Tpo" -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`; \381 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ object.Tpo" "$(DEPDIR)/object.Po"; else rm -f "$(DEPDIR)/object.Tpo"; exit 1; fi382 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/ object.cc' object='object.obj' libtool=no @AMDEPBACKSLASH@383 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/ object.Po' tmpdepfile='$(DEPDIR)/object.TPo' @AMDEPBACKSLASH@384 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 385 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o object.obj `if test -f 'importer/object.cc'; then $(CYGPATH_W) 'importer/object.cc'; else $(CYGPATH_W) '$(srcdir)/importer/object.cc'; fi`401 model.o: importer/model.cc 402 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT model.o -MD -MP -MF "$(DEPDIR)/model.Tpo" -c -o model.o `test -f 'importer/model.cc' || echo '$(srcdir)/'`importer/model.cc; \ 403 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/model.Tpo" "$(DEPDIR)/model.Po"; else rm -f "$(DEPDIR)/model.Tpo"; exit 1; fi 404 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/model.cc' object='model.o' libtool=no @AMDEPBACKSLASH@ 405 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/model.Po' tmpdepfile='$(DEPDIR)/model.TPo' @AMDEPBACKSLASH@ 406 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 407 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o model.o `test -f 'importer/model.cc' || echo '$(srcdir)/'`importer/model.cc 408 409 model.obj: importer/model.cc 410 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT model.obj -MD -MP -MF "$(DEPDIR)/model.Tpo" -c -o model.obj `if test -f 'importer/model.cc'; then $(CYGPATH_W) 'importer/model.cc'; else $(CYGPATH_W) '$(srcdir)/importer/model.cc'; fi`; \ 411 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/model.Tpo" "$(DEPDIR)/model.Po"; else rm -f "$(DEPDIR)/model.Tpo"; exit 1; fi 412 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/model.cc' object='model.obj' libtool=no @AMDEPBACKSLASH@ 413 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/model.Po' tmpdepfile='$(DEPDIR)/model.TPo' @AMDEPBACKSLASH@ 414 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 415 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o model.obj `if test -f 'importer/model.cc'; then $(CYGPATH_W) 'importer/model.cc'; else $(CYGPATH_W) '$(srcdir)/importer/model.cc'; fi` 386 416 387 417 array.o: importer/array.cc … … 416 446 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 417 447 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o material.obj `if test -f 'importer/material.cc'; then $(CYGPATH_W) 'importer/material.cc'; else $(CYGPATH_W) '$(srcdir)/importer/material.cc'; fi` 448 449 texture.o: importer/texture.cc 450 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture.o -MD -MP -MF "$(DEPDIR)/texture.Tpo" -c -o texture.o `test -f 'importer/texture.cc' || echo '$(srcdir)/'`importer/texture.cc; \ 451 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/texture.Tpo" "$(DEPDIR)/texture.Po"; else rm -f "$(DEPDIR)/texture.Tpo"; exit 1; fi 452 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/texture.cc' object='texture.o' libtool=no @AMDEPBACKSLASH@ 453 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/texture.Po' tmpdepfile='$(DEPDIR)/texture.TPo' @AMDEPBACKSLASH@ 454 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 455 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture.o `test -f 'importer/texture.cc' || echo '$(srcdir)/'`importer/texture.cc 456 457 texture.obj: importer/texture.cc 458 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT texture.obj -MD -MP -MF "$(DEPDIR)/texture.Tpo" -c -o texture.obj `if test -f 'importer/texture.cc'; then $(CYGPATH_W) 'importer/texture.cc'; else $(CYGPATH_W) '$(srcdir)/importer/texture.cc'; fi`; \ 459 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/texture.Tpo" "$(DEPDIR)/texture.Po"; else rm -f "$(DEPDIR)/texture.Tpo"; exit 1; fi 460 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importer/texture.cc' object='texture.obj' libtool=no @AMDEPBACKSLASH@ 461 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/texture.Po' tmpdepfile='$(DEPDIR)/texture.TPo' @AMDEPBACKSLASH@ 462 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 463 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o texture.obj `if test -f 'importer/texture.cc'; then $(CYGPATH_W) 'importer/texture.cc'; else $(CYGPATH_W) '$(srcdir)/importer/texture.cc'; fi` 418 464 uninstall-info-am: 419 465 -
orxonox/trunk/src/camera.cc
r3236 r3365 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/trunk/src/camera.h
r3236 r3365 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/trunk/src/curve.cc
r3217 r3365 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/trunk/src/curve.h
r3217 r3365 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/trunk/src/data_tank.cc
r2190 r3365 19 19 using namespace std; 20 20 21 long DataTank::timeStamp = 0; 22 21 23 DataTank::DataTank () {} 22 24 DataTank::~DataTank () {} -
orxonox/trunk/src/data_tank.h
r3224 r3365 10 10 ~DataTank (); 11 11 12 static long timeStamp; 13 12 14 }; 13 15 -
orxonox/trunk/src/debug.h
r3293 r3365 8 8 9 9 #ifdef DEBUG 10 extern int verbose; 10 11 #define PRINTF(x) \ 11 12 PRINTF ## x -
orxonox/trunk/src/environment.cc
r3236 r3365 21 21 #include "world_entity.h" 22 22 #include "vector.h" 23 #include "importer/model.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 Model("reaplow.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/trunk/src/importer/Makefile.am
r3201 r3365 8 8 importer_SOURCES= framework.cc \ 9 9 windowHandler.cc \ 10 object.cc \10 model.cc \ 11 11 array.cc \ 12 12 material.cc \ 13 texture.cc \ 13 14 vector.cc 14 15 15 16 noinst_HEADERS= framework.h \ 16 17 windowHandler.h \ 17 object.h \18 model.h \ 18 19 array.h \ 19 material.h 20 material.h \ 21 texture.h 20 22 21 23 -
orxonox/trunk/src/importer/Makefile.in
r3219 r3365 54 54 PROGRAMS = $(bin_PROGRAMS) 55 55 am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \ 56 object.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \57 vector.$(OBJEXT)56 model.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \ 57 texture.$(OBJEXT) vector.$(OBJEXT) 58 58 importer_OBJECTS = $(am_importer_OBJECTS) 59 59 importer_LDADD = $(LDADD) … … 62 62 am__depfiles_maybe = depfiles 63 63 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \ 64 @AMDEP_TRUE@ ./$(DEPDIR)/material.Po ./$(DEPDIR)/object.Po \ 65 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po 64 @AMDEP_TRUE@ ./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \ 65 @AMDEP_TRUE@ ./$(DEPDIR)/texture.Po ./$(DEPDIR)/vector.Po \ 66 @AMDEP_TRUE@ ./$(DEPDIR)/windowHandler.Po 66 67 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 67 68 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 176 177 importer_SOURCES = framework.cc \ 177 178 windowHandler.cc \ 178 object.cc \179 model.cc \ 179 180 array.cc \ 180 181 material.cc \ 182 texture.cc \ 181 183 vector.cc 182 184 183 185 noinst_HEADERS = framework.h \ 184 186 windowHandler.h \ 185 object.h \187 model.h \ 186 188 array.h \ 187 material.h 189 material.h \ 190 texture.h 188 191 189 192 all: all-am … … 256 259 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@ 257 260 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ 258 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@ 261 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@ 262 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 259 263 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ 260 264 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@ -
orxonox/trunk/src/importer/framework.cc
r3237 r3365 52 52 int main(int argc, char *argv[]) 53 53 { 54 int verbose = 3;54 verbose = 2; 55 55 56 56 PRINTF(2)("This is The big verbose-Test %i, %s\n", 1, "cool"); … … 71 71 PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h); 72 72 if (argc>=3) 73 obj = new Object(argv[1], atof(argv[2]));73 obj = new Model (argv[1], atof(argv[2])); 74 74 else if (argc>=2) 75 obj = new Object(argv[1]);75 obj = new Model(argv[1]); 76 76 else 77 obj = new Object();77 obj = new Model(); 78 78 79 79 M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); … … 215 215 case SDLK_c: 216 216 if (!obj) 217 obj = new Object(argv[1]);217 obj = new Model(argv[1]); 218 218 break; 219 219 } -
orxonox/trunk/src/importer/framework.h
r2963 r3365 3 3 4 4 #include "windowHandler.h" // Include the Whandler Basecode 5 #include " object.h"5 #include "model.h" 6 6 #include "vector.h" 7 7 … … 33 33 34 34 WindowHandler wHandler; // Create an instance of the whandler basecode class 35 Object* obj;35 Model* obj; 36 36 37 37 -
orxonox/trunk/src/importer/material.cc
r3208 r3365 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 /** … … 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/trunk/src/importer/material.h
r3196 r3365 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/trunk/src/list.h
r3224 r3365 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/trunk/src/orxonox.cc
r3226 r3365 115 115 // Set video mode 116 116 // TO DO: parse arguments for settings 117 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 118 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 119 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 120 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 121 117 //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 118 //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 119 //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 120 //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 121 122 123 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); 124 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16); 125 SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 126 SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0); 127 SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0); 128 SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0); 129 SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0); 130 131 132 122 133 int bpp = 16; 123 134 int width = 640; 124 135 int height = 480; 125 Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; 126 127 if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL) 136 //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/ 137 //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER; 138 139 Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE; 140 141 /* query SDL for information about our video hardware */ 142 const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo (); 143 144 if( videoInfo == NULL) 145 { 146 printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError()); 147 SDL_Quit (); 148 } 149 if( videoInfo->hw_available) 150 videoFlags |= SDL_HWSURFACE; 151 else 152 videoFlags |= SDL_SWSURFACE; 153 /* 154 if(VideoInfo -> blit_hw) 155 VideoFlags |= SDL_HWACCEL; 156 */ 157 158 if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL) 128 159 { 129 printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());160 printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError()); 130 161 SDL_Quit(); 131 162 return -1; … … 133 164 134 165 // Set window labeling 135 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);166 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 136 167 137 168 // TO DO: Create a cool icon and use it here … … 139 170 140 171 // OpenGL stuff 141 // (Is this all we initialize globally???) 142 glClearColor(0.0, 0.0, 0.0, 0.0); 143 glEnable(GL_DEPTH_TEST); 172 glClearColor (0.0, 0.0, 0.0, 0.0); 173 glEnable (GL_DEPTH_TEST); 144 174 145 175 // LIGHTING … … 148 178 GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0}; 149 179 150 glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);151 glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight);152 glEnable (GL_LIGHTING);153 glEnable (GL_LIGHT0);154 glEnable (GL_DEPTH_TEST);155 glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);156 glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);180 glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight); 181 glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight); 182 glEnable (GL_LIGHTING); 183 glEnable (GL_LIGHT0); 184 glEnable (GL_DEPTH_TEST); 185 glLightfv (GL_LIGHT0, GL_POSITION, lightPosition); 186 glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight); 157 187 188 //glEnable (GL_TEXTURE_2D); 158 189 // glEnable(GL_COLOR); 159 190 // glShadeModel(GL_SMOOTH); … … 311 342 312 343 344 SDL_Surface* Orxonox::getScreen () 345 { 346 return this->screen; 347 } 313 348 314 349 -
orxonox/trunk/src/orxonox.h
r3226 r3365 68 68 Camera* getCamera(); 69 69 World* getWorld(); 70 SDL_Surface* getScreen (); 70 71 71 72 //void mainLoop(); -
orxonox/trunk/src/p_node.cc
r3246 r3365 14 14 main-programmer: Patrick Boenzli 15 15 co-programmer: ... 16 17 \todo Null-Parent => center of the coord system - singleton 18 \todo Smooth-Parent: delay, speed 19 \todo destroy the stuff again, delete... 16 20 */ 17 21 … … 28 32 \todo this constructor is not jet implemented - do it 29 33 */ 30 PNode::PNode () {} 34 PNode::PNode () 35 { 36 this->children = new tList<PNode>(); 37 this->bRelCoorChanged = true; 38 this->bAbsCoorChanged = false; 39 this->bRelDirChanged = true; 40 this->bAbsDirChanged = false; 41 this->parent = NULL; 42 } 43 44 45 /** 46 \brief constructor with coodinates 47 */ 48 PNode::PNode (Vector* absCoordinate, PNode* parent ) 49 { 50 this->absCoordinate = *absCoordinate; 51 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 52 53 this->children = new tList<PNode>(); 54 this->bRelCoorChanged = true; 55 this->bAbsCoorChanged = false; 56 this->bRelDirChanged = true; 57 this->bAbsDirChanged = false; 58 this->parent = parent; 59 60 parent->addChild (this); 61 } 31 62 32 63 … … 36 67 \todo this deconstructor is not jet implemented - do it 37 68 */ 38 PNode::~PNode () {} 39 69 PNode::~PNode () 70 { 71 /* 72 delete &this->children; 73 delete &this->relCoordinate; 74 delete &this->absCoordinate; 75 delete &this->relDirection; 76 delete &this->absDirection; 77 */ 78 this->parent = NULL; 79 /* there is currently a problem with cleaning up - fix*/ 80 } 81 82 83 /** 84 \brief deletes the hole pnode tree 85 86 cleans up all pnodes 87 */ 88 void PNode::destroy () 89 { 90 PNode* pn = this->children->enumerate(); 91 while( pn != NULL) 92 { 93 pn->destroy (); 94 pn = this->children->nextElement(); 95 } 96 this->children->destroy (); 97 } 98 99 100 /** 101 \brief get relative coordinates 102 \returns relative coordinates to its parent 103 */ 104 Vector PNode::getRelCoor () 105 { 106 Vector r = this->relCoordinate; /* return a copy, so it can't be modified */ 107 return r; 108 } 109 110 111 /** 112 \brief set relative coordinates 113 \param relative coordinates to its parent 114 115 it is very importand, that you use this function, if you want to update the 116 relCoordinates. If you don't use this, the PNode won't recognize, that something 117 has changed and won't update the children Nodes. 118 */ 119 void PNode::setRelCoor (Vector* relCoord) 120 { 121 this->bRelCoorChanged = true; 122 this->relCoordinate = *relCoord; 123 } 124 125 126 /** 127 \brief get absolute coordinates 128 \returns absolute coordinates from (0,0,0) 129 */ 130 Vector PNode::getAbsCoor () 131 { 132 return this->absCoordinate; 133 } 134 135 136 /** 137 \brief get relative coordinates 138 \returns relative coordinates to its parent 139 140 it is very importand, that you use this function, if you want to update the 141 absCoordinates. If you don't use this, the PNode won't recognize, that something 142 has changed and won't update the children Nodes. 143 */ 144 void PNode::setAbsCoor (Vector* absCoord) 145 { 146 this->bAbsCoorChanged = true; 147 this->absCoordinate = *absCoord; 148 } 149 150 151 /** 152 \brief shift coordinate (abs and rel) 153 \param shift vector 154 155 this function shifts the current coordinates about the vector shift. this is 156 usefull because from some place else you can: 157 PNode* someNode = ...; 158 Vector objectMovement = calculateShift(); 159 someNode->shiftCoor(objectMovement); 160 161 elsewhere you would have to: 162 PNode* someNode = ...; 163 Vector objectMovement = calculateShift(); 164 Vector currentCoor = someNode->getRelCoor(); 165 Vector newCoor = currentCoor + objectMovement; 166 someNode->setRelCoor(newCoor); 167 168 yea right... shorter... 169 170 */ 171 void PNode::shiftCoor (Vector* shift) 172 { 173 if( this->bAbsCoorChanged) 174 { 175 this->absCoordinate = this->absCoordinate + *shift; 176 } 177 else 178 { 179 this->relCoordinate = this->relCoordinate + *shift; 180 this->bRelCoorChanged = true; 181 } 182 } 183 184 185 186 /** 187 \brief get relative direction 188 \returns relative direction to its parent 189 */ 190 Quaternion PNode::getRelDir () 191 { 192 return this->relDirection; 193 } 194 195 196 /** 197 \brief set relative direction 198 \param relative direction to its parent 199 200 it is very importand, that you use this function, if you want to update the 201 relDirection. If you don't use this, the PNode won't recognize, that something 202 has changed and won't update the children Nodes. 203 */ 204 void PNode::setRelDir (Quaternion* relDir) 205 { 206 this->bRelCoorChanged = true; 207 this->relDirection = *relDir; 208 } 209 210 211 /** 212 \brief gets the absolute direction (0,0,1) 213 \returns absolute coordinates 214 */ 215 Quaternion PNode::getAbsDir () 216 {} 217 218 219 /** 220 \brief sets the absolute direction (0,0,1) 221 \param absolute coordinates 222 223 it is very importand, that you use this function, if you want to update the 224 absDirection. If you don't use this, the PNode won't recognize, that something 225 has changed and won't update the children Nodes. 226 */ 227 void PNode::setAbsDir (Quaternion* absDir) 228 {} 229 230 231 /** 232 \brief shift coordinate (abs and rel) 233 \param shift vector 234 235 this function shifts the current coordinates about the vector shift. this is 236 usefull because from some place else you can: 237 PNode* someNode = ...; 238 Quaternion objectMovement = calculateShift(); 239 someNode->shiftCoor(objectMovement); 240 241 elsewhere you would have to: 242 PNode* someNode = ...; 243 Quaternion objectMovement = calculateShift(); 244 Quaternion currentCoor = someNode->getRelCoor(); 245 Quaternion newCoor = currentCoor + objectMovement; 246 someNode->setRelCoor(newCoor); 247 248 yea right... shorter... 249 250 */ 251 void PNode::shiftDir (Quaternion* shift) 252 {} 253 254 255 256 /** 257 \brief adds a child and makes this node to a parent 258 \param child reference 259 260 use this to add a child to this node. 261 */ 262 void PNode::addChild (PNode* pNode) 263 { 264 this->addChild(pNode, DEFAULT_MODE); 265 } 266 267 268 /** 269 \brief adds a child and makes this node to a parent 270 \param child reference 271 \param on which changes the child should also change ist state 272 273 use this to add a child to this node. 274 */ 275 void PNode::addChild (PNode* pNode, parentingMode mode) 276 { 277 pNode->mode = mode; 278 pNode->parent = this; 279 this->children->add (pNode); 280 } 281 282 283 /** 284 /brief removes a child from the node 285 */ 286 void PNode::removeChild (PNode* pNode) 287 { 288 this->children->remove (pNode); 289 } 290 291 292 /** 293 \brief sets the parent of this PNode 294 */ 295 void PNode::setParent (PNode* parent) 296 { 297 this->parent = parent; 298 } 299 300 /** 301 \brief set the mode of this parent manualy 302 */ 303 void PNode::setMode (parentingMode mode) 304 { 305 this->mode = mode; 306 } 307 308 /** 309 \brief has to be called, if the parent coordinate has changed 310 311 normaly this will be done by the parent itself automaticaly. If you call this, you 312 will force an update of the coordinated of the node. 313 */ 314 void PNode::parentCoorChanged () 315 { 316 this->bRelCoorChanged = true; 317 } 318 319 320 /** 321 \brief has to be called, if the parent direction has changed 322 323 normaly this will be done by the parent itself automaticaly. If you call this, you 324 will force an update of the direction of the node. 325 */ 326 void PNode::parentDirChanged () 327 { 328 this->bRelDirChanged = true; 329 } 330 331 332 /** 333 \brief updates the absCoordinate/absDirection 334 335 this is used to go through the parent-tree to update all the absolute coordinates 336 and directions. this update should be done by the engine, so you don't have to 337 worry, normaly... 338 */ 339 void PNode::update (float timeStamp) 340 { 341 printf ("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 342 343 if( this->mode == MOVEMENT || this->mode == ALL) 344 { 345 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 346 { 347 printf("PNode::update () - this->bAbsCoorChanged = true\n"); 348 /* if you have set the absolute coordinates this overrides all other changes */ 349 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 350 } 351 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 352 { 353 /*this is bad style... must be deleted later - just for testing*/ 354 if( this->parent == NULL) 355 { 356 this->absCoordinate = this->relCoordinate; 357 } 358 else 359 this->absCoordinate = parent->getAbsCoor () + this->relCoordinate; /* update the current absCoordinate */ 360 } 361 } 362 363 if( this->mode == ROTATION && this->mode == ALL) 364 { 365 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 366 { 367 /* if you have set the absolute coordinates this overrides all other changes */ 368 this->relDirection = this->absDirection - parent->getAbsDir (); 369 } 370 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 371 { 372 /* update the current absDirection - remember * means rotation around sth.*/ 373 this->absDirection = parent->getAbsDir () * this->relDirection; 374 } 375 } 376 // } 377 PNode* pn = this->children->enumerate(); 378 while( pn != NULL) 379 { 380 /* if this node has changed, make sure, that all children are updated also */ 381 if( this->bRelCoorChanged || this->bAbsCoorChanged) 382 pn->parentCoorChanged (); 383 if( this->bRelDirChanged || this->bAbsDirChanged) 384 pn->parentDirChanged (); 385 pn->update(timeStamp); 386 pn = this->children->nextElement(); 387 } 388 389 this->timeStamp = timeStamp; 390 this->bRelCoorChanged = false; 391 this->bAbsCoorChanged = false; 392 this->bRelDirChanged = false; 393 this->bAbsDirChanged = false; 394 } 395 396 397 /* 398 \brief tick 399 */ 400 void PNode::processTick (float dt) 401 { 402 this->tick (dt); 403 PNode* pn = this->children->enumerate(); 404 while( pn != NULL) 405 { 406 pn->processTick (dt); 407 pn = this->children->nextElement(); 408 } 409 } 410 411 412 void PNode::tick (float dt) 413 {} 414 415 416 void PNode::debug() 417 { 418 printf("PNode::debug() - absCoord: (%f, %f, %f)\n", 419 this->absCoordinate.x, 420 this->absCoordinate.y, 421 this->absCoordinate.z); 422 } 423 424 425 /* 426 \brief set the name of the node 427 428 for debug purposes realy usefull, not used to work properly 429 */ 430 void PNode::setName (char* newName) 431 { 432 this->objectName = newName; 433 } 434 435 436 /* 437 \brief gets the name of the node 438 */ 439 char* PNode::getName () 440 { 441 return this->objectName; 442 } -
orxonox/trunk/src/p_node.h
r3246 r3365 14 14 this conditions make it cheaper to recalculate the tree (reduces redundant work). 15 15 16 remember: if you have to change the coordinates , because the object (point) did move,17 don't forget to reset both relCoor and absCoor (offset is the same)16 remember: if you have to change the coordinates or the directions, use the functions 17 that are defined to execute this operation - otherwhise there will be big problems... 18 18 */ 19 19 … … 24 24 #include "stdincl.h" 25 25 26 class PNode; /* forward decleration, so that parentEntry has access to PNode */ 26 27 27 class PNode { 28 typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL}; 29 #define DEFAULT_MODE ALL 30 31 class PNode : public BaseObject { 28 32 29 33 public: 30 34 PNode (); 31 ~PNode (); 35 PNode (Vector* absCoordinate, PNode* pNode); 36 virtual ~PNode (); 37 38 void destroy (); 39 40 PNode* parent; //! a pointer to the parent node 41 tList<PNode>* children; //! list of the children 42 43 parentingMode mode; 32 44 33 45 Vector getRelCoor (); 34 void setRelCoor (Vector relCoord); 46 void setRelCoor (Vector* relCoord); 47 //void setRelCoor (Vector relCoord); 35 48 Vector getAbsCoor (); 36 void setAbsCoor (Vector absCoord); 49 void setAbsCoor (Vector* absCoord); 50 //void setAbsCoor (Vector absCoord); 51 void shiftCoor (Vector* shift); 52 //void shiftCoor (Vector shift); 37 53 38 54 Quaternion getRelDir (); 39 void setRelDir (Quaternion relDir);55 void setRelDir (Quaternion* relDir); 40 56 Quaternion getAbsDir (); 41 void setAbsCoor (Quaternion absDir); 57 void setAbsDir (Quaternion* absDir); 58 void shiftDir (Quaternion* shift); 42 59 43 60 void addChild (PNode* pNode); 61 void addChild (PNode* pNode, parentingMode mode); 44 62 void removeChild (PNode* pNode); 63 void setParent (PNode* parent); 64 void parentCoorChanged (); 65 void parentDirChanged (); 66 void setMode (parentingMode mode); 45 67 46 private: 47 long timeStamp; //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated 48 bool bCoorChanged; 49 bool bDirChanged; 68 virtual void update (float timeStamp); 69 void processTick (float dt); 70 virtual void tick (float dt); 71 72 void setName (char* newName); 73 char* getName (); 74 75 76 void debug (); 77 78 float timeStamp; //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated 79 char* objectName; 80 bool bAbsCoorChanged; 81 bool bRelCoorChanged; 82 bool bRelDirChanged; 83 bool bAbsDirChanged; 50 84 51 85 Vector relCoordinate; //! coordinates relative to the parent … … 54 88 Quaternion absDirection; //! absolute direvtion in the world ( from (0,0,1) ) 55 89 56 tList<PNode>* children; //! list of the children57 58 90 }; 59 91 -
orxonox/trunk/src/player.cc
r3233 r3365 19 19 #include "stdincl.h" 20 20 #include "collision.h" 21 #include "importer/model.h" 21 22 22 23 using namespace std; … … 26 27 { 27 28 28 this-> obj = new Object("reaplow.obj");29 this->model = new Model("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 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 107 //rotate 108 this->getAbsDir ().matrix (matrix); 107 109 glMultMatrixf((float*)matrix); 108 110 109 111 glMatrixMode(GL_MODELVIEW); 110 glRotatef(-90, 0,1,0); 111 obj->draw(); 112 this->model->draw(); 112 113 // glCallList(objectList); 113 114 115 116 114 } 117 115 116 117 /*PN 118 118 void Player::getLookat(Location* locbuf) 119 119 { … … 121 121 //locbuf->dist += 5.0; 122 122 } 123 */ 123 124 124 void Player::leftWorld ()125 void Player::leftWorld () 125 126 { 126 127 } 127 128 128 void Player::move (float time)129 void Player::move (float time) 129 130 { 130 131 Vector accel(0.0, 0.0, 0.0); 131 132 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 132 Placement *pos = getPlacement(); 133 //Placement *pos = getPlacement(); 134 133 135 /* calculate the direction in which the craft is heading */ 134 Vector direction (0.0, 0.0, 1.0);135 direction = pos->w.apply(direction);136 Vector orthDirection (0.0, 0.0, 1.0);137 orthDirection = orthDirection.cross(direction);136 Vector direction (1.0, 0.0, 0.0); 137 //direction = this->absDirection.apply (direction); 138 Vector orthDirection (0.0, 0.0, 1.0); 139 //orthDirection = orthDirection.cross (direction); 138 140 139 141 if( bUp) { accel = accel+(direction*acceleration); } 140 142 if( bDown) { accel = accel-(direction*acceleration); } 141 if( bLeft ) { accel = accel +(orthDirection*acceleration); }142 if( bRight ) { accel = accel -(orthDirection*acceleration); }143 if( bLeft ) { accel = accel - (orthDirection*acceleration); } 144 if( bRight ) { accel = accel + (orthDirection*acceleration); } 143 145 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 144 146 if( bDescend) {/* FIXME */} /* \todo up and down player movement */ 145 147 146 Location* l = getLocation();148 //Location* l = getLocation(); 147 149 148 150 // r(t) = r(0) + v(0)*t + 1/2*a*t^2 … … 152 154 153 155 /* this the base-speed of the player: determines how fast and how the player follows the track*/ 154 l->dist = l->dist + travelSpeed * time; 155 156 //l->dist = l->dist + travelSpeed * time; 157 158 Vector* shift = new Vector (this->travelSpeed * time, 0, 0); 159 this->shiftCoor (shift); 160 156 161 /* this updates the player position on the track - user interaction */ 157 l->pos = l->pos + accel*time; 162 //l->pos = l->pos + accel*time; 163 Vector move = accel * time; 164 this->shiftCoor (&move); 158 165 } -
orxonox/trunk/src/player.h
r3236 r3365 8 8 9 9 #include "world_entity.h" 10 #include "importer/object.h" 10 11 class Model; 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/trunk/src/proto_class.cc
r3329 r3365 27 27 \todo this constructor is not jet implemented - do it 28 28 */ 29 ProtoClass::ProtoClass () {} 29 ProtoClass::ProtoClass () 30 { 31 this->setClassName ("ProtoClass"); 32 } 30 33 31 34 -
orxonox/trunk/src/proto_class.h
r3329 r3365 19 19 here can be some longer description of this class 20 20 */ 21 class ProtoClass {21 class ProtoClass : public BaseObject { 22 22 23 23 public: -
orxonox/trunk/src/stdincl.h
r3224 r3365 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/trunk/src/story_entity.h
r3224 r3365 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/trunk/src/track.cc
r3232 r3365 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/trunk/src/track.h
r3232 r3365 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/trunk/src/vector.cc
r3234 r3365 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/trunk/src/vector.h
r3228 r3365 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/trunk/src/world.cc
r3233 r3365 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 glmis = new GLMenuImageScreen(); 151 glmis->init(); 152 glmis->draw(); 153 154 printf ("World::displayLoadScreen - end\n"); 155 } 156 157 158 void World::releaseLoadScreen () 159 { 160 printf ("World::releaseLoadScreen - start\n"); 161 162 printf ("World::releaseLoadScreen - end\n"); 163 } 164 110 165 111 166 void World::load() 112 167 { 168 // BezierCurve* tmpCurve = new BezierCurve(); 113 169 if(this->debugWorldNr != -1) 114 170 { 171 trackManager = TrackManager::getInstance(); 172 trackManager->addPoint(Vector(0,-5,0)); 173 trackManager->addPoint(Vector(10,0,5)); 174 trackManager->addPoint(Vector(20,0,-5)); 175 trackManager->addPoint(Vector(30,0,5)); 176 trackManager->addPoint(Vector(40,0,5)); 177 trackManager->setDuration(.5); 178 trackManager->setSavePoint(); 179 trackManager->addPoint(Vector(50,10,10)); 180 trackManager->addPoint(Vector(60,0, 10)); 181 trackManager->addPoint(Vector(70,0, 10)); 182 trackManager->addPoint(Vector(80,0,-10)); 183 trackManager->addPoint(Vector(90,0,-10)); 184 trackManager->setDuration(.5); 185 trackManager->setSavePoint(); 186 trackManager->addPoint(Vector(110,0,5)); 187 trackManager->addPoint(Vector(120,0, 10)); 188 trackManager->addPoint(Vector(130,0, 10)); 189 trackManager->addPoint(Vector(140,0,-10)); 190 trackManager->addPoint(Vector(150,0,-10)); 191 trackManager->setDuration(.5); 192 int fork11, fork12, fork13, fork14; 193 trackManager->fork(4, &fork11, &fork12, &fork13, &fork14); 194 trackManager->workOn(fork11); 195 trackManager->addPoint(Vector(170, 0, -15)); 196 trackManager->addPoint(Vector(180, 0, -15)); 197 trackManager->workOn(fork12); 198 trackManager->addPoint(Vector(170, 0, 10)); 199 trackManager->addPoint(Vector(180, 0, 10)); 200 trackManager->addPoint(Vector(190,2,5)); 201 trackManager->addPoint(Vector(200,2,5)); 202 int fork21, fork22; 203 trackManager->fork(2, &fork21, &fork22); 204 trackManager->workOn(fork21); 205 trackManager->addPoint(Vector(220, 10,-10)); 206 trackManager->addPoint(Vector(230, 0,-10)); 207 trackManager->addPoint(Vector(240, 0, 2)); 208 trackManager->addPoint(Vector(250, 0, 0)); 209 trackManager->addPoint(Vector(260, 0, 5)); 210 trackManager->join(2, fork12, fork11); 211 trackManager->workOn(fork22); 212 trackManager->addPoint(Vector(220, -10,10)); 213 trackManager->addPoint(Vector(230, 0, 10)); 214 trackManager->addPoint(Vector(240, 0, 10)); 215 trackManager->addPoint(Vector(250, 0, 5)); 216 trackManager->workOn(fork13); 217 trackManager->addPoint(Vector(200,-10,5)); 218 trackManager->addPoint(Vector(250,-10,5)); 219 printf("fork14: %d\n", fork14); 220 trackManager->workOn(fork14); 221 trackManager->addPoint(Vector(200,15,0)); 222 trackManager->addPoint(Vector(210,0,10)); 223 224 225 226 trackManager->join(4, fork21, fork22, fork13, fork14); 227 228 /* 229 tmpCurve->addNode(Vector(10,0,-10)); 230 //tmpCurve->addNode(Vector(10,2,5)); 231 //tmpCurve->addNode(Vector(10,3,-5)); 232 // tmpCurve->addNode(Vector(10,1,5)); 233 tmpCurve->addNode(Vector(10,0,5)); 234 */ 115 235 switch(this->debugWorldNr) 116 236 { … … 123 243 case DEBUG_WORLD_0: 124 244 { 245 this->nullParent = NullParent::getInstance (); 246 this->nullParent->setName ("NullParent"); 247 125 248 // create some path nodes 126 249 this->pathnodes = new Vector[6]; … … 141 264 // !\todo old track-system has to be removed 142 265 266 //create helper for player 267 HelperParent* hp = new HelperParent (); 268 /* the player has to be added to this helper */ 269 143 270 // create a player 144 WorldEntity* myPlayer = new Player(); 145 this->spawn(myPlayer); 271 WorldEntity* myPlayer = new Player (); 272 myPlayer->setName ("player"); 273 this->spawn (myPlayer); 146 274 this->localPlayer = myPlayer; 147 275 148 276 // bind input 149 Orxonox *orx = Orxonox::getInstance ();277 Orxonox *orx = Orxonox::getInstance (); 150 278 orx->getLocalInput()->bind (myPlayer); 151 279 152 280 // bind camera 153 281 this->localCamera = new Camera(this); 154 this->getCamera()->bind (myPlayer); 155 156 Placement* plc = new Placement; 157 plc->r = Vector(100, 10, 10); 158 plc->w = Quaternion(); 282 this->localCamera->setName ("camera"); 283 this->getCamera()->bind (myPlayer); 284 this->localPlayer->addChild (this->localCamera); 285 286 287 Vector* es = new Vector (50, 2, 0); 288 Quaternion* qs = new Quaternion (); 159 289 WorldEntity* env = new Environment(); 160 this->spawn(env, plc); 290 env->setName ("env"); 291 this->spawn(env, es, qs); 292 161 293 162 294 break; … … 164 296 case DEBUG_WORLD_1: 165 297 { 298 /* 299 this->testCurve = new UPointCurve(); 300 this->testCurve->addNode(Vector( 0, 0, 0)); 301 this->testCurve->addNode(Vector(10, 0, 5)); 302 this->testCurve->addNode(Vector(20, -5,-5)); 303 this->testCurve->addNode(Vector(30, 5, 10)); 304 this->testCurve->addNode(Vector(40, 0,-10)); 305 this->testCurve->addNode(Vector(50, 0,-10)); 306 */ 307 308 this->nullParent = NullParent::getInstance (); 309 this->nullParent->setName ("NullParent"); 310 166 311 // create some path nodes 167 312 this->pathnodes = new Vector[6]; … … 173 318 this->pathnodes[5] = Vector(30, 50, 0); 174 319 320 321 322 175 323 // create the tracks 176 324 this->tracklen = 6; … … 183 331 // create a player 184 332 WorldEntity* myPlayer = new Player(); 333 myPlayer->setName ("player"); 185 334 this->spawn(myPlayer); 186 335 this->localPlayer = myPlayer; … … 191 340 192 341 // bind camera 193 this->localCamera = new Camera(this); 342 this->localCamera = new Camera (this); 343 this->localCamera->setName ("camera"); 194 344 this->getCamera()->bind (myPlayer); 345 this->localPlayer->addChild (this->localCamera); 195 346 break; 196 347 } … … 212 363 213 364 int sizeX = 100; 214 int size Y= 80;365 int sizeZ = 80; 215 366 float length = 1000; 216 367 float width = 200; 217 368 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];369 float widthZ = float (width /sizeZ); 370 371 float height [sizeX][sizeZ]; 372 Vector normal_vectors[sizeX][sizeZ]; 222 373 223 374 224 375 for ( int i = 0; i<sizeX-1; i+=1) 225 for (int j = 0; j<size Y-1;j+=1)376 for (int j = 0; j<sizeZ-1;j+=1) 226 377 //height[i][j] = rand()/20046 + (j-25)*(j-25)/30; 227 378 #ifdef __WIN32__ … … 231 382 #endif 232 383 233 //Die H ügel ein wenig glätten384 //Die Huegel ein wenig glaetten 234 385 for (int h=1; h<2;h++) 235 386 for (int i=1;i<sizeX-2 ;i+=1 ) 236 for(int j=1;j<size Y-2;j+=1)387 for(int j=1;j<sizeZ-2;j+=1) 237 388 height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4; 238 389 239 390 //Berechnung von normalen Vektoren 240 241 391 for(int i=1;i<sizeX-2;i+=1) 242 for(int j=1;j<size Y-2 ;j+=1)392 for(int j=1;j<sizeZ-2 ;j+=1) 243 393 { 244 Vector v1 = Vector (widthX*(1), widthY*(j) , height[i][j]);245 Vector v2 = Vector (widthX*(i-1), widthY*(j) , height[i-1][j]);246 Vector v3 = Vector (widthX*(i), widthY*(j+1), height[i][j+1]);247 Vector v4 = Vector (widthX*(i+1), widthY*(j), height[i+1][j]);248 Vector v5 = Vector (widthX*(i), widthY*(j-1), height[i][j-1]);394 Vector v1 = Vector (widthX*(1), height[i][j], widthZ*(j) ); 395 Vector v2 = Vector (widthX*(i-1), height[i-1][j], widthZ*(j)); 396 Vector v3 = Vector (widthX*(i), height[i][j+1], widthZ*(j+1)); 397 Vector v4 = Vector (widthX*(i+1), height[i+1][j], widthZ*(j)); 398 Vector v5 = Vector (widthX*(i), height[i][j-1], widthZ*(j-1)); 249 399 250 400 Vector c1 = v2 - v1; … … 253 403 Vector c4 = v5 - v1; 254 404 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);405 normal_vectors[i][j]=c1.cross(v3-v5)+c2.cross(v4-v2)+c3.cross(v5-v3)+c4.cross(v2-v4); 256 406 normal_vectors[i][j].normalize(); 257 407 } … … 259 409 int snowheight=3; 260 410 for ( int i = 0; i<sizeX; i+=1) 261 for (int j = 0; j<size Y;j+=1)411 for (int j = 0; j<sizeZ;j+=1) 262 412 { 263 Vector v1 = Vector (widthX*(i), widthY*(j) -width/2, height[i][j]-20);264 Vector v2 = Vector (widthX*(i+1), widthY*(j) -width/2, height[i+1][j]-20);265 Vector v3 = Vector (widthX*(i+1), widthY*(j+1)-width/2, height[i+1][j+1]-20);266 Vector v4 = Vector (widthX*(i), widthY*(j+1)-width/2, height[i][j+1]-20);413 Vector v1 = Vector (widthX*(i), height[i][j]-20, widthZ*(j) -width/2); 414 Vector v2 = Vector (widthX*(i+1), height[i+1][j]-20, widthZ*(j) -width/2); 415 Vector v3 = Vector (widthX*(i+1), height[i+1][j+1]-20, widthZ*(j+1)-width/2); 416 Vector v4 = Vector (widthX*(i), height[i][j+1]-20, widthZ*(j+1)-width/2); 267 417 float a[3]; 268 418 if(height[i][j]<snowheight){ … … 371 521 //draw track 372 522 glBegin(GL_LINES); 373 glColor3f(0 ,1,1);523 glColor3f(0.0, 1.0, 1.0); 374 524 for( int i = 0; i < tracklen; i++) 375 525 { … … 378 528 } 379 529 glEnd(); 530 531 /* 532 glBegin(GL_LINE_STRIP); 533 glColor3f(1.0, 5.0, 1.0); 534 for( int i = 0; i <= 30; i++) 535 { 536 glEvalCoord1f ((GLfloat) i/30.0); 537 } 538 glEnd(); 539 */ 540 541 trackManager->drawGraph(.01); 542 trackManager->debug(2); 543 delete trackManager; 544 545 /* 546 glBegin(GL_LINES); 547 float i; 548 for(i = 0.0; i<1; i+=.01) 549 { 550 printf("%f, %f, %f\n",tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z); 551 glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z); 552 } 553 glEnd(); 554 */ 380 555 glEndList(); 381 556 } … … 430 605 void World::draw () 431 606 { 432 // draw geometry433 434 607 // draw entities 435 608 WorldEntity* entity; 436 437 609 entity = this->entities->enumerate(); 438 610 while( entity != NULL ) … … 440 612 if( entity->bDraw ) entity->draw(); 441 613 entity = this->entities->nextElement(); 442 } 443 444 614 } 615 616 //glmis = new GLMenuImageScreen(); 617 ///glmis->init(); 618 445 619 // draw debug coord system 446 620 glCallList (objectList); 447 448 621 449 622 } … … 459 632 void World::update () 460 633 { 634 /* 461 635 //List<WorldEntity> *l; 462 636 WorldEntity* entity; … … 477 651 t = loc->part; 478 652 479 /* check if entity has still a legal track-id */480 653 if( t >= tracklen ) 481 654 { … … 500 673 else 501 674 { 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 675 } 508 676 509 677 entity = entities->nextElement(); 510 678 } 511 679 */ 512 680 } 513 681 … … 522 690 float seconds = deltaT / 1000.0; 523 691 692 this->nullParent->update (seconds); 693 //this->nullParent->processTick (seconds); 694 524 695 entity = entities->enumerate(); 525 696 while( entity != NULL) … … 542 713 543 714 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 715 void World::setTrackLen(Uint32 len) 556 716 { … … 571 731 void World::debug() 572 732 { 573 //List<WorldEntity> *l; 733 printf ("World::debug() - starting debug\n"); 734 PNode* p1 = NullParent::getInstance (); 735 PNode* p2 = new PNode (new Vector(2, 2, 2), p1); 736 PNode* p3 = new PNode (new Vector(4, 4, 4), p1); 737 PNode* p4 = new PNode (new Vector(6, 6, 6), p2); 738 739 p1->debug (); 740 p2->debug (); 741 p3->debug (); 742 p4->debug (); 743 744 p1->shiftCoor (new Vector(-1, -1, -1)); 745 746 printf("World::debug() - shift\n"); 747 p1->debug (); 748 p2->debug (); 749 p3->debug (); 750 p4->debug (); 751 752 p1->update (1); 753 754 printf ("World::debug() - update\n"); 755 p1->debug (); 756 p2->debug (); 757 p3->debug (); 758 p4->debug (); 759 760 p2->shiftCoor (new Vector(-1, -1, -1)); 761 p1->update (2); 762 763 p1->debug (); 764 p2->debug (); 765 p3->debug (); 766 p4->debug (); 767 768 p2->setAbsCoor (new Vector(1,2,3)); 769 770 771 p1->update (2); 772 773 p1->debug (); 774 p2->debug (); 775 p3->debug (); 776 p4->debug (); 777 778 p1->destroy (); 779 780 781 /* 574 782 WorldEntity* entity; 575 576 783 printf("counting all entities\n"); 577 784 printf("World::debug() - enumerate()\n"); … … 582 789 entity = entities->nextElement(); 583 790 } 791 */ 584 792 } 585 793 … … 594 802 void World::mainLoop() 595 803 { 596 this->lastFrame = SDL_GetTicks ();804 this->lastFrame = SDL_GetTicks (); 597 805 printf("World::mainLoop() - Entering main loop\n"); 598 806 while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */ 599 807 { 600 808 // Network 601 synchronize();809 this->synchronize (); 602 810 // Process input 603 handleInput();811 this->handleInput (); 604 812 if( this->bQuitCurrentGame || this->bQuitOrxonox) 605 813 { … … 608 816 } 609 817 // Process time 610 t imeSlice();818 this->timeSlice (); 611 819 // Process collision 612 collision();820 this->collision (); 613 821 // Draw 614 display(); 615 616 for(int i = 0; i < 10000000; i++) {} 822 this->display (); 823 824 for( int i = 0; i < 5000000; i++) {} 825 /* \todo this is to slow down the program for openGl Software emulator computers, reimplement*/ 617 826 } 618 827 printf("World::mainLoop() - Exiting the main loop\n"); … … 701 910 this->draw(); 702 911 // draw HUD 912 /* \todo draw HUD */ 703 913 // flip buffers 704 914 SDL_GL_SwapBuffers(); 915 //SDL_Surface* screen = Orxonox::getInstance()->getScreen (); 916 //SDL_Flip (screen); 705 917 } 706 918 … … 723 935 void World::spawn(WorldEntity* entity) 724 936 { 725 Location zeroloc; 726 Location* loc = NULL; 727 WorldEntity* owner; 728 729 entities->add (entity); 730 zeroloc.dist = 0; 731 zeroloc.part = 0; 732 zeroloc.pos = Vector(); 733 zeroloc.rot = Quaternion(); 734 loc = &zeroloc; 735 entity->init (loc, owner); 736 if (entity->bFree) 737 { 738 this->track[loc->part].mapCoords( loc, entity->getPlacement()); 739 } 937 if( this->nullParent != NULL && entity->parent == NULL) 938 this->nullParent->addChild (entity); 939 940 this->entities->add (entity); 941 740 942 entity->postSpawn (); 741 943 } … … 747 949 \param location where to add 748 950 */ 749 void World::spawn(WorldEntity* entity, Location* loc) 750 { 751 Location zeroLoc; 752 WorldEntity* owner; 951 void World::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir) 952 { 953 entity->setAbsCoor (absCoor); 954 entity->setAbsDir (absDir); 955 956 if( this->nullParent != NULL && entity->parent == NULL) 957 this->nullParent->addChild (entity); 958 753 959 this->entities->add (entity); 754 if( loc == NULL) 755 { 756 zeroLoc.dist = 0; 757 zeroLoc.part = 0; 758 zeroLoc.pos = Vector(); 759 zeroLoc.rot = Quaternion(); 760 loc = &zeroLoc; 761 } 762 entity->init (loc, owner); 763 if (entity->bFree) 764 { 765 this->track[loc->part].mapCoords( loc, entity->getPlacement()); 766 } 960 767 961 entity->postSpawn (); 768 //return entity; 769 } 770 771 772 /** 773 \brief add and spawn a new entity to this world 774 \param entity to be added 775 \param place where to be added 776 */ 777 void World::spawn(WorldEntity* entity, Placement* plc) 778 { 779 Placement zeroPlc; 780 WorldEntity* owner; 781 if( plc == NULL) 782 { 783 zeroPlc.r = Vector(); 784 zeroPlc.w = Quaternion(); 785 plc = &zeroPlc; 786 } 787 this->entities->add (entity); 788 entity->init (plc, owner); 789 entity->postSpawn (); 790 //return entity; 791 } 962 } 963 792 964 793 965 … … 800 972 return false; 801 973 } 974 975 976 977 978 void World::swap (unsigned char &a, unsigned char &b) 979 { 980 unsigned char temp; 981 temp = a; 982 a = b; 983 b = temp; 984 } -
orxonox/trunk/src/world.h
r3236 r3365 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/trunk/src/world_entity.cc
r3245 r3365 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 41 } 42 42 … … 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/trunk/src/world_entity.h
r3229 r3365 8 8 9 9 #include "stdincl.h" 10 #include "p_node.h" 10 11 11 12 class CollisionCluster; 13 class Model; 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 Model* 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.