///<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); }
///<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; }
///<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; }
///<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(); }
///<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(); }