浏览代码

Disable a number of scene view draw modes for LWRP

/2018.1
Peter Bay Bastian 7 年前
当前提交
c19983e2
共有 3 个文件被更改,包括 67 次插入0 次删除
  1. 8
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 48
      ScriptableRenderPipeline/LightweightPipeline/LWRP/SceneViewDrawMode.cs
  3. 11
      ScriptableRenderPipeline/LightweightPipeline/LWRP/SceneViewDrawMode.cs.meta

8
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
#if UNITY_EDITOR
using UnityEditor.Experimental.Rendering.LightweightPipeline;
#endif
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;

CoreUtils.Destroy(m_ErrorMaterial);
CoreUtils.Destroy(m_CopyDepthMaterial);
CoreUtils.Destroy(m_BlitMaterial);
#if UNITY_EDITOR
SceneViewDrawMode.ResetDrawMode();
#endif
}
private void SetRenderingFeatures()

rendererSupportsReceiveShadows = true,
rendererSupportsReflectionProbes = true
};
SceneViewDrawMode.SetupDrawMode();
#endif
}

48
ScriptableRenderPipeline/LightweightPipeline/LWRP/SceneViewDrawMode.cs


#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering.LightweightPipeline
{
internal static class SceneViewDrawMode
{
static 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.SpriteMask ||
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;
}
public static void SetupDrawMode()
{
ArrayList sceneViewArray = SceneView.sceneViews;
foreach (SceneView sceneView in sceneViewArray)
sceneView.onValidateCameraMode += RejectDrawMode;
}
public static void ResetDrawMode()
{
ArrayList sceneViewArray = SceneView.sceneViews;
foreach (SceneView sceneView in sceneViewArray)
sceneView.onValidateCameraMode -= RejectDrawMode;
}
}
}
#endif

11
ScriptableRenderPipeline/LightweightPipeline/LWRP/SceneViewDrawMode.cs.meta


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