-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Displacement Map Visualizer QoL (#27392) * Update Displacement Map Visualizer.lua * Add files via upload * Fix background layer being offset This was caused by not taking the cel's own bounds into account. Aseprite doesn't make an image layer "full size" if it only covers a small part of the sprite. --------- Co-authored-by: Pieter-Jan Briers <[email protected]> * Displacement maps now works on any layers (#27405) * try * pipupi * Update ClientClothingSystem.cs * Update vox.yml * Update ClientClothingSystem.cs * Fix Vox clothing in character creation menu (#29709) Update vox.yml * Vox displacement updates (#29824) * more vox displacement maps * A * remove vox insuls sprites * sci magboots * Update vox.yml * Update meta.json --------- Co-authored-by: Ed <[email protected]> * Displacement maps big update (#30093) * split logic into own system * add support for different size displacement maps * some clothes may not use displacement maps * displacement maps spport hand sprites * Update DisplacementMapSystem.cs * rename things * fuck stencilmask * fix bugs * no masks * Update jumpsuits.yml * fix species specific sprites * Update ClothingSystem.cs * shoes + ears displacement, some bugfix * Update DisplacementMapSystem.cs * Vox head displacement map (#30699) * head displacement for vox * fixe * fix index stepping to avoid pushing front layers into back layers (#32553) Co-authored-by: charlie <[email protected]> * Mothroaches can now wear hamster-wearable clothes + pet inventory tweaks (#28956) * moth displacement + inventory tweaks * Fix off by 1 on the head sprites * Move files to main mothroach folder * Fix mask up a bit * Fix side mask sprites * Change format because it changed forever ago * fix mothroach spawner * remove nyano femaleMask --------- Co-authored-by: Ed <[email protected]> Co-authored-by: Pieter-Jan Briers <[email protected]> Co-authored-by: Flareguy <[email protected]> Co-authored-by: Charlie <[email protected]> Co-authored-by: charlie <[email protected]> Co-authored-by: Verm <[email protected]>
- Loading branch information
1 parent
683e101
commit db97317
Showing
76 changed files
with
514 additions
and
232 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Content.Shared.DisplacementMap; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Serialization.Manager; | ||
|
||
namespace Content.Client.DisplacementMap; | ||
|
||
public sealed class DisplacementMapSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ISerializationManager _serialization = default!; | ||
|
||
public bool TryAddDisplacement(DisplacementData data, SpriteComponent sprite, int index, string key, HashSet<string> revealedLayers) | ||
{ | ||
if (data.ShaderOverride != null) | ||
sprite.LayerSetShader(index, data.ShaderOverride); | ||
|
||
var displacementKey = $"{key}-displacement"; | ||
if (!revealedLayers.Add(displacementKey)) | ||
{ | ||
Log.Warning($"Duplicate key for DISPLACEMENT: {displacementKey}."); | ||
return false; | ||
} | ||
|
||
//allows you not to write it every time in the YML | ||
foreach (var pair in data.SizeMaps) | ||
{ | ||
pair.Value.CopyToShaderParameters??= new() | ||
{ | ||
LayerKey = "dummy", | ||
ParameterTexture = "displacementMap", | ||
ParameterUV = "displacementUV", | ||
}; | ||
} | ||
|
||
if (!data.SizeMaps.ContainsKey(32)) | ||
{ | ||
Log.Error($"DISPLACEMENT: {displacementKey} don't have 32x32 default displacement map"); | ||
return false; | ||
} | ||
|
||
// We choose a displacement map from the possible ones, matching the size with the original layer size. | ||
// If there is no such a map, we use a standard 32 by 32 one | ||
var displacementDataLayer = data.SizeMaps[EyeManager.PixelsPerMeter]; | ||
var actualRSI = sprite.LayerGetActualRSI(index); | ||
if (actualRSI is not null) | ||
{ | ||
if (actualRSI.Size.X != actualRSI.Size.Y) | ||
Log.Warning($"DISPLACEMENT: {displacementKey} has a resolution that is not 1:1, things can look crooked"); | ||
|
||
var layerSize = actualRSI.Size.X; | ||
if (data.SizeMaps.ContainsKey(layerSize)) | ||
displacementDataLayer = data.SizeMaps[layerSize]; | ||
} | ||
|
||
var displacementLayer = _serialization.CreateCopy(displacementDataLayer, notNullableOverride: true); | ||
displacementLayer.CopyToShaderParameters!.LayerKey = key; | ||
|
||
sprite.AddLayer(displacementLayer, index); | ||
sprite.LayerMapSet(displacementKey, index); | ||
|
||
revealedLayers.Add(displacementKey); | ||
|
||
return true; | ||
} | ||
} |
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,14 @@ | ||
namespace Content.Shared.DisplacementMap; | ||
|
||
[DataDefinition] | ||
public sealed partial class DisplacementData | ||
{ | ||
/// <summary> | ||
/// allows you to attach different maps for layers of different sizes. | ||
/// </summary> | ||
[DataField(required: true)] | ||
public Dictionary<int, PrototypeLayerData> SizeMaps = new(); | ||
|
||
[DataField] | ||
public string? ShaderOverride = "DisplacedStencilDraw"; | ||
} |
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
Oops, something went wrong.