浏览代码

Merge pull request #890 from Unity-Technologies/Disable-Unused-camera-draw-mode

HDRenderPipeline: Disable Unused camera draw mode
/main
GitHub 7 年前
当前提交
4c36ac1b
共有 3 个文件被更改,包括 66 次插入6 次删除
  1. 17
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  2. 44
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/SceneViewDrawMode.cs
  3. 11
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/SceneViewDrawMode.cs.meta

17
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


}
}
public class HDRenderPipeline : RenderPipeline
{
enum ForwardPass

rendererSupportsReceiveShadows = true,
rendererSupportsReflectionProbes = true
};
#if UNITY_EDITOR
SceneViewDrawMode.SetupDrawMode();
#endif
}
void InitializeDebugMaterials()

m_VolumetricLightingModule.Cleanup();
SupportedRenderingFeatures.active = new SupportedRenderingFeatures();
#if UNITY_EDITOR
SceneViewDrawMode.ResetDrawMode();
#endif
}
void CreateDepthStencilBuffer(HDCamera hdCamera)

m_LightLoop.UpdateCullingParameters(ref cullingParams);
#if UNITY_EDITOR
#endif
// decal system needs to be updated with current camera
if (m_FrameSettings.enableDBuffer)
DecalSystem.instance.BeginCull(camera);

// Make sure to unbind every render texture here because in the next iteration of the loop we might have to reallocate render texture (if the camera size is different)
cmd.SetRenderTarget(new RenderTargetIdentifier(-1), new RenderTargetIdentifier(-1));
#if UNITY_EDITOR
{
#endif
}
}
// Caution: ExecuteCommandBuffer must be outside of the profiling bracket

44
ScriptableRenderPipeline/HDRenderPipeline/HDRP/SceneViewDrawMode.cs


#if UNITY_EDITOR
using System.Collections;
using UnityEditor;
using UnityEditor.Experimental.Rendering;
public class SceneViewDrawMode
{
static private bool RejectDrawMode(SceneView.CameraMode cameraMode)
{
if (cameraMode.drawMode == DrawCameraMode.TexturedWire ||
cameraMode.drawMode == DrawCameraMode.ShadowCascades ||
cameraMode.drawMode == DrawCameraMode.RenderPaths ||
cameraMode.drawMode == DrawCameraMode.AlphaChannel ||
cameraMode.drawMode == DrawCameraMode.Overdraw ||
cameraMode.drawMode == DrawCameraMode.Mipmaps ||
cameraMode.drawMode == DrawCameraMode.DeferredDiffuse ||
cameraMode.drawMode == DrawCameraMode.DeferredSpecular ||
cameraMode.drawMode == DrawCameraMode.DeferredSmoothness ||
cameraMode.drawMode == DrawCameraMode.DeferredNormal ||
cameraMode.drawMode == DrawCameraMode.ValidateAlbedo ||
cameraMode.drawMode == DrawCameraMode.ValidateMetalSpecular ||
cameraMode.drawMode == DrawCameraMode.ShadowMasks ||
cameraMode.drawMode == DrawCameraMode.LightOverlap
)
return false;
return true;
}
static public void SetupDrawMode()
{
ArrayList sceneViewArray = SceneView.sceneViews;
foreach (SceneView sceneView in sceneViewArray)
sceneView.onValidateCameraMode += RejectDrawMode;
}
static public void ResetDrawMode()
{
ArrayList sceneViewArray = SceneView.sceneViews;
foreach (SceneView sceneView in sceneViewArray)
sceneView.onValidateCameraMode -= RejectDrawMode;
}
}
#endif

11
ScriptableRenderPipeline/HDRenderPipeline/HDRP/SceneViewDrawMode.cs.meta


fileFormatVersion: 2
guid: 1ce13303c7796bd4d80d623d982e7460
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存