浏览代码

HDRenderPipeline: Add include shader path for external generated shader

/main
Sebastien Lagarde 7 年前
当前提交
8b2b4a16
共有 5 个文件被更改,包括 51 次插入11 次删除
  1. 7
      ScriptableRenderPipeline/Core/Editor/CoreEditorUtils.cs
  2. 19
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDEditorUtils.cs
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
  4. 21
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDDefaultShaderIncludes.cs
  5. 11
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDDefaultShaderIncludes.cs.meta

7
ScriptableRenderPipeline/Core/Editor/CoreEditorUtils.cs


using System;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;

}
return state;
}
public static void RemoveMaterialKeywords(Material material)
{
material.shaderKeywords = null;
}
}
}

19
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDEditorUtils.cs


using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

return path;
}
// TODO: The two following functions depend on HDRP, they should be made generic
// TODO: The following functions depend on HDRP, they should be made generic
public static string GetScriptableRenderPipelinePath()
{
var hdrpPath = GetHDRenderPipelinePath();
var fullPath = Path.GetFullPath(hdrpPath + "../");
var relativePath = fullPath.Substring(fullPath.IndexOf("Assets"));
return relativePath.Replace("\\", "/") + "/";
}
public static string GetPostProcessingPath()
{
var hdrpPath = GetHDRenderPipelinePath();

MaterialResetter resetter;
if (k_MaterialResetters.TryGetValue(material.shader.name, out resetter))
{
RemoveMaterialKeywords(material);
CoreEditorUtils.RemoveMaterialKeywords(material);
}
public static void RemoveMaterialKeywords(Material material)
{
material.shaderKeywords = null;
}
}
}

4
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


{
mat.shader = litShader;
// We remove all keyword already present
HDEditorUtils.RemoveMaterialKeywords(mat);
CoreEditorUtils.RemoveMaterialKeywords(mat);
LitGUI.SetupMaterialKeywordsAndPass(mat);
EditorUtility.SetDirty(mat);
}

// We remove all keyword already present
HDEditorUtils.RemoveMaterialKeywords(mat);
CoreEditorUtils.RemoveMaterialKeywords(mat);
LayeredLitGUI.SetupMaterialKeywordsAndPass(mat);
EditorUtility.SetDirty(mat);
}

21
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDDefaultShaderIncludes.cs


using UnityEditor.Experimental.Rendering.HDPipeline;
namespace UnityEditor
{
internal static class HDDefaultShaderIncludes
{
static string s_RenderPipelinePath
{
get { return HDEditorUtils.GetScriptableRenderPipelinePath(); }
}
[ShaderIncludePath]
public static string[] GetPaths()
{
return new[]
{
s_RenderPipelinePath
};
}
}
}

11
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDDefaultShaderIncludes.cs.meta


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