浏览代码

Started conversion of testrunner tests to UTF

/HDRP_GraphicTests
Remy 6 年前
当前提交
c9a4bb3a
共有 27 个文件被更改,包括 145 次插入570 次删除
  1. 3
      .gitmodules
  2. 7
      CHANGELOG.md.meta
  3. 8
      Tests/UTF_Suites_HDRP.meta
  4. 8
      Tests/UTF_Suites_HDRP/Resources.meta
  5. 22
      Tests/UTF_Suites_HDRP/Resources/HDRP_Build_Config.asset
  6. 8
      Tests/UTF_Suites_HDRP/Resources/HDRP_Build_Config.asset.meta
  7. 29
      Tests/UTF_Suites_HDRP/Resources/HDRP_Deferred.asset
  8. 8
      Tests/UTF_Suites_HDRP/Resources/HDRP_Deferred.asset.meta
  9. 47
      Tests/UTF_Suites_HDRP/Resources/HDRP_Test_Settings.asset
  10. 8
      Tests/UTF_Suites_HDRP/Resources/HDRP_Test_Settings.asset.meta
  11. 10
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes.meta
  12. 8
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets.meta
  13. 13
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MaterialParameterVariationDrawer.cs.meta
  14. 13
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MultiMaterialPlacerEditor.cs.meta
  15. 13
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/GraphicTestTools.cs.meta
  16. 136
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MaterialParameterVariationDrawer.cs
  17. 43
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/GraphicTestTools.cs
  18. 259
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MultiMaterialPlacerEditor.cs
  19. 53
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/DebugViewController_Editor.cs
  20. 11
      Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/DebugViewController_Editor.cs.meta
  21. 8
      Tests/Scripts/GraphicTests/HDRenderPipeline.meta
  22. 0
      /Tests/UTF_Tests_HDRP.meta

3
.gitmodules


[submodule "Tests/UTF_Core"]
path = Tests/UTF_Core
url = git@github.com:Unity-Technologies/UTF_Core.git
[submodule "Tests/UTF_HDRP"]
path = Tests/UTF_HDRP
url = git@github.com:Unity-Technologies/UTF_Tests_HDRP.git

7
CHANGELOG.md.meta


fileFormatVersion: 2
guid: ce3703c6cb43f154bac29c5ad0a09ba6
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Tests/UTF_Suites_HDRP.meta


fileFormatVersion: 2
guid: 24ab35501ddd7644f8b34bc1cdd1d66a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Tests/UTF_Suites_HDRP/Resources.meta


fileFormatVersion: 2
guid: 79ceb5df81633174b83d79327403069e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

22
Tests/UTF_Suites_HDRP/Resources/HDRP_Build_Config.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: af86c82ed6c380b4ba6846797b102e25, type: 3}
m_Name: HDRP_Build_Config
m_EditorClassIdentifier:
nameOverride:
pathOverride:
enableScriptLogging: 0
buildOption: 1
buildTargets:
- nameOverride:
pathOverride:
platform: 5
graphicsApi: 2

8
Tests/UTF_Suites_HDRP/Resources/HDRP_Build_Config.asset.meta


fileFormatVersion: 2
guid: b17e86b59f0af9646a221986ba4614a3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

29
Tests/UTF_Suites_HDRP/Resources/HDRP_Deferred.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 95285c6cacdfe25449799296c7d847ae, type: 3}
m_Name: HDRP_Deferred
m_EditorClassIdentifier:
suiteName: HDRPDeferred
isDebugSuite: 0
defaultTestSettings: {fileID: 0}
defaultRenderPipeline: {fileID: 11400000, guid: d7fe5f39d2c099a4ea1f1f610af309d7,
type: 2}
groups:
- groupName: 1xxxMaterials
tests:
- name: Assets/SRP/Tests/UTF_Tests_HDRP/Scenes/1xxx_Materials/1101_Unlit.unity
scene: {fileID: 102900000, guid: 7fe3f9e94b4355641ba1534c54d5c356, type: 3}
scenePath: Assets/SRP/Tests/UTF_Tests_HDRP/Scenes/1xxx_Materials/1101_Unlit.unity
testTypes: 2
minimumUnityVersion: 4
platforms: 64
run: 1
suiteVersion: 15

