|
|
|
|
|
|
[SerializeField] private Vector3 m_Cascade4Split = new Vector3(0.067f, 0.2f, 0.467f); |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
private LightweightPipelineResource m_ResourceAsset; |
|
|
|
private LightweightPipelineResources m_ResourcesAsset; |
|
|
|
|
|
|
|
private LightweightPipelineEditorResources m_EditorResourcesAsset; |
|
|
|
|
|
|
|
[MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)] |
|
|
|
static void CreateLightweightPipeline() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//[MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Resources", priority = CoreUtils.assetCreateMenuPriority1)]
|
|
|
|
static void CreateLightweightPipelineResources() |
|
|
|
{ |
|
|
|
var instance = CreateInstance<LightweightPipelineResources>(); |
|
|
|
AssetDatabase.CreateAsset(instance, string.Format("Assets/{0}.asset", typeof(LightweightPipelineResources).Name)); |
|
|
|
} |
|
|
|
|
|
|
|
//[MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Editor Resources", priority = CoreUtils.assetCreateMenuPriority1)]
|
|
|
|
static void CreateLightweightPipelineEditorResources() |
|
|
|
{ |
|
|
|
var instance = CreateInstance<LightweightPipelineEditorResources>(); |
|
|
|
AssetDatabase.CreateAsset(instance, string.Format("Assets/{0}.asset", typeof(LightweightPipelineEditorResources).Name)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
instance.LoadResourceFile(); |
|
|
|
instance.m_EditorResourcesAsset = LoadResourceFile<LightweightPipelineEditorResources>(); |
|
|
|
instance.m_ResourcesAsset = LoadResourceFile<LightweightPipelineResources>(); |
|
|
|
private void LoadResourceFile() |
|
|
|
private static T LoadResourceFile<T>() where T : ScriptableObject |
|
|
|
string[] guids = AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths); |
|
|
|
LightweightPipelineResource resourceAsset = null; |
|
|
|
T resourceAsset = null; |
|
|
|
var guids = AssetDatabase.FindAssets(typeof(T).Name + " t:scriptableobject", m_SearchPaths); |
|
|
|
m_ResourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path); |
|
|
|
if (m_ResourceAsset != null) |
|
|
|
resourceAsset = AssetDatabase.LoadAssetAtPath<T>(path); |
|
|
|
if (resourceAsset != null) |
|
|
|
if (m_ResourceAsset == null) |
|
|
|
if (resourceAsset == null) |
|
|
|
{ |
|
|
|
string path = m_SearchPaths[PACKAGE_MANAGER_PATH_INDEX] + "/LWRP/Data/" + typeof(T).Name + ".asset"; |
|
|
|
resourceAsset = AssetDatabase.LoadAssetAtPath<T>(path); |
|
|
|
} |
|
|
|
return resourceAsset; |
|
|
|
} |
|
|
|
|
|
|
|
LightweightPipelineEditorResources editorResources |
|
|
|
{ |
|
|
|
get |
|
|
|
string path = m_SearchPaths[PACKAGE_MANAGER_PATH_INDEX] + "/LWRP/Data/LightweightPipelineResource.asset"; |
|
|
|
m_ResourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path); |
|
|
|
if (m_EditorResourcesAsset == null) |
|
|
|
m_EditorResourcesAsset = LoadResourceFile<LightweightPipelineEditorResources>(); |
|
|
|
|
|
|
|
return m_EditorResourcesAsset; |
|
|
|
LightweightPipelineResources resources |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (m_ResourcesAsset == null) |
|
|
|
m_ResourcesAsset = LoadResourceFile<LightweightPipelineResources>(); |
|
|
|
#endif
|
|
|
|
return m_ResourcesAsset; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override IRenderPipeline InternalCreatePipeline() |
|
|
|
{ |
|
|
|
|
|
|
private Material GetMaterial(DefaultMaterialType materialType) |
|
|
|
{ |
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (m_ResourceAsset == null) |
|
|
|
LoadResourceFile(); |
|
|
|
|
|
|
|
|
|
|
|
return m_ResourceAsset.DefaultMaterial; |
|
|
|
return editorResources.DefaultMaterial; |
|
|
|
return m_ResourceAsset.DefaultParticleMaterial; |
|
|
|
return editorResources.DefaultParticleMaterial; |
|
|
|
return m_ResourceAsset.DefaultTerrainMaterial; |
|
|
|
return editorResources.DefaultTerrainMaterial; |
|
|
|
|
|
|
|
// Unity Builtin Default
|
|
|
|
default: |
|
|
|
|
|
|
|
|
|
|
public Shader BlitShader |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (m_ResourceAsset == null) |
|
|
|
LoadResourceFile(); |
|
|
|
#endif
|
|
|
|
if (m_ResourceAsset) |
|
|
|
return m_ResourceAsset.BlitShader; |
|
|
|
return null; |
|
|
|
} |
|
|
|
get { return resources != null ? resources.BlitShader : null; } |
|
|
|
get |
|
|
|
{ |
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (m_ResourceAsset == null) |
|
|
|
LoadResourceFile(); |
|
|
|
#endif
|
|
|
|
if (m_ResourceAsset) |
|
|
|
return m_ResourceAsset.CopyDepthShader; |
|
|
|
return null; |
|
|
|
} |
|
|
|
get { return resources != null ? resources.CopyDepthShader : null; } |
|
|
|
} |
|
|
|
} |
|
|
|
} |