Changeset 1591
- Timestamp:
- Jul 8, 2012, 6:16:57 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build/vs2010/Lol.Core.Vars.props
r1586 r1591 23 23 <BtPhysDir>$(ContribDir)\bullet-2.80-rev2531</BtPhysDir> 24 24 <BtPhysIncludes>$(BtPhysDir)\include;$(BtPhysDir)\include\bullet</BtPhysIncludes> 25 <Win32Defines>HAVE_PHYS_USE_BULLET;$(Win32Defines)</Win32Defines> 25 26 26 27 <!-- GTK+ & GtkGl --> 27 28 <GtkDir>$(ContribDir)\gtk-2.22.1</GtkDir> 28 29 <GtkGlDir>$(ContribDir)\gtkglarea-2.0.1</GtkGlDir> -
trunk/test/BtPhysTest.cpp
r1581 r1591 41 41 using namespace lol; 42 42 43 #ifndef HAVE_PHYS_USE_BULLET 44 #define HAVE_PHYS_USE_BULLET 45 #endif /* HAVE_PHYS_USE_BULLET */ 46 47 #include "Physics\LolPhysics.h" 48 #include "Physics\EasyPhysics.h" 49 #include "PhysicObject.h" 43 50 #include "BtPhysTest.h" 51 52 using namespace lol::phys; 44 53 45 54 #define CUBE_HALF_EXTENTS .5f … … 61 70 m_ready = false; 62 71 72 m_simulation = new Simulation(); 73 m_simulation->InitContext(); 74 m_simulation->SetGravity(vec3(.0f, -10.0f, .0f)); 75 76 m_ground_object = new PhysicsObject(m_simulation); 77 Ticker::Ref(m_ground_object); 78 79 for (int x=0; x < 10; x++) 80 { 81 for (int y=0; y < 10; y++) 82 { 83 PhysicsObject* new_physobj = new PhysicsObject(m_simulation, 10.f, vec3(0.f, 20.f, -20.0f) + vec3(.0f, 4.f * (float)y, 4.f * (float)x)); 84 m_physobj_list << new_physobj; 85 Ticker::Ref(new_physobj); 86 } 87 } 88 89 #if 0 63 90 //init Physics 64 91 { … … 70 97 //use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded) 71 98 m_bt_dispatcher = new btCollisionDispatcher(m_bt_collision_config); 72 m_bt_dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE,BOX_SHAPE_PROXYTYPE,m_bt_collision_config->getCollisionAlgorithmCreateFunc(CONVEX_SHAPE_PROXYTYPE,CONVEX_SHAPE_PROXYTYPE)); 99 m_bt_dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE, 100 BOX_SHAPE_PROXYTYPE, 101 m_bt_collision_config->getCollisionAlgorithmCreateFunc(CONVEX_SHAPE_PROXYTYPE, 102 CONVEX_SHAPE_PROXYTYPE)); 73 103 74 104 m_bt_broadphase = new btDbvtBroadphase(); … … 89 119 btCollisionShape* groundShape = box; 90 120 m_bt_collision_shapes << groundShape; 91 m_ground_mesh.Compile("[sc#ddd afcb 110 1 110 -1]");121 m_ground_mesh.Compile("[sc#ddd afcb220 2 220 -1]"); 92 122 93 123 //m_bt_collision_shapes << new btCylinderShape(btVector3(.5f,.5f,.5f)); … … 152 182 //stack them 153 183 int colsize = 10; 154 int row = (i*CUBE_HALF_EXTENTS*2)/(colsize*2*CUBE_HALF_EXTENTS);184 int row = int(((float)i*CUBE_HALF_EXTENTS*2.0f)/((float)colsize*2.0f*CUBE_HALF_EXTENTS)); 155 185 int row2 = row; 156 186 int col = (i)%(colsize)-colsize/2; … … 200 230 } 201 231 } 232 #endif 202 233 } 203 234 … … 209 240 Ticker::Shutdown(); 210 241 242 m_simulation->TickContext(seconds); 243 244 m_camera->SetTarget(vec3(.0f)); 245 m_camera->SetPosition(vec3(-30.0f, 10.0f, .0f)); 246 247 #if 0 211 248 ///step the simulation 212 249 if (m_bt_world) 213 250 { 214 int steps = (int)(seconds / 0.005f);215 for (int i = 0; i < steps; i++)216 m_bt_world->stepSimulation(seconds / steps);251 //int steps = (int)(seconds / 0.005f); 252 //for (int i = 0; i < steps; i++) 253 m_bt_world->stepSimulation(seconds /*/ steps*/); 217 254 //optional but useful: debug drawing 218 255 //m_bt_world->debugDrawWorld(); 219 256 } 257 #endif 220 258 } 221 259 … … 226 264 if (!m_ready) 227 265 { 266 #if 0 228 267 m_ground_mesh.MeshConvert(); 229 268 m_rigid_mesh[0].MeshConvert(); … … 233 272 m_rigid_mesh[4].MeshConvert(); 234 273 m_rigid_mesh[5].MeshConvert(); 274 #endif 235 275 /* FIXME: this object never cleans up */ 236 276 m_ready = true; … … 239 279 Video::SetClearColor(vec4(0.0f, 0.0f, 0.12f, 1.0f)); 240 280 281 #if 0 241 282 vec3 BarycenterLocation = vec3(.0f); 242 283 float BarycenterFactor = 0.0f; … … 275 316 m_camera->SetPosition(BarycenterLocation + vec3(-20.0f, 8.0f, .0f)); 276 317 } 318 #endif 277 319 } 278 320 … … 281 323 Ticker::Unref(m_camera); 282 324 325 #if 0 283 326 //Exit Physics 284 327 { … … 310 353 delete m_bt_collision_config; 311 354 } 355 #endif 312 356 } 313 357 -
trunk/test/BtPhysTest.h
r1581 r1591 24 24 Camera* m_camera; 25 25 bool m_ready; 26 27 lol::phys::Simulation* m_simulation; 28 Array<PhysicsObject*> m_physobj_list; 29 PhysicsObject* m_ground_object; 30 31 #if 0 26 32 EasyMesh m_ground_mesh; 27 33 EasyMesh m_rigid_mesh[6]; … … 41 47 Array<btCollisionShape*> m_bt_collision_shapes; 42 48 Array<btCollisionShape*> m_bt_dynamic_shapes; 49 #endif 43 50 }; 44 51 -
trunk/test/BtPhysTest.vcxproj
r1554 r1591 37 37 <ItemGroup> 38 38 <ClInclude Include="BtPhysTest.h" /> 39 <ClInclude Include="PhysicObject.h" /> 40 <ClInclude Include="Physics\EasyPhysics.h" /> 41 <ClInclude Include="Physics\LolBtPhysicsIntegration.h" /> 42 <ClInclude Include="Physics\LolPhysics.h" /> 39 43 </ItemGroup> 40 44 <ItemGroup> 41 45 <ClCompile Include="BtPhysTest.cpp" /> 46 <ClCompile Include="Physics\EasyPhysics.cpp" /> 42 47 </ItemGroup> 43 48 <ItemGroup> -
trunk/test/BtPhysTest.vcxproj.filters
r1554 r1591 3 3 <ItemGroup> 4 4 <ClInclude Include="BtPhysTest.h" /> 5 <ClInclude Include="Physics\EasyPhysics.h"> 6 <Filter>Physics</Filter> 7 </ClInclude> 8 <ClInclude Include="Physics\LolPhysics.h"> 9 <Filter>Physics</Filter> 10 </ClInclude> 11 <ClInclude Include="Physics\LolBtPhysicsIntegration.h"> 12 <Filter>Physics</Filter> 13 </ClInclude> 14 <ClInclude Include="PhysicObject.h" /> 5 15 </ItemGroup> 6 16 <ItemGroup> 7 17 <ClCompile Include="BtPhysTest.cpp" /> 18 <ClCompile Include="Physics\EasyPhysics.cpp"> 19 <Filter>Physics</Filter> 20 </ClCompile> 8 21 </ItemGroup> 9 22 <ItemGroup> … … 11 24 <UniqueIdentifier>{4fc7662b-b17a-49b9-acd1-0cf767183b06}</UniqueIdentifier> 12 25 </Filter> 26 <Filter Include="Physics"> 27 <UniqueIdentifier>{ccecd634-9321-4c49-9471-e9da50dda6d3}</UniqueIdentifier> 28 </Filter> 13 29 </ItemGroup> 14 30 </Project>
Note: See TracChangeset
for help on using the changeset viewer.