internal static bool IsSubsystemStateValid()
 {
     return(s_NativeProviderPtr != IntPtr.Zero &&
            !s_NativeTrackerCreationJobHandle.Equals(default(JobHandle)) &&
            s_NativeTrackerCreationJobHandle.IsCompleted &&
            Native.IsNativeTrackerHandleValid(s_NativeProviderPtr));
 }
            protected override JobHandle OnUpdate(JobHandle inputDeps)
            {
                if (!inputDeps.Equals(new JobHandle()))//after completing all jobs an empty jobhandle is returned.
                {
                    throw new Exception("InputDeps were not forced to completion earlier in frame.");
                }

                return(new TestJob().Schedule(m_Group, inputDeps));
            }
Esempio n. 3
0
            unsafe void CheckPreviewJobsForCompletion()
            {
                var repaintSceneViews = false;

                foreach (var job in m_PreviewJobsOutput.Keys.ToArray()) // TODO: don't allocate on heap
                {
                    // repaint scene views to indicate progress if most recent preview job is still in the queue
                    var mostRecentlyScheduledJob = m_MostRecentlyScheduledJob.Equals(job);
                    repaintSceneViews |= mostRecentlyScheduledJob;

                    if (!job.IsCompleted)
                    {
                        continue;
                    }

                    var output = m_PreviewJobsOutput[job];
                    m_PreviewJobsOutput.Remove(job);
                    job.Complete();

                    // only populate preview edge data if not already disposed and this job was actually the most recent
                    if (!m_Disposed && mostRecentlyScheduledJob)
                    {
                        switch (((ConvexCollider *)output[0].GetUnsafePtr())->Type)
                        {
                        case ColliderType.Convex:
                            DrawingUtility.GetConvexHullEdges(
                                ref ((ConvexCollider *)output[0].GetUnsafePtr())->ConvexHull, s_ReusableEdges
                                );
                            break;

                        case ColliderType.Mesh:
                            DrawingUtility.GetMeshEdges(ref ((MeshCollider *)output[0].GetUnsafePtr())->Mesh, s_ReusableEdges);
                            break;
                        }

                        Edges = s_ReusableEdges.ToArray();

                        EditorApplication.delayCall += SceneViewUtility.ClearNotificationInSceneView;
                    }

                    output[0].Release();
                    output.Dispose();
                }

                if (repaintSceneViews)
                {
                    SceneView.RepaintAll();
                }

                if (m_PreviewJobsOutput.Count == 0)
                {
                    EditorApplication.update -= CheckPreviewJobsForCompletion;
                }
            }
Esempio n. 4
0
    void FixedUpdate()
    {
        for (int i = 0; i < allShots.Count; i++)
        {
            Shot shot = allShots[i];
            if (shot.completed)
            {
                if (activeShotLines.ContainsKey(shot))
                {
                    DetachLine(shot);
                }
                allShots.RemoveAt(i);
            }
            else if (shot.readyToFire)
            {
                readyShotsIndex.Add(i);
            }
            else
            {
                shot.Tick();
            }
        }

        shotCountText.text = "Current Shots: " + allShots.Count;
        rayCountText.text  = "Updating Rays: " + readyShotsIndex.Count;

        if (readyShotsIndex.Count != 0 && !shotsHandle.Equals(null))
        {
            if (shotsHandle.IsCompleted && !shotRays.IsCreated && !shotResults.IsCreated)
            {
                DoReadyShots(readyShotsIndex.Count, ref hitsThisFrame, ref shotsHandle);
            }
            UpdateAllShots(readyShotsIndex.Count, hitsThisFrame);

            readyShotsIndex.Clear();
            hitsThisFrame.Clear();
        }
    }