Jon Hogins
3 年前
当前提交
78b4c1fb
共有 2 个文件被更改,包括 78 次插入 和 43 次删除
-
80com.unity.perception/Editor/GroundTruth/ShaderPreprocessor.cs
-
41com.unity.perception/Runtime/GroundTruth/Resources/KeypointDepthCheck.shader
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEditor.Build; |
|||
using UnityEditor.Rendering; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Perception.GroundTruth |
|||
{ |
|||
public class ShaderPreprocessor : IPreprocessShaders |
|||
{ |
|||
private string[] shadersToPreprocess = new[] |
|||
{ |
|||
"Perception/KeypointDepthCheck" |
|||
}; |
|||
public int callbackOrder => 0; |
|||
public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data) |
|||
{ |
|||
if (!shadersToPreprocess.Contains(shader.name)) |
|||
return; |
|||
|
|||
var hdrpKeyword = new ShaderKeyword(shader, "HDRP_ENABLED"); |
|||
#if HDRP_PRESENT || URP_PRESENT
|
|||
|
|||
#if HDRP_PRESENT
|
|||
bool isHdrp = true; |
|||
#else
|
|||
bool isHdrp = false; |
|||
#endif
|
|||
for (var i = data.Count - 1; i >= 0; --i) |
|||
{ |
|||
if (data[i].shaderKeywordSet.IsEnabled(hdrpKeyword) == isHdrp) |
|||
continue; |
|||
|
|||
data.RemoveAt(i); |
|||
} |
|||
#endif
|
|||
} |
|||
} |
|||
} |
|||
// using System.Collections.Generic;
|
|||
// using System.Linq;
|
|||
// using UnityEditor.Build;
|
|||
// using UnityEditor.Rendering;
|
|||
// using UnityEngine;
|
|||
// using UnityEngine.Rendering;
|
|||
//
|
|||
// namespace UnityEditor.Perception.GroundTruth
|
|||
// {
|
|||
// public class ShaderPreprocessor : IPreprocessShaders
|
|||
// {
|
|||
// private string[] shadersToPreprocess = new[]
|
|||
// {
|
|||
// "Perception/KeypointDepthCheck"
|
|||
// };
|
|||
// public int callbackOrder => 0;
|
|||
// public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data)
|
|||
// {
|
|||
// if (!shadersToPreprocess.Contains(shader.name))
|
|||
// return;
|
|||
//
|
|||
// var hdrpKeyword = new ShaderKeyword(shader, "HDRP_ENABLED");
|
|||
// #if HDRP_PRESENT || URP_PRESENT
|
|||
//
|
|||
// #if HDRP_PRESENT
|
|||
// bool isHdrp = true;
|
|||
// #else
|
|||
// bool isHdrp = false;
|
|||
// #endif
|
|||
// for (var i = data.Count - 1; i >= 0; --i)
|
|||
// {
|
|||
// if (data[i].shaderKeywordSet.IsEnabled(hdrpKeyword) == isHdrp)
|
|||
// continue;
|
|||
//
|
|||
// data.RemoveAt(i);
|
|||
// }
|
|||
// #endif
|
|||
// }
|
|||
// }
|
|||
// }
|
撰写
预览
正在加载...
取消
保存
Reference in new issue