1
edit
Changes
→Framework Breakdown
=== PhysicsScene ===
PhysicsScene is the coordinator responsible for all frame by frame physics simulation.It should be created in <code>Engine</code>'s constructor by calling:<pre>CreatePhysicsScene(iContext* c)</pre> The collision space, if any, should be set in <code>Engine</code>'s setup() function. We will look at this later. Let's take a look at PhysicsScene's interface:<pre>/* Physics Scene Interface - Scene Component - Model Branch * * iPhysicsScene.h * November 6 2010 */ //--------------------------- iPhysicsScene -----------------------------------//// iPhysicsScene is the interface to the physics scene coordinator//class iRigidBody;class iContext;class iCollisionSpace; class iPhysicsScene {public: // initialization functions virtual bool add(iRigidBody* o) = 0; virtual void setNewGlobalCollisionSpace(iCollisionSpace* cs) = 0; virtual void restore(int now) = 0; // execution functions virtual void update(int now) = 0; // termination functions virtual void reset(int now) = 0; virtual void suspend() const = 0; virtual void release() const = 0; virtual void remove(const iRigidBody* o) = 0; virtual void Delete() const = 0;}; extern "C"iPhysicsScene* CreatePhysicsScene(iContext* c);</pre> The standard controller functions should be called in the usual places in Engine.cpp (Delete(), release(), suspend(), reset(), restore()), please refer to Engine.cpp in the reference implementation for more details. In order to advance the simulation forward, <code>update(int now)</code> should be called every frame. Naturally, PhysicsScene's <code>update()</code> should be called from within <code>Engine</code>'s run. Physics should be update
== Integrating Framework Into Existing Projects ==