Skip to content

Commit

Permalink
Fix shader regression (pointfreeco#44)
Browse files Browse the repository at this point in the history
* Fix shader regression

* Snap
  • Loading branch information
stephencelis authored Mar 25, 2021
1 parent fa94729 commit 064a060
Show file tree
Hide file tree
Showing 4 changed files with 574 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,9 @@ if ProcessInfo.processInfo.environment["TEST_SERVER"] == nil {
dependencies: [
"GameCore",
"TestHelpers",
]
.product(name: "SnapshotTesting", package: "SnapshotTesting"),
],
exclude: ["__Snapshots__"]
),
.target(
name: "GameFeature",
Expand Down
16 changes: 15 additions & 1 deletion Sources/CubeCore/Resources/shaders/Letter.surface.shader
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,18 @@ float4 textureColor = lettersTexture.sample(
)
);

_surface.diffuse.rgba = float4(0, 0, 0, textureColor.a);
// NB: This avoids drawing letter pixels in the corner of a face
float borderBuffer = 0.05;
if (
in.side == 2
&& (
texcoord.x <= borderBuffer
|| texcoord.x >= 1 - borderBuffer
|| texcoord.y <= borderBuffer
|| texcoord.y >= 1 - borderBuffer
)
) {
_surface.diffuse.rgba = float4(0, 0, 0, 0);
} else {
_surface.diffuse.rgba = float4(0, 0, 0, textureColor.a);
}
Loading

0 comments on commit 064a060

Please sign in to comment.