forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gateway destinations (space-wizards#21040)
* Gateway generation * Gateway stuff * gatewehs * mercenaries * play area * Range fixes and tweaks * weh * Gateway UI polish * Lots of fixes * Knock some items off * Fix dungeon spawning Realistically we should probably be using a salvage job. * wahwah * wehvs * expression * weh * eee * a * a * WEH * frfr * Gatwey * Fix gateway windows * Fix gateway windows * a * a * Better layer masking * a * a * Noise fixes * a * Fix fractal calculations * a * More fixes * Fixes * Add layers back in * Fixes * namespaces and ftl * Other TODO * Fix distance * Cleanup * Fix test
- Loading branch information
1 parent
67a3c3a
commit 816ee2e
Showing
51 changed files
with
1,560 additions
and
957 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.Numerics; | ||
using Content.Shared.Salvage; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.Overlays; | ||
|
||
public sealed partial class StencilOverlay | ||
{ | ||
private void DrawRestrictedRange(in OverlayDrawArgs args, RestrictedRangeComponent rangeComp, Matrix3 invMatrix) | ||
{ | ||
var worldHandle = args.WorldHandle; | ||
var renderScale = args.Viewport.RenderScale.X; | ||
// TODO: This won't handle non-standard zooms so uhh yeah, not sure how to structure it on the shader side. | ||
var zoom = args.Viewport.Eye?.Zoom ?? Vector2.One; | ||
var length = zoom.X; | ||
var bufferRange = MathF.Min(10f, rangeComp.Range); | ||
|
||
var pixelCenter = invMatrix.Transform(rangeComp.Origin); | ||
// Something something offset? | ||
var vertical = args.Viewport.Size.Y; | ||
|
||
var pixelMaxRange = rangeComp.Range * renderScale / length * EyeManager.PixelsPerMeter; | ||
var pixelBufferRange = bufferRange * renderScale / length * EyeManager.PixelsPerMeter; | ||
var pixelMinRange = pixelMaxRange - pixelBufferRange; | ||
|
||
_shader.SetParameter("position", new Vector2(pixelCenter.X, vertical - pixelCenter.Y)); | ||
_shader.SetParameter("maxRange", pixelMaxRange); | ||
_shader.SetParameter("minRange", pixelMinRange); | ||
_shader.SetParameter("bufferRange", pixelBufferRange); | ||
_shader.SetParameter("gradient", 0.80f); | ||
|
||
var worldAABB = args.WorldAABB; | ||
var worldBounds = args.WorldBounds; | ||
var position = args.Viewport.Eye?.Position.Position ?? Vector2.Zero; | ||
var localAABB = invMatrix.TransformBox(worldAABB); | ||
|
||
// Cut out the irrelevant bits via stencil | ||
// This is why we don't just use parallax; we might want specific tiles to get drawn over | ||
// particularly for planet maps or stations. | ||
worldHandle.RenderInRenderTarget(_blep!, () => | ||
{ | ||
worldHandle.UseShader(_shader); | ||
worldHandle.DrawRect(localAABB, Color.White); | ||
}, Color.Transparent); | ||
|
||
worldHandle.SetTransform(Matrix3.Identity); | ||
worldHandle.UseShader(_protoManager.Index<ShaderPrototype>("StencilMask").Instance()); | ||
worldHandle.DrawTextureRect(_blep!.Texture, worldBounds); | ||
var curTime = _timing.RealTime; | ||
var sprite = _sprite.GetFrame(new SpriteSpecifier.Texture(new ResPath("/Textures/Parallaxes/noise.png")), curTime); | ||
|
||
// Draw the rain | ||
worldHandle.UseShader(_protoManager.Index<ShaderPrototype>("StencilDraw").Instance()); | ||
_parallax.DrawParallax(worldHandle, worldAABB, sprite, curTime, position, new Vector2(0.5f, 0f)); | ||
} | ||
} |
Oops, something went wrong.