2026-06-09 룸 프로토타입 디자인 (진행중)

This commit is contained in:
skrwns304@gmail.com
2026-06-09 20:53:26 +09:00
parent 3a18351d17
commit 4c955dafc3
3544 changed files with 226503 additions and 17 deletions

View File

@@ -0,0 +1,168 @@
// 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 UnityEngine;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace StylizedWater3
{
[CustomPropertyDrawer(typeof(HeightQuerySystem.Interface))]
public class HeightInterfaceDrawer : PropertyDrawer
{
private bool waveProfileMismatch;
private bool renderFeatureSetup;
private bool enabled;
private void OnEnable()
{
enabled = true;
CheckRenderFeature();
}
private void CheckRenderFeature()
{
renderFeatureSetup = StylizedWaterEditor.IsRenderFeatureSetup();
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if(!enabled) OnEnable();
GUILayout.Space(-GetPropertyHeight(property, label));
EditorGUILayout.LabelField("Water Height Interface", EditorStyles.boldLabel);
var methodProperty = property.FindPropertyRelative("method");
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(methodProperty);
if (EditorGUI.EndChangeCheck())
{
CheckRenderFeature();
}
if (methodProperty.intValue == (int)HeightQuerySystem.Interface.Method.CPU)
{
EditorGUILayout.Separator();
EditorGUI.BeginChangeCheck();
EditorGUI.indentLevel++;
var waterObject = property.FindPropertyRelative("waterObject");
var autoFind = property.FindPropertyRelative("autoFind");
using (new EditorGUI.DisabledScope(autoFind.boolValue))
{
EditorGUILayout.PropertyField(waterObject);
}
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(autoFind);
EditorGUI.indentLevel--;
var waveProfile = property.FindPropertyRelative("waveProfile");
EditorGUILayout.PropertyField(waveProfile);
if (waveProfile.objectReferenceValue == null)
{
if (waterObject.objectReferenceValue)
{
UI.DrawNotification(true, "A wave profile must assigned", "Try get", () =>
{
waveProfile.objectReferenceValue = WaveProfileEditor.LoadFromWaterObject(waterObject.objectReferenceValue as WaterObject);
}, MessageType.Error);
}
else
{
UI.DrawNotification("A wave profile must assigned", MessageType.Error);
}
}
else
{
if (waveProfileMismatch)
{
UI.DrawNotification(true, "The wave profile does not match the one used on the water material." +
"\n\nWave animations will likely appear out of sync", "Attempt fix",() =>
{
WaterObject obj = (WaterObject)waterObject.objectReferenceValue;
waveProfile.objectReferenceValue = WaveProfileEditor.LoadFromMaterial(obj.material);
}, MessageType.Warning);
}
}
EditorGUILayout.Separator();
var waterLevelSource = property.FindPropertyRelative("waterLevelSource");
EditorGUILayout.PropertyField(waterLevelSource);
if (waterLevelSource.intValue == (int)HeightQuerySystem.Interface.WaterLevelSource.FixedValue)
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("waterLevel"));
}
if (waterLevelSource.intValue == (int)HeightQuerySystem.Interface.WaterLevelSource.Transform)
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("waterLevelTransform"), new GUIContent("Transform", "The transform to use to calculate the water level"));
}
if (waterLevelSource.intValue == (int)HeightQuerySystem.Interface.WaterLevelSource.Ocean &&
!OceanFollowBehaviour.Instance)
{
EditorGUILayout.HelpBox("No ocean is currently present", MessageType.Warning);
}
if (waterLevelSource.intValue != (int)HeightQuerySystem.Interface.WaterLevelSource.FixedValue)
{
HeightQuerySystem.Interface interfaceObj = property.boxedValue as HeightQuerySystem.Interface;
EditorGUILayout.HelpBox($"Water level: {interfaceObj.GetWaterLevel()}", MessageType.None, false);
}
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck())
{
waveProfileMismatch = false;
if (waveProfile.objectReferenceValue && waterObject.objectReferenceValue)
{
WaveProfile profile = (WaveProfile)waveProfile.objectReferenceValue;
WaterObject obj = (WaterObject)waterObject.objectReferenceValue;
WaveProfile materialProfile = WaveProfileEditor.LoadFromMaterial(obj.material);
waveProfileMismatch = materialProfile != profile;
}
}
}
else
{
UI.DrawNotification(HeightQuerySystem.IsSupported() == false,"This technique is not supported on the current platform." +
"\n\n" +
"Unity reports asynchronous compute shaders are not supported, which this functionality relies on.", MessageType.Error);
UI.DrawRenderFeatureSetupError(ref renderFeatureSetup);
if (Application.isPlaying == false && HeightQuerySystem.DISABLE_IN_EDIT_MODE)
{
UI.DrawNotification("GPU height queries have been disabled while in edit mode. You'll find this option on the render feature", MessageType.Warning);
}
if (Application.isPlaying && Camera.main == null)
{
UI.DrawNotification("No main camera found, water height will not be correct. Ensure a camera has the \"MainCamera\" tag.", MessageType.Error);
}
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.LabelField("");
if (GUILayout.Button(new GUIContent(" Inspect Queries", EditorGUIUtility.FindTexture("_Help"))))
{
HeightQuerySystemEditor.HeightQueryInspector.Open();
}
}
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 76d63d50bd644766b0f1ad187f4492e7
timeCreated: 1719918895
AssetOrigin:
serializedVersion: 1
productId: 287769
packageName: Stylized Water 3
packageVersion: 3.2.7
assetPath: Assets/Stylized Water 3/Editor/PropertyDrawers/HeightInterfaceDrawer.cs
uploadId: 927372

