2026-06-09 룸 프로토타입 디자인 (진행중)
This commit is contained in:
@@ -0,0 +1,224 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
public static class HeightQuerySystemEditor
|
||||
{
|
||||
public class HeightQueryInspector : EditorWindow
|
||||
{
|
||||
[MenuItem("Window/Analysis/Stylized Water 3/Height Query Inspector", false, 0)]
|
||||
public static void Open()
|
||||
{
|
||||
HeightQueryInspector window = GetWindow<HeightQueryInspector>(false);
|
||||
window.titleContent = new GUIContent("Height Query Inspector", EditorGUIUtility.IconContent("ComputeShader Icon").image);
|
||||
|
||||
window.autoRepaintOnSceneChange = true;
|
||||
window.minSize = new Vector2(1200f, 200f);
|
||||
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private Vector2 scrollPos;
|
||||
private Vector2 outputScrollPos;
|
||||
|
||||
private int selectedQueryIndex;
|
||||
private int requestIndex;
|
||||
private int highlightedRequest = -1;
|
||||
|
||||
//private bool showOutput = false;
|
||||
private bool showIndices = false;
|
||||
|
||||
[SerializeField]
|
||||
private GUIStyle labelStyle;
|
||||
private GUIStyle labelStyleSelected;
|
||||
|
||||
private Color GetUniqueColor(int i)
|
||||
{
|
||||
UnityEngine.Random.InitState(i);
|
||||
return Color.HSVToRGB(UnityEngine.Random.value, 0.75f, 1f);
|
||||
}
|
||||
|
||||
private readonly Color lineColor = new Color(0,0,0, 0.5f);
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
labelStyle = new GUIStyle(EditorStyles.label);
|
||||
labelStyle.richText = true;
|
||||
labelStyleSelected = new GUIStyle(EditorStyles.selectionRect);
|
||||
labelStyleSelected.richText = true;
|
||||
labelStyleSelected.onFocused = new GUIStyleState();
|
||||
labelStyleSelected.onFocused.background = Texture2D.grayTexture;
|
||||
|
||||
this.Repaint();
|
||||
|
||||
var queryCount = HeightQuerySystem.QueryCount;
|
||||
|
||||
if (queryCount == 0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("No water height queries are currently enqueued", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
//showOutput = EditorGUILayout.Toggle("Show output", showOutput);
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope(GUILayout.MaxWidth(200f)))
|
||||
{
|
||||
EditorGUILayout.LabelField($"Query ({queryCount}):", EditorStyles.boldLabel, GUILayout.MaxWidth(100f));
|
||||
GUIContent[] content = new GUIContent[queryCount];
|
||||
for (int i = 0; i < content.Length; i++)
|
||||
{
|
||||
content[i] = new GUIContent(i.ToString());
|
||||
}
|
||||
selectedQueryIndex = GUILayout.Toolbar(selectedQueryIndex, content);
|
||||
}
|
||||
selectedQueryIndex = Mathf.Min(selectedQueryIndex, queryCount);
|
||||
|
||||
int queryIndex = 0;
|
||||
foreach (HeightQuerySystem.Query query in HeightQuerySystem.queries)
|
||||
{
|
||||
if (selectedQueryIndex == queryIndex)
|
||||
{
|
||||
EditorGUILayout.LabelField($"Capacity: {query.sampleCount}/{HeightQuerySystem.Query.MAX_SIZE}", EditorStyles.boldLabel);
|
||||
Rect rect = EditorGUILayout.GetControlRect();
|
||||
rect.width -= 5f;
|
||||
|
||||
//EditorGUI.DrawRect(rect, Color.grey);
|
||||
|
||||
float cellWidth = rect.width / (float)HeightQuerySystem.Query.MAX_SIZE;
|
||||
|
||||
//Draw available indices
|
||||
for (int i = 0; i < query.availableIndices.Count; i++)
|
||||
{
|
||||
float x = rect.x + (float)(query.availableIndices[i] * cellWidth);
|
||||
Rect cellRect = new Rect(x, rect.y, cellWidth, rect.height);
|
||||
EditorGUI.DrawRect(cellRect, Color.grey * 0.6f);
|
||||
}
|
||||
|
||||
//Draw occupied indices
|
||||
requestIndex = 0;
|
||||
highlightedRequest = -1;
|
||||
foreach (KeyValuePair<int, HeightQuerySystem.AsyncRequest> request in query.requests)
|
||||
{
|
||||
Color color = GetUniqueColor(request.Key);
|
||||
for (int i = 0; i < request.Value.indices.Count; i++)
|
||||
{
|
||||
int sampleIndex = request.Value.indices[i];
|
||||
float x = rect.x + (float)(sampleIndex * cellWidth);
|
||||
|
||||
Rect cellRect = new Rect(x, rect.y, cellWidth, rect.height);
|
||||
EditorGUI.DrawRect(cellRect, color);
|
||||
|
||||
if (cellRect.Contains(Event.current.mousePosition))
|
||||
{
|
||||
highlightedRequest = requestIndex;
|
||||
|
||||
GUIContent tooltip = new GUIContent($"[{sampleIndex.ToString()}] {request.Value.label}");
|
||||
|
||||
Rect tooltipRect = cellRect;
|
||||
tooltipRect.y -= tooltipRect.height + 5f;
|
||||
tooltipRect.width = EditorStyles.label.CalcSize(tooltip).x;
|
||||
EditorGUI.HelpBox(tooltipRect, tooltip);
|
||||
}
|
||||
}
|
||||
requestIndex++;
|
||||
}
|
||||
|
||||
//Draw overlay lines
|
||||
for (int i = 0; i < HeightQuerySystem.Query.MAX_SIZE; i++)
|
||||
{
|
||||
float x = rect.x + (float)(i * cellWidth);
|
||||
Rect lineRect = new Rect(x, rect.y, 1f, rect.height);
|
||||
EditorGUI.DrawRect(lineRect, lineColor);
|
||||
}
|
||||
|
||||
showIndices = EditorGUILayout.ToggleLeft("Show available indices", showIndices);
|
||||
if (showIndices)
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope(EditorStyles.textArea))
|
||||
{
|
||||
string indicesString = "";
|
||||
for (int i = 0; i < query.availableIndices.Count; i++)
|
||||
{
|
||||
indicesString += $"{query.availableIndices[i].ToString()}, ";
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField(indicesString, EditorStyles.miniLabel);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.LabelField($"Requests ({query.requests.Count}):", EditorStyles.boldLabel);
|
||||
|
||||
using (new EditorGUILayout.VerticalScope(EditorStyles.textArea))
|
||||
{
|
||||
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, true, true);
|
||||
requestIndex = 0;
|
||||
foreach (KeyValuePair<int, HeightQuerySystem.AsyncRequest> request in query.requests)
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
Rect iconRect = EditorGUILayout.GetControlRect(GUILayout.MaxWidth(10f));
|
||||
iconRect.width = 10f;
|
||||
iconRect.height = 10f;
|
||||
iconRect.y += 5f;
|
||||
EditorGUI.DrawRect(iconRect, GetUniqueColor(request.Key));
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
bool selected = highlightedRequest == requestIndex;
|
||||
|
||||
EditorGUILayout.LabelField($"<b>Label:</b> {request.Value.label}", selected ? labelStyleSelected : labelStyle, GUILayout.Width(200f));
|
||||
EditorGUILayout.LabelField($"<b>ID:</b> {request.Value.hashCode}", selected ? labelStyleSelected : labelStyle, GUILayout.Width(75f));
|
||||
EditorGUILayout.LabelField($"<b>Samples:</b> {request.Value.SampleCount}", selected ? labelStyleSelected : labelStyle, GUILayout.Width(100f));
|
||||
|
||||
string indicesString = "{ ";
|
||||
for (int i = 0; i < request.Value.indices.Count; i++)
|
||||
{
|
||||
indicesString += $"{request.Value.indices[i].ToString()}, ";
|
||||
}
|
||||
indicesString += " }";
|
||||
EditorGUILayout.LabelField($"<b>Indices:</b> {indicesString}", selected ? labelStyleSelected : labelStyle, GUILayout.MaxWidth(250f));
|
||||
|
||||
string heightsString = "{ ";
|
||||
for (int i = 0; i < request.Value.sampler.heightValues.Length; i++)
|
||||
{
|
||||
heightsString += $"{Math.Round(request.Value.sampler.heightValues[i], 3)}, ";
|
||||
}
|
||||
heightsString += " }";
|
||||
EditorGUILayout.LabelField($"<b>Heights:</b> {heightsString}", selected ? labelStyleSelected : labelStyle);
|
||||
}
|
||||
|
||||
/*
|
||||
if (showOutput)
|
||||
{
|
||||
EditorGUILayout.LabelField("Outputs");
|
||||
using (new EditorGUILayout.VerticalScope(EditorStyles.textArea, GUILayout.MaxHeight(200f)))
|
||||
{
|
||||
//outputScrollPos = EditorGUILayout.BeginScrollView(outputScrollPos);
|
||||
for (int i = 0; i < request.Value.indices.Count; i++)
|
||||
{
|
||||
int index = request.Value.indices[i];
|
||||
EditorGUILayout.LabelField(index + ": " + query.outputOffsets[index], EditorStyles.miniLabel);
|
||||
}
|
||||
//EditorGUILayout.EndScrollView();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
requestIndex++;
|
||||
}
|
||||
EditorGUILayout.EndScrollView();
|
||||
}
|
||||
}
|
||||
queryIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59dec72c64294028996963ed7821a007
|
||||
timeCreated: 1717758709
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.7
|
||||
assetPath: Assets/Stylized Water 3/Editor/Windows/HeightQuerySystemEditor.cs
|
||||
uploadId: 927372
|
||||
651
Assets/Stylized Water 3/Editor/Windows/HelpWindow.cs
Normal file
651
Assets/Stylized Water 3/Editor/Windows/HelpWindow.cs
Normal file
File diff suppressed because one or more lines are too long
18
Assets/Stylized Water 3/Editor/Windows/HelpWindow.cs.meta
Normal file
18
Assets/Stylized Water 3/Editor/Windows/HelpWindow.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6d03cdf323bbdf43a0cfb24ab918b8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.7
|
||||
assetPath: Assets/Stylized Water 3/Editor/Windows/HelpWindow.cs
|
||||
uploadId: 927372
|
||||
@@ -0,0 +1,162 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
public class RenderTargetDebuggerWindow : EditorWindow
|
||||
{
|
||||
private const int m_width = 550;
|
||||
private const int m_height = 300;
|
||||
|
||||
[MenuItem("Window/Analysis/Stylized Water 3/Render targets", false, 0)]
|
||||
private static void OpenDebugger()
|
||||
{
|
||||
RenderTargetDebuggerWindow.Open();
|
||||
}
|
||||
|
||||
#if SWS_DEV
|
||||
[MenuItem("SWS/Debug/Render Targets")]
|
||||
#endif
|
||||
public static void Open()
|
||||
{
|
||||
RenderTargetDebuggerWindow window = GetWindow<RenderTargetDebuggerWindow>(false);
|
||||
window.titleContent = new GUIContent("Water Render Buffer Inspector");
|
||||
|
||||
window.autoRepaintOnSceneChange = true;
|
||||
window.minSize = new Vector2(m_width, m_height);
|
||||
//window.maxSize = new Vector2(m_width, m_height);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private float width = 300f;
|
||||
private Vector2 scrollPos;
|
||||
|
||||
private ColorWriteMask colorMask = ColorWriteMask.All;
|
||||
private int colorChannel = 1;
|
||||
private int renderTargetIndex;
|
||||
private float exposure = 1f;
|
||||
private int mipmap = 0;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
RenderTargetDebugger.Initialize();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
RenderTargetDebugger.Cleanup();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
Repaint();
|
||||
|
||||
if (RenderTargetDebugger.renderTargetNames.Length < 5)
|
||||
{
|
||||
renderTargetIndex = GUILayout.Toolbar(renderTargetIndex, RenderTargetDebugger.renderTargetNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderTargetIndex = EditorGUILayout.Popup($"Render target ({RenderTargetDebugger.renderTargets.Count})", renderTargetIndex, RenderTargetDebugger.renderTargetNames);
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField($"Active camera: {RenderTargetDebugger.CurrentCameraName}", EditorStyles.miniLabel);
|
||||
width = (Mathf.Min(this.position.height, this.position.width) * 1f) - 15f;
|
||||
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
|
||||
|
||||
//EditorGUILayout.LabelField($"RenderTargetInspector.InspectedProperty: {RenderTargetInspector.InspectedProperty}");
|
||||
//EditorGUILayout.LabelField($"RenderTargetInspector.CurrentRT: {RenderTargetInspector.CurrentRT}");
|
||||
|
||||
int currentTarget = 0;
|
||||
foreach (var renderTarget in RenderTargetDebugger.renderTargets)
|
||||
{
|
||||
if(renderTargetIndex == currentTarget)
|
||||
{
|
||||
//mark as current!
|
||||
RenderTargetDebugger.InspectedProperty = renderTarget.propertyID;
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
using (new EditorGUILayout.VerticalScope())
|
||||
{
|
||||
DrawTexture(renderTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentTarget++;
|
||||
|
||||
}
|
||||
|
||||
EditorGUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
private void DrawTexture(RenderTargetDebugger.RenderTarget renderTarget)
|
||||
{
|
||||
if (RenderTargetDebugger.CurrentRT == null || renderTarget == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox($"Render target \"{renderTarget.textureName}\" couldn't be found, or it is not bound." +
|
||||
$"\n\nThe related render pass may be disabled, or not render for the current view (scene/game view not open)", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
//Null at the very first frame
|
||||
if (RenderTargetDebugger.CurrentRT.rt == null) return;
|
||||
|
||||
EditorGUILayout.LabelField($"\"{renderTarget.textureName}\" {RenderTargetDebugger.CurrentRT.rt.descriptor.graphicsFormat} {RenderTargetDebugger.CurrentRT.rt.width}x{RenderTargetDebugger.CurrentRT.rt.height}px @ {(UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(RenderTargetDebugger.CurrentRT) / 1024f / 1024f).ToString("F2")}mb", EditorStyles.boldLabel);
|
||||
if (renderTarget.description != string.Empty) EditorGUILayout.HelpBox(renderTarget.description, MessageType.Info);
|
||||
|
||||
Rect rect = EditorGUILayout.GetControlRect();
|
||||
|
||||
Rect position = EditorGUI.PrefixLabel(rect, GUIUtility.GetControlID(FocusType.Passive), GUIContent.none);
|
||||
position.width = width;
|
||||
|
||||
//colorChannel = EditorGUI.Popup(position, "Channel mask", colorChannel, new string[] { "RGB", "R", "G", "B", "A" });
|
||||
colorChannel = (int)GUI.Toolbar(position, colorChannel, new GUIContent[] { new GUIContent("RGBA"), new GUIContent("RGB"), new GUIContent("R"), new GUIContent("G"), new GUIContent("B"), new GUIContent("A") });
|
||||
|
||||
switch (colorChannel)
|
||||
{
|
||||
case 1: colorMask = ColorWriteMask.All;
|
||||
break;
|
||||
case 2: colorMask = ColorWriteMask.Red;
|
||||
break;
|
||||
case 3: colorMask = ColorWriteMask.Green;
|
||||
break;
|
||||
case 4: colorMask = ColorWriteMask.Blue;
|
||||
break;
|
||||
case 5: colorMask = ColorWriteMask.Alpha;
|
||||
break;
|
||||
}
|
||||
|
||||
rect.y += 21f;
|
||||
rect.width = width;
|
||||
float aspect = (RenderTargetDebugger.CurrentRT.rt.height / RenderTargetDebugger.CurrentRT.rt.width);
|
||||
rect.height = rect.width;
|
||||
|
||||
if (colorChannel == 0) //RGBA
|
||||
{
|
||||
EditorGUI.DrawTextureTransparent(rect, RenderTargetDebugger.CurrentRT, ScaleMode.ScaleToFit, aspect);
|
||||
}
|
||||
else if (colorMask == ColorWriteMask.Alpha)
|
||||
{
|
||||
EditorGUI.DrawTextureAlpha(rect, RenderTargetDebugger.CurrentRT, ScaleMode.ScaleToFit, aspect, mipmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.DrawPreviewTexture(rect, RenderTargetDebugger.CurrentRT, null, ScaleMode.ScaleToFit, aspect, mipmap, colorMask, exposure);
|
||||
}
|
||||
GUILayout.Space(rect.height + 10f);
|
||||
|
||||
mipmap = EditorGUILayout.IntSlider("Mipmap", mipmap, 0, 8);
|
||||
exposure = EditorGUILayout.Slider("Exposure", exposure, 1f, 16f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6271584fb7f40cab8c6fcf351bd5372
|
||||
timeCreated: 1717592416
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.7
|
||||
assetPath: Assets/Stylized Water 3/Editor/Windows/RenderTargetDebuggerWindow.cs
|
||||
uploadId: 927372
|
||||
Reference in New Issue
Block a user