コード例 #1
0
        /// <summary>Submit a camera for rendering.</summary>
        /// <param name="allowCameraDefault">Indicates if built-in command builders and custom ones without a custom CommandBuilder.cameraTargets should render to this camera.</param>
        void Submit(Camera camera, CommandBuffer cmd, bool usingRenderPipeline, bool allowCameraDefault)
        {
            // This must always be done to avoid a potential memory leak if gizmos are never drawn
            RemoveDestroyedGizmoDrawers();
#if UNITY_EDITOR
            bool drawGizmos = Handles.ShouldRenderGizmos() || drawToAllCameras;
#else
            bool drawGizmos = false;
#endif
            // Only build gizmos if a camera actually needs them.
            // This is only done for the first camera that needs them each frame.
            if (drawGizmos && !builtGizmos && allowCameraDefault)
            {
                builtGizmos = true;
                DrawGizmos(usingRenderPipeline);
            }

            UnityEngine.Profiling.Profiler.BeginSample("Submit Gizmos");
            Draw.builder.DisposeInternal();
            Draw.ingame_builder.DisposeInternal();
            gizmos.Render(camera, drawGizmos, cmd, allowCameraDefault, detectedRenderPipeline);
            Draw.builder        = gizmos.GetBuiltInBuilder(false);
            Draw.ingame_builder = gizmos.GetBuiltInBuilder(true);
            UnityEngine.Profiling.Profiler.EndSample();
        }
コード例 #2
0
        void Submit(Camera camera, CommandBuffer cmd, bool usingRenderPipeline)
        {
            // This must always be done to avoid a potential memory leak if gizmos are never drawn
            RemoveDestroyedGizmoDrawers();
#if UNITY_EDITOR
            bool drawGizmos = Handles.ShouldRenderGizmos() || drawToAllCameras;
#else
            bool drawGizmos = false;
#endif
            if (drawGizmos && !builtGizmos)
            {
                builtGizmos = true;
                DrawGizmos(usingRenderPipeline);
            }

            UnityEngine.Profiling.Profiler.BeginSample("Submit Gizmos");
            Draw.builder.Dispose();
            gizmos.Render(camera, drawGizmos, cmd);
            Draw.builder = gizmos.GetBuilder();
            UnityEngine.Profiling.Profiler.EndSample();
        }