View File

@@ -0,0 +1,66 @@
// 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 UnityEditor;
using UnityEngine;
namespace StylizedWater3
{
//Use as "[MinMaxSlider(0, 5)]" on a material property. Proper should be a Vector type
public class MinMaxSliderDrawer : MaterialPropertyDrawer
{
private readonly float min;
private readonly float max;
private Rect minFieldRect;
private Rect sliderFieldRect;
private Rect maxFieldRect;
public MinMaxSliderDrawer(float min, float max)
{
this.min = min;
this.max = max;
}
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
{
MaterialEditor.BeginProperty(prop);
float minVal = prop.vectorValue.x;
float maxVal = prop.vectorValue.y;
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = prop.hasMixedValue;
Rect labelRect = position;
labelRect.width = EditorGUIUtility.labelWidth;
EditorGUI.LabelField(labelRect, label);
minFieldRect = labelRect;
minFieldRect.x = labelRect.x + labelRect.width;
minFieldRect.width = EditorGUIUtility.fieldWidth;
minVal = EditorGUI.FloatField(minFieldRect, minVal);
sliderFieldRect = labelRect;
sliderFieldRect.x = minFieldRect.x + minFieldRect.width + 5f;
sliderFieldRect.width = position.width - (EditorGUIUtility.fieldWidth * 2f) - labelRect.width - 10f;
EditorGUI.MinMaxSlider(sliderFieldRect, ref minVal, ref maxVal, min, max);
maxFieldRect = labelRect;
maxFieldRect.x = sliderFieldRect.x + sliderFieldRect.width + 5f;
maxFieldRect.width = EditorGUIUtility.fieldWidth;
maxVal = EditorGUI.FloatField(maxFieldRect, maxVal);
if (EditorGUI.EndChangeCheck())
{
prop.vectorValue = new Vector4(minVal, maxVal);
}
EditorGUI.showMixedValue = false;
MaterialEditor.EndProperty();
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cf68eb48df7045e6ab979eeb7dd25215
timeCreated: 1718782193
AssetOrigin:
serializedVersion: 1
productId: 287769
packageName: Stylized Water 3
packageVersion: 3.2.7
assetPath: Assets/Stylized Water 3/Editor/PropertyDrawers/MinMaxSlider.cs
uploadId: 927372

View File

@@ -0,0 +1,53 @@
// 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 UnityEditor;
using UnityEngine;
namespace StylizedWater3
{
public class WaveProfileDrawer : MaterialPropertyDrawer
{
private const float EDIT_BTN_WIDTH = 50f;
public override void OnGUI (Rect position, MaterialProperty prop, String label, MaterialEditor editor)
{
MaterialEditor.BeginProperty(prop);
// Setup
WaveProfile profile = WaveProfileEditor.LoadFromLUT(prop.textureValue);
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = prop.hasMixedValue;
Rect labelRect = position;
labelRect.width = EditorGUIUtility.labelWidth + 37;
EditorGUI.LabelField(labelRect, label);
Rect fieldRect = position;
fieldRect.x = labelRect.width;
fieldRect.width = (EditorGUIUtility.fieldWidth * 4f) - EDIT_BTN_WIDTH;
profile = (WaveProfile)EditorGUI.ObjectField(fieldRect, profile, typeof(WaveProfile), false);
Rect editBtnRect = position;
editBtnRect.x = fieldRect.x + fieldRect.width;
editBtnRect.width = EDIT_BTN_WIDTH;
if (GUI.Button(editBtnRect, "Edit"))
{
Selection.activeObject = WaveProfileEditor.LoadFromLUT(prop.textureValue);
}
EditorGUI.showMixedValue = false;
if (EditorGUI.EndChangeCheck())
{
prop.textureValue = profile.shaderParametersLUT;
}
MaterialEditor.EndProperty();
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4d2ada3c8d25ab44ebe13baf27cd9427
timeCreated: 1716196796
AssetOrigin:
serializedVersion: 1
productId: 287769
packageName: Stylized Water 3
packageVersion: 3.2.7
assetPath: Assets/Stylized Water 3/Editor/PropertyDrawers/WaveProfileDrawer.cs
uploadId: 927372