8#pragma warning(disable:4355)
19 m_EnterCallback = callback;
24 m_InsideCallback = callback;
29 m_ExitCallback = callback;
34World::World(Ogre::Real desiredFps,
int maxUpdatesPerFrames, Ogre::String name) :
35 m_bodyInAABBIterator(this)
39 NewtonWorldSetUserData(
m_world,
this);
95void World::setPreListener(std::string name,
void*
const listenerUserData, NewtonWorldUpdateListenerCallback update)
97 NewtonWorldAddPreListener(
m_world, name.c_str(), listenerUserData,
update, NULL);
102 NewtonWorldAddPostListener(
m_world, name.c_str(), listenerUserData,
update, NULL);
107 if (maxUpdatesPerFrames < 1) {
108 maxUpdatesPerFrames = 1;
111 if (desiredFps < 120.0f)
113 else if (desiredFps > 600.0f)
126 NewtonSetMemorySystem (newtonAlloc, newtonFree);
131 NewtonSetThreadsCount(
m_world, threads);
139 float ntimeStep = t_step;
185 body->updateNode(1.0f);
193 NewtonBody* body = NewtonWorldGetFirstBody(
m_world );
195 return (
Body*) NewtonBodyGetUserData(body);
208 NewtonSetSolverModel(
m_world, model);
209 NewtonSetFrictionModel(
m_world, model);
main class for all Rigid Bodies in the system.
Body * getNext() const
use this function to iterate through all bodies
For viewing the Newton rigid bodies visually.
represents a physics world.
World(Ogre::Real desiredFps=100.0f, int maxUpdatesPerFrames=5, Ogre::String name="main")
Constructor, creates the world and gives it a name.
void setPreListener(std::string name, void *const listenerUserData, NewtonWorldUpdateListenerCallback update)
void DestroyController(CustomTriggerController *const controller)
WorldTriggerManager * m_triggerManager
static void setAllocators(NewtonAllocMemory newtonAlloc, NewtonFreeMemory newtonFree)
Set the newton world allocators,.
MaterialID * m_defaultMatID
void setpostListener(std::string name, void *const listenerUserData, NewtonWorldUpdateListenerCallback update)
Ogre::Vector3 m_defaultAngularDamping
int update(Ogre::Real t_step)
update the world by the specified time_step.
void setThreadCount(int threads)
set the number of threads for the physics simulation to use, don't do this while world update
void setSolverModel(int model)
set the physics solver model
CustomTriggerController * CreateController(const dMatrix &matrix, NewtonCollision *const convexShape)
Ogre::Real m_timeAcumulator
void setUpdateFPS(Ogre::Real desiredFps, int maxUpdatesPerFrames)
set simulation frames per and max updated per updates
Body * getFirstBody() const
to iterate through all bodies call this function and then use body->getNext()
~World()
Standard Destructor, destroys the world.
Ogre::Real m_defaultLinearDamping
void setTriggerInsideCallback(WorldTriggerInsideCallback callback)
void setTriggerExitCallback(WorldTriggerExitCallback callback)
void setTriggerEnterCallback(WorldTriggerEnterCallback callback)
CustomTriggerController * CreateController(const dMatrix &matrix, NewtonCollision *const convexShape)
void DestroyController(CustomTriggerController *const controller)
WorldTriggerManager(World *const world)
std::function< void(NewtonBody *const visitor)> WorldTriggerInsideCallback
std::function< void(NewtonBody *const visitor)> WorldTriggerEnterCallback
std::function< void(NewtonBody *const visitor)> WorldTriggerExitCallback