int main(int argc, char** argv) { DemoApplication app; app.setup(); return app.exec(); }
int main(int argc,char** argv) { DemoApplication ccdDemo; ccdDemo.getBulletWorld()->getDynamicsWorld()->setDebugDrawer(&sDebugDraw); #ifdef CHECK_MEMORY_LEAKS ccdDemo.exitPhysics(); #else return glutmain(argc, argv,1024,600,"Bullet Physics Demo. http://bulletphysics.org",&ccdDemo); #endif //default glut doesn't return from mainloop return 0; }
virtual CcdPhysicsController* CreatePhysicsObject(bool isDynamic, float mass, const SimdTransform& startTransform, CollisionShape* shape) { CcdPhysicsController* ctrl = m_demoApp->LocalCreatePhysicsObject(isDynamic, mass, startTransform,shape); return ctrl; }
DemoApplication* CreatDemo(btDemoEntry* entry) { DemoApplication* demo = entry->createFcn(); btAssert(demo); if (demo->getDynamicsWorld()) { demo->getDynamicsWorld()->setDebugDrawer(new GLDebugDrawer()); gDrawTextures = demo->getTexturing(); gDrawShadows = demo->getShadows(); if (glui) glui->sync_live(); } #ifndef BT_NO_PROFILE CProfileManager::Reset(); #endif //BT_NO_PROFILE return demo; }
virtual void AddConvexVerticesCollider(std::vector<SimdVector3>& vertices, bool isEntity, const SimdVector3& entityTargetLocation) { ///perhaps we can do something special with entities (isEntity) ///like adding a collision Triggering (as example) if (vertices.size() > 0) { bool isDynamic = false; float mass = 0.f; SimdTransform startTransform; //can use a shift startTransform.setIdentity(); startTransform.setOrigin(SimdVector3(0,0,-10.f)); //this create an internal copy of the vertices CollisionShape* shape = new ConvexHullShape(&vertices[0],vertices.size()); m_demoApp->LocalCreatePhysicsObject(isDynamic, mass, startTransform,shape); } }
///those 2 virtuals are called for each constraint/physics object virtual int createUniversalD6Constraint( class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, SimdTransform& localAttachmentFrameRef, SimdTransform& localAttachmentOther, const SimdVector3& linearMinLimits, const SimdVector3& linearMaxLimits, const SimdVector3& angularMinLimits, const SimdVector3& angularMaxLimits ) { return m_demoApp->GetPhysicsEnvironment()->createUniversalD6Constraint( ctrlRef,ctrlOther, localAttachmentFrameRef, localAttachmentOther, linearMinLimits, linearMaxLimits, angularMinLimits, angularMaxLimits ); }
virtual void setCameraInfo(const btVector3& camUp,int forwardAxis) { m_demoApp->setCameraUp(camUp); m_demoApp->setCameraForwardAxis(forwardAxis); }
virtual void SetGravity(const SimdVector3& grav) { m_demoApp->GetPhysicsEnvironment()->setGravity(grav.getX(),grav.getY(),grav.getZ()); }