ask amo why it isn't finding the targets
This commit is contained in:
parent
d385189a97
commit
caa6e1ac0a
6 changed files with 34 additions and 34 deletions
|
@ -2,6 +2,7 @@ package at.petrak.hexcasting.client.render.overlays;
|
|||
|
||||
import at.petrak.hexcasting.client.render.shader.HexShaders;
|
||||
import at.petrak.hexcasting.mixin.accessor.client.AccessorGameRenderer;
|
||||
import at.petrak.hexcasting.mixin.accessor.client.AccessorPostChain;
|
||||
import com.mojang.blaze3d.pipeline.TextureTarget;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
|
@ -11,8 +12,6 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
||||
|
||||
/**
|
||||
* How eigengrau works
|
||||
* - EIGENGRAU_BZ_SIMULATION stores the state of the BZ cellular automata (thanks Acerola). It's updated on the GPU
|
||||
|
@ -23,8 +22,6 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
|||
public class EigengrauOverlay {
|
||||
public static TextureTarget EIGENGRAU_BZ_SIMULATION;
|
||||
public static TextureTarget EIGENGRAU_VEIL;
|
||||
public static final ResourceLocation SPECIAL_BZ_SIM_ID = modLoc("eigengrau/simulation");
|
||||
public static final ResourceLocation SPECIAL_BZ_VEIL_ID = modLoc("eigengrau/veil");
|
||||
/**
|
||||
* "Radius" of a hex cell in pixels
|
||||
*/
|
||||
|
@ -34,8 +31,21 @@ public class EigengrauOverlay {
|
|||
// Post-processing
|
||||
if (Minecraft.getInstance().gameRenderer.currentEffect() == null) {
|
||||
var mogrwbjah = (AccessorGameRenderer) Minecraft.getInstance().gameRenderer;
|
||||
|
||||
mogrwbjah.hex$loadEffect(new ResourceLocation(
|
||||
"shaders/post/hexcasting__eigengrau_presenter_entrypoint.json"));
|
||||
var post = mogrwbjah.hex$postEffect();
|
||||
var passes = ((AccessorPostChain) post).hex$getPasses();
|
||||
|
||||
var window = Minecraft.getInstance().getWindow();
|
||||
int w = window.getWidth();
|
||||
int h = window.getHeight();
|
||||
|
||||
var passPresent = passes.get(0);
|
||||
passPresent.getEffect().setSampler("simulation",
|
||||
() -> EIGENGRAU_BZ_SIMULATION.getColorTextureId());
|
||||
passPresent.getEffect().setSampler("veil",
|
||||
() -> EIGENGRAU_VEIL.getColorTextureId());
|
||||
}
|
||||
|
||||
var window = Minecraft.getInstance().getWindow();
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package at.petrak.hexcasting.mixin.accessor.client;
|
||||
|
||||
import net.minecraft.client.renderer.PostChain;
|
||||
import net.minecraft.client.renderer.PostPass;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(PostChain.class)
|
||||
public interface AccessorPostChain {
|
||||
@Accessor("passes")
|
||||
List<PostPass> hex$getPasses();
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package at.petrak.hexcasting.mixin.client;
|
||||
|
||||
import at.petrak.hexcasting.client.render.overlays.EigengrauOverlay;
|
||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
import net.minecraft.client.renderer.PostChain;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(PostChain.class)
|
||||
public class MixinPostChain {
|
||||
@Inject(method = "getRenderTarget", at = @At("RETURN"), cancellable = true)
|
||||
void hex$useOurTargets(String target, CallbackInfoReturnable<RenderTarget> cir) {
|
||||
if (EigengrauOverlay.SPECIAL_BZ_SIM_ID.toString().equals(target)) {
|
||||
cir.setReturnValue(EigengrauOverlay.EIGENGRAU_BZ_SIMULATION);
|
||||
} else if (EigengrauOverlay.SPECIAL_BZ_VEIL_ID.toString().equals(target)) {
|
||||
cir.setReturnValue(EigengrauOverlay.EIGENGRAU_VEIL);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,24 +2,22 @@
|
|||
{
|
||||
targets: [
|
||||
"swap",
|
||||
"hexcasting:eigengrau/simulation",
|
||||
"hexcasting:eigengrau/veil"
|
||||
"simulation",
|
||||
"veil"
|
||||
],
|
||||
passes: [
|
||||
{
|
||||
// Due to 1984, we can't have this in the hexcasting namespace.
|
||||
// This is minecraft:shaders/program/hexcasting__eigengray_presenter.json, which loads the .fsh
|
||||
name: "hexcasting__eigengrau_presenter",
|
||||
intarget: "minecraft:main",
|
||||
outtarget: "swap",
|
||||
auxtargets: [
|
||||
{
|
||||
name: "bz",
|
||||
id: "hexcasting:eigengrau/simulation",
|
||||
id: "simulation",
|
||||
},
|
||||
{
|
||||
name: "veil",
|
||||
id: "hexcasting:eigengrau/veil",
|
||||
id: "veil",
|
||||
}
|
||||
],
|
||||
},
|
||||
|
|
|
@ -10,7 +10,6 @@ uniform vec2 ScreenSize;
|
|||
const float resolution = 5.0;
|
||||
|
||||
in vec2 texCoord0;
|
||||
out vec4 fragColor;
|
||||
|
||||
ivec2 pxToHex(vec2 px) {
|
||||
float sqrt3 = sqrt(3.0);
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
"accessor.client.AccessorEmptyTextureStateShard",
|
||||
"accessor.client.AccessorGameRenderer",
|
||||
"accessor.client.AccessorMouseHandler",
|
||||
"accessor.client.AccessorPostChain",
|
||||
"accessor.client.AccessorRenderStateShard",
|
||||
"accessor.client.AccessorRenderType",
|
||||
"client.MixinClientLevel",
|
||||
"client.MixinPlayerRenderer",
|
||||
"client.MixinPostChain"
|
||||
"client.MixinPlayerRenderer"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue