浏览代码

Moved utility class in CoreRP

/main
Frédéric Vauchelles 7 年前
当前提交
fac31578
共有 3 个文件被更改,包括 34 次插入21 次删除
  1. 24
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  2. 20
      ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs
  3. 11
      ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs.meta

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


public class LightLoop
{
// We use this class to instantiate a specific component once
// This is required to have default HDAdditional*Data as they are MonoBehaviour.
static class DefaultStaticComponent<TType>
where TType : Component
{
static TType s_DefaultComponent = null;
public static TType defaultComponent
{
get
{
return s_DefaultComponent ?? (s_DefaultComponent = new GameObject("Default " + typeof(TType))
{
hideFlags = HideFlags.HideAndDontSave
}.AddComponent<TType>());
}
}
}
public enum TileClusterDebug : int
{
None,

static Texture2DArray s_DefaultTexture2DArray;
static Cubemap s_DefaultTextureCube;
static HDAdditionalReflectionData defaultHDAdditionalReflectionData { get { return DefaultStaticComponent<HDAdditionalReflectionData>.defaultComponent; } }
static HDAdditionalLightData defaultHDAdditionalLightData { get { return DefaultStaticComponent<HDAdditionalLightData>.defaultComponent; } }
static HDAdditionalCameraData defaultHDAdditionalCameraData { get { return DefaultStaticComponent<HDAdditionalCameraData>.defaultComponent; } }
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;

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:
正在加载...
取消
保存