您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

69 行
2.3 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using UnityEditor;
using UnityEditor.Rendering;
public static class SetupProject
{
public static Dictionary<string, string> RPAssets = new Dictionary<string, string>
{
{ "deferred", "Assets/GraphicTests/Common/RP_Assets/HDRP_Test_Def.asset" },
{ "deferred-depth-prepass", "Assets/GraphicTests/Common/RP_Assets/HDRP_Test_Def_DepthPrepass.asset" },
{ "deferred-depth-prepass-alpha-only", "Assets/GraphicTests/Common/RP_Assets/HDRP_Test_Def_DepthPrepass_AlphaOnly.asset" },
{ "forward", "Assets/GraphicTests/Common/RP_Assets/HDRP_Test_Fwd.asset" }
};
public static Dictionary<string, Action> Options = new Dictionary<string, Action>
{
{ "deferred", () => {SetRPAsset("deferred");} },
{ "deferred-depth-prepass", () => {SetRPAsset("deferred-depth-prepass");} },
{ "deferred-depth-prepass-alpha-only", () => {SetRPAsset("deferred-depth-prepass-alpha-only");} },
{ "forward", () => {SetRPAsset("forward");} }
};
public static void SetRPAsset( string rpAssetIdentifier )
{
RenderPipelineAsset rpAsset = AssetDatabase.LoadAssetAtPath<RenderPipelineAsset>(RPAssets[rpAssetIdentifier]);
GraphicsSettings.renderPipelineAsset = rpAsset;
}
public static void ApplySettings()
{
var args = Environment.GetCommandLineArgs();
foreach (var arg in args)
{
Action action;
if (Options.TryGetValue(arg, out action))
action();
}
}
[MenuItem("Graphic Tests/Project Setup/RP: Deferred")]
public static void SetRP_Deferred()
{
SetRPAsset("deferred");
}
[MenuItem("Graphic Tests/Project Setup/RP: Deferred Depth Prepass")]
public static void SetRP_DeferredDepthPrepass()
{
SetRPAsset("deferred-depth-prepass");
}
[MenuItem("Graphic Tests/Project Setup/RP: Deferred Depth Prepass Alpha Only")]
public static void SetRP_DeferredDepthPrepassAlphaOnly()
{
SetRPAsset("deferred-depth-prepass-alpha-only");
}
[MenuItem("Graphic Tests/Project Setup/RP: Forward")]
public static void SetRP_Forward()
{
SetRPAsset("forward");
}
}