8
Tests/UTF_Suites_HDRP/Resources/HDRP_Deferred.asset.meta


fileFormatVersion: 2
guid: cfb805134cee998469c8b6f814293e5b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

47
Tests/UTF_Suites_HDRP/Resources/HDRP_Test_Settings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 175be2e184a4936459215890cb4b9d93, type: 3}
m_Name: HDRP_Test_Settings
m_EditorClassIdentifier:
antiAliasingNames:
- Disabled
- 2x Multi Sampling
- 4x Multi Sampling
- 8x Multi Sampling
shadowCascadeNames:
- None
- Two Cascades
- Four Cascades
vSyncCountNames:
- Dont Sync
- Every V Blank
- Every Second V Sync
pixelLightCount: 4
anisotropicFiltering: 2
antiAliasing: 0
softParticles: 1
realtimeReflectionProbes: 1
billboardsFacingCameraPosition: 1
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowDistance: 150
shadowNearPlaneOffset: 3
shadowCascades: 2
shadowCascade2Split: 0.33
shadowCascade4Split: {x: 0.067, y: 0.2, z: 0.467}
blendWeights: 4
vSyncCount: 0
lodBias: 2
maximumLodLevel: 0
particleRaycastBudget: 4096
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 4

8
Tests/UTF_Suites_HDRP/Resources/HDRP_Test_Settings.asset.meta


fileFormatVersion: 2
guid: 3364bf19a7d803045b80462f9399baad
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

10
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes.meta


fileFormatVersion: 2
guid: da5a3f10e37fea74c8fb43737fbb9100
folderAsset: yes
timeCreated: 1508423723
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets.meta


fileFormatVersion: 2
guid: 2871da9607c8801419f9a3e693ebf232
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

13
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MaterialParameterVariationDrawer.cs.meta


fileFormatVersion: 2
guid: 86bdb0faa4c8ff34296938f27576e9b8
timeCreated: 1508490437
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MultiMaterialPlacerEditor.cs.meta


fileFormatVersion: 2
guid: 5281c02282428e24ab103a8084bb3745
timeCreated: 1508502463
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/GraphicTestTools.cs.meta


fileFormatVersion: 2
guid: e7e0d76a496345b4a936cf8f24bd1ec4
timeCreated: 1508766595
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

