예제 #1
0
        ///<summary>
        /// Constructs a new space for things to live in.
        ///</summary>
        ///<param name="parallelLooper">Used by the space to perform multithreaded updates. Pass null if multithreading is not required.</param>
        public Space(IParallelLooper parallelLooper)
        {
            timeStepSettings = new TimeStepSettings();

            this.parallelLooper = parallelLooper;

            SpaceObjectBuffer      = new SpaceObjectBuffer(this);
            EntityStateWriteBuffer = new EntityStateWriteBuffer();
            DeactivationManager    = new DeactivationManager(TimeStepSettings, ParallelLooper);
            ForceUpdater           = new ForceUpdater(TimeStepSettings, ParallelLooper);
            BoundingBoxUpdater     = new BoundingBoxUpdater(TimeStepSettings, ParallelLooper);
            BroadPhase             = new DynamicHierarchy(ParallelLooper);
            NarrowPhase            = new NarrowPhase(TimeStepSettings, BroadPhase.Overlaps, ParallelLooper);
            Solver                  = new Solver(TimeStepSettings, DeactivationManager, ParallelLooper);
            NarrowPhase.Solver      = Solver;
            PositionUpdater         = new ContinuousPositionUpdater(TimeStepSettings, ParallelLooper);
            BufferedStates          = new BufferedStatesManager(ParallelLooper);
            DeferredEventDispatcher = new DeferredEventDispatcher();

            DuringForcesUpdateables         = new DuringForcesUpdateableManager(timeStepSettings, ParallelLooper);
            BeforeNarrowPhaseUpdateables    = new BeforeNarrowPhaseUpdateableManager(timeStepSettings, ParallelLooper);
            BeforeSolverUpdateables         = new BeforeSolverUpdateableManager(timeStepSettings, ParallelLooper);
            BeforePositionUpdateUpdateables = new BeforePositionUpdateUpdateableManager(timeStepSettings, ParallelLooper);
            EndOfTimeStepUpdateables        = new EndOfTimeStepUpdateableManager(timeStepSettings, ParallelLooper);
            EndOfFrameUpdateables           = new EndOfFrameUpdateableManager(timeStepSettings, ParallelLooper);
        }
예제 #2
0
 ///<summary>
 /// Constructs a new interpolated states manager.
 ///</summary>
 ///<param name="manager">Owning buffered states manager.</param>
 /// <param name="parallelLooper">Parallel loop provider to use.</param>
 public InterpolatedStatesManager(BufferedStatesManager manager, IParallelLooper parallelLooper)
 {
     this.manager = manager;
     multithreadedWithReadBuffersDelegate = UpdateIndex;
     FlipLocker          = new object();
     ParallelLooper      = parallelLooper;
     AllowMultithreading = true;
 }
예제 #3
0
 ///<summary>
 /// Constructs a read buffer manager.
 ///</summary>
 ///<param name="manager">Owning buffered states manager.</param>
 ///<param name="parallelLooper">Parallel loop provider to use.</param>
 public StateReadBuffers(BufferedStatesManager manager, IParallelLooper parallelLooper)
 {
     this.manager = manager;
     multithreadedStateUpdateDelegate = MultithreadedStateUpdate;
     FlipLocker          = new object();
     ParallelLooper      = parallelLooper;
     AllowMultithreading = true;
 }
예제 #4
0
 ///<summary>
 /// Constructs a new interpolated states manager.
 ///</summary>
 ///<param name="manager">Owning buffered states manager.</param>
 public InterpolatedStatesManager(BufferedStatesManager manager)
 {
     this.manager = manager;
     multithreadedWithReadBuffersDelegate = UpdateIndex;
     FlipLocker = new object();
 }
예제 #5
0
 ///<summary>
 /// Constructs a read buffer manager.
 ///</summary>
 ///<param name="manager">Owning buffered states manager.</param>
 public StateReadBuffers(BufferedStatesManager manager)
 {
     this.manager = manager;
     multithreadedStateUpdateDelegate = MultithreadedStateUpdate;
     FlipLocker = new object();
 }