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:
@@ -43,10 +43,8 @@ namespace Content.Client.Graphics.Overlays
|
|||||||
SingularityQuery(args.Viewport.Eye);
|
SingularityQuery(args.Viewport.Eye);
|
||||||
|
|
||||||
var viewportWB = args.WorldBounds;
|
var viewportWB = args.WorldBounds;
|
||||||
// This is a blatant cheat.
|
// Has to be correctly handled because of the way intensity/falloff transform works so just do it.
|
||||||
// The correct way of doing this would be if the singularity shader performed the matrix transforms.
|
_shader?.SetParameter("renderScale", args.Viewport.RenderScale);
|
||||||
// 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));
|
|
||||||
foreach (SingularityShaderInstance instance in _singularities.Values)
|
foreach (SingularityShaderInstance instance in _singularities.Values)
|
||||||
{
|
{
|
||||||
// To be clear, this needs to use "inside-viewport" pixels.
|
// To be clear, this needs to use "inside-viewport" pixels.
|
||||||
@@ -56,8 +54,8 @@ namespace Content.Client.Graphics.Overlays
|
|||||||
_shader?.SetParameter("positionInput", tempCoords);
|
_shader?.SetParameter("positionInput", tempCoords);
|
||||||
if (ScreenTexture != null)
|
if (ScreenTexture != null)
|
||||||
_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
||||||
_shader?.SetParameter("intensity", instance.Intensity / resolution);
|
_shader?.SetParameter("intensity", instance.Intensity);
|
||||||
_shader?.SetParameter("falloff", instance.Falloff / resolution);
|
_shader?.SetParameter("falloff", instance.Falloff);
|
||||||
|
|
||||||
var worldHandle = args.WorldHandle;
|
var worldHandle = args.WorldHandle;
|
||||||
worldHandle.UseShader(_shader);
|
worldHandle.UseShader(_shader);
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
if (value > 6) value = 6;
|
if (value > 6) value = 6;
|
||||||
|
|
||||||
_level = value;
|
|
||||||
if ((_level > 1) && (value <= 1))
|
if ((_level > 1) && (value <= 1))
|
||||||
{
|
{
|
||||||
// Prevents it getting stuck (see SingularityController.MoveSingulo)
|
// Prevents it getting stuck (see SingularityController.MoveSingulo)
|
||||||
if (_collidableComponent != null) _collidableComponent.LinearVelocity = Vector2.Zero;
|
if (_collidableComponent != null) _collidableComponent.LinearVelocity = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
_level = value;
|
||||||
|
|
||||||
if(_radiationPulseComponent != null) _radiationPulseComponent.RadsPerSecond = 10 * value;
|
if(_radiationPulseComponent != null) _radiationPulseComponent.RadsPerSecond = 10 * value;
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,9 @@
|
|||||||
bodyType: Static
|
bodyType: Static
|
||||||
fixtures:
|
fixtures:
|
||||||
- shape:
|
- shape:
|
||||||
!type:PhysShapeAabb
|
# Using a circle here makes it a lot easier to pull it all the way from Cargo
|
||||||
bounds: "-0.5, -0.5, 0.5, 0.5"
|
!type:PhysShapeCircle
|
||||||
|
radius: 0.45
|
||||||
mass: 25
|
mass: 25
|
||||||
# Keep an eye on ParticlesProjectile when adjusting these
|
# Keep an eye on ParticlesProjectile when adjusting these
|
||||||
layer:
|
layer:
|
||||||
|
|||||||
@@ -1,30 +1,12 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
abstract: true
|
abstract: true
|
||||||
id: BaseSmes
|
id: BaseSmes
|
||||||
|
parent: BaseMachine
|
||||||
name: SMES
|
name: SMES
|
||||||
description: A high-capacity superconducting magnetic energy storage (SMES) unit.
|
description: A high-capacity superconducting magnetic energy storage (SMES) unit.
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
- type: Clickable
|
|
||||||
- type: InteractionOutline
|
|
||||||
- type: Physics
|
|
||||||
bodyType: Static
|
|
||||||
fixtures:
|
|
||||||
- shape:
|
|
||||||
!type:PhysShapeAabb {}
|
|
||||||
mass: 25
|
|
||||||
mask:
|
|
||||||
- Impassable
|
|
||||||
- MobImpassable
|
|
||||||
- VaultImpassable
|
|
||||||
- SmallImpassable
|
|
||||||
layer:
|
|
||||||
- Opaque
|
|
||||||
- MobImpassable
|
|
||||||
- VaultImpassable
|
|
||||||
- SmallImpassable
|
|
||||||
- type: SnapGrid
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
sprite: Constructible/Power/smes.rsi
|
sprite: Constructible/Power/smes.rsi
|
||||||
@@ -52,8 +34,6 @@
|
|||||||
- type: PowerSupplier
|
- type: PowerSupplier
|
||||||
- type: BatteryDischarger
|
- type: BatteryDischarger
|
||||||
activeSupplyRate: 1000
|
activeSupplyRate: 1000
|
||||||
- type: Anchorable
|
|
||||||
- type: Pullable
|
|
||||||
- type: ClientEntitySpawner
|
- type: ClientEntitySpawner
|
||||||
prototypes:
|
prototypes:
|
||||||
- HVDummyWire
|
- HVDummyWire
|
||||||
@@ -61,30 +41,12 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
abstract: true
|
abstract: true
|
||||||
id: BaseSubstation
|
id: BaseSubstation
|
||||||
|
parent: BaseMachine
|
||||||
name: substation
|
name: substation
|
||||||
description: Reduces the voltage of electricity put into it.
|
description: Reduces the voltage of electricity put into it.
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
components:
|
components:
|
||||||
- type: Clickable
|
|
||||||
- type: InteractionOutline
|
|
||||||
- type: Physics
|
|
||||||
bodyType: Static
|
|
||||||
fixtures:
|
|
||||||
- shape:
|
|
||||||
!type:PhysShapeAabb {}
|
|
||||||
mass: 25
|
|
||||||
mask:
|
|
||||||
- Impassable
|
|
||||||
- MobImpassable
|
|
||||||
- VaultImpassable
|
|
||||||
- SmallImpassable
|
|
||||||
layer:
|
|
||||||
- Opaque
|
|
||||||
- MobImpassable
|
|
||||||
- VaultImpassable
|
|
||||||
- SmallImpassable
|
|
||||||
- type: SnapGrid
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Constructible/Power/substation.rsi
|
sprite: Constructible/Power/substation.rsi
|
||||||
layers:
|
layers:
|
||||||
@@ -113,8 +75,6 @@
|
|||||||
voltage: Medium
|
voltage: Medium
|
||||||
- type: BatteryDischarger
|
- type: BatteryDischarger
|
||||||
activeSupplyRate: 1000
|
activeSupplyRate: 1000
|
||||||
- type: Anchorable
|
|
||||||
- type: Pullable
|
|
||||||
- type: ClientEntitySpawner
|
- type: ClientEntitySpawner
|
||||||
prototypes:
|
prototypes:
|
||||||
- HVDummyWire
|
- HVDummyWire
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: CloningPod
|
id: CloningPod
|
||||||
parent: BaseMachine
|
parent: BaseMachinePowered
|
||||||
name: cloning pod
|
name: cloning pod
|
||||||
description: A Cloning Pod. 50% reliable.
|
description: A Cloning Pod. 50% reliable.
|
||||||
components:
|
components:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
id: MedicalScanner
|
id: MedicalScanner
|
||||||
parent: BaseMachine
|
parent: BaseMachinePowered
|
||||||
name: medical scanner
|
name: medical scanner
|
||||||
description: A bulky medical scanner.
|
description: A bulky medical scanner.
|
||||||
components:
|
components:
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
bodyType: Static
|
bodyType: Static
|
||||||
fixtures:
|
fixtures:
|
||||||
- shape:
|
- shape:
|
||||||
!type:PhysShapeAabb {}
|
!type:PhysShapeAabb
|
||||||
|
bounds: "-0.45, -0.45, 0.45, 0.45"
|
||||||
mass: 50
|
mass: 50
|
||||||
layer:
|
layer:
|
||||||
- SmallImpassable
|
- SmallImpassable
|
||||||
@@ -34,7 +35,8 @@
|
|||||||
bodyType: Dynamic
|
bodyType: Dynamic
|
||||||
fixtures:
|
fixtures:
|
||||||
- shape:
|
- shape:
|
||||||
!type:PhysShapeAabb {}
|
!type:PhysShapeAabb
|
||||||
|
bounds: "-0.45, -0.45, 0.45, 0.45"
|
||||||
mass: 50
|
mass: 50
|
||||||
layer:
|
layer:
|
||||||
- SmallImpassable
|
- SmallImpassable
|
||||||
|
|||||||
@@ -5,13 +5,12 @@
|
|||||||
components:
|
components:
|
||||||
- type: InteractionOutline
|
- type: InteractionOutline
|
||||||
- type: Anchorable
|
- type: Anchorable
|
||||||
- type: Pullable
|
|
||||||
- type: PowerReceiver
|
|
||||||
- type: Physics
|
- type: Physics
|
||||||
bodyType: Static
|
bodyType: Static
|
||||||
fixtures:
|
fixtures:
|
||||||
- shape:
|
- shape:
|
||||||
!type:PhysShapeAabb {}
|
!type:PhysShapeAabb
|
||||||
|
bounds: "-0.45, -0.45, 0.45, 0.45"
|
||||||
mass: 25
|
mass: 25
|
||||||
layer:
|
layer:
|
||||||
- MobMask
|
- MobMask
|
||||||
@@ -28,3 +27,11 @@
|
|||||||
behaviors:
|
behaviors:
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: ["Destruction"]
|
acts: ["Destruction"]
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
abstract: true
|
||||||
|
parent: BaseMachine
|
||||||
|
id: BaseMachinePowered
|
||||||
|
components:
|
||||||
|
- type: PowerReceiver
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
uniform sampler2D SCREEN_TEXTURE;
|
uniform sampler2D SCREEN_TEXTURE;
|
||||||
uniform highp vec2 positionInput;
|
uniform highp vec2 positionInput;
|
||||||
|
uniform highp vec2 renderScale;
|
||||||
uniform highp float falloff;
|
uniform highp float falloff;
|
||||||
uniform highp float intensity;
|
uniform highp float intensity;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
highp float distanceToCenter = length(FRAGCOORD.xy-positionInput);
|
highp float distanceToCenter = length((FRAGCOORD.xy - positionInput) / renderScale);
|
||||||
|
|
||||||
highp vec2 finalCoords = FRAGCOORD.xy - positionInput;
|
highp vec2 finalCoords = FRAGCOORD.xy - positionInput;
|
||||||
highp float deformation = (pow(intensity, 2.0)*500.0) / pow(distanceToCenter, pow(falloff, 0.5));
|
highp float deformation = (pow(intensity, 2.0)*500.0) / pow(distanceToCenter, pow(falloff, 0.5));
|
||||||
|
|||||||
Reference in New Issue
Block a user