Preserve volume witness diagnostics
This commit is contained in:
parent
e6ba1a36f6
commit
0118c35b57
5 changed files with 76 additions and 8 deletions
|
|
@ -1269,7 +1269,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
floatCopy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
|
||||
floatCopy.Apply();
|
||||
RenderTexture.active = previous;
|
||||
File.WriteAllBytes(Path.Combine(directory, $"field-{layerKey}.exr"), floatCopy.EncodeToEXR());
|
||||
File.WriteAllBytes(
|
||||
Path.Combine(directory, $"field-{layerKey}.exr"),
|
||||
floatCopy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat));
|
||||
UnityEngine.Object.DestroyImmediate(floatCopy);
|
||||
}
|
||||
}
|
||||
|
|
@ -1288,6 +1290,12 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
var historyIndexField = typeof(EveUnityFieldsVolumeRenderer).GetField(
|
||||
"_historyTextureIndex",
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
var materialField = typeof(EveUnityFieldsVolumeRenderer).GetField(
|
||||
"_material",
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
var metadataField = typeof(EveUnityFieldsVolumeRenderer).GetField(
|
||||
"_programMetadata",
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
var raymarchTexture = raymarchField?.GetValue(renderer) as RenderTexture;
|
||||
var historyTextures = historyTexturesField?.GetValue(renderer) as RenderTexture[];
|
||||
var historyIndex = historyIndexField?.GetValue(renderer) is int value ? value : -1;
|
||||
|
|
@ -1299,9 +1307,35 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
: null;
|
||||
WriteFloatTexture(historyTexture, Path.Combine(directory, "field-volume-history.exr"));
|
||||
WriteFloatTexture(historyTexture ?? raymarchTexture, Path.Combine(directory, "field-volume-cloud.exr"));
|
||||
WriteVolumeMaterialFacts(
|
||||
materialField?.GetValue(renderer) as Material,
|
||||
metadataField?.GetValue(renderer) as IReadOnlyDictionary<string, string>,
|
||||
Path.Combine(directory, "field-volume-material.txt"));
|
||||
RenderTexture.active = previous;
|
||||
}
|
||||
|
||||
private static void WriteVolumeMaterialFacts(
|
||||
Material material,
|
||||
IReadOnlyDictionary<string, string> metadata,
|
||||
string path)
|
||||
{
|
||||
if (material == null || metadata == null) return;
|
||||
var facts = new List<string>();
|
||||
foreach (var binding in metadata.OrderBy(value => value.Key, StringComparer.Ordinal))
|
||||
{
|
||||
if (binding.Key.Contains(".floatPort.", StringComparison.Ordinal))
|
||||
facts.Add($"{binding.Key}={binding.Value}:{material.GetFloat(binding.Value):R}");
|
||||
else if (binding.Key.Contains(".vectorPort.", StringComparison.Ordinal))
|
||||
facts.Add($"{binding.Key}={binding.Value}:{material.GetVector(binding.Value)}");
|
||||
else if (binding.Key.Contains(".texturePort.", StringComparison.Ordinal))
|
||||
{
|
||||
var texture = material.HasProperty(binding.Value) ? material.GetTexture(binding.Value) : null;
|
||||
facts.Add($"{binding.Key}={binding.Value}:{texture?.name ?? "<none>"}:{texture?.width ?? 0}x{texture?.height ?? 0}");
|
||||
}
|
||||
}
|
||||
File.WriteAllLines(path, facts);
|
||||
}
|
||||
|
||||
private static void WriteFloatTexture(RenderTexture texture, string path)
|
||||
{
|
||||
if (texture == null || string.IsNullOrWhiteSpace(path)) return;
|
||||
|
|
@ -1311,7 +1345,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
copy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
|
||||
copy.Apply();
|
||||
RenderTexture.active = previous;
|
||||
File.WriteAllBytes(path, copy.EncodeToEXR());
|
||||
File.WriteAllBytes(path, copy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat));
|
||||
UnityEngine.Object.DestroyImmediate(copy);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.13",
|
||||
"org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.2.3",
|
||||
"org.gamecult.eve.surface": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.2",
|
||||
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.48",
|
||||
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.49",
|
||||
"org.gamecult.eve.unity-uitoolkit": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.1"
|
||||
},
|
||||
"testables": [
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@
|
|||
"hash": "140e1bd963a0033e66777a3b2c5fe6e9c97dfe32"
|
||||
},
|
||||
"org.gamecult.eve.unity-scene": {
|
||||
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.48",
|
||||
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.49",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
"com.unity.render-pipelines.universal": "17.4.0",
|
||||
"com.unity.modules.particlesystem": "1.0.0"
|
||||
},
|
||||
"hash": "c00ee0e9e33f63a9084b01255523ca21ab9368d2"
|
||||
"hash": "e6ba1a36f6f0bce8df2c9834c25a8a980f03413c"
|
||||
},
|
||||
"org.gamecult.eve.unity-uitoolkit": {
|
||||
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.1",
|
||||
|
|
|
|||
|
|
@ -1269,7 +1269,9 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
floatCopy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
|
||||
floatCopy.Apply();
|
||||
RenderTexture.active = previous;
|
||||
File.WriteAllBytes(Path.Combine(directory, $"field-{layerKey}.exr"), floatCopy.EncodeToEXR());
|
||||
File.WriteAllBytes(
|
||||
Path.Combine(directory, $"field-{layerKey}.exr"),
|
||||
floatCopy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat));
|
||||
UnityEngine.Object.DestroyImmediate(floatCopy);
|
||||
}
|
||||
}
|
||||
|
|
@ -1288,6 +1290,12 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
var historyIndexField = typeof(EveUnityFieldsVolumeRenderer).GetField(
|
||||
"_historyTextureIndex",
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
var materialField = typeof(EveUnityFieldsVolumeRenderer).GetField(
|
||||
"_material",
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
var metadataField = typeof(EveUnityFieldsVolumeRenderer).GetField(
|
||||
"_programMetadata",
|
||||
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
var raymarchTexture = raymarchField?.GetValue(renderer) as RenderTexture;
|
||||
var historyTextures = historyTexturesField?.GetValue(renderer) as RenderTexture[];
|
||||
var historyIndex = historyIndexField?.GetValue(renderer) is int value ? value : -1;
|
||||
|
|
@ -1299,9 +1307,35 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
: null;
|
||||
WriteFloatTexture(historyTexture, Path.Combine(directory, "field-volume-history.exr"));
|
||||
WriteFloatTexture(historyTexture ?? raymarchTexture, Path.Combine(directory, "field-volume-cloud.exr"));
|
||||
WriteVolumeMaterialFacts(
|
||||
materialField?.GetValue(renderer) as Material,
|
||||
metadataField?.GetValue(renderer) as IReadOnlyDictionary<string, string>,
|
||||
Path.Combine(directory, "field-volume-material.txt"));
|
||||
RenderTexture.active = previous;
|
||||
}
|
||||
|
||||
private static void WriteVolumeMaterialFacts(
|
||||
Material material,
|
||||
IReadOnlyDictionary<string, string> metadata,
|
||||
string path)
|
||||
{
|
||||
if (material == null || metadata == null) return;
|
||||
var facts = new List<string>();
|
||||
foreach (var binding in metadata.OrderBy(value => value.Key, StringComparer.Ordinal))
|
||||
{
|
||||
if (binding.Key.Contains(".floatPort.", StringComparison.Ordinal))
|
||||
facts.Add($"{binding.Key}={binding.Value}:{material.GetFloat(binding.Value):R}");
|
||||
else if (binding.Key.Contains(".vectorPort.", StringComparison.Ordinal))
|
||||
facts.Add($"{binding.Key}={binding.Value}:{material.GetVector(binding.Value)}");
|
||||
else if (binding.Key.Contains(".texturePort.", StringComparison.Ordinal))
|
||||
{
|
||||
var texture = material.HasProperty(binding.Value) ? material.GetTexture(binding.Value) : null;
|
||||
facts.Add($"{binding.Key}={binding.Value}:{texture?.name ?? "<none>"}:{texture?.width ?? 0}x{texture?.height ?? 0}");
|
||||
}
|
||||
}
|
||||
File.WriteAllLines(path, facts);
|
||||
}
|
||||
|
||||
private static void WriteFloatTexture(RenderTexture texture, string path)
|
||||
{
|
||||
if (texture == null || string.IsNullOrWhiteSpace(path)) return;
|
||||
|
|
@ -1311,7 +1345,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
copy.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
|
||||
copy.Apply();
|
||||
RenderTexture.active = previous;
|
||||
File.WriteAllBytes(path, copy.EncodeToEXR());
|
||||
File.WriteAllBytes(path, copy.EncodeToEXR(Texture2D.EXRFlags.OutputAsFloat));
|
||||
UnityEngine.Object.DestroyImmediate(copy);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ param(
|
|||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$expectedEveUnityCommit = "c00ee0e9e33f63a9084b01255523ca21ab9368d2"
|
||||
$expectedEveUnityCommit = "e6ba1a36f6f0bce8df2c9834c25a8a980f03413c"
|
||||
$expectedEveFieldsCommit = "c5a4a75c1b727499b16c2dae1895f29e2a9f72f0"
|
||||
$expectedEveUnityUiToolkitCommit = "4d0cbe0185bdc4fc65eb63503a7c5cb578539669"
|
||||
$expectedCultLibCommit = "feb5c71513e71d681699f462fe3682b3168c6f73"
|
||||
|
|
|
|||
Reference in a new issue