Improve singularity shader (#7647)
* Working example * vector arrays * simplify math * max distance * max distance * PVS override * rename count
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace Content.Shared.Singularity
|
||||
return level switch
|
||||
{
|
||||
0 => 9999f,
|
||||
1 => 6.4f,
|
||||
2 => 7.0f,
|
||||
3 => 8.0f,
|
||||
4 => 10.0f,
|
||||
5 => 12.0f,
|
||||
6 => 12.0f,
|
||||
1 => MathF.Sqrt(6.4f),
|
||||
2 => MathF.Sqrt(7.0f),
|
||||
3 => MathF.Sqrt(8.0f),
|
||||
4 => MathF.Sqrt(10.0f),
|
||||
5 => MathF.Sqrt(12.0f),
|
||||
6 => MathF.Sqrt(12.0f),
|
||||
_ => -1.0f
|
||||
};
|
||||
}
|
||||
@@ -37,12 +37,12 @@ namespace Content.Shared.Singularity
|
||||
return level switch
|
||||
{
|
||||
0 => 0.0f,
|
||||
1 => 2.7f,
|
||||
2 => 14.4f,
|
||||
3 => 47.2f,
|
||||
4 => 180.0f,
|
||||
5 => 600.0f,
|
||||
6 => 800.0f,
|
||||
1 => 3645f,
|
||||
2 => 103680f,
|
||||
3 => 1113920f,
|
||||
4 => 16200000f,
|
||||
5 => 180000000f,
|
||||
6 => 180000000f,
|
||||
_ => -1.0f
|
||||
};
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace Content.Shared.Singularity
|
||||
|
||||
if (EntityManager.TryGetComponent(singularity.Owner, out SingularityDistortionComponent? distortion))
|
||||
{
|
||||
distortion.Falloff = GetFalloff(value);
|
||||
distortion.FalloffPower = GetFalloff(value);
|
||||
distortion.Intensity = GetIntensity(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user