Changeset 3605 in orxonox.OLD for orxonox/branches/levelloader/src/lib
- Timestamp:
- Mar 18, 2005, 11:52:15 AM (20 years ago)
- Location:
- orxonox/branches/levelloader/src/lib
- Files:
-
- 2 deleted
- 30 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/lib/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 78 78 DEFS = @DEFS@ 79 79 DEPDIR = @DEPDIR@ 80 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 81 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 80 82 DOXYGEN = @DOXYGEN@ 81 83 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 181 183 esac; \ 182 184 done; \ 183 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/Makefile'; \185 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/Makefile'; \ 184 186 cd $(top_srcdir) && \ 185 $(AUTOMAKE) -- gnusrc/lib/Makefile187 $(AUTOMAKE) --foreign src/lib/Makefile 186 188 .PRECIOUS: Makefile 187 189 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 276 278 tags=; \ 277 279 here=`pwd`; \ 278 if ( etags--etags-include --version) >/dev/null 2>&1; then \280 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ 279 281 include_option=--etags-include; \ 282 empty_fix=.; \ 280 283 else \ 281 284 include_option=--include; \ 285 empty_fix=; \ 282 286 fi; \ 283 287 list='$(SUBDIRS)'; for subdir in $$list; do \ 284 288 if test "$$subdir" = .; then :; else \ 285 test -f $$subdir/TAGS &&\289 test ! -f $$subdir/TAGS || \ 286 290 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 287 291 fi; \ … … 293 297 $(AWK) ' { files[$$0] = 1; } \ 294 298 END { for (i in files) print i; }'`; \ 295 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 296 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 297 $$tags $$unique 299 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 300 test -n "$$unique" || unique=$$empty_fix; \ 301 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 302 $$tags $$unique; \ 303 fi 298 304 ctags: CTAGS 299 305 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ -
orxonox/branches/levelloader/src/lib/coord/helper_parent.cc
r3499 r3605 39 39 \todo this deconstructor is not jet implemented - do it 40 40 */ 41 HelperParent::~HelperParent () {} 41 HelperParent::~HelperParent () 42 { 42 43 44 } -
orxonox/branches/levelloader/src/lib/coord/helper_parent.h
r3499 r3605 17 17 public: 18 18 HelperParent (); 19 ~HelperParent (); 20 19 virtual ~HelperParent (); 21 20 22 21 }; -
orxonox/branches/levelloader/src/lib/coord/null_parent.cc
r3499 r3605 16 16 */ 17 17 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_NULL_PARENT 18 19 19 20 #include "null_parent.h" … … 26 27 NullParent* NullParent::getInstance () 27 28 { 28 if( singletonRef == NULL)29 if(!singletonRef) 29 30 singletonRef = new NullParent (); 30 31 return singletonRef; … … 36 37 \todo this constructor is not jet implemented - do it 37 38 */ 38 NullParent::NullParent () 39 NullParent::NullParent () : PNode (new Vector(0,0,0), NULL) 39 40 { 41 PRINTF(4)("NullParent::NullParent() - making new NullParent, there can only be one..\n"); 40 42 this->parent = this; 41 this->mode = ALL; 43 this->mode = PNODE_ALL; 44 this->setName("NullParent"); 42 45 } 43 46 44 47 45 NullParent::NullParent (Vector* absCoordinate) 48 NullParent::NullParent (Vector* absCoordinate) : PNode (new Vector(0,0,0), NULL) 46 49 { 50 singletonRef = this; 47 51 this->parent = this; 48 this->mode = ALL;52 this->mode = PNODE_ALL; 49 53 this->absCoordinate = *absCoordinate; 54 this->setName("NullParent"); 50 55 } 51 56 … … 58 63 NullParent::~NullParent () 59 64 { 60 delete singletonRef;65 //delete singletonRef; 61 66 singletonRef = NULL; 62 67 } 63 64 65 66 68 67 69 /** … … 72 74 worry, normaly... 73 75 */ 74 void NullParent::update ( float timeStamp)76 void NullParent::update () 75 77 { 78 79 PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 76 80 this->absCoordinate = this->relCoordinate; 77 81 this->absDirection = parent->getAbsDir () * this->relDirection; … … 85 89 if( this->bRelDirChanged || this->bAbsDirChanged) 86 90 pn->parentDirChanged (); 87 pn->update ( timeStamp);91 pn->update (); 88 92 pn = this->children->nextElement (); 89 93 } -
orxonox/branches/levelloader/src/lib/coord/null_parent.h
r3499 r3605 16 16 public: 17 17 static NullParent* getInstance (); 18 ~NullParent (); 19 20 static NullParent* singletonRef; 18 virtual ~NullParent (); 21 19 22 virtual void update (float timeStamp); 20 21 virtual void update (); 23 22 24 23 private: 25 24 NullParent (); 26 25 NullParent (Vector* absCoordinate); 26 static NullParent* singletonRef; 27 27 28 28 }; -
orxonox/branches/levelloader/src/lib/coord/p_node.cc
r3557 r3605 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: ... 16 17 \todo Null-Parent => center of the coord system - singleton 15 co-programmer: 16 18 17 \todo Smooth-Parent: delay, speed 19 \todo destroy the stuff again, delete... 20 */ 21 18 */ 19 20 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PNODE 22 21 23 22 #include "p_node.h" 24 23 24 #include "null_parent.h" 25 #include "vector.h" 25 26 26 27 using namespace std; … … 34 35 PNode::PNode () 35 36 { 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; 37 init(NULL); 38 39 NullParent* np = NullParent::getInstance(); 40 np->addChild(this); 42 41 this->objectName = NULL; 43 42 } … … 51 50 PNode::PNode (Vector* absCoordinate, PNode* parent ) 52 51 { 52 this->init(parent); 53 53 54 this->absCoordinate = *absCoordinate; 54 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 55 56 this->children = new tList<PNode>(); 57 this->bRelCoorChanged = true; 58 this->bAbsCoorChanged = false; 59 this->bRelDirChanged = true; 60 this->bAbsDirChanged = false; 61 this->parent = parent; 62 this->objectName = NULL; 63 64 parent->addChild (this); 65 } 66 55 if (parent != NULL) 56 { 57 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 58 parent->addChild (this); 59 } 60 else 61 this->relCoordinate = Vector(0,0,0); 62 } 67 63 68 64 /** … … 80 76 delete &this->absDirection; 81 77 */ 82 this->parent = NULL;78 //this->parent = NULL; 83 79 if( this->objectName) delete this->objectName; 84 80 /* there is currently a problem with cleaning up - fix*/ 85 } 86 81 82 PNode* pn = this->children->enumerate(); 83 while( pn != NULL) 84 { 85 delete pn; 86 pn = this->children->nextElement(); 87 88 } 89 90 /* this deletes all children in the list */ 91 delete this->children; 92 93 delete []this->objectName; 94 } 95 96 void PNode::init(PNode* parent) 97 { 98 this->children = new tList<PNode>(); 99 this->bRelCoorChanged = true; 100 this->bAbsCoorChanged = false; 101 this->bRelDirChanged = true; 102 this->bAbsDirChanged = false; 103 this->parent = parent; 104 this->objectName = NULL; 105 } 87 106 88 107 /** … … 91 110 cleans up all pnodes 92 111 */ 112 /* 93 113 void PNode::destroy () 94 114 { … … 99 119 pn = this->children->nextElement(); 100 120 } 121 // this deletes all children in the list 101 122 this->children->destroy (); 102 } 103 123 124 static_cast<BaseObject*>(this)->destroy(); 125 } 126 */ 104 127 105 128 /** … … 262 285 {} 263 286 264 265 266 287 /** 267 288 \brief adds a child and makes this node to a parent … … 283 304 use this to add a child to this node. 284 305 */ 285 void PNode::addChild (PNode* pNode, parentingMode mode) 286 { 287 pNode->mode = mode; 306 void PNode::addChild (PNode* pNode, int parentingMode) 307 { 308 if( pNode->parent != NULL ) 309 { 310 PRINTF(2)("PNode::addChild() - reparenting node: removing it and adding it again\n"); 311 pNode->parent->children->remove(pNode); 312 } 313 pNode->mode = parentingMode; 288 314 pNode->parent = this; 289 this->children->add 315 this->children->add(pNode); 290 316 } 291 317 … … 294 320 \brief removes a child from the node 295 321 \param pNode the child to remove from this pNode. 322 323 Children from pNode will not be lost, they are referenced to NullPointer 296 324 */ 297 325 void PNode::removeChild (PNode* pNode) 298 326 { 327 pNode->remove(); 299 328 this->children->remove (pNode); 329 pNode->parent = NULL; 330 } 331 332 333 /** 334 \brief remove this pnode from the tree and adds all following to NullParent 335 336 this can be the case, if an entity in the world is been destroyed. 337 */ 338 void PNode::remove() 339 { 340 NullParent* np = NullParent::getInstance(); 341 PNode* pn = this->children->enumerate(); 342 while( pn != NULL) 343 { 344 this->children->remove(pn); 345 np->addChild(pn, pn->getMode()); 346 pn = this->children->nextElement(); 347 } 300 348 } 301 349 … … 307 355 void PNode::setParent (PNode* parent) 308 356 { 309 this->parent = parent; 310 } 357 parent->addChild(this); 358 } 359 311 360 312 361 /** … … 314 363 \param mode the mode of the bind-type. 315 364 */ 316 void PNode::setMode (parentingMode mode) 317 { 318 this->mode = mode; 365 void PNode::setMode (int parentingMode) 366 { 367 this->mode = parentingMode; 368 } 369 370 371 /** 372 \brief gets the mode of this parent manualy 373 \return the mode of the bind-type. 374 */ 375 int PNode::getMode() 376 { 377 return this->mode; 319 378 } 320 379 … … 351 410 worry, normaly... 352 411 */ 353 void PNode::update (float timeStamp) 354 { 355 printf ("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 356 357 if( this->mode == MOVEMENT || this->mode == ALL) 412 void PNode::update () 413 { 414 PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 415 // printf("%s", this->objectName); 416 if(this->mode & PNODE_MOVEMENT ) 417 { 418 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 358 419 { 359 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 420 /* if you have set the absolute coordinates this overrides all other changes */ 421 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 422 } 423 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 424 { 425 /*this is bad style... must be deleted later - just for testing*/ 426 if( this->parent == NULL) 360 427 { 361 printf("PNode::update () - this->bAbsCoorChanged = true\n"); 362 /* if you have set the absolute coordinates this overrides all other changes */ 363 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 428 this->absCoordinate = this->relCoordinate; 364 429 } 365 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 366 { 367 /*this is bad style... must be deleted later - just for testing*/ 368 if( this->parent == NULL) 369 { 370 this->absCoordinate = this->relCoordinate; 371 } 372 else 373 this->absCoordinate = parent->getAbsCoor () + this->relCoordinate; /* update the current absCoordinate */ 374 } 430 else 431 this->absCoordinate = parent->getAbsCoor() + this->relCoordinate; /* update the current absCoordinate */ 375 432 } 376 377 if( this->mode == ROTATION && this->mode == ALL) 433 } 434 435 if( this->mode & PNODE_LOCAL_ROTATE) 436 { 437 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 378 438 { 379 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 380 { 381 /* if you have set the absolute coordinates this overrides all other changes */ 382 this->relDirection = this->absDirection - parent->getAbsDir (); 383 } 384 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 385 { 386 /* update the current absDirection - remember * means rotation around sth.*/ 387 this->absDirection = parent->getAbsDir () * this->relDirection; 388 } 389 } 390 // } 439 /* if you have set the absolute coordinates this overrides all other changes */ 440 this->relDirection = this->absDirection - parent->getAbsDir(); 441 } 442 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 443 { 444 /* update the current absDirection - remember * means rotation around sth.*/ 445 this->absDirection = parent->getAbsDir() * this->relDirection; 446 } 447 } 448 449 if( this->mode & PNODE_ROTATE_MOVEMENT) 450 { 451 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 452 { 453 /* if you have set the absolute coordinates this overrides all other changes */ 454 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 455 } 456 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 457 { 458 /*this is bad style... must be deleted later - just for testing*/ 459 if( this->parent == NULL) 460 this->absCoordinate = this->relCoordinate; 461 else 462 this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate); /* update the current absCoordinate */ 463 } 464 } 465 466 391 467 PNode* pn = this->children->enumerate(); 392 468 while( pn != NULL) … … 397 473 if( this->bRelDirChanged || this->bAbsDirChanged) 398 474 pn->parentDirChanged (); 399 pn->update( timeStamp);475 pn->update(); 400 476 pn = this->children->nextElement(); 401 477 } … … 415 491 void PNode::processTick (float dt) 416 492 { 417 this->tick (dt);493 //this->tick (dt); 418 494 PNode* pn = this->children->enumerate(); 419 495 while( pn != NULL) … … 424 500 } 425 501 426 /**427 \param dt time to tick428 */429 void PNode::tick (float dt)430 {}431 502 432 503 /** … … 435 506 void PNode::debug() 436 507 { 437 printf("PNode::debug() - absCoord: (%f, %f, %f)\n",508 PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n", 438 509 this->absCoordinate.x, 439 510 this->absCoordinate.y, … … 451 522 void PNode::setName (const char* newName) 452 523 { 453 int l = strlen( newName); 454 455 if( this->objectName != NULL) delete this->objectName; 456 this->objectName = NULL; 457 458 if( newName != NULL) 459 { 460 this->objectName = new char[l+1]; 461 462 for( int i = 0; i < l+1; i++) 463 this->objectName[i] = newName[i]; 464 } 524 if (this->objectName) 525 delete []this->objectName; 526 this->objectName = new char[strlen(newName)+1]; 527 strcpy(this->objectName,newName); 465 528 } 466 529 … … 473 536 return this->objectName; 474 537 } 538 -
orxonox/branches/levelloader/src/lib/coord/p_node.h
r3557 r3605 22 22 #define _P_NODE_H 23 23 24 #include " stdincl.h"24 #include "base_object.h" 25 25 26 // FORWARD DEFINITION \\ 26 27 class PNode; /* forward decleration, so that parentEntry has access to PNode */ 28 class Quaternion; 29 class Vector; 27 30 28 31 //! enumeration for the different translation-binding-types 29 typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL}; 32 //typedef enum parentingMode {PNODE_LOCAL_ROTATE, PNODE_ROTATE_MOVEMENT, PNODE_ALL, PNODE_MOVEMENT, PNODE_ROTATE_AND_MOVE}; 33 // linkage modes 34 #define PNODE_LOCAL_ROTATE 1 //!< Rotates all the children around their centers. 35 #define PNODE_ROTATE_MOVEMENT 2 //!< Moves all the children around the center of their parent, without the rotation around their own centers. 36 #define PNODE_MOVEMENT 4 //!< Moves all children along with the parent. 37 // special linkage modes 38 #define PNODE_ALL 3 //!< Moves all children around the center of their parent, and also rotates their centers 39 #define PNODE_ROTATE_AND_MOVE 5 //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent. 40 30 41 //! The default mode of the translation-binding. 31 #define DEFAULT_MODE ALL42 #define DEFAULT_MODE PNODE_ALL 32 43 33 44 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent. … … 39 50 virtual ~PNode (); 40 51 41 void destroy ();42 43 52 PNode* parent; //!< a pointer to the parent node 44 53 tList<PNode>* children; //!< list of the children 45 54 46 parentingMode mode; //!< the mode of the binding 55 47 56 48 57 Vector getRelCoor (); … … 62 71 63 72 void addChild (PNode* pNode); 64 void addChild (PNode* pNode, parentingMode mode);73 void addChild (PNode* pNode, int parentingMode); 65 74 void removeChild (PNode* pNode); 75 void remove(); 76 77 66 78 void setParent (PNode* parent); 67 79 void parentCoorChanged (); 68 80 void parentDirChanged (); 69 void setMode (parentingMode mode); 81 void setMode (int parentingMode); 82 int getMode(); 70 83 71 virtual void update ( float timeStamp);84 virtual void update (); 72 85 void processTick (float dt); 73 virtual void tick (float dt);74 86 75 87 void setName (const char* newName); … … 79 91 void debug (); 80 92 93 private: 94 void init(PNode* parent); 95 96 protected: 81 97 float timeStamp; //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated 82 98 char* objectName; //!< The name of the Object … … 91 107 Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) ) 92 108 109 int mode; //!< the mode of the binding 110 93 111 }; 94 112 95 113 #endif /* _P_NODE_H */ 114 -
orxonox/branches/levelloader/src/lib/graphics/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 78 78 DEFS = @DEFS@ 79 79 DEPDIR = @DEPDIR@ 80 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 81 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 80 82 DOXYGEN = @DOXYGEN@ 81 83 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 175 177 esac; \ 176 178 done; \ 177 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/graphics/Makefile'; \179 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/graphics/Makefile'; \ 178 180 cd $(top_srcdir) && \ 179 $(AUTOMAKE) -- gnusrc/lib/graphics/Makefile181 $(AUTOMAKE) --foreign src/lib/graphics/Makefile 180 182 .PRECIOUS: Makefile 181 183 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 270 272 tags=; \ 271 273 here=`pwd`; \ 272 if ( etags--etags-include --version) >/dev/null 2>&1; then \274 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ 273 275 include_option=--etags-include; \ 276 empty_fix=.; \ 274 277 else \ 275 278 include_option=--include; \ 279 empty_fix=; \ 276 280 fi; \ 277 281 list='$(SUBDIRS)'; for subdir in $$list; do \ 278 282 if test "$$subdir" = .; then :; else \ 279 test -f $$subdir/TAGS &&\283 test ! -f $$subdir/TAGS || \ 280 284 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 281 285 fi; \ … … 287 291 $(AWK) ' { files[$$0] = 1; } \ 288 292 END { for (i in files) print i; }'`; \ 289 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 290 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 291 $$tags $$unique 293 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 294 test -n "$$unique" || unique=$$empty_fix; \ 295 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 296 $$tags $$unique; \ 297 fi 292 298 ctags: CTAGS 293 299 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ -
orxonox/branches/levelloader/src/lib/graphics/font/fontset.cc
r3499 r3605 45 45 #include <stdarg.h> 46 46 47 #include "../importer/texture.h" 47 #include "texture.h" 48 #include <string.h> 48 49 49 50 /** -
orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 42 42 subdir = src/lib/graphics/importer 43 43 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ 44 $(srcdir)/Makefile.in TODO44 $(srcdir)/Makefile.in 45 45 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 46 46 am__aclocal_m4_deps = $(top_srcdir)/configure.ac … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = $(DESTDIR)$(bindir)52 am__installdirs = "$(DESTDIR)$(bindir)" 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) … … 98 98 DEFS = @DEFS@ 99 99 DEPDIR = @DEPDIR@ 100 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 101 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 100 102 DOXYGEN = @DOXYGEN@ 101 103 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 215 217 esac; \ 216 218 done; \ 217 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/graphics/importer/Makefile'; \219 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/graphics/importer/Makefile'; \ 218 220 cd $(top_srcdir) && \ 219 $(AUTOMAKE) -- gnusrc/lib/graphics/importer/Makefile221 $(AUTOMAKE) --foreign src/lib/graphics/importer/Makefile 220 222 .PRECIOUS: Makefile 221 223 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 237 239 install-binPROGRAMS: $(bin_PROGRAMS) 238 240 @$(NORMAL_INSTALL) 239 $(mkdir_p) $(DESTDIR)$(bindir)241 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" 240 242 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 241 243 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 243 245 ; then \ 244 246 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 245 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \246 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f|| exit 1; \247 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ 248 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ 247 249 else :; fi; \ 248 250 done … … 252 254 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 253 255 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 254 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \255 rm -f $(DESTDIR)$(bindir)/$$f; \256 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ 257 rm -f "$(DESTDIR)$(bindir)/$$f"; \ 256 258 done 257 259 … … 330 332 $(AWK) ' { files[$$0] = 1; } \ 331 333 END { for (i in files) print i; }'`; \ 332 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 333 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 334 $$tags $$unique 334 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 335 test -n "$$unique" || unique=$$empty_fix; \ 336 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 337 $$tags $$unique; \ 338 fi 335 339 ctags: CTAGS 336 340 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 387 391 all-am: Makefile $(PROGRAMS) $(HEADERS) 388 392 installdirs: 389 $(mkdir_p) $(DESTDIR)$(bindir) 393 for dir in "$(DESTDIR)$(bindir)"; do \ 394 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 395 done 390 396 install: install-am 391 397 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/graphics/importer/array.cc
r3499 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "array.h" … … 30 32 Array::~Array() 31 33 { 32 PRINTF( 2)("deleting array\n");34 PRINTF(4)("deleting array\n"); 33 35 Entry* walker = this->firstEntry; 34 36 Entry* previous; … … 49 51 void Array::initializeArray () 50 52 { 51 PRINTF( 2)("crating new Array\n");53 PRINTF(4)("crating new Array\n"); 52 54 this->firstEntry = new Entry; 53 55 this->firstEntry->next =NULL; … … 64 66 void Array::finalizeArray (void) 65 67 { 66 PRINTF( 3)("Finalizing array. Length: %i\n", entryCount);68 PRINTF(4)("Finalizing array. Length: %i\n", entryCount); 67 69 // if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL) 68 70 if (!(this->array = new GLfloat [this->entryCount])) … … 87 89 if (!this->finalized) 88 90 { 89 PRINTF( 3)("adding new Entry to Array: %f\n", entry);91 PRINTF(5)("adding new Entry to Array: %f\n", entry); 90 92 91 93 this->currentEntry->value = entry; … … 96 98 } 97 99 else 98 PRINTF( 1)("adding failed, because list has been finalized\n");100 PRINTF(2)("adding failed, because list has been finalized\n"); 99 101 } 100 102 … … 131 133 void Array::debug () 132 134 { 133 PRINT F(0)("entryCount=%i, address=%p\n", this->entryCount, this->array);135 PRINT(0)("entryCount=%i, address=%p\n", this->entryCount, this->array); 134 136 } -
orxonox/branches/levelloader/src/lib/graphics/importer/array.h
r3499 r3605 8 8 #ifndef _ARRAY_H 9 9 #define _ARRAY_H 10 11 extern int verbose; //!< will be obsolete soon12 10 13 11 #include "stdincl.h" -
orxonox/branches/levelloader/src/lib/graphics/importer/material.cc
r3499 r3605 15 15 */ 16 16 17 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 18 17 19 #include "material.h" 18 20 19 21 #include "texture.h" 22 #include "debug.h" 20 23 #include <stdlib.h> 21 24 #include <string.h> … … 51 54 Material::~Material() 52 55 { 53 PRINTF( 2)("delete Material %s.\n", this->name);56 PRINTF(4)("delete Material %s.\n", this->name); 54 57 if (this->name) 55 58 delete []this->name; … … 67 70 Material* Material::addMaterial(char* mtlName) 68 71 { 69 PRINTF( 2)("adding Material %s.\n", mtlName);72 PRINTF(4)("adding Material %s.\n", mtlName); 70 73 Material* tmpMat = this; 71 74 while (tmpMat->nextMat != NULL) … … 83 86 void Material::init(void) 84 87 { 85 PRINTF( 2)("initializing new Material.\n");88 PRINTF(4)("initializing new Material.\n"); 86 89 this->nextMat = NULL; 87 90 this->name =""; … … 112 115 Material* Material::search(char* mtlName) 113 116 { 114 PRINTF( 2)("Searching for material %s", mtlName);117 PRINTF(5)("Searching for material %s", mtlName); 115 118 Material* searcher = this; 116 119 while (searcher != NULL) 117 120 { 118 PRINT( 2)(".");121 PRINT(5)("."); 119 122 if (!strcmp (searcher->getName(), mtlName)) 120 123 { 121 PRINT( 2)("found.\n");124 PRINT(5)("found.\n"); 122 125 return searcher; 123 126 } 124 127 searcher = searcher->nextMat; 125 128 } 126 PRINT(2)(" not found\n");129 PRINT(2)("material %s not found\n", mtlName); 127 130 return NULL; 128 131 } … … 153 156 154 157 if (this->diffuseTextureSet) 155 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture()); 158 { 159 glEnable(GL_TEXTURE_2D); 160 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture()); 161 } 156 162 else 157 glBindTexture(GL_TEXTURE_2D, 0); 158 163 { 164 glDisable(GL_TEXTURE_2D); 165 glBindTexture(GL_TEXTURE_2D, 0); 166 } 159 167 } 160 168 … … 166 174 void Material::setName (char* mtlName) 167 175 { 168 PRINTF( 3)("setting Material Name to %s.\n", this->name);176 PRINTF(4)("setting Material Name to %s.\n", this->name); 169 177 this->name = new char [strlen(mtlName)+1]; 170 178 strcpy(this->name, mtlName); … … 185 193 void Material::setIllum (int illum) 186 194 { 187 PRINTF( 3)("setting illumModel of Material %s to %i\n", this->name, illum);195 PRINTF(4)("setting illumModel of Material %s to %i\n", this->name, illum); 188 196 this->illumModel = illum; 189 // PRINTF(3)("setting illumModel to: %i\n", illumModel);190 197 } 191 198 /** … … 205 212 void Material::setDiffuse (float r, float g, float b) 206 213 { 207 PRINTF( 3)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);214 PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 208 215 this->diffuse[0] = r; 209 216 this->diffuse[1] = g; … … 231 238 void Material::setAmbient (float r, float g, float b) 232 239 { 233 PRINTF( 3)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);240 PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 234 241 this->ambient[0] = r; 235 242 this->ambient[1] = g; … … 256 263 void Material::setSpecular (float r, float g, float b) 257 264 { 258 PRINTF( 3)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);265 PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 259 266 this->specular[0] = r; 260 267 this->specular[1] = g; … … 296 303 void Material::setTransparency (float trans) 297 304 { 298 PRINTF( 3)("setting Transparency of Material %s to %f.\n", this->name, trans);305 PRINTF(4)("setting Transparency of Material %s to %f.\n", this->name, trans); 299 306 this->transparency = trans; 300 307 } … … 325 332 void Material::setDiffuseMap(char* dMap) 326 333 { 327 PRINTF( 3)("setting Diffuse Map %s\n", dMap);334 PRINTF(4)("setting Diffuse Map %s\n", dMap); 328 335 diffuseTexture = new Texture(); 329 336 this->diffuseTextureSet = diffuseTexture->loadImage(dMap); -
orxonox/branches/levelloader/src/lib/graphics/importer/material.h
r3499 r3605 9 9 #define _MATERIAL_H 10 10 11 12 13 extern int verbose; //!< will be obsolete soon.14 11 15 12 #if HAVE_CONFIG_H -
orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
r3499 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "model.h" … … 80 82 Model::~Model(void) 81 83 { 82 PRINTF( 3)("Deleting Model ");84 PRINTF(4)("Deleting Model "); 83 85 if (this->name) 84 86 { 85 PRINT( 3)("%s\n", this->name);87 PRINT(4)("%s\n", this->name); 86 88 delete []this->name; 87 89 } 88 90 else 89 PRINT( 3)("\n");90 91 PRINTF( 3)("Deleting display Lists.\n");91 PRINT(4)("\n"); 92 93 PRINTF(4)("Deleting display Lists.\n"); 92 94 Group* walker = this->firstGroup; 93 95 while (walker != NULL) … … 99 101 } 100 102 101 PRINTF( 3)("Deleting Materials.\n");103 PRINTF(4)("Deleting Materials.\n"); 102 104 if (this->material) 103 105 delete this->material; … … 122 124 void Model::draw (void) const 123 125 { 124 PRINTF( 2)("drawing the 3D-Models\n");126 PRINTF(4)("drawing the 3D-Models\n"); 125 127 Group* walker = this->firstGroup; 126 128 while (walker != NULL) 127 129 { 128 PRINTF( 3)("Drawing model %s\n", walker->name);130 PRINTF(5)("Drawing model %s\n", walker->name); 129 131 glCallList (walker->listNumber); 130 132 walker = walker->next; … … 142 144 if (groupNumber >= this->groupCount) 143 145 { 144 PRINTF( 1)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);146 PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount); 145 147 return; 146 148 } 147 PRINTF( 2)("drawing the requested 3D-Models if found.\n");149 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 148 150 Group* walker = this->firstGroup; 149 151 int counter = 0; … … 152 154 if (counter == groupNumber) 153 155 { 154 PRINTF( 2)("Drawing model number %i named %s\n", counter, walker->name);156 PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name); 155 157 glCallList (walker->listNumber); 156 158 return; … … 159 161 walker = walker->next; 160 162 } 161 PRINTF( 1)("Model number %i in %s not Found.\n", groupNumber, this->name);163 PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name); 162 164 return; 163 165 … … 172 174 void Model::draw (char* groupName) const 173 175 { 174 PRINTF( 2)("drawing the requested 3D-Models if found.\n");176 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 175 177 Group* walker = this->firstGroup; 176 178 while (walker != NULL) … … 178 180 if (!strcmp(walker->name, groupName)) 179 181 { 180 PRINTF( 2)("Drawing model %s\n", walker->name);182 PRINTF(4)("Drawing model %s\n", walker->name); 181 183 glCallList (walker->listNumber); 182 184 return; … … 184 186 walker = walker->next; 185 187 } 186 PRINTF( 1)("Model Named %s in %s not Found.\n", groupName, this->name);188 PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name); 187 189 return; 188 190 } … … 204 206 bool Model::initialize (void) 205 207 { 206 PRINTF( 2)("new 3D-Model is being created\n");208 PRINTF(4)("new 3D-Model is being created\n"); 207 209 208 210 this->name = NULL; … … 243 245 bool Model::initGroup(Group* group) 244 246 { 245 PRINTF( 3)("Adding new Group\n");247 PRINTF(4)("Adding new Group\n"); 246 248 group->name = ""; 247 249 group->faceMode = -1; … … 277 279 bool Model::cleanup(void) 278 280 { 279 PRINTF( 3)("cleaning up the 3D-Model to save Memory.\n");281 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 280 282 281 283 if (this->vertices) … … 296 298 bool Model::cleanupGroup (Group* group) 297 299 { 298 PRINTF( 3)("Cleaning up group\n");300 PRINTF(5)("Cleaning up group\n"); 299 301 if (group->firstFace != NULL) 300 302 { … … 314 316 bool Model::cleanupFace (Face* face) 315 317 { 316 PRINTF( 3)("Cleaning up Face\n");318 PRINTF(5)("Cleaning up Face\n"); 317 319 318 320 if (face->materialString != NULL) … … 355 357 bool Model::addGroup (char* groupString) 356 358 { 357 PRINTF( 3)("Read Group: %s.\n", groupString);359 PRINTF(5)("Read Group: %s.\n", groupString); 358 360 if (this->groupCount != 0 && this->currentGroup->faceCount>0) 359 361 { … … 384 386 float subbuffer3; 385 387 sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 386 PRINTF( 3)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);388 PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3); 387 389 this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor); 388 390 return true; … … 398 400 bool Model::addVertex(const float x, const float y, const float z) 399 401 { 400 PRINTF( 4)("reading in a vertex: %f %f %f\n", x, y, z);402 PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z); 401 403 this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor); 402 404 return true; … … 513 515 float subbuffer3; 514 516 sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 515 PRINTF( 3)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);517 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3); 516 518 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3); 517 519 return true; … … 544 546 float subbuffer2; 545 547 sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2); 546 PRINTF( 3)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);548 PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2); 547 549 this->vTexture->addEntry(subbuffer1); 548 550 this->vTexture->addEntry(subbuffer2); … … 610 612 if ((this->currentGroup->listNumber = glGenLists(1)) == 0) 611 613 { 612 PRINTF( 1)("list could not be created for this Model\n");614 PRINTF(2)("glList could not be created for this Model\n"); 613 615 return false; 614 616 } … … 628 630 { 629 631 tmpMat->select(); 630 PRINTF( 2)("using material %s for coming Faces.\n", tmpFace->materialString);632 PRINTF(5)("using material %s for coming Faces.\n", tmpFace->materialString); 631 633 } 632 634 else 633 PRINTF( 1)("material %s not found.\n", tmpFace->materialString);635 PRINTF(2)("material %s not found.\n", tmpFace->materialString); 634 636 635 637 … … 646 648 647 649 this->currentGroup->faceMode = 3; 648 PRINTF( 3)("found triag.\n");650 PRINTF(5)("found triag.\n"); 649 651 } 650 652 … … 658 660 } 659 661 this->currentGroup->faceMode = 4; 660 PRINTF( 3)("found quad.\n");662 PRINTF(5)("found quad.\n"); 661 663 } 662 664 … … 666 668 glEnd(); 667 669 glBegin(GL_POLYGON); 668 PRINTF( 3)("Polygon with %i faces found.", tmpFace->vertexCount);670 PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount); 669 671 this->currentGroup->faceMode = tmpFace->vertexCount; 670 672 } … … 698 700 bool Model::addGLElement (FaceElement* elem) 699 701 { 700 PRINTF( 3)("importing grafical Element to openGL.\n");702 PRINTF(5)("importing grafical Element to openGL.\n"); 701 703 702 704 if (elem->texCoordNumber != -1) … … 721 723 { 722 724 723 PRINTF( 2)("Normals are being calculated.\n");725 PRINTF(4)("Normals are being calculated.\n"); 724 726 725 727 Vector* normArray = new Vector [vertices->getCount()/3]; … … 778 780 { 779 781 normArray[i].normalize(); 780 PRINTF( 3)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);782 PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z); 781 783 782 784 this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z); … … 881 883 //printf ("%f %f\n", vz, sin (vz)); 882 884 if (i==0.0) 883 printf("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));885 PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI)); 884 886 } 885 887 } -
orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc
r3542 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "objModel.h" … … 86 88 bool OBJModel::importFile (const char* fileName) 87 89 { 88 PRINTF( 3)("preparing to read in file: %s\n", fileName);90 PRINTF(4)("preparing to read in file: %s\n", fileName); 89 91 90 92 … … 107 109 strncpy(this->objPath, fileName, name-fileName); 108 110 this->objPath[name-fileName] = '\0'; 109 if (verbose>=2) 110 if (strlen(objPath)> 0) 111 PRINTF(0)("Resolved file %s to folder: %s.\n", name, objPath); 112 else 113 PRINTF(0)("Resolved file %s.\n", name); 111 if (strlen(objPath)> 0) 112 PRINTF(5)("Resolved file %s to folder: %s.\n", name, objPath); 113 else 114 PRINTF(5)("Resolved file %s.\n", name); 114 115 115 116 this->setName(name); … … 144 145 return false; 145 146 } 146 PRINTF( 2)("Reading from opened file %s\n", fileName);147 PRINTF(4)("Reading from opened file %s\n", fileName); 147 148 char Buffer[10000]; 148 149 while(!OBJ_FILE->eof()) 149 150 { 150 151 OBJ_FILE->getline(Buffer, 10000); 151 PRINTF( 3)("Read input line: %s\n", Buffer);152 PRINTF(5)("Read input line: %s\n", Buffer); 152 153 153 154 … … 192 193 else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented 193 194 { 194 if (verbose >= 2) 195 PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer); 195 PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer); 196 196 } 197 197 } … … 221 221 222 222 223 PRINTF( 3)("Opening mtlFile: %s\n", fileName);223 PRINTF(4)("Opening mtlFile: %s\n", fileName); 224 224 225 225 ifstream* MTL_FILE = new ifstream (fileName); 226 226 if (MTL_FILE->fail()) 227 227 { 228 PRINTF( 1)("unable to open file: %s\n", fileName);228 PRINTF(2)("unable to open file: %s\n", fileName); 229 229 MTL_FILE->close(); 230 230 delete []fileName; … … 237 237 { 238 238 MTL_FILE->getline(Buffer, 500); 239 PRINTF( 4)("found line in mtlFile: %s\n", Buffer);239 PRINTF(5)("found line in mtlFile: %s\n", Buffer); 240 240 241 241 -
orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc
r3499 r3605 17 17 */ 18 18 19 20 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 19 21 20 22 #include "texture.h" … … 87 89 if (pName[0] == '\0') 88 90 { 89 PRINTF( 3)("not Adding empty Path to the List.\n");91 PRINTF(2)("not Adding empty Path to the List.\n"); 90 92 return; 91 93 } … … 99 101 if (status.st_mode & S_IFDIR) 100 102 { 101 PRINTF( 2)("Adding Path %s to the PathList.\n", pName);103 PRINTF(4)("Adding Path %s to the PathList.\n", pName); 102 104 PathList* tmpPathList = this; 103 105 while (tmpPathList->next) … … 193 195 bool Texture::loadTexToGL (Image* pImage) 194 196 { 195 PRINTF( 2)("Loading texture to OpenGL-Environment.\n");197 PRINTF(4)("Loading texture to OpenGL-Environment.\n"); 196 198 glGenTextures(1, &this->texture); 197 199 glBindTexture(GL_TEXTURE_2D, this->texture); … … 229 231 pImage->format = GL_RGBA; 230 232 231 PRINTF(0)("Bits Per Pixel: %d\n", pImage->bpp);232 233 if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb"))) 233 234 for (int i=0;i<map->h * map->w *3;i+=3) … … 249 250 else 250 251 { 251 PRINTF( 1)("Image not Found: %s\n", imgNameWithPath);252 PRINTF(2)("Image not Found: %s\n", imgNameWithPath); 252 253 return false; 253 254 } … … 268 269 if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4)) 269 270 { 270 PRINTF( 3)("Requested bmp-image. Trying to Import.\n");271 PRINTF(4)("Requested bmp-image. Trying to Import.\n"); 271 272 return this->loadBMP(imgNameWithPath); 272 273 } … … 274 275 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5)) 275 276 { 276 PRINTF( 3)("Requested jpeg-image. Trying to Import\n");277 PRINTF(4)("Requested jpeg-image. Trying to Import\n"); 277 278 return this->loadJPG(imgNameWithPath); 278 279 } 279 280 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4)) 280 281 { 281 PRINTF( 3)("Requested tga-image. Trying to Import\n");282 PRINTF(4)("Requested tga-image. Trying to Import\n"); 282 283 return this->loadTGA(imgNameWithPath); 283 284 } 284 285 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4)) 285 286 { 286 PRINTF( 3)("Requested png-image. Trying to Import\n");287 PRINTF(4)("Requested png-image. Trying to Import\n"); 287 288 return this->loadPNG(imgNameWithPath); 288 289 } 289 290 else 290 291 { 291 PRINTF( 1)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);292 PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath); 292 293 return false; 293 294 } … … 295 296 else 296 297 { 297 PRINTF( 1)("Image not Found: %s\n", imgNameWithPath);298 PRINTF(2)("Image not Found: %s\n", imgNameWithPath); 298 299 return false; 299 300 } … … 316 317 if ((file = fopen(bmpName, "rb"))==NULL) 317 318 { 318 PRINTF( 1)("File Not Found : %s\n",bmpName);319 PRINTF(2)("File Not Found : %s\n",bmpName); 319 320 return false; 320 321 } … … 325 326 if ((i = fread(&pImage->width, 4, 1, file)) != 1) 326 327 { 327 PRINTF( 1)("Error reading width from %s.\n", bmpName);328 PRINTF(2)("Error reading width from %s.\n", bmpName); 328 329 return false; 329 330 } … … 331 332 if ((i = fread(&pImage->height, 4, 1, file)) != 1) 332 333 { 333 PRINTF( 1)("Error reading height from %s.\n", bmpName);334 PRINTF(2)("Error reading height from %s.\n", bmpName); 334 335 return false; 335 336 } … … 341 342 if ((fread(&planes, 2, 1, file)) != 1) 342 343 { 343 PRINTF( 1)("Error reading planes from %s.\n", bmpName);344 PRINTF(2)("Error reading planes from %s.\n", bmpName); 344 345 return false; 345 346 } … … 353 354 if ((i = fread(&bpp, 2, 1, file)) != 1) 354 355 { 355 PRINTF( 1)("Error reading bpp from %s.\n", bmpName);356 PRINTF(2)("Error reading bpp from %s.\n", bmpName); 356 357 return false; 357 358 } 358 359 if (bpp != 24) 359 360 { 360 PRINTF( 1)("Bpp from %s is not 24: %u\n", bmpName, bpp);361 PRINTF(2)("Bpp from %s is not 24: %u\n", bmpName, bpp); 361 362 return false; 362 363 } … … 369 370 if (pImage->data == NULL) 370 371 { 371 PRINTF( 1)("Error allocating memory for color-corrected image data");372 PRINTF(2)("Error allocating memory for color-corrected image data"); 372 373 return false; 373 374 } … … 375 376 if ((i = fread(pImage->data, size, 1, file)) != 1) 376 377 { 377 PRINTF( 1)("Error reading image data from %s.\n", bmpName);378 PRINTF(2)("Error reading image data from %s.\n", bmpName); 378 379 return false; 379 380 } … … 418 419 { 419 420 // Display an error message saying the file was not found, then return NULL 420 PRINTF( 1)("Unable to load JPG File %s.\n", jpgName);421 PRINTF(2)("Unable to load JPG File %s.\n", jpgName); 421 422 return false; 422 423 } … … 521 522 if(fTGA == NULL) 522 523 { 523 PRINTF( 1)("Error could not open texture file: %s\n", tgaName);524 PRINTF(2)("Error could not open texture file: %s\n", tgaName); 524 525 return false; 525 526 } … … 527 528 if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0) 528 529 { 529 PRINTF( 1)("Error could not read file header of %s\n", tgaName);530 PRINTF(2)("Error could not read file header of %s\n", tgaName); 530 531 if(fTGA != NULL) 531 532 { … … 549 550 else 550 551 { 551 PRINTF( 1)("Error TGA file be type 2 or type 10\n");552 PRINTF(2)("Error TGA file be type 2 or type 10\n"); 552 553 if (fTGA) 553 554 fclose(fTGA); … … 576 577 if(fread(header, sizeof(header), 1, fTGA) == 0) 577 578 { 578 PRINTF( 1)("Error could not read info header\n");579 PRINTF(2)("Error could not read info header\n"); 579 580 return false; 580 581 } … … 586 587 if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32))) 587 588 { 588 PRINTF( 1)("Error invalid texture information\n");589 PRINTF(2)("Error invalid texture information\n"); 589 590 return false; 590 591 } … … 605 606 if(pImage->data == NULL) 606 607 { 607 PRINTF( 1)("Error could not allocate memory for image\n");608 PRINTF(2)("Error could not allocate memory for image\n"); 608 609 return false; 609 610 } … … 611 612 if(fread(pImage->data, 1, imageSize, fTGA) != imageSize) 612 613 { 613 PRINTF( 1)("Error could not read image data\n");614 PRINTF(2)("Error could not read image data\n"); 614 615 if(pImage->data != NULL) 615 616 { … … 648 649 if(fread(header, sizeof(header), 1, fTGA) == 0) 649 650 { 650 PRINTF( 1)("Error could not read info header\n");651 PRINTF(2)("Error could not read info header\n"); 651 652 return false; 652 653 } … … 664 665 if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32))) 665 666 { 666 PRINTF( 1)("Error Invalid pImage information\n");667 PRINTF(2)("Error Invalid pImage information\n"); 667 668 return false; 668 669 } … … 674 675 if(pImage->data == NULL) 675 676 { 676 PRINTF( 1)("Error could not allocate memory for image\n");677 PRINTF(2)("Error could not allocate memory for image\n"); 677 678 return false; 678 679 } … … 684 685 if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0) 685 686 { 686 PRINTF( 1)("Error could not read RLE header\n");687 PRINTF(2)("Error could not read RLE header\n"); 687 688 if(pImage->data != NULL) 688 689 { … … 702 703 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) 703 704 { 704 PRINTF( 1)("Error could not read image data\n");705 PRINTF(2)("Error could not read image data\n"); 705 706 if(colorbuffer != NULL) 706 707 { … … 732 733 if(currentpixel > pixelcount) 733 734 { 734 PRINTF( 1)("Error too many pixels read\n");735 PRINTF(2)("Error too many pixels read\n"); 735 736 if(colorbuffer != NULL) 736 737 { … … 754 755 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values 755 756 { 756 PRINTF( 1)("Error could not read from file");757 PRINTF(2)("Error could not read from file"); 757 758 if(colorbuffer != NULL) 758 759 { … … 785 786 if(currentpixel > pixelcount) 786 787 { 787 PRINTF( 1)("Error too many pixels read\n");788 PRINTF(2)("Error too many pixels read\n"); 788 789 if(colorbuffer != NULL) 789 790 { -
orxonox/branches/levelloader/src/lib/graphics/importer/texture.h
r3499 r3605 10 10 #define _TEXTURE_H 11 11 12 #include "stdincl.h" 12 #include "glincl.h" 13 14 #include "debug.h" 15 13 16 #ifdef HAVE_SDL_SDL_IMAGE_H 14 17 #include <SDL/SDL_image.h> -
orxonox/branches/levelloader/src/lib/graphics/importer/windowHandler.h
r3499 r3605 7 7 #ifndef _WINDOWHANDLER_H 8 8 #define _WINDOWHANDLER_H 9 10 extern int verbose;11 9 12 10 #include "stdincl.h" -
orxonox/branches/levelloader/src/lib/gui/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 78 78 DEFS = @DEFS@ 79 79 DEPDIR = @DEPDIR@ 80 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 81 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 80 82 DOXYGEN = @DOXYGEN@ 81 83 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 177 179 esac; \ 178 180 done; \ 179 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/gui/Makefile'; \181 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/gui/Makefile'; \ 180 182 cd $(top_srcdir) && \ 181 $(AUTOMAKE) -- gnusrc/lib/gui/Makefile183 $(AUTOMAKE) --foreign src/lib/gui/Makefile 182 184 .PRECIOUS: Makefile 183 185 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 272 274 tags=; \ 273 275 here=`pwd`; \ 274 if ( etags--etags-include --version) >/dev/null 2>&1; then \276 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ 275 277 include_option=--etags-include; \ 278 empty_fix=.; \ 276 279 else \ 277 280 include_option=--include; \ 281 empty_fix=; \ 278 282 fi; \ 279 283 list='$(SUBDIRS)'; for subdir in $$list; do \ 280 284 if test "$$subdir" = .; then :; else \ 281 test -f $$subdir/TAGS &&\285 test ! -f $$subdir/TAGS || \ 282 286 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 283 287 fi; \ … … 289 293 $(AWK) ' { files[$$0] = 1; } \ 290 294 END { for (i in files) print i; }'`; \ 291 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 292 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 293 $$tags $$unique 295 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 296 test -n "$$unique" || unique=$$empty_fix; \ 297 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 298 $$tags $$unique; \ 299 fi 294 300 ctags: CTAGS 295 301 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ -
orxonox/branches/levelloader/src/lib/gui/console/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = $(DESTDIR)$(bindir)52 am__installdirs = "$(DESTDIR)$(bindir)" 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) … … 96 96 DEFS = @DEFS@ 97 97 DEPDIR = @DEPDIR@ 98 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 99 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 98 100 DOXYGEN = @DOXYGEN@ 99 101 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 203 205 esac; \ 204 206 done; \ 205 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/gui/console/Makefile'; \207 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/gui/console/Makefile'; \ 206 208 cd $(top_srcdir) && \ 207 $(AUTOMAKE) -- gnusrc/lib/gui/console/Makefile209 $(AUTOMAKE) --foreign src/lib/gui/console/Makefile 208 210 .PRECIOUS: Makefile 209 211 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 225 227 install-binPROGRAMS: $(bin_PROGRAMS) 226 228 @$(NORMAL_INSTALL) 227 $(mkdir_p) $(DESTDIR)$(bindir)229 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" 228 230 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 229 231 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 231 233 ; then \ 232 234 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 233 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \234 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f|| exit 1; \235 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ 236 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ 235 237 else :; fi; \ 236 238 done … … 240 242 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 241 243 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 242 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \243 rm -f $(DESTDIR)$(bindir)/$$f; \244 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ 245 rm -f "$(DESTDIR)$(bindir)/$$f"; \ 244 246 done 245 247 … … 297 299 $(AWK) ' { files[$$0] = 1; } \ 298 300 END { for (i in files) print i; }'`; \ 299 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 300 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 301 $$tags $$unique 301 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 302 test -n "$$unique" || unique=$$empty_fix; \ 303 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 304 $$tags $$unique; \ 305 fi 302 306 ctags: CTAGS 303 307 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 354 358 all-am: Makefile $(PROGRAMS) $(HEADERS) 355 359 installdirs: 356 $(mkdir_p) $(DESTDIR)$(bindir) 360 for dir in "$(DESTDIR)$(bindir)"; do \ 361 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 362 done 357 363 install: install-am 358 364 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = $(DESTDIR)$(bindir)52 am__installdirs = "$(DESTDIR)$(bindir)" 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) … … 105 105 DEFS = @DEFS@ 106 106 DEPDIR = @DEPDIR@ 107 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 108 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 107 109 DOXYGEN = @DOXYGEN@ 108 110 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 236 238 esac; \ 237 239 done; \ 238 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/gui/gui/Makefile'; \240 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/gui/gui/Makefile'; \ 239 241 cd $(top_srcdir) && \ 240 $(AUTOMAKE) -- gnusrc/lib/gui/gui/Makefile242 $(AUTOMAKE) --foreign src/lib/gui/gui/Makefile 241 243 .PRECIOUS: Makefile 242 244 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 258 260 install-binPROGRAMS: $(bin_PROGRAMS) 259 261 @$(NORMAL_INSTALL) 260 $(mkdir_p) $(DESTDIR)$(bindir)262 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" 261 263 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 262 264 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 264 266 ; then \ 265 267 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 266 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \267 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f|| exit 1; \268 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ 269 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ 268 270 else :; fi; \ 269 271 done … … 273 275 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 274 276 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 275 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \276 rm -f $(DESTDIR)$(bindir)/$$f; \277 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ 278 rm -f "$(DESTDIR)$(bindir)/$$f"; \ 277 279 done 278 280 … … 336 338 $(AWK) ' { files[$$0] = 1; } \ 337 339 END { for (i in files) print i; }'`; \ 338 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 339 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 340 $$tags $$unique 340 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 341 test -n "$$unique" || unique=$$empty_fix; \ 342 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 343 $$tags $$unique; \ 344 fi 341 345 ctags: CTAGS 342 346 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 393 397 all-am: Makefile $(PROGRAMS) $(HEADERS) 394 398 installdirs: 395 $(mkdir_p) $(DESTDIR)$(bindir) 399 for dir in "$(DESTDIR)$(bindir)"; do \ 400 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 401 done 396 402 install: install-am 397 403 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h
r3499 r3605 9 9 #include <config.h> 10 10 #endif 11 12 //! verbose level, soon obsolete13 extern int verbose; // soon obsolete here14 11 15 12 #include "debug.h" -
orxonox/branches/levelloader/src/lib/lang/base_object.cc
r3499 r3605 26 26 \brief standard constructor 27 27 */ 28 BaseObject::BaseObject () {} 28 BaseObject::BaseObject () 29 { 30 this->className = NULL; 31 } 29 32 30 33 … … 32 35 \brief standard deconstructor 33 36 */ 34 BaseObject::~BaseObject () {} 35 37 BaseObject::~BaseObject () 38 { 39 delete []this->className; 40 } 36 41 37 42 void BaseObject::setClassName (char* className) 38 43 { 39 this->className = className; 44 this->className = new char[strlen(className)+1]; 45 strcpy(this->className, className); 40 46 } 41 47 -
orxonox/branches/levelloader/src/lib/lang/base_object.h
r3499 r3605 15 15 public: 16 16 BaseObject (); 17 ~BaseObject ();17 virtual ~BaseObject (); 18 18 19 19 void setClassName (char* className); -
orxonox/branches/levelloader/src/lib/math/curve.cc
r3499 r3605 19 19 local-Time implementation 20 20 NURBS 21 tList implementation 21 22 22 23 */ 23 24 25 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MATH 26 24 27 #include "curve.h" 25 #include "matrix.h" 28 26 29 #include "debug.h" 27 30 28 31 #include <math.h> 29 32 #include <stdio.h> 33 34 35 /** 36 \brief default constructor for a Curve 37 */ 38 Curve::Curve(void) 39 { 40 nodeCount = 0; 41 firstNode = new PathNode; 42 currentNode = firstNode; 43 44 firstNode->position = Vector (.0, .0, .0); 45 firstNode->number = 0; 46 firstNode->next = 0; // not sure if this really points to NULL!! 47 } 30 48 31 49 /** … … 131 149 this->derivation = 0; 132 150 dirCurve = new BezierCurve(1); 133 this->init();134 151 } 135 152 … … 141 158 this->derivation = derivation; 142 159 dirCurve=NULL; 143 this->init();144 160 } 145 161 … … 161 177 if (dirCurve) 162 178 delete dirCurve; 163 }164 165 /**166 \brief Initializes a BezierCurve167 */168 void BezierCurve::init(void)169 {170 nodeCount = 0;171 firstNode = new PathNode;172 currentNode = firstNode;173 174 firstNode->position = Vector (.0, .0, .0);175 firstNode->number = 0;176 firstNode->next = 0; // not sure if this really points to NULL!!177 178 return;179 179 } 180 180 … … 285 285 return curvePoint; 286 286 } 287 288 289 290 ///////////////////////////////////291 //// Uniform Point curve /////////292 ///////////////////////////////////293 /**294 \brief Creates a new UPointCurve295 */296 UPointCurve::UPointCurve (void)297 {298 this->derivation = 0;299 this->init();300 }301 302 /**303 \brief Creates a new UPointCurve-Derivation-Curve of deriavation'th degree304 */305 UPointCurve::UPointCurve (int derivation)306 {307 this->derivation = derivation;308 dirCurve=NULL;309 this->init();310 }311 312 /**313 \brief Deletes a UPointCurve.314 315 It does this by freeing all the space taken over from the nodes316 */317 UPointCurve::~UPointCurve(void)318 {319 PathNode* tmpNode;320 currentNode = firstNode;321 while (tmpNode != 0)322 {323 tmpNode = currentNode;324 currentNode = currentNode->next;325 delete tmpNode;326 }327 if (dirCurve)328 delete dirCurve;329 }330 331 /**332 \brief Initializes a UPointCurve333 */334 void UPointCurve::init(void)335 {336 nodeCount = 0;337 firstNode = new PathNode;338 currentNode = firstNode;339 340 firstNode->position = Vector (.0, .0, .0);341 firstNode->number = 0;342 firstNode->next = 0; // not sure if this really points to NULL!!343 344 return;345 }346 347 /**348 \brief Rebuilds a UPointCurve349 350 \todo very bad algorithm351 */352 void UPointCurve::rebuild(void)353 {354 // rebuilding the Curve itself355 PathNode* tmpNode = this->firstNode;356 int i=0;357 Matrix xTmpMat = Matrix(this->nodeCount, this->nodeCount);358 Matrix yTmpMat = Matrix(this->nodeCount, this->nodeCount);359 Matrix zTmpMat = Matrix(this->nodeCount, this->nodeCount);360 Matrix xValMat = Matrix(this->nodeCount, 3);361 Matrix yValMat = Matrix(this->nodeCount, 3);362 Matrix zValMat = Matrix(this->nodeCount, 3);363 while(tmpNode)364 {365 Vector fac = Vector(1,1,1);366 for (int j = 0; j < this->nodeCount; j++)367 {368 xTmpMat(i,j) = fac.x; fac.x *= (float)i/(float)this->nodeCount;//tmpNode->position.x;369 yTmpMat(i,j) = fac.y; fac.y *= (float)i/(float)this->nodeCount;//tmpNode->position.y;370 zTmpMat(i,j) = fac.z; fac.z *= (float)i/(float)this->nodeCount;//tmpNode->position.z;371 }372 xValMat(i,0) = tmpNode->position.x;373 yValMat(i,0) = tmpNode->position.y;374 zValMat(i,0) = tmpNode->position.z;375 ++i;376 tmpNode = tmpNode->next;377 }378 tmpNode = this->firstNode;379 xValMat = xTmpMat.Inv() *= xValMat;380 yValMat = yTmpMat.Inv() *= yValMat;381 zValMat = zTmpMat.Inv() *= zValMat;382 i = 0;383 while(tmpNode)384 {385 tmpNode->vFactor.x = xValMat(i,0);386 tmpNode->vFactor.y = yValMat(i,0);387 tmpNode->vFactor.z = zValMat(i,0);388 389 i++;390 tmpNode = tmpNode->next;391 }392 }393 394 /**395 \brief calculates the Position on the curve396 \param t The position on the Curve (0<=t<=1)397 \return the Position on the Path398 */399 Vector UPointCurve::calcPos(float t)400 {401 PathNode* tmpNode = firstNode;402 Vector ret = Vector(0.0,0.0,0.0);403 float factor = 1.0;404 while(tmpNode)405 {406 ret.x += tmpNode->vFactor.x * factor;407 ret.y += tmpNode->vFactor.y * factor;408 ret.z += tmpNode->vFactor.z * factor;409 factor *= t;410 411 tmpNode = tmpNode->next;412 }413 return ret;414 }415 416 /**417 \brief Calulates the direction of the Curve at time t.418 \param The time at which to evaluate the curve.419 \returns The vvaluated Vector.420 */421 Vector UPointCurve::calcDir (float t)422 {423 PathNode* tmpNode = firstNode;424 Vector ret = Vector(0.0,0.0,0.0);425 float factor = 1.0/t;426 int k=0;427 while(tmpNode)428 {429 ret.x += tmpNode->vFactor.x * factor *k;430 ret.y += tmpNode->vFactor.y * factor *k;431 ret.z += tmpNode->vFactor.z * factor *k;432 factor *= t;433 k++;434 tmpNode = tmpNode->next;435 }436 ret.normalize();437 return ret;438 }439 440 Vector UPointCurve::calcAcc (float t)441 {442 }443 444 /**445 \brief Calculates the Quaternion needed for our rotations446 \param t The time at which to evaluate the cuve.447 \returns The evaluated Quaternion.448 */449 Quaternion UPointCurve::calcQuat (float t)450 {451 return Quaternion (calcDir(t), Vector(0,0,1));452 }453 454 455 /**456 \brief returns the Position of the point calculated on the Curve457 \return a Vector to the calculated position458 */459 Vector UPointCurve::getPos(void) const460 {461 return curvePoint;462 } -
orxonox/branches/levelloader/src/lib/math/curve.h
r3499 r3605 13 13 14 14 //! An Enumerator that defines what sort of Curves are availible 15 enum CurveType {BEZIERCURVE , UPOINTCURVE};15 enum CurveType {BEZIERCURVE}; 16 16 17 17 … … 38 38 PathNode* currentNode; //!< The node we are working with (the Last node). 39 39 40 40 41 private: 41 42 virtual void rebuild(void) = 0; 42 43 public: 44 Curve(void); 45 43 46 Curve* dirCurve; //!< The derivation-curve of this Curve. 44 47 void addNode(const Vector& newNode); … … 68 71 BezierCurve(void); 69 72 BezierCurve(int derivation); 70 ~BezierCurve(void); 71 void init(void); 73 virtual ~BezierCurve(void); 72 74 73 75 Vector calcPos(float t); … … 91 93 }; 92 94 93 //! Uniform Point Curve-class94 /**95 A UPoint Curve is a A Curve, that flows through all the nodes given it.96 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.97 98 This Curve is very erattic, so i do not recommend to use it.99 */100 class UPointCurve : public Curve101 {102 private:103 void rebuild(void);104 public:105 UPointCurve(void);106 UPointCurve(int derivation);107 ~UPointCurve(void);108 void init(void);109 110 Vector calcPos(float t);111 Vector calcDir(float t);112 Vector calcAcc(float t);113 Quaternion calcQuat(float t);114 115 Vector getPos(void) const;116 };117 118 95 #endif /* _CURVE_H */ -
orxonox/branches/levelloader/src/lib/math/vector.cc
r3499 r3605 19 19 */ 20 20 21 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MATH 21 22 22 23 #include "vector.h" 23 24 #include "debug.h" 24 25 25 26 using namespace std; … … 201 202 } 202 203 203 204 204 /** 205 205 \brief calculate the angle between two vectors in radiances … … 225 225 f = acos( v1 * v2 / (v1.len() * v2.len())); 226 226 return f * 180 / PI; 227 } 228 229 230 /** 231 \brief Outputs the values of the Vector 232 */ 233 void Vector::debug(void) 234 { 235 PRINT(0)("Vector Debug information\n"); 236 PRINT(0)("x: %f; y: %f; z: %f", x, y, z); 237 PRINT(3)(" lenght: %f", len()); 238 PRINT(0)("\n"); 227 239 } 228 240 … … 581 593 582 594 /** 595 \brief outputs some nice formated debug information about this quaternion 596 */ 597 void Quaternion::debug(void) 598 { 599 PRINT(0)("Quaternion Debug Information\n"); 600 PRINT(0)("real a=%f; imag: x=%f y=%f z=%f\n", w, v.x, v.y, v.z); 601 } 602 603 /** 583 604 \brief create a rotation from a vector 584 605 \param v: a vector -
orxonox/branches/levelloader/src/lib/math/vector.h
r3499 r3605 41 41 Vector* getNormalized(); 42 42 Vector abs(); 43 44 void debug(); 43 45 }; 44 46 … … 53 55 { 54 56 public: 55 Vector v; //!< Imaginary Vector 56 float w; //!< Real part of the number 57 58 Quaternion (); 59 Quaternion (float m[4][4]); 60 Quaternion (float angle, const Vector& axis); 61 Quaternion (const Vector& dir, const Vector& up); 62 Quaternion (float roll, float pitch, float yaw); 63 64 Quaternion operator/ (const float& f) const; 65 Quaternion operator* (const float& f) const; 66 Quaternion operator* (const Quaternion& q) const; 67 Quaternion operator+ (const Quaternion& q) const; 68 Quaternion operator- (const Quaternion& q) const; 69 Quaternion conjugate () const; 70 Quaternion inverse () const; 71 Vector apply (Vector& f) const; 72 float norm () const; 73 void matrix (float m[4][4]) const; 74 void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res); 75 57 Vector v; //!< Imaginary Vector 58 float w; //!< Real part of the number 59 60 Quaternion (); 61 Quaternion (float m[4][4]); 62 Quaternion (float angle, const Vector& axis); 63 Quaternion (const Vector& dir, const Vector& up); 64 Quaternion (float roll, float pitch, float yaw); 65 66 Quaternion operator/ (const float& f) const; 67 Quaternion operator* (const float& f) const; 68 Quaternion operator* (const Quaternion& q) const; 69 Quaternion operator+ (const Quaternion& q) const; 70 Quaternion operator- (const Quaternion& q) const; 71 Quaternion conjugate () const; 72 Quaternion inverse () const; 73 Vector apply (Vector& f) const; 74 float norm () const; 75 void matrix (float m[4][4]) const; 76 void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res); 77 78 void debug(); 76 79 private: 77 80 float DELTA; //!< resolution of calculation 78 81 79 82 }; -
orxonox/branches/levelloader/src/lib/util/list.h
r3499 r3605 86 86 T* enumerate(); 87 87 T* nextElement(); 88 T* nextElement(T* toEntity); 88 89 T* toArray(); 89 90 void debug(); … … 101 102 template<class T> 102 103 tList<T>::~tList () 103 {} 104 { 105 this->currentEl = this->first; 106 while(this->currentEl != NULL) 107 { 108 listElement* le = this->currentEl->next; 109 //delete this->currentEl->curr; 110 delete this->currentEl; 111 this->currentEl = le; 112 } 113 this->first = NULL; 114 this->last = NULL; 115 this->size = 0; 116 } 117 104 118 105 119 template<class T> 106 120 void tList<T>::add(T* entity) 107 121 { 122 if( entity == NULL) return; 108 123 listElement* el = new listElement; 109 124 el->prev = this->last; … … 113 128 this->last = el; 114 129 115 if( this->size == 0) this->first = el;130 if(el->prev == NULL) this->first = el; /* if first element */ 116 131 else el->prev->next = el; 117 132 this->size++; … … 122 137 void tList<T>::remove(T* entity) 123 138 { 139 if( entity == NULL) return; 124 140 this->currentEl = this->first; 125 141 listElement* te; … … 134 150 else this->currentEl->next->prev = this->currentEl->prev; 135 151 136 te = this->currentEl->next; 152 te = this->currentEl->next; // for what am i doing this? 137 153 delete this->currentEl; 138 154 this->currentEl = te; 155 this->size--; 139 156 return; 140 157 } … … 151 168 { 152 169 listElement* le = this->currentEl->next; 153 delete this->currentEl->curr;170 //delete this->currentEl->curr; 154 171 delete this->currentEl; 155 172 this->currentEl = le; … … 185 202 T* tList<T>::enumerate() 186 203 { 204 //if( this->last == this->first == NULL) return NULL; 187 205 if(this->size == 0) return NULL; 188 206 this->currentEl = this->first; … … 194 212 T* tList<T>::nextElement() 195 213 { 214 // if( this->last == this->first == NULL) return NULL; 196 215 if(this->size == 0) return NULL; 197 216 this->currentEl = this->currentEl->next; … … 201 220 202 221 222 /** 223 \brief this returns the next element after toEntity or the first if toEntity is last 224 */ 225 template<class T> 226 T* tList<T>::nextElement(T* toEntity) 227 { 228 //if( this->last == this->first == NULL) return NULL; 229 if(this->size == 0) return NULL; 230 if( toEntity == NULL) return this->first->curr; 231 if( toEntity == this->last->curr ) return this->first->curr; 232 this->currentEl = this->first; 233 while(this->currentEl->curr != toEntity && this->currentEl->next != NULL) 234 { 235 this->currentEl = this->currentEl->next; 236 } 237 if(this->currentEl == NULL) return NULL; 238 return this->currentEl->next->curr; 239 } 240 241 203 242 template<class T> 204 243 T* tList<T>::toArray()
Note: See TracChangeset
for help on using the changeset viewer.