浏览代码

Merge pull request #743 from Unity-Technologies/feature/LightLoopDefaultData

Refactor default data component
/main
GitHub 7 年前
当前提交
4ac572c2
共有 3 个文件被更改,包括 42 次插入11 次删除
  1. 22
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  2. 20
      ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs
  3. 11
      ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs.meta

22
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


static ComputeBuffer s_EnvLightDatas = null;
static ComputeBuffer s_shadowDatas = null;
static Texture2DArray m_DefaultTexture2DArray;
static Cubemap m_DefaultTextureCube;
static Texture2DArray s_DefaultTexture2DArray;
static Cubemap s_DefaultTextureCube;
static HDAdditionalReflectionData defaultHDAdditionalReflectionData { get { return ComponentSingleton<HDAdditionalReflectionData>.instance; } }
static HDAdditionalLightData defaultHDAdditionalLightData { get { return ComponentSingleton<HDAdditionalLightData>.instance; } }
static HDAdditionalCameraData defaultHDAdditionalCameraData { get { return ComponentSingleton<HDAdditionalCameraData>.instance; } }
ReflectionProbeCache m_ReflectionProbeCache;
TextureCache2D m_CookieTexArray;

FrameSettings m_FrameSettings = null;
RenderPipelineResources m_Resources = null;
// this defualt additionalLightData is use for lights that don't have any (like preview light)
HDAdditionalLightData defaultHDAdditionalLightData = new HDAdditionalLightData();
HDAdditionalReflectionData defaultHDAdditionalReflectionData = new HDAdditionalReflectionData();
// Following is an array of material of size eight for all combination of keyword: OUTPUT_SPLIT_LIGHTING - LIGHTLOOP_TILE_PASS - SHADOWS_SHADOWMASK - USE_FPTL_LIGHTLIST/USE_CLUSTERED_LIGHTLIST - DEBUG_DISPLAY
Material[] m_deferredLightingMaterial;

m_DebugViewTilesMaterial = CoreUtils.CreateEngineMaterial(m_Resources.debugViewTilesShader);
m_DefaultTexture2DArray = new Texture2DArray(1, 1, 1, TextureFormat.ARGB32, false);
m_DefaultTexture2DArray.SetPixels32(new Color32[1] { new Color32(128, 128, 128, 128) }, 0);
m_DefaultTexture2DArray.Apply();
s_DefaultTexture2DArray = new Texture2DArray(1, 1, 1, TextureFormat.ARGB32, false);
s_DefaultTexture2DArray.SetPixels32(new Color32[1] { new Color32(128, 128, 128, 128) }, 0);
s_DefaultTexture2DArray.Apply();
m_DefaultTextureCube = new Cubemap(16, TextureFormat.ARGB32, false);
m_DefaultTextureCube.Apply();
s_DefaultTextureCube = new Cubemap(16, TextureFormat.ARGB32, false);
s_DefaultTextureCube.Apply();
#if UNITY_EDITOR
UnityEditor.SceneView.onSceneGUIDelegate -= OnSceneGUI;

20
ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs


namespace UnityEngine.Experimental.Rendering
{
// Use this class to get a static instance of a component
// Mainly used to have a default instance
public static class ComponentSingleton<TType>
where TType : Component
{
static TType s_Instance = null;
public static TType instance
{
get
{
return s_Instance ?? (s_Instance = new GameObject("Default " + typeof(TType))
{
hideFlags = HideFlags.HideAndDontSave
}.AddComponent<TType>());
}
}
}
}

11
ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs.meta


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