diff --git a/src/main/java/org/confluence/mod/client/post/DIYBlitTarget.java b/src/main/java/org/confluence/mod/client/post/DIYBlitTarget.java index 26380127c..c838bbd27 100644 --- a/src/main/java/org/confluence/mod/client/post/DIYBlitTarget.java +++ b/src/main/java/org/confluence/mod/client/post/DIYBlitTarget.java @@ -13,6 +13,7 @@ import net.minecraft.client.renderer.ShaderInstance; import org.confluence.mod.client.shader.ModRenderTypes; import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11; import java.util.function.Consumer; @@ -25,6 +26,7 @@ public DIYBlitTarget(int pWidth, int pHeight, boolean pUseDepth, boolean pClearE super(pWidth, pHeight, pUseDepth, pClearError); this.blitShader = blitShader; } + private boolean autoClear = true; private Consumer createSampler; private DIYShaderInstance blitShader; public void blitToScreen(int pWidth, int pHeight, boolean pDisableBlend) { @@ -88,7 +90,9 @@ private void _blitToScreen(int pWidth, int pHeight, boolean pDisableBlend) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, 0); + GlStateManager._depthMask(true); + GlStateManager._colorMask(true, true, true, true); } @@ -105,4 +109,13 @@ public void setUniforms(Consumer consumer) { public void setCreateSampler(Consumer blitShader) { this.createSampler = blitShader; } + public void setAutoClear(boolean autoClear) { + this.autoClear = autoClear; + } + public void clear(boolean error){ + super.clear(error); + if( autoClear && (this.viewHeight!=Minecraft.getInstance().getWindow().getHeight() || this.viewWidth!=Minecraft.getInstance().getWindow().getWidth())){ + this.resize(Minecraft.getInstance().getWindow().getWidth(), Minecraft.getInstance().getWindow().getHeight(),error); + } + } } diff --git a/src/main/java/org/confluence/mod/client/post/DIYShaderInstance.java b/src/main/java/org/confluence/mod/client/post/DIYShaderInstance.java index 9806a32db..a51d747be 100644 --- a/src/main/java/org/confluence/mod/client/post/DIYShaderInstance.java +++ b/src/main/java/org/confluence/mod/client/post/DIYShaderInstance.java @@ -37,17 +37,14 @@ public DIYShaderInstance(ResourceProvider resourceProvider, ResourceLocation sha public void apply(){ super.apply(); - if(createUniforms!= null &&um.programId== this.getId()) createUniforms.accept(um); - //um.createUniform("samcolor"); - if(applyUniforms!= null && um.programId == this.getId()) applyUniforms.accept(um); - //um.setUniform("samcolor", new Vector4f(0,1,0,1)); - + if(createUniforms!= null &&um.programId== this.getId() && !um.isReady) createUniforms.accept(um); + if(applyUniforms!= null && um.programId == this.getId() && um.isReady) applyUniforms.accept(um); if(multiOut || bind) { multiOut = false; //glActiveTexture(GL_TEXTURE0+SAMPLE_CHANNELS); - glBindTexture(GL_TEXTURE_2D, textureId); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Minecraft.getInstance().getMainRenderTarget().width,Minecraft.getInstance().getMainRenderTarget().height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer) null); +// glBindTexture(GL_TEXTURE_2D, textureId); +// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Minecraft.getInstance().getMainRenderTarget().width,Minecraft.getInstance().getMainRenderTarget().height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer) null); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+SAMPLE_CHANNELS, GL_TEXTURE_2D, textureId, 0); int[] textures = new int[]{GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT0+SAMPLE_CHANNELS}; glDrawBuffers(textures); diff --git a/src/main/java/org/confluence/mod/client/post/PostEffect.java b/src/main/java/org/confluence/mod/client/post/PostEffect.java new file mode 100644 index 000000000..3e18db539 --- /dev/null +++ b/src/main/java/org/confluence/mod/client/post/PostEffect.java @@ -0,0 +1,9 @@ +package org.confluence.mod.client.post; + +public interface PostEffect { + + void init(); + void clear(); + void apply(); + +} diff --git a/src/main/java/org/confluence/mod/client/post/PostUtil.java b/src/main/java/org/confluence/mod/client/post/PostUtil.java index b3a9577fa..1f7861c71 100644 --- a/src/main/java/org/confluence/mod/client/post/PostUtil.java +++ b/src/main/java/org/confluence/mod/client/post/PostUtil.java @@ -1,116 +1,72 @@ package org.confluence.mod.client.post; +import com.mojang.blaze3d.pipeline.MainTarget; import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ShaderInstance; -import net.minecraft.world.entity.Entity; +import net.minecraft.stats.Stat; import net.minecraft.world.entity.LivingEntity; -import org.confluence.mod.client.renderer.entity.boss.CthulhuEyeRenderer; +import org.confluence.mod.client.post.effect.Bloom; +import org.confluence.mod.client.post.effect.MotionBlur; import org.confluence.mod.client.shader.ModRenderTypes; -import org.confluence.mod.item.sword.Swords; import org.joml.Vector2f; import java.util.*; import java.util.function.Consumer; -import static com.mojang.blaze3d.platform.GlStateManager.glActiveTexture; //import static org.confluence.mod.client.renderer.entity.boss.CthulhuEyeRenderer.tempBlurTarget; -import static org.lwjgl.opengl.GL11C.GL_TEXTURE_2D; -import static org.lwjgl.opengl.GL11C.glBindTexture; +import static com.mojang.blaze3d.platform.GlStateManager.glBlendFuncSeparate; +import static org.lwjgl.opengl.GL11C.*; import static org.lwjgl.opengl.GL13C.GL_TEXTURE0; public class PostUtil { - // 辉光帧缓冲 - public static DIYBlitTarget glowTarget; - // 辉光效果 - public static void renderGlow() { -// Minecraft.getInstance().player.getMainHandItem().is(Swords.DEVELOPER_SWORD.get()) - } + public static List effects = new ArrayList<>(); + public static Bloom bloom; + public static MotionBlur motionBlur; - // 运动模糊帧缓冲 - public static DIYBlitTarget cthBlurTarget; - public static Map blurList = new LinkedHashMap<>(); - public static class blurTuple{ - public DIYBlitTarget fbo; - public float distance; - public Vector2f dir; - public boolean dirty; - public blurTuple(DIYBlitTarget fbo, float distance, Vector2f dir, boolean dirty){ - this.dir = dir; - this.distance = distance; - this.fbo = fbo; - this.dirty = dirty; - } - } - - // 运动模糊效果 - public static void renderCthBlur(){ - // 触发条件 - blurList.forEach((k,v)->{ - if(v.dirty){ - - // 迭代模糊 -// for(int i=1;i<=5;i++) { - postPass(v.fbo, //输入FBO - v.fbo, //输出FBO - ModRenderTypes.Shaders.conv, //使用shader - shader-> shader.setSampler("att", v.fbo), //采样 - um-> { - um.setUniform("dir", v.dir); - um.setUniform("dist", v.distance); //uniform - } - ); -// } - - // 混合方式 - postPass(v.fbo, //输入FBO - Minecraft.getInstance().getMainRenderTarget(), //输出FBO - ModRenderTypes.Shaders.diy_blit, //shader定义实现的混合方式 - shader-> { - shader.setSampler("ori",Minecraft.getInstance().getMainRenderTarget()); //采样主屏幕 - shader.setSampler("att", v.fbo); //采样当前帧缓冲 - }, - null - //2 //视图缩放倍数 - ); - } - }); - } // 咖式管线 public static void postProcess() { if(!isFirstFrame) { - renderGlow(); - renderCthBlur(); + //renderGlow(); + motionBlur.apply(); backUp(); } } - public static void backUp(){ - Minecraft.getInstance().getMainRenderTarget().bindWrite(true); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, Minecraft.getInstance().getMainRenderTarget().getColorTextureId()); - } - - public static boolean isFirstFrame = true; // 必须初始化一次 + // 添加特效 public static void init() { if(isFirstFrame) { isFirstFrame = false; - int width = Minecraft.getInstance().getWindow().getWidth(); - int height = Minecraft.getInstance().getWindow().getHeight(); - glowTarget = new DIYBlitTarget(width, height, false, true, ModRenderTypes.Shaders.diy_blit); - cthBlurTarget = new DIYBlitTarget(width, height, false, true, ModRenderTypes.Shaders.conv); - cthBlurTarget.setClearColor(0, 0, 0, 0); + bloom = new Bloom(); + motionBlur = new MotionBlur(); + effects.add(bloom); + effects.add(motionBlur); + + + + effects.forEach(PostEffect::init); } } + public static boolean isFirstFrame = true; // 必须初始化一次 + + public static void addEffect(PostEffect effect){ + effects.add(effect); + } + + public static void backUp(){ + Minecraft.getInstance().getMainRenderTarget().bindWrite(true); + GlStateManager.glActiveTexture(GL_TEXTURE0); + GlStateManager._bindTexture(Minecraft.getInstance().getMainRenderTarget().getColorTextureId()); + } + // 单个特效渲染 - public static void postPass(DIYBlitTarget in, RenderTarget out, DIYShaderInstance shader, Consumer samplers,Consumer uniforms){ + public static void postPass( RenderTarget out, DIYBlitTarget in,DIYShaderInstance shader, Consumer samplers,Consumer uniforms){ out.bindWrite(true); GlStateManager.glActiveTexture(GL_TEXTURE0); GlStateManager._bindTexture(out.getColorTextureId()); @@ -124,7 +80,7 @@ public static void postPass(DIYBlitTarget in, RenderTarget out, DIYShaderInstanc } // 重载用于缩放 - public static void postPass(DIYBlitTarget in, RenderTarget out, DIYShaderInstance shader, Consumer samplers,Consumer uniforms,int scale){ + public static void postPass(RenderTarget out,DIYBlitTarget in, DIYShaderInstance shader, Consumer samplers,Consumer uniforms,float scale){ out.bindWrite(true); GlStateManager.glActiveTexture(GL_TEXTURE0); GlStateManager._bindTexture(out.getColorTextureId()); @@ -132,21 +88,15 @@ public static void postPass(DIYBlitTarget in, RenderTarget out, DIYShaderInstanc in.setUniforms(uniforms); in.setCreateSampler(samplers); in.blitToScreen( - Minecraft.getInstance().getWindow().getWidth()/scale, - Minecraft.getInstance().getWindow().getHeight()/scale,false + (int) (Minecraft.getInstance().getWindow().getWidth()*scale), + (int) (Minecraft.getInstance().getWindow().getHeight()*scale),false ); } - public static void clear(){ - if(glowTarget!=null) glowTarget.clear(true); - if(cthBlurTarget!=null) cthBlurTarget.clear(true); - blurList.forEach((k,v)->{ - v.dirty = false; - v.fbo.clear(true); - if(k instanceof LivingEntity && !((LivingEntity) k).isAlive()) blurList.remove(v); - }); - } + public static void clear(){ + effects.forEach(PostEffect::clear); + } } diff --git a/src/main/java/org/confluence/mod/client/post/UniformsMap.java b/src/main/java/org/confluence/mod/client/post/UniformsMap.java index 32b90ec7b..1835e3e36 100644 --- a/src/main/java/org/confluence/mod/client/post/UniformsMap.java +++ b/src/main/java/org/confluence/mod/client/post/UniformsMap.java @@ -14,6 +14,7 @@ public class UniformsMap { public int programId; private Map uniforms; + public boolean isReady = false; public UniformsMap(int programId) { this.programId = programId; @@ -23,10 +24,14 @@ public UniformsMap(int programId) { public void createUniform(String uniformName) { int uniformLocation = glGetUniformLocation(programId, uniformName); if (uniformLocation < 0) { - throw new RuntimeException("Could not find uniform [" + uniformName + "] in shader program [" + + + System.out.println("Could not find uniform [" + uniformName + "] in shader program [" + programId + "]"); + + }else{ + uniforms.put(uniformName, uniformLocation); + isReady = true; } - uniforms.put(uniformName, uniformLocation); } private int getUniformLocation(String uniformName) { @@ -37,6 +42,8 @@ private int getUniformLocation(String uniformName) { return location.intValue(); } + + public void setUniform(String uniformName, int value) { glUniform1i(getUniformLocation(uniformName), value); } diff --git a/src/main/java/org/confluence/mod/client/post/effect/Bloom.java b/src/main/java/org/confluence/mod/client/post/effect/Bloom.java new file mode 100644 index 000000000..53cc75e50 --- /dev/null +++ b/src/main/java/org/confluence/mod/client/post/effect/Bloom.java @@ -0,0 +1,111 @@ +package org.confluence.mod.client.post.effect; + +import net.minecraft.client.Minecraft; +import org.confluence.mod.client.post.DIYBlitTarget; +import org.confluence.mod.client.post.PostEffect; +import org.confluence.mod.client.shader.ModRenderTypes; + +import static org.confluence.mod.client.post.PostUtil.postPass; +import static org.lwjgl.opengl.GL11C.*; +import static org.lwjgl.opengl.GL11C.GL_ONE; + +public class Bloom implements PostEffect { + + // 辉光帧缓冲 + public DIYBlitTarget glowTargetOri; + public DIYBlitTarget glowTargetH; + public DIYBlitTarget glowTargetV; + public Bloom(){ + + } + // 辉光效果 + public void apply() { + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + postPass( + Minecraft.getInstance().getMainRenderTarget(), + glowTargetOri, + ModRenderTypes.Shaders.diy_blit, + shader-> { + //shader.setSampler("ori", Minecraft.getInstance().getMainRenderTarget()); + shader.setSampler("att", glowTargetOri); + }, + null + ); + glDisable(GL_BLEND); + for(int i=0;i<20;i++){ + int finalI = i; + var out =i%2==0? glowTargetV: glowTargetH; + var in =i%2==0? glowTargetH: glowTargetV; + postPass( + out, //输出FBO + in, //输入FBO + ModRenderTypes.Shaders.gaussian_blur, //shader定义实现的混合方式 + shader-> { + shader.setSampler("att", in); //采样当前帧缓冲 + }, + um->{um.setUniform("hor", finalI %2==0?GL_TRUE:GL_FALSE);} + ); + } + +// glEnable(GL_BLEND); +// glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); +/* +// glBlendFunc(GL_ONE, GL_ONE); + postPass( + glowTargetH, + glowTargetOri, + ModRenderTypes.Shaders.diy_blit_gamma, + shader-> { + shader.setSampler("ori", glowTargetH); + shader.setSampler("att", glowTargetOri); + }, + null + ); +*/ + +// glEnable(GL_BLEND); +// + //glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); + //glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); + glEnable(GL_BLEND); + //glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); + glBlendFunc(GL_ONE, GL_ONE); + postPass( + Minecraft.getInstance().getMainRenderTarget(), + glowTargetH, + ModRenderTypes.Shaders.diy_blit, + shader-> { + //shader.setSampler("ori", Minecraft.getInstance().getMainRenderTarget()); + shader.setSampler("att", glowTargetH); + }, + null + ); + + } + + @Override + public void init() { + int width = Minecraft.getInstance().getWindow().getWidth(); + int height = Minecraft.getInstance().getWindow().getHeight(); + + glowTargetOri = new DIYBlitTarget(width, height, false, true, ModRenderTypes.Shaders.diy_blit); + glowTargetOri.setClearColor(0, 0, 0, 0); + + glowTargetH = new DIYBlitTarget(width, height, false, true, ModRenderTypes.Shaders.diy_blit); + glowTargetH.setClearColor(0, 0, 0, 0); + + glowTargetV = new DIYBlitTarget(width, height, false, true, ModRenderTypes.Shaders.diy_blit); + glowTargetV.setClearColor(0, 0, 0, 0); + } + + @Override + public void clear() { + if(glowTargetOri!=null) glowTargetOri.clear(true); + if(glowTargetH !=null) glowTargetH.clear(true); + if(glowTargetV !=null) glowTargetV.clear(true); + + } + +} diff --git a/src/main/java/org/confluence/mod/client/post/effect/MotionBlur.java b/src/main/java/org/confluence/mod/client/post/effect/MotionBlur.java new file mode 100644 index 000000000..05e8a8e3d --- /dev/null +++ b/src/main/java/org/confluence/mod/client/post/effect/MotionBlur.java @@ -0,0 +1,83 @@ +package org.confluence.mod.client.post.effect; + +import net.minecraft.client.Minecraft; +import net.minecraft.world.entity.LivingEntity; +import org.confluence.mod.client.post.DIYBlitTarget; +import org.confluence.mod.client.post.PostEffect; +import org.confluence.mod.client.shader.ModRenderTypes; +import org.joml.Vector2f; + +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.confluence.mod.client.post.PostUtil.postPass; + +public class MotionBlur implements PostEffect { + + // 运动模糊帧缓冲 + public Map blurList; + public static class blurTuple{ + public DIYBlitTarget fbo; + public float distance; + public Vector2f dir; + public boolean dirty; + public blurTuple(DIYBlitTarget fbo, float distance, Vector2f dir, boolean dirty){ + this.dir = dir; + this.distance = distance; + this.fbo = fbo; + this.dirty = dirty; + } + } + + + @Override + public void init() { + blurList = new LinkedHashMap<>(); + } + + @Override + public void clear() { + + blurList.forEach((k,v)->{ + v.dirty = false; + v.fbo.clear(true); + if(k instanceof LivingEntity && !((LivingEntity) k).isAlive()) blurList.remove(v); + + }); + } + + @Override + public void apply() { + // 触发条件 + blurList.forEach((k,v)->{ + if(v.dirty){ + + // 迭代模糊 +// for(int i=1;i<=5;i++) { + postPass(v.fbo, //输出FBO + v.fbo, //输入FBO + ModRenderTypes.Shaders.motion_blur, //使用shader + shader-> shader.setSampler("att", v.fbo), //采样 + um-> { + um.setUniform("dir", v.dir); + um.setUniform("dist", v.distance); //uniform + } + ); +// } + + // 混合方式 + postPass( + Minecraft.getInstance().getMainRenderTarget(), //输出FBO + v.fbo, //输入FBO + ModRenderTypes.Shaders.diy_blit_mix_add, //shader定义实现的混合方式 + shader-> { + shader.setSampler("ori",Minecraft.getInstance().getMainRenderTarget()); //采样主屏幕 + shader.setSampler("att", v.fbo); //采样当前帧缓冲 + }, + null + //视图缩放倍数 + ); + } + }); + } +} diff --git a/src/main/java/org/confluence/mod/client/renderer/entity/boss/CthulhuEyeRenderer.java b/src/main/java/org/confluence/mod/client/renderer/entity/boss/CthulhuEyeRenderer.java index ec6182a62..1d21adf85 100644 --- a/src/main/java/org/confluence/mod/client/renderer/entity/boss/CthulhuEyeRenderer.java +++ b/src/main/java/org/confluence/mod/client/renderer/entity/boss/CthulhuEyeRenderer.java @@ -10,6 +10,7 @@ import org.confluence.mod.client.model.entity.CthulhuEyeModel; import org.confluence.mod.client.post.DIYBlitTarget; import org.confluence.mod.client.post.PostUtil; +import org.confluence.mod.client.post.effect.MotionBlur; import org.confluence.mod.client.shader.ModRenderTypes; import org.confluence.mod.entity.boss.geoEntity.CthulhuEye; import org.joml.Matrix4f; @@ -20,7 +21,6 @@ import javax.annotation.Nullable; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; public class CthulhuEyeRenderer extends GeoEntityRenderer { //public static DIYBlitTarget tempBlurTarget; @@ -45,31 +45,41 @@ protected float getDeathMaxRotation(CthulhuEye animatable){ @Override public void render(CthulhuEye entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { - - if(entity.stage>1){ + MotionBlur mb = PostUtil.motionBlur; + if(mb!=null && entity.stage>1 && entity.getDeltaMovement().length() > 0.3){ Object obj = entity.getUUID(); AtomicBoolean exisit = new AtomicBoolean(false); - PostUtil.blurList.forEach((k,v)->{ if(k==obj) exisit.set(true);}); + mb.blurList.forEach((k,v)->{ if(k==obj) exisit.set(true);}); DIYBlitTarget target; + // 运动方向 Vector3f dir = entity.getDeltaMovement().toVector3f(); + // 旋转到相机坐标系 new Matrix4f().rotate(Minecraft.getInstance().gameRenderer.getMainCamera().rotation().conjugate().normalize()).transformPosition(dir); + // 长度与距离相关 float distance = Minecraft.getInstance().player.distanceTo(entity); - distance /= Math.min(entity.getDeltaMovement().length(), 1); + // 长度与移速相关 + distance /= (float) Math.min(entity.getDeltaMovement().length(), 1); + // 长度与角度相关 + //distance *= Math.max(Math.cos((dir.angle(new Vector3f(1,0,0)))),0.3f); if(!exisit.get()){ target = new DIYBlitTarget(Minecraft.getInstance().getWindow().getWidth(), Minecraft.getInstance().getWindow().getHeight(), - false,true,ModRenderTypes.Shaders.conv); + false,true,ModRenderTypes.Shaders.motion_blur); target.setClearColor(0,0,0,0); - PostUtil.blurList.put(obj,new PostUtil.blurTuple(target,distance,new Vector2f(dir.x,dir.y),true)); + mb.blurList.put(obj,new MotionBlur.blurTuple(target,distance,new Vector2f(dir.x,dir.y),true)); }else{ - target = PostUtil.blurList.get(obj).fbo; + target = mb.blurList.get(obj).fbo; - PostUtil.blurList.get(obj).dir = new Vector2f(dir.x,dir.y); - PostUtil.blurList.get(obj).distance = distance; - PostUtil.blurList.get(obj).dirty = true; + mb.blurList.get(obj).dir = new Vector2f(dir.x,dir.y); + mb.blurList.get(obj).distance = distance; + mb.blurList.get(obj).dirty = true; } ModRenderTypes.Shaders.cthSampler.setMultiOutTarget(target); + } + + + super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); } diff --git a/src/main/java/org/confluence/mod/client/shader/ModRenderTypes.java b/src/main/java/org/confluence/mod/client/shader/ModRenderTypes.java index bce4f29b7..53e77680a 100644 --- a/src/main/java/org/confluence/mod/client/shader/ModRenderTypes.java +++ b/src/main/java/org/confluence/mod/client/shader/ModRenderTypes.java @@ -32,10 +32,15 @@ public static class Shaders { private static ShaderInstance shimmerLiquid; - public static DIYShaderInstance cthSampler; + public static DIYShaderInstance cthSampler;//克眼采样着色器 + public static DIYShaderInstance positionColorSampler;//点颜色采样着色器 + + public static DIYShaderInstance motion_blur; + public static DIYShaderInstance gaussian_blur; + public static DIYShaderInstance diy_blit;//直接输出到屏幕 + public static DIYShaderInstance diy_blit_gamma;//gamma校正 + public static DIYShaderInstance diy_blit_mix_add;//线性混合相加 - public static DIYShaderInstance conv; - public static DIYShaderInstance diy_blit; public static ShaderInstance aether; @@ -75,6 +80,16 @@ public static void onRegisterShaders(RegisterShadersEvent event) throws IOExcept ), shader -> cthSampler = (DIYShaderInstance) shader ); + event.registerShader( + new DIYShaderInstance( + resourceProvider, + Confluence.asResource("position_color"), + DefaultVertexFormat.POSITION_COLOR, + um->{} + ), + shader -> positionColorSampler = (DIYShaderInstance) shader + ); + event.registerShader( new DIYShaderInstance( @@ -89,14 +104,43 @@ public static void onRegisterShaders(RegisterShadersEvent event) throws IOExcept event.registerShader( new DIYShaderInstance( resourceProvider, - Confluence.asResource("conv_blur"), + Confluence.asResource("diy_blit_mix_add"), + DefaultVertexFormat.BLIT_SCREEN, + null + ), + shader -> diy_blit_mix_add = (DIYShaderInstance) shader + ); + event.registerShader( + new DIYShaderInstance( + resourceProvider, + Confluence.asResource("diy_blit_gamma"), + DefaultVertexFormat.BLIT_SCREEN, + null + ), + shader -> diy_blit_gamma = (DIYShaderInstance) shader + ); + event.registerShader( + new DIYShaderInstance( + resourceProvider, + Confluence.asResource("motion_blur"), DefaultVertexFormat.BLIT_SCREEN, um->{ um.createUniform("dist"); um.createUniform("dir"); } ), - shader -> conv = (DIYShaderInstance) shader + shader -> motion_blur = (DIYShaderInstance) shader + ); + event.registerShader( + new DIYShaderInstance( + resourceProvider, + Confluence.asResource("gaussian_blur"), + DefaultVertexFormat.BLIT_SCREEN, + um->{ + um.createUniform("hor"); + } + ), + shader -> gaussian_blur = (DIYShaderInstance) shader ); } diff --git a/src/main/java/org/confluence/mod/client/shader/RenderEvents.java b/src/main/java/org/confluence/mod/client/shader/RenderEvents.java index 371bb817f..9c5dc6ec3 100644 --- a/src/main/java/org/confluence/mod/client/shader/RenderEvents.java +++ b/src/main/java/org/confluence/mod/client/shader/RenderEvents.java @@ -1,7 +1,5 @@ package org.confluence.mod.client.shader; -import com.mojang.blaze3d.platform.GlStateManager; -import net.minecraft.client.Minecraft; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RenderLevelStageEvent; import net.minecraftforge.event.TickEvent; @@ -9,19 +7,16 @@ import net.minecraftforge.fml.common.Mod; import org.confluence.mod.Confluence; import org.confluence.mod.client.post.PostUtil; -import org.confluence.mod.item.sword.Swords; - import static org.confluence.mod.effect.beneficial.helper.SpelunkerHelper.renderLevel; -import static org.lwjgl.opengl.GL30C.*; - @Mod.EventBusSubscriber(modid = Confluence.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public final class RenderEvents { @SubscribeEvent public static void renderLevelStage(RenderLevelStageEvent event) { renderLevel(event); //洞探 + if(event.getStage()== RenderLevelStageEvent.Stage.AFTER_LEVEL // && Minecraft.getInstance().player.getMainHandItem().is(Swords.DEVELOPER_SWORD.get()) ){ @@ -109,16 +104,10 @@ public static void renderLevelStage(RenderLevelStageEvent event) { @SubscribeEvent public static void onRenderTickEnd(TickEvent.RenderTickEvent event){ - /* - if(event.phase == TickEvent.Phase.START && event.type == TickEvent.Type.RENDER){ - if(postUtil.isFirstFrame){ - postUtil.isFirstFrame = false; - postUtil.init(); - } - } - */ + if(event.phase == TickEvent.Phase.END && event.type == TickEvent.Type.RENDER){ PostUtil.clear(); + } } diff --git a/src/main/java/org/confluence/mod/event/GuiRenderEvent.java b/src/main/java/org/confluence/mod/event/GuiRenderEvent.java index 338419ec1..4cb8a32af 100644 --- a/src/main/java/org/confluence/mod/event/GuiRenderEvent.java +++ b/src/main/java/org/confluence/mod/event/GuiRenderEvent.java @@ -1,23 +1,36 @@ package org.confluence.mod.event; +import net.minecraft.world.InteractionHand; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.RenderGuiEvent; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; +import org.confluence.mod.client.post.PostUtil; import org.confluence.mod.client.renderer.gui.ArrowInBowOverlay; +import org.confluence.mod.client.shader.ModRenderTypes; import static org.confluence.mod.Confluence.MODID; +import static org.confluence.mod.client.post.PostUtil.*; @Mod.EventBusSubscriber(modid = MODID,value = Dist.CLIENT) public class GuiRenderEvent { @SubscribeEvent - public static void RenderGuiEvent(RenderHandEvent event) { + public static void renderHandEvent(RenderHandEvent event) { ArrowInBowOverlay.render(event); + if(event.getHand()== InteractionHand.OFF_HAND){ + PostUtil.bloom.glowTargetOri.bindWrite(true); + ModRenderTypes.Shaders.positionColorSampler.setMultiOutTarget(PostUtil.bloom.glowTargetH); + ModRenderTypes.Shaders.positionColorSampler.apply(); + } - + } + @SubscribeEvent + public static void renderGuiEvent(RenderGuiEvent event) { } + } diff --git a/src/main/java/org/confluence/mod/mixin/client/GameRendererMixin.java b/src/main/java/org/confluence/mod/mixin/client/GameRendererMixin.java new file mode 100644 index 000000000..99220472a --- /dev/null +++ b/src/main/java/org/confluence/mod/mixin/client/GameRendererMixin.java @@ -0,0 +1,28 @@ +package org.confluence.mod.mixin.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.GameRenderer; +import org.confluence.mod.client.post.PostUtil; +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.CallbackInfo; + +@Mixin(GameRenderer.class) +public abstract class GameRendererMixin { + + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;renderItemInHand(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/Camera;F)V")) + public void renderLevelHeadMixin(float pPartialTicks, long pFinishTimeNano, PoseStack pPoseStack, CallbackInfo ci ){ + + + } + + @Inject(method = "renderLevel", at = @At("RETURN")) + public void renderLevelReturnMixin(float pPartialTicks, long pFinishTimeNano, PoseStack pPoseStack, CallbackInfo ci ){ + PostUtil.bloom.apply(); + PostUtil.backUp(); + + } + + +} diff --git a/src/main/java/org/confluence/mod/mixin/client/MinectaftMixin.java b/src/main/java/org/confluence/mod/mixin/client/MinecraftMixin.java similarity index 98% rename from src/main/java/org/confluence/mod/mixin/client/MinectaftMixin.java rename to src/main/java/org/confluence/mod/mixin/client/MinecraftMixin.java index 281005a50..4bffb4842 100644 --- a/src/main/java/org/confluence/mod/mixin/client/MinectaftMixin.java +++ b/src/main/java/org/confluence/mod/mixin/client/MinecraftMixin.java @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Minecraft.class) -public abstract class MinectaftMixin { +public abstract class MinecraftMixin { @Inject(method = "shouldEntityAppearGlowing", at = @At(value = "HEAD"), cancellable = true) public void changeGlowOutline(Entity pentity, CallbackInfoReturnable cir) { diff --git a/src/main/resources/assets/confluence/shaders/core/cth.fsh b/src/main/resources/assets/confluence/shaders/core/cth.fsh index e5b1bdd6a..2deaea9f2 100644 --- a/src/main/resources/assets/confluence/shaders/core/cth.fsh +++ b/src/main/resources/assets/confluence/shaders/core/cth.fsh @@ -31,14 +31,8 @@ void main() { color *= lightMapColor; fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); - float average = dot(fragColor.rgb,vec3(0.299, 0.587, 0.114)); - - - // frag3 = vec4(average, average, average, color.a); frag3 =fragColor; - - } diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit.fsh b/src/main/resources/assets/confluence/shaders/core/diy_blit.fsh index acafaa59e..7c6510f49 100644 --- a/src/main/resources/assets/confluence/shaders/core/diy_blit.fsh +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit.fsh @@ -1,12 +1,11 @@ -#version 420 +#version 150 in vec2 texCoord; uniform sampler2D att; -uniform sampler2D ori; out vec4 fragColor; void main(){ //if(texture(att, texCoord).a < 0.01) discard; - fragColor = texture(ori, texCoord) + texture(att, texCoord); + fragColor = texture(att, texCoord); } diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit.json b/src/main/resources/assets/confluence/shaders/core/diy_blit.json index 0d1369178..e9dbf49f2 100644 --- a/src/main/resources/assets/confluence/shaders/core/diy_blit.json +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit.json @@ -12,8 +12,7 @@ "UV0" ], "samplers": [ - { "name": "ori"}, - { "name": "att"} + { "name": "att" } ], "uniforms": [ diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit_gamma.fsh b/src/main/resources/assets/confluence/shaders/core/diy_blit_gamma.fsh new file mode 100644 index 000000000..40ae4f508 --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit_gamma.fsh @@ -0,0 +1,37 @@ +#version 150 +in vec2 texCoord; + +uniform sampler2D ori; +uniform sampler2D att; + +out vec4 fragColor; + +void main(){ + + fragColor = texture(att, texCoord)+texture(ori, texCoord)*2; + /* + if(texture(att, texCoord).a > 0) { + fragColor = vec4(texture(att, texCoord).rgb,1.0); + }else{ + fragColor =vec4(texture(ori, texCoord).rgb,1.0); +// fragColor = vec4(1,0,0, 1.0); + */ + /* + const float gamma = 2.2; + const float exposure = 1; + vec3 hdrColor = texture(ori, texCoord).rgb; + vec3 bloomColor = texture(att, texCoord).rgb; + hdrColor += bloomColor; // additive blending + fragColor = vec4(hdrColor,1.0); +*/ + /* + // tone mapping + fragColor = vec4(hdrColor, 1.0f); + vec3 result = vec3(1.0) - exp(-hdrColor * exposure); + // also gamma correct while we're at it + result = pow(result, vec3(1.0 / gamma)); + fragColor = vec4(result, 1.0f); +*/ +// } + +} diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit_gamma.json b/src/main/resources/assets/confluence/shaders/core/diy_blit_gamma.json new file mode 100644 index 000000000..e24032dac --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit_gamma.json @@ -0,0 +1,24 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "confluence:diy_blit", + "fragment": "confluence:diy_blit_gamma", + "attributes": [ + "Position", + "Color", + "UV0" + ], + "samplers": [ + { "name": "ori" }, + { "name": "att" } + + ], + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.fsh b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.fsh new file mode 100644 index 000000000..af7ef019e --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.fsh @@ -0,0 +1,26 @@ +#version 420 +in vec2 texCoord; + +uniform sampler2D att; +uniform sampler2D ori; + +out vec4 fragColor; + +void main(){ +// if(texture(att, texCoord).a < 0.01) discard; + fragColor = texture(ori, texCoord) + texture(att, texCoord); + +/* + const float gamma = 2.2; + const float exposure = 1; + + vec3 hdrColor = texture(ori, texCoord).rgb; + vec3 bloomColor = texture(att, texCoord).rgb; + hdrColor += bloomColor; // additive blending + // tone mapping + vec3 result = vec3(1.0) - exp(-hdrColor * exposure); + // also gamma correct while we're at it + result = pow(result, vec3(1.0 / gamma)); + fragColor = vec4(result, 1.0f); +*/ +} diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.json b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.json new file mode 100644 index 000000000..bac4cc5bd --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.json @@ -0,0 +1,24 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "confluence:diy_blit", + "fragment": "confluence:diy_blit_mix_add", + "attributes": [ + "Position", + "Color", + "UV0" + ], + "samplers": [ + { "name": "ori"}, + { "name": "att"} + + ], + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/confluence/shaders/core/conv_blur.vsh b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.vsh similarity index 100% rename from src/main/resources/assets/confluence/shaders/core/conv_blur.vsh rename to src/main/resources/assets/confluence/shaders/core/diy_blit_mix_add.vsh diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_normal.fsh b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_normal.fsh new file mode 100644 index 000000000..d4e6771e1 --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_normal.fsh @@ -0,0 +1,20 @@ +#version 420 +in vec2 texCoord; + +uniform sampler2D att; +uniform sampler2D ori; + +out vec4 fragColor; + +void main(){ + //混合模式 + //fragColor = texture(ori, texCoord) * texture(att, texCoord); + + + if(texture(ori, texCoord).a < 0.01) { + + }else{ + + } + fragColor = texture(ori, texCoord) + texture(att, texCoord); +} diff --git a/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_normal.json b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_normal.json new file mode 100644 index 000000000..753597bd8 --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/diy_blit_mix_normal.json @@ -0,0 +1,24 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "confluence:diy_blit", + "fragment": "confluence:diy_blit_mix_normal", + "attributes": [ + "Position", + "Color", + "UV0" + ], + "samplers": [ + { "name": "ori"}, + { "name": "att"} + + ], + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/confluence/shaders/core/gaussian_blur.fsh b/src/main/resources/assets/confluence/shaders/core/gaussian_blur.fsh new file mode 100644 index 000000000..7796dfb2a --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/gaussian_blur.fsh @@ -0,0 +1,31 @@ +#version 420 + +out vec4 fragColor; +in vec2 texCoord; + +uniform sampler2D att; +uniform int hor; + +void main() +{ + float weight[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216); + vec2 tex_offset = 1.0 / vec2(200,200); // gets size of single texel + vec3 result = texture(att, texCoord).rgb * weight[0]; // current fragment's contribution + if(hor>0) + { + for(int i = 1; i < 5; ++i) + { + result += texture(att, texCoord + vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; + result += texture(att, texCoord - vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; + } + } + else + { + for(int i = 1; i < 5; ++i) + { + result += texture(att, texCoord + vec2(0.0, tex_offset.y * i)).rgb * weight[i]; + result += texture(att, texCoord - vec2(0.0, tex_offset.y * i)).rgb * weight[i]; + } + } + fragColor = vec4(result, texture(att, texCoord).a); +} diff --git a/src/main/resources/assets/confluence/shaders/core/gaussian_blur.json b/src/main/resources/assets/confluence/shaders/core/gaussian_blur.json new file mode 100644 index 000000000..b2a3afa1d --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/gaussian_blur.json @@ -0,0 +1,22 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "confluence:diy_blit", + "fragment": "confluence:gaussian_blur", + "attributes": [ + "Position", + "Color", + "UV0" + ], + "samplers": [ + { "name": "att"} + ], + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/confluence/shaders/core/gaussian_blur.vsh b/src/main/resources/assets/confluence/shaders/core/gaussian_blur.vsh new file mode 100644 index 000000000..3371de195 --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/gaussian_blur.vsh @@ -0,0 +1,16 @@ +#version 150 + +in vec4 Position; +in vec2 UV0; + +uniform mat4 ProjMat; +uniform vec2 OutSize; + +out vec2 texCoord; + +void main(){ + vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); + gl_Position = vec4(outPos.xy, 0.2, 1.0); + + texCoord = UV0;; +} diff --git a/src/main/resources/assets/confluence/shaders/core/conv_blur.fsh b/src/main/resources/assets/confluence/shaders/core/motion_blur.fsh similarity index 100% rename from src/main/resources/assets/confluence/shaders/core/conv_blur.fsh rename to src/main/resources/assets/confluence/shaders/core/motion_blur.fsh diff --git a/src/main/resources/assets/confluence/shaders/core/conv_blur.json b/src/main/resources/assets/confluence/shaders/core/motion_blur.json similarity index 88% rename from src/main/resources/assets/confluence/shaders/core/conv_blur.json rename to src/main/resources/assets/confluence/shaders/core/motion_blur.json index 57c3be978..60e57a39d 100644 --- a/src/main/resources/assets/confluence/shaders/core/conv_blur.json +++ b/src/main/resources/assets/confluence/shaders/core/motion_blur.json @@ -4,8 +4,8 @@ "srcrgb": "srcalpha", "dstrgb": "1-srcalpha" }, - "vertex": "confluence:conv_blur", - "fragment": "confluence:conv_blur", + "vertex": "confluence:diy_blit", + "fragment": "confluence:motion_blur", "attributes": [ "Position", "Color", diff --git a/src/main/resources/assets/confluence/shaders/core/motion_blur.vsh b/src/main/resources/assets/confluence/shaders/core/motion_blur.vsh new file mode 100644 index 000000000..3371de195 --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/motion_blur.vsh @@ -0,0 +1,16 @@ +#version 150 + +in vec4 Position; +in vec2 UV0; + +uniform mat4 ProjMat; +uniform vec2 OutSize; + +out vec2 texCoord; + +void main(){ + vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); + gl_Position = vec4(outPos.xy, 0.2, 1.0); + + texCoord = UV0;; +} diff --git a/src/main/resources/assets/confluence/shaders/core/position_color.fsh b/src/main/resources/assets/confluence/shaders/core/position_color.fsh new file mode 100644 index 000000000..e80f39fef --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/position_color.fsh @@ -0,0 +1,19 @@ +#version 150 +#extension GL_ARB_explicit_attrib_location : enable + +in vec4 vertexColor; + +uniform vec4 ColorModulator; + +layout (location = 0) out vec4 fragColor; +layout (location = 1) out vec4 frag3; + +void main() { + vec4 color = vertexColor; + if (color.a == 0.0) { + discard; + } + fragColor = color * ColorModulator; + + frag3 = color; +} diff --git a/src/main/resources/assets/confluence/shaders/core/position_color.json b/src/main/resources/assets/confluence/shaders/core/position_color.json new file mode 100644 index 000000000..d1416bf9e --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/position_color.json @@ -0,0 +1,19 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "confluence:position_color", + "fragment": "confluence:position_color", + "attributes": [ + "Color" + ], + "samplers": [ + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/confluence/shaders/core/position_color.vsh b/src/main/resources/assets/confluence/shaders/core/position_color.vsh new file mode 100644 index 000000000..19d3fdbae --- /dev/null +++ b/src/main/resources/assets/confluence/shaders/core/position_color.vsh @@ -0,0 +1,15 @@ +#version 150 + +in vec3 Position; +in vec4 Color; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; + +out vec4 vertexColor; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexColor = Color; +} diff --git a/src/main/resources/confluence.mixins.json b/src/main/resources/confluence.mixins.json index 7f4030f5f..084a2999e 100644 --- a/src/main/resources/confluence.mixins.json +++ b/src/main/resources/confluence.mixins.json @@ -15,12 +15,13 @@ "client.EntityRenderDispatcherMixin", "client.EntityRendererProvider$ContextMixin", "client.EyesLayerMixin", + "client.GameRendererMixin", "client.GuiMixin", "client.ItemInHandLayerMixin", "client.LevelRendererMixin", "client.LivingEntityRendererMixin", "client.LocalPlayerMixin", - "client.MinectaftMixin", + "client.MinecraftMixin", "client.ModelPartMixin", "client.MooshroomMushroomLayerMixin", "client.MouseHandlerMixin",