136
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MaterialParameterVariationDrawer.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomPropertyDrawer(typeof(MaterialParameterVariation))]
public class MaterialParameterVariationDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// Using BeginProperty / EndProperty on the parent property means that
// prefab override logic works on the entire property.
EditorGUI.BeginProperty(position, label, property);
// Draw label
//position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
// Don't make child fields be indented
var indent = EditorGUI.indentLevel;
//EditorGUI.indentLevel = 0;
float cellStart = 0f;
float remainingWidth = position.width - cellStart;
bool isMulti = property.FindPropertyRelative("multi").boolValue;
MaterialParameterVariation.ParamType type = (MaterialParameterVariation.ParamType)property.FindPropertyRelative("paramType").enumValueIndex;
float nonValueHeight = (type == MaterialParameterVariation.ParamType.Vector) ? position.height / 4f : position.height;
Rect multiRect = new Rect(position.x, position.y, 25f, nonValueHeight);
cellStart += multiRect.width;
remainingWidth -= multiRect.width;
Rect paramRect = new Rect(cellStart, position.y, remainingWidth / 5f, nonValueHeight);
cellStart += paramRect.width;
remainingWidth -= paramRect.width;
Rect typeRect = new Rect(cellStart, position.y, 70, nonValueHeight);
cellStart += typeRect.width;
remainingWidth -= typeRect.width;
Rect valueRect = new Rect();
Rect maxRect = new Rect();
Rect countRect = new Rect();
if (!isMulti || (type == MaterialParameterVariation.ParamType.Texture) )
{
valueRect = new Rect(cellStart, position.y, remainingWidth, position.height);
}
else
{
valueRect = new Rect(cellStart, position.y, remainingWidth/3f, position.height);
cellStart += valueRect.width;
remainingWidth -= valueRect.width;
maxRect = new Rect(cellStart, position.y, remainingWidth/2f, position.height);
cellStart += maxRect.width;
remainingWidth -= maxRect.width;
countRect = new Rect(cellStart, position.y, remainingWidth, nonValueHeight);
}
if (GUI.Button(multiRect, isMulti ? "∞" : "1"))
property.FindPropertyRelative("multi").boolValue = !isMulti;
EditorGUI.PropertyField(paramRect, property.FindPropertyRelative("parameter"), GUIContent.none);
EditorGUI.PropertyField(typeRect, property.FindPropertyRelative("paramType"), GUIContent.none);
switch (type)
{
case MaterialParameterVariation.ParamType.Float:
EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("f_Value"), GUIContent.none);
if (isMulti)
EditorGUI.PropertyField(maxRect, property.FindPropertyRelative("f_Value_Max"), GUIContent.none);
break;
case MaterialParameterVariation.ParamType.Bool:
if (!isMulti)
EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("b_Value"), GUIContent.none);
break;
case MaterialParameterVariation.ParamType.Vector:
//EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("v_Value"), GUIContent.none);
DrawVector(valueRect, property.FindPropertyRelative("v_Value"));
if (isMulti)
DrawVector(maxRect, property.FindPropertyRelative("v_Value_Max"));
break;
case MaterialParameterVariation.ParamType.Int:
EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("i_Value"), GUIContent.none);
if (isMulti)
EditorGUI.PropertyField(maxRect, property.FindPropertyRelative("i_Value_Max"), GUIContent.none);
break;
case MaterialParameterVariation.ParamType.Texture:
EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("t_Value"), GUIContent.none);
break;
case MaterialParameterVariation.ParamType.Color:
EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("c_Value"), GUIContent.none);
if (isMulti)
EditorGUI.PropertyField(maxRect, property.FindPropertyRelative("c_Value_Max"), GUIContent.none);
break;
}
if (isMulti && (type != MaterialParameterVariation.ParamType.Bool) && (type != MaterialParameterVariation.ParamType.Texture) )
EditorGUI.PropertyField(countRect, property.FindPropertyRelative("count"), GUIContent.none);
// Set indent back to what it was
EditorGUI.indentLevel = indent;
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
float mul = ((MaterialParameterVariation.ParamType)property.FindPropertyRelative("paramType").enumValueIndex == MaterialParameterVariation.ParamType.Vector) ? 4f : 1f;
return base.GetPropertyHeight(property, label) * mul;
}
void DrawVector( Rect rect, SerializedProperty property)
{
Vector4 v = property.vector4Value;
float labelwidth = 15f;
Rect lx = new Rect(rect.x, rect.y, labelwidth, rect.height / 4f);
Rect ly = new Rect(lx.x, rect.y + lx.height, labelwidth, lx.height);
Rect lz = new Rect(lx.x, rect.y + 2f * lx.height, labelwidth, lx.height);
Rect lw = new Rect(lx.x, rect.y + 3f * lx.height, labelwidth, lx.height);
GUI.Label(lx, "X");
GUI.Label(ly, "Y");
GUI.Label(lz, "Z");
GUI.Label(lw, "W");
Rect rx = new Rect(rect.x, rect.y, rect.width, rect.height / 4f);
Rect ry = new Rect(rx.x, rect.y + rx.height, rx.width, rect.height / 4f);
Rect rz = new Rect(rx.x, rect.y + 2f*rx.height, rx.width, rect.height / 4f);
Rect rw = new Rect(rx.x, rect.y + 3f*rx.height, rx.width, rect.height / 4f);
v.x = EditorGUI.FloatField(rx, v.x);
v.y = EditorGUI.FloatField(ry, v.y);
v.z = EditorGUI.FloatField(rz, v.z);
v.w = EditorGUI.FloatField(rw, v.w);
property.vector4Value = v;
}
}

