Improved the culling result of HizCulling;

Added custom inspector for VolumeObject;
Change the name of AoVolume to VolumeObject;
This commit is contained in:
2025-02-24 00:22:04 +09:00
parent 833502f87c
commit 2f79df128e
23 changed files with 336 additions and 86 deletions

View File

@@ -0,0 +1,59 @@
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
using UnityEngine.UIElements;
namespace Misaki.AoVolume.Editor
{
[CustomEditor(typeof(VolumeObject))]
[CanEditMultipleObjects]
public class VolumeObjectView : UnityEditor.Editor
{
[SerializeField]
private VisualTreeAsset _viewAsset;
private readonly BoxBoundsHandle _boundsHandle = new()
{
wireframeColor = Color.green,
handleColor = Color.green
};
public override VisualElement CreateInspectorGUI()
{
if (_viewAsset == null)
{
return null;
}
var view = _viewAsset.Instantiate();
view.dataSource = target;
view.Q<Button>("force-update-button").clicked += () =>
{
var volumeObject = target as VolumeObject;
volumeObject.ForceDataUpdate();
};
return view;
}
private void OnSceneGUI()
{
var volume = (VolumeObject)target;
using (new Handles.DrawingScope(volume.transform.localToWorldMatrix))
{
_boundsHandle.center = Vector3.zero;
_boundsHandle.size = volume.data.size;
EditorGUI.BeginChangeCheck();
_boundsHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(volume, string.Format("Change {0} Volume Size", target.name));
volume.data.size = _boundsHandle.size;
}
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: faa9f9c3bc2e589479a3c193b297430f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- _viewAsset: {fileID: 9197481963319205126, guid: 436554c15c49ae24cb05da739f863971,
type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<engine:VisualElement data-source-type="Misaki.AoVolume.VolumeObject, Misaki.AoVolume" style="flex-grow: 1;">
<editor:PropertyField binding-path="dynamicVolume" label="Dynamic Volume" />
<editor:PropertyField binding-path="data.size" label="Size" />
<editor:PropertyField binding-path="data.intensity" label="Intensity" />
<editor:PropertyField binding-path="data.falloff" label="IntensityFalloff" />
<editor:PropertyField binding-path="data.normalFalloff" label="NormalFalloff" />
<engine:Button text="Force Update" name="force-update-button" />
</engine:VisualElement>
</engine:UXML>

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 436554c15c49ae24cb05da739f863971
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}