Changeset 4917 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 21, 2005, 12:22:44 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
r4916 r4917 19 19 #include "quadtree_node.h" 20 20 #include "material.h" 21 #include "vector.h" 21 22 22 23 using namespace std; … … 102 103 103 104 105 QuadtreeNode* Quadtree::getQuadtreeFromPosition(const Vector& position) 106 { 107 Vector v = position; 108 Rectangle* r = this->rootNode->getDimension(); 109 float len = this->nodes[0]->getDimension()->getAxis() * 2.0f; 110 float xOff = r->getCenter()->x - r->getAxis(); 111 float yOff = r->getCenter()->z - r->getAxis(); 112 113 int i = (int)(( position.x - xOff) / len) + 1; 114 int j = (int)(( position.z - yOff) / len) + 1; 115 116 printf("the array coordinates are: %i, %i\n", i, j); 117 } 118 119 104 120 /** 105 121 * draws the debug quadtree boxes around the model -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h
r4911 r4917 30 30 31 31 float getHeight(const Vector& position); 32 Rectangle* getDimension() { return this->pDimension; } 32 33 33 34 void drawTree(int depth, int drawMode) const; -
orxonox/trunk/src/story_entities/world.cc
r4890 r4917 69 69 #include "class_list.h" 70 70 71 #include "cd_engine.h" 72 71 73 72 74 using namespace std; … … 787 789 788 790 /** 789 * checks for collisions790 791 This method runs through all WorldEntities known to the world and checks for collisions792 between them. In case of collisions the collide() method of the corresponding entities793 is called.794 */795 void World::collide ()796 {797 /*798 List *a, *b;799 WorldEntity *aobj, *bobj;800 801 a = entities;802 803 while( a != NULL)804 {805 aobj = a->nextElement();806 if( aobj->bCollide && aobj->collisioncluster != NULL)807 {808 b = a->nextElement();809 while( b != NULL )810 {811 bobj = b->nextElement();812 if( bobj->bCollide && bobj->collisioncluster != NULL )813 {814 unsigned long ahitflg, bhitflg;815 if( check_collision ( &aobj->place, aobj->collisioncluster,816 &ahitflg, &bobj->place, bobj->collisioncluster,817 &bhitflg) );818 {819 aobj->collide (bobj, ahitflg, bhitflg);820 bobj->collide (aobj, bhitflg, ahitflg);821 }822 }823 b = b->nextElement();824 }825 }826 a = a->enumerate();827 }828 */829 }830 831 /**832 * runs through all entities calling their draw() methods833 */834 void World::draw ()835 {836 /* draw entities */837 WorldEntity* entity;838 glLoadIdentity();839 //entity = this->entities->enumerate();840 tIterator<WorldEntity>* iterator = this->entities->getIterator();841 entity = iterator->nextElement();842 while( entity != NULL )843 {844 if( entity->isVisible() ) entity->draw();845 //entity = this->entities->nextElement();846 entity = iterator->nextElement();847 }848 delete iterator;849 850 glCallList (objectList);851 852 ParticleEngine::getInstance()->draw();853 854 GraphicsEngine::getInstance()->draw();855 //TextEngine::getInstance()->draw();856 }857 858 859 /**860 791 * function to put your own debug stuff into it. it can display informations about 861 792 the current class/procedure … … 863 794 void World::debug() 864 795 { 865 PRINTF(2)("debug() - starting debug\n");866 PNode* p1 = NullParent::getInstance ();867 PNode* p2 = new PNode (Vector(2, 2, 2), p1);868 PNode* p3 = new PNode (Vector(4, 4, 4), p1);869 PNode* p4 = new PNode (Vector(6, 6, 6), p2);870 871 p1->debug ();872 p2->debug ();873 p3->debug ();874 p4->debug ();875 876 p1->shiftCoor (Vector(-1, -1, -1));877 878 printf("World::debug() - shift\n");879 p1->debug ();880 p2->debug ();881 p3->debug ();882 p4->debug ();883 884 p1->update (0);885 886 printf ("World::debug() - update\n");887 p1->debug ();888 p2->debug ();889 p3->debug ();890 p4->debug ();891 892 p2->shiftCoor (Vector(-1, -1, -1));893 p1->update (0);894 895 p1->debug ();896 p2->debug ();897 p3->debug ();898 p4->debug ();899 900 p2->setAbsCoor (Vector(1,2,3));901 902 903 p1->update (0);904 905 p1->debug ();906 p2->debug ();907 p3->debug ();908 p4->debug ();909 910 delete p1;911 912 913 /*914 WorldEntity* entity;915 printf("counting all entities\n");916 printf("World::debug() - enumerate()\n");917 entity = entities->enumerate();918 while( entity != NULL )919 {920 if( entity->bDraw ) printf("got an entity\n");921 entity = entities->nextElement();922 }923 */924 796 } 925 797 … … 1075 947 1076 948 949 void World::collide() 950 { 951 952 } 953 1077 954 /** 1078 955 * render the current frame … … 1098 975 1099 976 /** 977 * runs through all entities calling their draw() methods 978 */ 979 void World::draw () 980 { 981 /* draw entities */ 982 WorldEntity* entity; 983 glLoadIdentity(); 984 //entity = this->entities->enumerate(); 985 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 986 entity = iterator->nextElement(); 987 while( entity != NULL ) 988 { 989 if( entity->isVisible() ) entity->draw(); 990 //entity = this->entities->nextElement(); 991 entity = iterator->nextElement(); 992 } 993 delete iterator; 994 995 glCallList (objectList); 996 997 ParticleEngine::getInstance()->draw(); 998 999 GraphicsEngine::getInstance()->draw(); 1000 //TextEngine::getInstance()->draw(); 1001 } 1002 1003 /** 1100 1004 * add and spawn a new entity to this world 1101 1005 * @param entity to be added
Note: See TracChangeset
for help on using the changeset viewer.