43
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/GraphicTestTools.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class GraphicTestTools
{
[MenuItem("Internal/GraphicTest Tools/Make Material Scene Instance")]
public static void MakeMaterialSceneInstance()
{
foreach(Object obj in Selection.objects)
{
Renderer rndr = ((GameObject)obj).GetComponent<Renderer>();
if(rndr!=null)
{
Material[] mats = rndr.sharedMaterials;
for (int i=0; i< mats.Length; ++i)
{
if (mats[i] != null)
{
//Debug.Log("Instantiate materal " + rndr.sharedMaterials[i].ToString() + " of object " + rndr.gameObject.name);
Material mat = Object.Instantiate(rndr.sharedMaterials[i]);
mats[i] = mat;
}
}
rndr.sharedMaterials = mats;
}
}
}
[MenuItem("Internal/GraphicTest Tools/Update All Material Placers")]
public static void UpdateAllPlacers()
{
MultiMaterialPlacer[] placers = Object.FindObjectsOfType<MultiMaterialPlacer>();
for (int i=0; i<placers.Length; ++i)
{
MultiMaterialPlacerEditor.PlaceObjects(placers[i]);
}
}
}

259
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/MultiMaterialPlacerEditor.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(MultiMaterialPlacer))]
[CanEditMultipleObjects]
public class MultiMaterialPlacerEditor : Editor
{
// We need to use and to call an instnace of the default MaterialEditor
private MaterialEditor _materialEditor;
private void OnEnable()
{
if ( !serializedObject.FindProperty("material").hasMultipleDifferentValues )
{
if (serializedObject.FindProperty("material") != null)
{
// Create an instance of the default MaterialEditor
_materialEditor = (MaterialEditor)CreateEditor((Material) serializedObject.FindProperty("material").objectReferenceValue);
}
}
}
public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
base.OnInspectorGUI();
if ( GUILayout.Button("Place") )
{
foreach (object obj in targets)
{
PlaceObjects(obj as MultiMaterialPlacer);
}
}
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
if (_materialEditor != null)
{
// Free the memory used by the previous MaterialEditor
DestroyImmediate(_materialEditor);
}
if (!serializedObject.FindProperty("material").hasMultipleDifferentValues && (serializedObject.FindProperty("material") != null) )
{
// Create a new instance of the default MaterialEditor
_materialEditor = (MaterialEditor)CreateEditor((Material)serializedObject.FindProperty("material").objectReferenceValue);
}
}
if (_materialEditor != null)
{
// Draw the material's foldout and the material shader field
// Required to call _materialEditor.OnInspectorGUI ();
_materialEditor.DrawHeader();
// We need to prevent the user to edit Unity default materials
bool isDefaultMaterial = !AssetDatabase.GetAssetPath((Material)serializedObject.FindProperty("material").objectReferenceValue).StartsWith("Assets");
using (new EditorGUI.DisabledGroupScope(isDefaultMaterial))
{
// Draw the material properties
// Works only if the foldout of _materialEditor.DrawHeader () is open
_materialEditor.OnInspectorGUI();
}
}
}
public static void PlaceObjects(MultiMaterialPlacer _target)
{
//clear hierarchy
for (int i=_target.transform.childCount-1; i>=0; --i)
{
//DestroyImmediate(_target.transform.GetChild(i).GetComponent<Renderer>().sharedMaterial);
DestroyImmediate(_target.transform.GetChild(i).gameObject);
}
if (_target.prefabObject == null) return;
List<Material> materials = new List<Material>();
Renderer refObject = Instantiate(_target.prefabObject.gameObject).GetComponent<Renderer>();
if (_target.material != null)
refObject.sharedMaterial = Instantiate( _target.material );
else
refObject.sharedMaterial = Instantiate(_target.prefabObject.sharedMaterial);
for (int i = 0; i < _target.commonParameters.Length; i++)
{
ApplyParameterToMaterial(refObject.sharedMaterial, _target.commonParameters[i]);
}
float x = 0f;
float y = 0f;
if (_target.is2D)
{
if (_target.instanceParameters.Length < 2) return;
if (!(_target.instanceParameters[0].multi && _target.instanceParameters[1].multi)) return;
for (int i = 0; i < _target.instanceParameters[0].count; i++)
{
for (int j = 0; j < _target.instanceParameters[1].count; j++)
{
Renderer tmp = CopyObject(refObject, x, y, _target.transform, _target);
tmp.gameObject.name = _target.prefabObject.name+"_"+ ApplyParameterToMaterial(tmp.sharedMaterial, _target.instanceParameters[0], i);
tmp.gameObject.name += "_"+ApplyParameterToMaterial(tmp.sharedMaterial, _target.instanceParameters[1], j);
materials.Add(tmp.sharedMaterial);
y -= _target.offset;
}
x += _target.offset;
y = 0f;
}
}
else
{
for (int i = 0; i < _target.instanceParameters.Length; i++)
{
if (!string.IsNullOrEmpty(_target.instanceParameters[i].parameter))
{
if (_target.instanceParameters[i].multi)
{
if (_target.instanceParameters[i].paramType == MaterialParameterVariation.ParamType.Texture)
{
Renderer tmp = CopyObject(refObject, x, y, _target.transform, _target);
tmp.gameObject.name = _target.prefabObject.name + "_" + ApplyParameterToMaterial(tmp.sharedMaterial, _target.instanceParameters[i]);
materials.Add(tmp.sharedMaterial);
}
else
{
for (int j = 0; j < _target.instanceParameters[i].count; j++)
{
if (j > 0)
x += _target.offset;
Renderer tmp = CopyObject(refObject, x, y, _target.transform, _target);
tmp.gameObject.name = _target.prefabObject.name + "_" + ApplyParameterToMaterial(tmp.sharedMaterial, _target.instanceParameters[i], j);
materials.Add(tmp.sharedMaterial);
}
}
}
else
{
Renderer tmp = CopyObject(refObject, x, y, _target.transform, _target);
tmp.gameObject.name = _target.prefabObject.name + "_" + ApplyParameterToMaterial(tmp.sharedMaterial, _target.instanceParameters[i]);
materials.Add(tmp.sharedMaterial);
}
}
x += _target.offset;
}
}
DestroyImmediate(refObject.gameObject);
if (materials != null)
{
foreach (Material mat in materials)
{
UnityEditor.Experimental.Rendering.HDPipeline.HDEditorUtils.ResetMaterialKeywords(mat);
}
}
UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty();
}
public static Renderer CopyObject( Renderer _target, float _x, float _y, Transform _parent, MultiMaterialPlacer _placer )
{
Renderer o = Instantiate(_target.gameObject).GetComponent<Renderer>();
o.sharedMaterial = Instantiate(_target.sharedMaterial);
o.transform.parent = _parent;
o.transform.localPosition = new Vector3(_x, _y, 0f);
o.transform.localRotation = Quaternion.identity;
o.transform.localScale = Vector3.one * _placer.scale;
o.transform.localEulerAngles = _placer.rotation;
o.gameObject.isStatic = _parent.gameObject.isStatic;
return o;
}
public static string ApplyParameterToMaterial(Material _mat, MaterialParameterVariation _param)
{
if (_param.multi) return null;
string o = _param.parameter + "_";
switch (_param.paramType)
{
case MaterialParameterVariation.ParamType.Bool:
_mat.SetFloat(_param.parameter, _param.b_Value ? 1f : 0f);
o += _param.b_Value.ToString();
break;
case MaterialParameterVariation.ParamType.Float:
_mat.SetFloat(_param.parameter, _param.f_Value);
o += string.Format("{0:0.00}", _param.f_Value);
break;
case MaterialParameterVariation.ParamType.Int:
_mat.SetInt(_param.parameter, _param.i_Value);
o += _param.i_Value.ToString();
break;
case MaterialParameterVariation.ParamType.Vector:
_mat.SetVector(_param.parameter, _param.v_Value);
o += _param.v_Value.ToString();
break;
case MaterialParameterVariation.ParamType.Texture:
_mat.SetTexture(_param.parameter, _param.t_Value);
o += _param.t_Value.ToString();
break;
case MaterialParameterVariation.ParamType.Color:
_mat.SetColor(_param.parameter, _param.c_Value);
o += _param.c_Value.ToString();
break;
}
return o;
}
public static string ApplyParameterToMaterial(Material _mat, MaterialParameterVariation _param, int _num)
{
if (!_param.multi) return null;
if (_param.paramType == MaterialParameterVariation.ParamType.Texture) return null;
if ((_num < 0) || (_num > _param.count)) return null;
if ((_param.paramType == MaterialParameterVariation.ParamType.Bool) && (_num > 1)) return null;
float f = 1.0f * _num / (_param.count - 1.0f);
string o = _param.parameter+"_";
switch (_param.paramType)
{
case MaterialParameterVariation.ParamType.Bool:
_mat.SetFloat(_param.parameter, _num);
o += (_num==1)?"true":"false";
break;
case MaterialParameterVariation.ParamType.Float:
_mat.SetFloat(_param.parameter, Mathf.Lerp(_param.f_Value, _param.f_Value_Max, f));
o += string.Format("{0:0.00}", Mathf.Lerp(_param.f_Value, _param.f_Value_Max, f));
break;
case MaterialParameterVariation.ParamType.Int:
_mat.SetInt(_param.parameter, Mathf.RoundToInt(Mathf.Lerp(_param.i_Value, _param.i_Value_Max, f)));
o += Mathf.RoundToInt(Mathf.Lerp(_param.i_Value, _param.i_Value_Max, f)).ToString();
break;
case MaterialParameterVariation.ParamType.Vector:
_mat.SetVector(_param.parameter, Vector4.Lerp(_param.v_Value, _param.v_Value_Max, f));
o += Vector4.Lerp(_param.v_Value, _param.v_Value_Max, f).ToString();
break;
case MaterialParameterVariation.ParamType.Color:
_mat.SetColor(_param.parameter, Color.Lerp(_param.c_Value, _param.c_Value_Max, f));
o += Color.Lerp(_param.c_Value, _param.c_Value_Max, f).ToString();
break;
}
return o;
}
}

