Singularity Fixes, Part 3 (#4105)

* Hopefully make singularity shader warping resolution-invariant

This may or may not fix intensity issues

* Fix singularity 'zero velocity' check

It got stuck in a corner. Twice. I really thought I'd fixed that.

* Make it easier to move around various power stuff by shrinking their AABBs a little and making singulo generator a circle

* Changes to some machine prototypes to reduce duplication of collision changes (#1)

* Changes to some machine prototypes to reduce duplication of collision changes

* BaseMachine.BaseMachineUnpowered -> BaseMachine.BaseMachinePowered
This commit is contained in:
20kdc
2021-06-03 08:55:50 +01:00
committed by GitHub
parent 74eb2bd283
commit 6a78c401bf
9 changed files with 28 additions and 59 deletions

View File

@@ -43,10 +43,8 @@ namespace Content.Client.Graphics.Overlays
SingularityQuery(args.Viewport.Eye);
var viewportWB = args.WorldBounds;
// This is a blatant cheat.
// The correct way of doing this would be if the singularity shader performed the matrix transforms.
// I don't need to explain why I'm not doing that.
var resolution = Math.Max(0.125f, Math.Min(args.Viewport.RenderScale.X, args.Viewport.RenderScale.Y));
// Has to be correctly handled because of the way intensity/falloff transform works so just do it.
_shader?.SetParameter("renderScale", args.Viewport.RenderScale);
foreach (SingularityShaderInstance instance in _singularities.Values)
{
// To be clear, this needs to use "inside-viewport" pixels.
@@ -56,8 +54,8 @@ namespace Content.Client.Graphics.Overlays
_shader?.SetParameter("positionInput", tempCoords);
if (ScreenTexture != null)
_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_shader?.SetParameter("intensity", instance.Intensity / resolution);
_shader?.SetParameter("falloff", instance.Falloff / resolution);
_shader?.SetParameter("intensity", instance.Intensity);
_shader?.SetParameter("falloff", instance.Falloff);
var worldHandle = args.WorldHandle;
worldHandle.UseShader(_shader);