Skip to content

Commit

Permalink
Added dynamic highlight thickness, made global immutable from clien…
Browse files Browse the repository at this point in the history
…t and server scripts
  • Loading branch information
LatvianModder committed Jun 23, 2024
1 parent c13f78a commit 0f3b9e8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
import java.time.Duration;
import java.time.temporal.TemporalAmount;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -375,7 +376,7 @@ public void registerClasses(ClassFilter filter) {

@Override
public void registerBindings(BindingRegistry bindings) {
bindings.add("global", GLOBAL);
bindings.add("global", bindings.type().isStartup() ? GLOBAL : Collections.unmodifiableMap(GLOBAL));
bindings.add("Platform", PlatformWrapper.class);
bindings.add("console", bindings.type().console);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ public void afterEverything(Minecraft mc, GuiGraphics graphics, float delta) {

graphics.flush();

postChain.setUniform("OutlineSize", (float) mc.getWindow().getGuiScale());
postChain.process(delta);
mc.getMainRenderTarget().bindWrite(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
uniform sampler2D DiffuseSampler;
uniform sampler2D DiffuseDepthSampler;
uniform sampler2D MCDepthSampler;
uniform float OutlineSize;

in vec2 texCoord;
in vec2 sampleStep;
Expand Down Expand Up @@ -32,8 +33,8 @@ void main() {
float g = 1.0;
float b = 1.0;

for (float i = -2.0; i <= 2.0; i += 1.0) {
for (float j = -2.0; j <= 2.0; j += 1.0) {
for (float i = -OutlineSize; i <= OutlineSize; i += 1.0) {
for (float j = -OutlineSize; j <= OutlineSize; j += 1.0) {
vec4 c = texture(DiffuseSampler, texCoord + vec2(i, j) * sampleStep);

if (c.a > 0.005) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
"type": "float",
"count": 2,
"values": [1.0, 1.0]
},
{
"name": "OutlineSize",
"type": "float",
"count": 1,
"values": [1.0]
}
]
}

0 comments on commit 0f3b9e8

Please sign in to comment.