World.h

Go to the documentation of this file.
00001 
00005 /* Copyright © 2009, 2010 James Legg.
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 */
00011 #ifndef WORLD_H_
00012 #define WORLD_H_
00013 
00014 #include <set>
00015 #include <vector>
00016 #include <ostream>
00017 #include <btBulletDynamicsCommon.h>
00018 #include "TickObserver.h"
00019 #include "../InputReport.h"
00020 #include <libtrack/Track.h>
00021 
00022 namespace Engine
00023 {
00024 
00029 namespace Physics
00030 {
00031 
00032 class World
00033 {
00034 private:
00035     World & operator=(const World & world);
00036     World(const World & world);
00037 public:
00038     World(const Track::Track & track);
00039     virtual ~World();
00040     void update(unsigned int milliseconds_elapsed);
00041     btDiscreteDynamicsWorld & get_dynamics_world();
00042     void add_tick_observer(TickObserver * observer);
00043     void remove_tick_observer(TickObserver * observer);
00045     btCollisionWorld & get_floor_world();
00046     
00052     void add_replay_report(const InputReport & report);
00053     
00060     void write_replay_events(std::ostream & stream);
00061     
00063     unsigned long int get_tick_number();
00064     
00066     const Track::Track & get_track();
00067 private:
00068     const Track::Track & m_track;
00069     
00070     btAxisSweep3* broadphase;
00071     btAxisSweep3* floor_broadphase;
00072     btDefaultCollisionConfiguration* collisionConfiguration;
00073     btDefaultCollisionConfiguration* floor_collision_configuration;
00074     btCollisionDispatcher* dispatcher;
00075     btCollisionDispatcher* floor_dispatcher;
00076     btSequentialImpulseConstraintSolver* solver;
00078     btDiscreteDynamicsWorld* dynamicsWorld;
00080     btCollisionWorld * floor_world;
00081     
00082     std::set<TickObserver *> observers;
00083     
00084     int milliseconds_remaining;
00085     
00087     struct ReplayEvent
00088     {
00089         ReplayEvent(unsigned long int tick_number, const InputReport & report);
00090         unsigned long int tick_number;
00091         InputReport report;
00092     };
00093     
00095     std::vector<ReplayEvent> replay_events;
00097     unsigned long int tick_number;
00098 };
00099 
00100 }
00101 
00102 }
00103 
00104 #endif /*WORLD_H_*/

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:12 2010 by Doxygen version 1.4.7 for Racer version svn335.