53
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/DebugViewController_Editor.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEditor.Experimental.Rendering;
using UnityEditor.Experimental.Rendering.HDPipeline;
[DisallowMultipleComponent]
[CustomEditor(typeof(DebugViewController))]
public class DebugViewController_Editor : Editor
{
SerializedProperty s_settingType;
SerializedProperty s_gBuffer;
SerializedProperty s_fullScreenDebugMode;
public void OnEnable()
{
s_settingType = serializedObject.FindProperty("settingType");
s_gBuffer = serializedObject.FindProperty("gBuffer");
s_fullScreenDebugMode = serializedObject.FindProperty("fullScreenDebugMode");
}
public override void OnInspectorGUI()
{
//base.OnInspectorGUI();
//EditorGUILayout.PropertyField(s_settingType);
int i_settingType = s_settingType.intValue;//= (int) (target as DebugViewController).settingType;
s_settingType.intValue = GUILayout.Toolbar(s_settingType.intValue, new string[] { "Material", "Rendering" });
switch ( (DebugViewController.SettingType) s_settingType.intValue )
{
case DebugViewController.SettingType.Material :
s_gBuffer.intValue = EditorGUILayout.IntPopup(new GUIContent("GBuffer"), s_gBuffer.intValue, MaterialDebugSettings.debugViewMaterialGBufferStrings, MaterialDebugSettings.debugViewMaterialGBufferValues);
break;
case DebugViewController.SettingType.Rendering:
s_fullScreenDebugMode.intValue = EditorGUILayout.IntPopup(new GUIContent("GBuffer"), s_fullScreenDebugMode.intValue, DebugDisplaySettings.renderingFullScreenDebugStrings, DebugDisplaySettings.renderingFullScreenDebugValues);
break;
}
if ( serializedObject.ApplyModifiedProperties() )
{
serializedObject.Update();
(target as DebugViewController).SetDebugView();
}
}
}

11
Tests/Scripts/Editor/GraphicTests/HDRenderPipeline/DebugViewController_Editor.cs.meta


fileFormatVersion: 2
guid: da59c0df09fb17e4f99a667936fce895
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Tests/Scripts/GraphicTests/HDRenderPipeline.meta


fileFormatVersion: 2
guid: bc1bb683fc523b64db50561762ca88cc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/Tests/UTF_HDRP.meta → /Tests/UTF_Tests_HDRP.meta

正在加载...
取消
保存