protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            if (!(HasSingleton <PhysicsDebugDisplayData>() && GetSingleton <PhysicsDebugDisplayData>().DrawTriggerEvents != 0))
            {
                return(inputDeps);
            }

            unsafe
            {
                // Allocate a block of memory to store our debug output, so it can be shared across the display/finish jobs
                var sharedOutput = (DebugStream.Context *)UnsafeUtility.Malloc(sizeof(DebugStream.Context), 16, Allocator.TempJob);
                *   sharedOutput = m_DebugStreamSystem.GetContext(1);
                sharedOutput->Begin(0);

                var job = new DisplayTriggerEventsJob
                {
                    World = m_BuildPhysicsWorldSystem.PhysicsWorld,
                    OutputStreamContext = sharedOutput
                };

                JobHandle handle = ScheduleTriggerEventsJob(job, m_StepPhysicsWorldSystem.Simulation, ref m_BuildPhysicsWorldSystem.PhysicsWorld, inputDeps);

#pragma warning disable 618
                JobHandle finishHandle = new FinishDisplayTriggerEventsJob
                {
                    OutputStreamContext = sharedOutput
                }.Schedule(handle);
#pragma warning restore 618

                m_EndFramePhysicsSystem.HandlesToWaitFor.Add(finishHandle);

                return(handle);
            }
        }
Exemplo n.º 2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            if (!(HasSingleton <PhysicsDebugDisplayData>() && GetSingleton <PhysicsDebugDisplayData>().DrawTriggerEvents != 0))
            {
                return(inputDeps);
            }

            inputDeps = JobHandle.CombineDependencies(inputDeps, m_BuildPhysicsWorldSystem.FinalJobHandle, m_StepPhysicsWorldSystem.FinalSimulationJobHandle);

            JobHandle handle = new DisplayTriggerEventsJob
            {
                World         = m_BuildPhysicsWorldSystem.PhysicsWorld,
                TriggerEvents = m_StepPhysicsWorldSystem.Simulation.TriggerEvents,
                OutputStream  = m_DebugStreamSystem.GetContext(1)
            }.Schedule(1, 1, inputDeps);

            m_EndFramePhysicsSystem.HandlesToWaitFor.Add(handle);

            return(handle);
        }
 protected virtual JobHandle ScheduleTriggerEventsJob(DisplayTriggerEventsJob job, ISimulation simulation, ref PhysicsWorld world, JobHandle inDeps)
 {
     // Explicitly call ScheduleImpl here, to avoid a dependency on Havok.Physics
     return(job.ScheduleImpl(simulation, ref world, inDeps));
 }