升级6.4.升级水,升级天气
This commit is contained in:
@@ -36,6 +36,10 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
MonoBehaviour Component { get; }
|
||||
|
||||
IReportsHeight HeightReporter => null;
|
||||
IReportsDisplacement DisplacementReporter => null;
|
||||
IReportWaveDisplacement WaveDisplacementReporter => null;
|
||||
|
||||
// Allow sorting within a queue. Callers can pass in things like sibling index to
|
||||
// get deterministic sorting.
|
||||
int Order => Queue * k_QueueMaximumSubIndex + Mathf.Min(Component.transform.GetSiblingIndex(), k_QueueMaximumSubIndex - 1);
|
||||
@@ -70,9 +74,9 @@ namespace WaveHarmonic.Crest
|
||||
// For others it is a case of only supporting unsupported mode(s).
|
||||
|
||||
[Tooltip("Scales the input.")]
|
||||
[@Predicated(typeof(AlbedoLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(ClipLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(DepthLodInput), inverted: true, hide: true)]
|
||||
[@Hide(typeof(AlbedoLodInput))]
|
||||
[@Hide(typeof(ClipLodInput))]
|
||||
[@Hide(typeof(DepthLodInput))]
|
||||
[@Range(0f, 1f)]
|
||||
[@GenerateAPI]
|
||||
[SerializeField]
|
||||
@@ -84,17 +88,17 @@ namespace WaveHarmonic.Crest
|
||||
int _Queue;
|
||||
|
||||
[Tooltip("How this input blends into existing data.\n\nSimilar to blend operations in shaders. For inputs which have materials, use the blend functionality on the shader/material.")]
|
||||
[@Predicated(typeof(AbsorptionLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(AlbedoLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(AnimatedWavesLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(ClipLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(DepthLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(DynamicWavesLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(ScatteringLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(ShadowLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Global))]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Primitive))]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Renderer))]
|
||||
[@Hide(typeof(AbsorptionLodInput))]
|
||||
[@Hide(typeof(AlbedoLodInput))]
|
||||
[@Hide(typeof(AnimatedWavesLodInput))]
|
||||
[@Hide(typeof(ClipLodInput))]
|
||||
[@Hide(typeof(DepthLodInput))]
|
||||
[@Hide(typeof(DynamicWavesLodInput))]
|
||||
[@Hide(typeof(ScatteringLodInput))]
|
||||
[@Hide(typeof(ShadowLodInput))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Global))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Primitive))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Renderer))]
|
||||
[@Filtered]
|
||||
[@GenerateAPI]
|
||||
[SerializeField]
|
||||
@@ -102,35 +106,35 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
[@Label("Feather")]
|
||||
[Tooltip("The width of the feathering to soften the edges to blend inputs.\n\nInputs that do not support feathering will have this field disabled or hidden in UI.")]
|
||||
[@Predicated(typeof(AlbedoLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(AnimatedWavesLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(ClipLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(DepthLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(DynamicWavesLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(LevelLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Renderer))]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Global))]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Primitive))]
|
||||
[@Hide(typeof(AlbedoLodInput))]
|
||||
[@Hide(typeof(AnimatedWavesLodInput))]
|
||||
[@Hide(typeof(ClipLodInput))]
|
||||
[@Hide(typeof(DepthLodInput))]
|
||||
[@Hide(typeof(DynamicWavesLodInput))]
|
||||
[@Hide(typeof(LevelLodInput))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Renderer))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Global))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Primitive))]
|
||||
[@GenerateAPI]
|
||||
[@DecoratedField, SerializeField]
|
||||
float _FeatherWidth = 0.1f;
|
||||
|
||||
[Tooltip("How this input responds to horizontal displacement.\n\nIf false, data will not move horizontally with the waves. Has a small performance overhead when disabled. Only suitable for inputs of small size.")]
|
||||
[@Predicated(typeof(ClipLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(FlowLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(LevelLodInput), inverted: true, hide: true)]
|
||||
[@Predicated(typeof(ShapeWaves), inverted: true, hide: true)]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Global))]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Spline))]
|
||||
[@Hide(typeof(ClipLodInput))]
|
||||
[@Hide(typeof(FlowLodInput))]
|
||||
[@Hide(typeof(LevelLodInput))]
|
||||
[@Hide(typeof(ShapeWaves))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Global))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Spline))]
|
||||
[@GenerateAPI]
|
||||
[@DecoratedField, SerializeField]
|
||||
private protected bool _FollowHorizontalWaveMotion = false;
|
||||
|
||||
[@Heading("Mode")]
|
||||
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Unset), hide: true)]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Primitive), hide: true)]
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Global), hide: true)]
|
||||
[@Hide(nameof(_Mode), nameof(LodInputMode.Unset))]
|
||||
[@Hide(nameof(_Mode), nameof(LodInputMode.Primitive))]
|
||||
[@Hide(nameof(_Mode), nameof(LodInputMode.Global))]
|
||||
[@Stripped]
|
||||
[SerializeReference]
|
||||
internal LodInputData _Data;
|
||||
@@ -140,7 +144,7 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
[@Group("Debug", order = k_DebugGroupOrder)]
|
||||
|
||||
[@Predicated(nameof(_Mode), inverted: false, nameof(LodInputMode.Global))]
|
||||
[@Disable(nameof(_Mode), nameof(LodInputMode.Global))]
|
||||
[@DecoratedField, SerializeField]
|
||||
internal bool _DrawBounds;
|
||||
|
||||
@@ -376,6 +380,16 @@ namespace WaveHarmonic.Crest
|
||||
//
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void SetMode(LodInputMode previous, LodInputMode current)
|
||||
{
|
||||
if (previous == current) return;
|
||||
if (!isActiveAndEnabled) { ChangeMode(Mode); return; }
|
||||
OnDisable();
|
||||
ChangeMode(Mode);
|
||||
UnityEditor.EditorTools.ToolManager.RefreshAvailableTools();
|
||||
OnEnable();
|
||||
}
|
||||
|
||||
[@OnChange(skipIfInactive: false)]
|
||||
void OnChange(string propertyPath, object previousValue)
|
||||
{
|
||||
@@ -385,15 +399,11 @@ namespace WaveHarmonic.Crest
|
||||
SetQueue((int)previousValue, _Queue);
|
||||
break;
|
||||
case nameof(_Mode):
|
||||
if (!isActiveAndEnabled) { ChangeMode(Mode); break; }
|
||||
OnDisable();
|
||||
ChangeMode(Mode);
|
||||
UnityEditor.EditorTools.ToolManager.RefreshAvailableTools();
|
||||
OnEnable();
|
||||
SetMode((LodInputMode)previousValue, Mode);
|
||||
break;
|
||||
case nameof(_Blend):
|
||||
// TODO: Make compatible with disabled.
|
||||
if (isActiveAndEnabled) Data.OnChange($"../{propertyPath}", previousValue);
|
||||
if (isActiveAndEnabled) Data?.OnChange($"../{propertyPath}", previousValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -467,6 +477,9 @@ namespace WaveHarmonic.Crest
|
||||
partial class LodInput
|
||||
{
|
||||
Input _Input;
|
||||
private protected IReportsHeight _HeightReporter;
|
||||
internal IReportsDisplacement _DisplacementReporter;
|
||||
private protected IReportWaveDisplacement _WaveDisplacementReporter;
|
||||
|
||||
sealed class Input : ILodInput
|
||||
{
|
||||
@@ -478,6 +491,9 @@ namespace WaveHarmonic.Crest
|
||||
public int Pass => _Input.Pass;
|
||||
public Rect Rect => _Input.Rect;
|
||||
public MonoBehaviour Component => _Input;
|
||||
public IReportsHeight HeightReporter => _Input._HeightReporter;
|
||||
public IReportsDisplacement DisplacementReporter => _Input._DisplacementReporter;
|
||||
public IReportWaveDisplacement WaveDisplacementReporter => _Input._WaveDisplacementReporter;
|
||||
public float Filter(WaterRenderer water, int slice) => _Input.Filter(water, slice);
|
||||
public void Draw(Lod lod, CommandBuffer buffer, RenderTargetIdentifier target, int pass = -1, float weight = 1, int slice = -1) => _Input.Draw(lod, buffer, target, pass, weight, slice);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user