示例#1
0
        protected Simulation(BufferPool bufferPool, SimulationAllocationSizes initialAllocationSizes)
        {
            BufferPool = bufferPool;
            Shapes     = new Shapes(bufferPool, initialAllocationSizes.ShapesPerType);
            BroadPhase = new BroadPhase(bufferPool, initialAllocationSizes.Bodies, initialAllocationSizes.Bodies + initialAllocationSizes.Statics);
            Bodies     = new Bodies(bufferPool, Shapes, BroadPhase,
                                    initialAllocationSizes.Bodies,
                                    initialAllocationSizes.Islands,
                                    initialAllocationSizes.ConstraintCountPerBodyEstimate);
            Statics = new Statics(bufferPool, Shapes, Bodies, BroadPhase, initialAllocationSizes.Statics);

            Solver = new Solver(Bodies, BufferPool, 8,
                                initialCapacity: initialAllocationSizes.Constraints,
                                initialIslandCapacity: initialAllocationSizes.Islands,
                                minimumCapacityPerTypeBatch: initialAllocationSizes.ConstraintsPerTypeBatch);
            constraintRemover = new ConstraintRemover(BufferPool, Bodies, Solver);
            Sleeper           = new IslandSleeper(Bodies, Solver, BroadPhase, constraintRemover, BufferPool);
            Awakener          = new IslandAwakener(Bodies, Statics, Solver, BroadPhase, Sleeper, bufferPool);
            Statics.awakener  = Awakener;
            Solver.awakener   = Awakener;
            Bodies.Initialize(Solver, Awakener);
            PoseIntegrator            = new PoseIntegrator(Bodies, Shapes, BroadPhase);
            SolverBatchCompressor     = new BatchCompressor(Solver, Bodies);
            BodyLayoutOptimizer       = new BodyLayoutOptimizer(Bodies, BroadPhase, Solver, bufferPool);
            ConstraintLayoutOptimizer = new ConstraintLayoutOptimizer(Bodies, Solver);
        }
示例#2
0
        public Simulation(BufferPool bufferPool, SimulationAllocationSizes initialAllocationSizes, int solverIterationCount, int solverFallbackBatchThreshold, ITimestepper timestepper)
        {
            BufferPool = bufferPool;
            Shapes     = new Shapes(bufferPool, initialAllocationSizes.ShapesPerType);
            BroadPhase = new BroadPhase(bufferPool, initialAllocationSizes.Bodies, initialAllocationSizes.Bodies + initialAllocationSizes.Statics);
            Bodies     = new Bodies(bufferPool, Shapes, BroadPhase,
                                    initialAllocationSizes.Bodies,
                                    initialAllocationSizes.Islands,
                                    initialAllocationSizes.ConstraintCountPerBodyEstimate);
            Statics = new Statics(bufferPool, Shapes, Bodies, BroadPhase, initialAllocationSizes.Statics);

            Solver = new Solver(Bodies, BufferPool, solverIterationCount, solverFallbackBatchThreshold,
                                initialCapacity: initialAllocationSizes.Constraints,
                                initialIslandCapacity: initialAllocationSizes.Islands,
                                minimumCapacityPerTypeBatch: initialAllocationSizes.ConstraintsPerTypeBatch);
            constraintRemover = new ConstraintRemover(BufferPool, Bodies, Solver);
            Sleeper           = new IslandSleeper(Bodies, Solver, BroadPhase, constraintRemover, BufferPool);
            Awakener          = new IslandAwakener(Bodies, Statics, Solver, BroadPhase, Sleeper, bufferPool);
            Statics.awakener  = Awakener;
            Solver.awakener   = Awakener;
            Bodies.Initialize(Solver, Awakener);
            SolverBatchCompressor     = new BatchCompressor(Solver, Bodies);
            BodyLayoutOptimizer       = new BodyLayoutOptimizer(Bodies, BroadPhase, Solver, bufferPool);
            ConstraintLayoutOptimizer = new ConstraintLayoutOptimizer(Bodies, Solver);
            Timestepper = timestepper;
        }
示例#3
0
        public IslandAwakener(Bodies bodies, Statics statics, Solver solver, BroadPhase broadPhase, IslandSleeper sleeper, BufferPool pool)
        {
            this.bodies     = bodies;
            this.statics    = statics;
            this.solver     = solver;
            this.broadPhase = broadPhase;
            this.sleeper    = sleeper;
            this.pool       = pool;

            this.phaseOneWorkerDelegate = PhaseOneWorker;
            this.phaseTwoWorkerDelegate = PhaseTwoWorker;
        }