|
|
|
|
|
|
|
|
|
|
const float k_MaxExposure = 32.0f; |
|
|
|
|
|
|
|
void FillWithProperties(Type type, GUIContent[] debugViewMaterialStrings, int[] debugViewMaterialValues, bool isBSDFData, ref int index) |
|
|
|
string GetSubNameSpaceName(Type type) |
|
|
|
{ |
|
|
|
var attributes = type.GetCustomAttributes(true); |
|
|
|
return type.Namespace.Substring(type.Namespace.LastIndexOf((".")) + 1) + "/"; |
|
|
|
} |
|
|
|
|
|
|
|
void FillWithProperties(Type type, GUIContent[] debugViewMaterialStrings, int[] debugViewMaterialValues, bool isBSDFData, string strSubNameSpace, ref int index) |
|
|
|
{ |
|
|
|
var attributes = type.GetCustomAttributes(true); |
|
|
|
// Get attribute to get the start number of the value for the enum
|
|
|
|
|
|
|
|
|
|
|
var fields = type.GetFields(); |
|
|
|
|
|
|
|
var subNamespace = type.Namespace.Substring(type.Namespace.LastIndexOf((".")) + 1); |
|
|
|
var subNamespace = GetSubNameSpaceName(type); |
|
|
|
|
|
|
|
var localIndex = 0; |
|
|
|
foreach (var field in fields) |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fieldName = (isBSDFData ? "Engine/" : "") + subNamespace + "/" + fieldName; |
|
|
|
fieldName = (isBSDFData ? "Engine/" : "") + strSubNameSpace + fieldName; |
|
|
|
|
|
|
|
debugViewMaterialStrings[index] = new GUIContent(fieldName); |
|
|
|
debugViewMaterialValues[index] = attr.paramDefinesStart + (int)localIndex; |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void FillWithPropertiesEnum(Type type, GUIContent[] debugViewMaterialStrings, int[] debugViewMaterialValues, bool isBSDFData, ref int index) |
|
|
|
void FillWithPropertiesEnum(Type type, GUIContent[] debugViewMaterialStrings, int[] debugViewMaterialValues, string prefix, bool isBSDFData, ref int index) |
|
|
|
{ |
|
|
|
var names = Enum.GetNames(type); |
|
|
|
|
|
|
|
|
|
|
var valueName = (isBSDFData ? "Engine/" : "") + names[localIndex]; |
|
|
|
var valueName = (isBSDFData ? "Engine/" : "" + prefix) + names[localIndex]; |
|
|
|
|
|
|
|
debugViewMaterialStrings[index] = new GUIContent(valueName); |
|
|
|
debugViewMaterialValues[index] = (int)value; |
|
|
|
|
|
|
// +1 for the zero case
|
|
|
|
var num = 1 + varyingNames.Length |
|
|
|
+ gbufferNames.Length |
|
|
|
+ typeof(Builtin.BuiltinData).GetFields().Length |
|
|
|
+ typeof(Builtin.BuiltinData).GetFields().Length * 2 // BuildtinData are duplicated for each material
|
|
|
|
+ typeof(Lit.SurfaceData).GetFields().Length |
|
|
|
+ typeof(Lit.BSDFData).GetFields().Length |
|
|
|
+ typeof(Unlit.SurfaceData).GetFields().Length |
|
|
|
|
|
|
styles.debugViewMaterialValues[0] = 0; |
|
|
|
index++; |
|
|
|
|
|
|
|
FillWithPropertiesEnum(typeof(HDRenderLoop.DebugViewVaryingMode), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, ref index); |
|
|
|
FillWithProperties(typeof(Builtin.BuiltinData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, ref index); |
|
|
|
FillWithProperties(typeof(Lit.SurfaceData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, ref index); |
|
|
|
FillWithProperties(typeof(Unlit.SurfaceData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, ref index); |
|
|
|
FillWithPropertiesEnum(typeof(HDRenderLoop.DebugViewVaryingMode), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, "Attributes/", false, ref index); |
|
|
|
FillWithProperties(typeof(Builtin.BuiltinData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, GetSubNameSpaceName(typeof(Lit.SurfaceData)), ref index); |
|
|
|
FillWithProperties(typeof(Lit.SurfaceData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, GetSubNameSpaceName(typeof(Lit.SurfaceData)), ref index); |
|
|
|
FillWithProperties(typeof(Builtin.BuiltinData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, GetSubNameSpaceName(typeof(Unlit.SurfaceData)), ref index); |
|
|
|
FillWithProperties(typeof(Unlit.SurfaceData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, false, GetSubNameSpaceName(typeof(Unlit.SurfaceData)), ref index); |
|
|
|
FillWithPropertiesEnum(typeof(HDRenderLoop.DebugViewGbufferMode), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, true, ref index); |
|
|
|
FillWithProperties(typeof(Lit.BSDFData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, true, ref index); |
|
|
|
FillWithProperties(typeof(Unlit.BSDFData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, true, ref index); |
|
|
|
FillWithPropertiesEnum(typeof(HDRenderLoop.DebugViewGbufferMode), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, "", true, ref index); |
|
|
|
FillWithProperties(typeof(Lit.BSDFData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, true, "", ref index); |
|
|
|
FillWithProperties(typeof(Unlit.BSDFData), styles.debugViewMaterialStrings, styles.debugViewMaterialValues, true, "", ref index); |
|
|
|
|
|
|
|
styles.isDebugViewMaterialInit = true; |
|
|
|
} |
|
|
|