Improve singularity shader (#7647)

* Working example

* vector arrays

* simplify math

* max distance

* max distance

* PVS override

* rename count
This commit is contained in:
Leon Friedrich
2022-04-29 00:43:16 +12:00
committed by GitHub
parent 4aa45dc695
commit 8fb48a09ef
7 changed files with 114 additions and 156 deletions

View File

@@ -1,11 +1,5 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Singularity.Components
{
[RegisterComponent]
@@ -13,10 +7,10 @@ namespace Content.Shared.Singularity.Components
public sealed class SingularityDistortionComponent : Component
{
[DataField("intensity")]
private float _intensity = 0.25f;
private float _intensity = 31.25f;
[DataField("falloff")]
private float _falloff = 2;
[DataField("falloffPower")]
private float _falloffPower = MathF.Sqrt(2f);
[ViewVariables(VVAccess.ReadWrite)]
public float Intensity
@@ -26,15 +20,15 @@ namespace Content.Shared.Singularity.Components
}
[ViewVariables(VVAccess.ReadWrite)]
public float Falloff
public float FalloffPower
{
get => _falloff;
set => this.SetAndDirtyIfChanged(ref _falloff, value);
get => _falloffPower;
set => this.SetAndDirtyIfChanged(ref _falloffPower, value);
}
public override ComponentState GetComponentState()
{
return new SingularityDistortionComponentState(Intensity, Falloff);
return new SingularityDistortionComponentState(Intensity, FalloffPower);
}
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
@@ -47,7 +41,7 @@ namespace Content.Shared.Singularity.Components
}
Intensity = state.Intensity;
Falloff = state.Falloff;
FalloffPower = state.Falloff;
}
}