forge170-shaders #13
No files matched your search
@@ -0,0 +1,42 @@
|
|||||||
|
package org.taumc.celeritas.compat;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector3d;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
import org.taumc.celeritas.state.MatrixRenderingState;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class Camera {
|
||||||
|
final Vector3d pos = new Vector3d();
|
||||||
|
final BlockPos blockPos = new BlockPos();
|
||||||
|
float pitch;
|
||||||
|
float yaw;
|
||||||
|
EntityLivingBase entity;
|
||||||
|
boolean thirdPerson;
|
||||||
|
final float partialTicks;
|
||||||
|
|
||||||
|
public Camera(EntityLivingBase entity, float partialTicks) {
|
||||||
|
this.partialTicks = partialTicks;
|
||||||
|
final Vector4f offset = new Vector4f(); // third person offset
|
||||||
|
final Matrix4f inverseModelView = new Matrix4f(MatrixRenderingState.INSTANCE.getModelViewMatrix()).invert();
|
||||||
|
inverseModelView.transform(offset);
|
||||||
|
|
||||||
|
final double camX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks + offset.x;
|
||||||
|
final double camY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks + offset.y;
|
||||||
|
final double camZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks + offset.z;
|
||||||
|
this.entity = entity;
|
||||||
|
|
||||||
|
pos.set(camX, camY, camZ);
|
||||||
|
blockPos.set(MathHelper.floor_double(camX), MathHelper.floor_double(camY), MathHelper.floor_double(camZ));
|
||||||
|
pitch = entity.cameraPitch;
|
||||||
|
yaw = entity.rotationYaw;
|
||||||
|
thirdPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,8 @@ public class CeleritasArchaicMixinPlugin implements IMixinConfigPlugin {
|
|||||||
var handle = SharedConfig.getRfbTransformers().stream().filter(transformer -> transformer.id().equals("lwjgl3ify:redirect")).findFirst().orElseThrow();
|
var handle = SharedConfig.getRfbTransformers().stream().filter(transformer -> transformer.id().equals("lwjgl3ify:redirect")).findFirst().orElseThrow();
|
||||||
handle.exclusions().add("org.embeddedt.embeddium");
|
handle.exclusions().add("org.embeddedt.embeddium");
|
||||||
handle.exclusions().add("org.taumc.celeritas");
|
handle.exclusions().add("org.taumc.celeritas");
|
||||||
|
handle.exclusions().add("net.irisshaders.iris");
|
||||||
|
handle.exclusions().add("com.mitchej123");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,12 +3,24 @@ public net.minecraft.client.renderer.GlStateManager$FogState
|
|||||||
public net.minecraft.client.renderer.GlStateManager fogState # fogState
|
public net.minecraft.client.renderer.GlStateManager fogState # fogState
|
||||||
public net.minecraft.client.renderer.GlStateManager$BooleanState
|
public net.minecraft.client.renderer.GlStateManager$BooleanState
|
||||||
public net.minecraft.client.renderer.GlStateManager$BooleanState currentState # currentState
|
public net.minecraft.client.renderer.GlStateManager$BooleanState currentState # currentState
|
||||||
|
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer renderHand(FI)V # void renderHand(float, int)
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer getFOVModifier(FZ)F # float getFOVModifier(float, boolean)
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer hurtCameraEffect(F)V # void hurtCameraEffect(float)
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer setupViewBobbing(F)V # void setupViewBobbing(float)
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer cameraZoom # cameraZoom
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer cameraYaw # cameraYaw
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer cameraPitch # cameraPitch
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer farPlaneDistance # farPlaneDistance
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer mouseFilterXAxis # mouseFilterXAxis
|
||||||
|
public net.minecraft.client.renderer.EntityRenderer mouseFilterYAxis # mouseFilterYAxis
|
||||||
public net.minecraft.client.renderer.EntityRenderer fogColorRed # fogColorRed
|
public net.minecraft.client.renderer.EntityRenderer fogColorRed # fogColorRed
|
||||||
public net.minecraft.client.renderer.EntityRenderer fogColorGreen # fogColorGreen
|
public net.minecraft.client.renderer.EntityRenderer fogColorGreen # fogColorGreen
|
||||||
public net.minecraft.client.renderer.EntityRenderer fogColorBlue # fogColorBlue
|
public net.minecraft.client.renderer.EntityRenderer fogColorBlue # fogColorBlue
|
||||||
|
private-f net.minecraft.client.renderer.EntityRenderer field_78504_Q # lightmapColors
|
||||||
|
|
||||||
public net.minecraft.client.renderer.block.model.WeightedBakedModel$WeightedModel
|
public net.minecraft.client.renderer.block.model.WeightedBakedModel$WeightedModel
|
||||||
public net.minecraft.client.renderer.block.model.WeightedBakedModel$WeightedModel model # model
|
public net.minecraft.client.renderer.block.model.WeightedBakedModel$WeightedModel model # model
|
||||||
private-f net.minecraft.client.renderer.EntityRenderer field_78504_Q # lightmapColors
|
|
||||||
public net.minecraft.world.WorldSettings$GameType
|
public net.minecraft.world.WorldSettings$GameType
|
||||||
public net.minecraft.world.WorldSettings.GameType
|
public net.minecraft.world.WorldSettings.GameType
|
||||||
public net.minecraft.client.multiplayer.PlayerControllerMP currentGameType # currentGameType
|
public net.minecraft.client.multiplayer.PlayerControllerMP currentGameType # currentGameType
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package net.irisshaders.iris;
|
package net.irisshaders.iris;
|
||||||
|
|
||||||
import net.irisshaders.iris.features.FeatureFlags;
|
import net.irisshaders.iris.features.FeatureFlags;
|
||||||
|
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||||
|
import net.irisshaders.iris.pipeline.ArchaicVanillaRenderingPipeline;
|
||||||
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
||||||
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
import net.irisshaders.iris.shaderpack.materialmap.BlockEntry;
|
import net.irisshaders.iris.shaderpack.materialmap.BlockEntry;
|
||||||
@@ -140,6 +142,8 @@ public class IrisArchaic implements CeleritasShaderVersionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRenderSystemInit() {
|
public void onRenderSystemInit() {
|
||||||
|
// IrisRenderSystem.initRenderer();
|
||||||
|
// IrisSamplers.initRenderer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +175,7 @@ public class IrisArchaic implements CeleritasShaderVersionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorldRenderingPipeline createVanillaRenderingPipeline() {
|
public WorldRenderingPipeline createVanillaRenderingPipeline() {
|
||||||
// TODO
|
return new ArchaicVanillaRenderingPipeline();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -180,6 +183,11 @@ public class IrisArchaic implements CeleritasShaderVersionService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean shouldActivateWireframe() {
|
||||||
|
// TODO: Keybinds
|
||||||
|
return IrisCommon.getIrisConfig().areDebugOptionsEnabled() && false; // && IrisArchaic.wireframeKeybind.isDown();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getDHCompatInstance(IrisRenderingPipeline pipeline, boolean renderDHShadow)
|
public Object getDHCompatInstance(IrisRenderingPipeline pipeline, boolean renderDHShadow)
|
||||||
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package net.irisshaders.iris.pathways;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPhase;
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.util.glu.Project;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
import org.taumc.celeritas.compat.Camera;
|
||||||
|
import org.taumc.celeritas.compat.InteractionHand;
|
||||||
|
import org.taumc.celeritas.state.MatrixRenderingState;
|
||||||
|
|
||||||
|
public class HandRenderer {
|
||||||
|
public static final HandRenderer INSTANCE = new HandRenderer();
|
||||||
|
|
||||||
|
private boolean ACTIVE;
|
||||||
|
private boolean renderingSolid;
|
||||||
|
public static final float DEPTH = 0.125F;
|
||||||
|
|
||||||
|
private void setupGlState(RenderGlobal gameRenderer, Camera camera, float tickDelta) {
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||||
|
GL11.glLoadIdentity();
|
||||||
|
// We need to scale the matrix by 0.125 so the hand doesn't clip through blocks.
|
||||||
|
GL11.glScalef(1.0F, 1.0F, DEPTH);
|
||||||
|
|
||||||
|
if (mc.entityRenderer.cameraZoom != 1.0D) {
|
||||||
|
GL11.glTranslatef((float) mc.entityRenderer.cameraYaw, (float) (-mc.entityRenderer.cameraPitch), 0.0F);
|
||||||
|
GL11.glScaled(mc.entityRenderer.cameraZoom, mc.entityRenderer.cameraZoom, 1.0D);
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.gluPerspective(mc.entityRenderer.getFOVModifier(tickDelta, false), (float) mc.displayWidth / (float) mc.displayHeight, 0.05F, mc.entityRenderer.farPlaneDistance * 2.0F);
|
||||||
|
|
||||||
|
|
||||||
|
if (mc.playerController.enableEverythingIsScrewedUpMode()) {
|
||||||
|
GL11.glScalef(1.0F, 2 / 3f, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||||
|
GL11.glLoadIdentity();
|
||||||
|
|
||||||
|
mc.entityRenderer.hurtCameraEffect(tickDelta);
|
||||||
|
|
||||||
|
if (mc.gameSettings.viewBobbing) {
|
||||||
|
mc.entityRenderer.setupViewBobbing(tickDelta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canRender(Camera camera, RenderGlobal gameRenderer) {
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
return mc.entityRenderer.debugViewDirection <= 0 &&
|
||||||
|
mc.gameSettings.thirdPersonView == 0 &&
|
||||||
|
!camera.getEntity().isPlayerSleeping() &&
|
||||||
|
!mc.gameSettings.hideGUI &&
|
||||||
|
// TODO: SPECTATOR
|
||||||
|
// mc.playerController.currentGameType
|
||||||
|
!mc.playerController.enableEverythingIsScrewedUpMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHandTranslucent(InteractionHand hand) {
|
||||||
|
ItemStack heldItem = hand.getItemInHand(Minecraft.getMinecraft().thePlayer);
|
||||||
|
|
||||||
|
if (heldItem == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Item item = heldItem.getItem();
|
||||||
|
|
||||||
|
// TODO: Figure out getBlockTypeIds
|
||||||
|
// if (item instanceof ItemBlock itemBlock) {
|
||||||
|
// Map<Block, RenderLayer> blockTypeIds = BlockRenderingSettings.INSTANCE.getBlockTypeIds();
|
||||||
|
// return blockTypeIds != null && blockTypeIds.get(itemBlock.field_150939_a) == RenderLayer.translucent();
|
||||||
|
// }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAnyHandTranslucent() {
|
||||||
|
return isHandTranslucent(InteractionHand.MAIN_HAND) || isHandTranslucent(InteractionHand.OFF_HAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderSolid(float tickDelta, Camera camera, RenderGlobal gameRenderer, WorldRenderingPipeline pipeline) {
|
||||||
|
if (!canRender(camera, gameRenderer) || !CeleritasShadersApi.getInstance().isShaderPackInUse()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
ACTIVE = true;
|
||||||
|
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.HAND_SOLID);
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDepthMask(true); // actually write to the depth buffer, it's normally disabled at this point
|
||||||
|
|
||||||
|
mc.mcProfiler.startSection("iris_hand");
|
||||||
|
|
||||||
|
setupGlState(gameRenderer, camera, tickDelta);
|
||||||
|
|
||||||
|
renderingSolid = true;
|
||||||
|
mc.entityRenderer.enableLightmap(tickDelta);
|
||||||
|
mc.entityRenderer.itemRenderer.renderItemInFirstPerson(tickDelta);
|
||||||
|
mc.entityRenderer.disableLightmap(tickDelta);
|
||||||
|
|
||||||
|
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
mc.mcProfiler.endSection();
|
||||||
|
|
||||||
|
resetProjectionMatrix();
|
||||||
|
|
||||||
|
renderingSolid = false;
|
||||||
|
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.NONE);
|
||||||
|
|
||||||
|
ACTIVE = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderTranslucent(float tickDelta, Camera camera, RenderGlobal gameRenderer, WorldRenderingPipeline pipeline) {
|
||||||
|
if (!canRender(camera, gameRenderer) || !isAnyHandTranslucent() || !CeleritasShadersApi.getInstance().isShaderPackInUse()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
ACTIVE = true;
|
||||||
|
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.HAND_TRANSLUCENT);
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
mc.mcProfiler.startSection("iris_hand_translucent");
|
||||||
|
|
||||||
|
setupGlState(gameRenderer, camera, tickDelta);
|
||||||
|
|
||||||
|
mc.entityRenderer.enableLightmap(tickDelta);
|
||||||
|
mc.entityRenderer.itemRenderer.renderItemInFirstPerson(tickDelta);
|
||||||
|
mc.entityRenderer.disableLightmap(tickDelta);
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
resetProjectionMatrix();
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().mcProfiler.endSection();
|
||||||
|
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.NONE);
|
||||||
|
|
||||||
|
ACTIVE = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetProjectionMatrix() {
|
||||||
|
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||||
|
GL11.glLoadIdentity();
|
||||||
|
GL11.glMultMatrixf(MatrixRenderingState.INSTANCE.getProjectionBuffer());
|
||||||
|
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRenderingSolid() {
|
||||||
|
return renderingSolid;
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package net.irisshaders.iris.pipeline;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.shaderpack.properties.ParticleRenderingSettings;
|
||||||
|
|
||||||
|
public class ArchaicVanillaRenderingPipeline extends VanillaRenderingPipeline{
|
||||||
|
public ArchaicVanillaRenderingPipeline() {
|
||||||
|
super();
|
||||||
|
// TODO: 1.7.10 specific setup
|
||||||
|
// ModernWorldRenderingSettings.INSTANCE.setBlockTypeIds(null);
|
||||||
|
// ModernWorldRenderingSettings.INSTANCE.setFallbackTextureMaterialMapping(null);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ParticleRenderingSettings getParticleRenderingSettings() {
|
||||||
|
// TODO
|
||||||
|
// return Minecraft.useShaderTransparency() ? ParticleRenderingSettings.AFTER : ParticleRenderingSettings.MIXED;
|
||||||
|
return true ? ParticleRenderingSettings.AFTER : ParticleRenderingSettings.MIXED;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package org.taumc.celeritas.interfaces;
|
||||||
|
|
||||||
|
public interface IRenderTargetExt {
|
||||||
|
int iris$getDepthBufferVersion();
|
||||||
|
|
||||||
|
int iris$getColorBufferVersion();
|
||||||
|
|
||||||
|
boolean getIris$useDepth();
|
||||||
|
int getIris$depthTextureId();
|
||||||
|
}
|
||||||
+124
@@ -0,0 +1,124 @@
|
|||||||
|
package org.taumc.celeritas.mixin.shaders;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Share;
|
||||||
|
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
|
||||||
|
import net.irisshaders.iris.IrisArchaic;
|
||||||
|
import net.irisshaders.iris.IrisCommon;
|
||||||
|
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||||
|
import net.irisshaders.iris.pathways.HandRenderer;
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPhase;
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.shaderpack.DimensionId;
|
||||||
|
import net.irisshaders.iris.uniforms.CapturedRenderingState;
|
||||||
|
import net.irisshaders.iris.uniforms.IrisTimeUniforms;
|
||||||
|
import net.irisshaders.iris.uniforms.SystemTimeUniforms;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
|
import org.lwjgl.opengl.GL43C;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Slice;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
import org.taumc.celeritas.compat.Camera;
|
||||||
|
|
||||||
|
@Mixin(EntityRenderer.class)
|
||||||
|
public class MixinEntityRenderer_Shaders {
|
||||||
|
@Shadow public Minecraft mc;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private WorldRenderingPipeline pipeline;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private double celeritas$currentTickDelta;
|
||||||
|
|
||||||
|
@Inject(method="renderWorld(FJ)V", at=@At(value="HEAD"))
|
||||||
|
private void iris$setupPipeline(float partialTicks, long limitTime, CallbackInfo ci) {
|
||||||
|
// DHCompat.checkFrame();
|
||||||
|
|
||||||
|
this.celeritas$currentTickDelta = partialTicks;
|
||||||
|
|
||||||
|
IrisTimeUniforms.updateTime();
|
||||||
|
|
||||||
|
CapturedRenderingState.INSTANCE.setTickDelta((float) partialTicks);
|
||||||
|
// TODO: Figure out world time/ticks
|
||||||
|
CapturedRenderingState.INSTANCE.setCloudTime((float)(this.mc.renderViewEntity.worldObj.getWorldTime() + partialTicks) * 0.03F);
|
||||||
|
|
||||||
|
// pipeline = IrisCommon.getPipelineManager().preparePipeline(IrisArchaic.getCurrentDimension());
|
||||||
|
// TODO: getCurrentDimension
|
||||||
|
pipeline = IrisCommon.getPipelineManager().preparePipeline(DimensionId.OVERWORLD);
|
||||||
|
|
||||||
|
// if (pipeline.shouldDisableFrustumCulling()) {
|
||||||
|
// this.cullingFrustum = new NonCullingFrustum();
|
||||||
|
// }
|
||||||
|
|
||||||
|
IrisRenderSystem.backupAndDisableCullingState(pipeline.shouldDisableOcclusionCulling());
|
||||||
|
|
||||||
|
if (IrisArchaic.shouldActivateWireframe() && mc.isSingleplayer()) {
|
||||||
|
IrisRenderSystem.setPolygonMode(GL43C.GL_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.NONE);
|
||||||
|
}
|
||||||
|
@Inject(method="renderWorld(FJ)V", at=@At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I", ordinal = 0))
|
||||||
|
private void iris$beginTerrain(float partialTicks, long limitTime, CallbackInfo ci) {
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.TERRAIN_CUTOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Inject(method="renderWorld(FJ)V",
|
||||||
|
at=@At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I"),
|
||||||
|
slice=@Slice(from=@At(value="INVOKE", target ="Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V"))
|
||||||
|
)
|
||||||
|
private void iris$beginTranslucentRender(float partialTicks, long limitTime, CallbackInfo ci) {
|
||||||
|
final Camera camera = new Camera(mc.renderViewEntity, partialTicks);
|
||||||
|
pipeline.beginHand();
|
||||||
|
HandRenderer.INSTANCE.renderSolid(camera.getPartialTicks(), camera, mc.renderGlobal, pipeline);
|
||||||
|
mc.mcProfiler.endStartSection("iris_pre_translucent");
|
||||||
|
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.TERRAIN_TRANSLUCENT);
|
||||||
|
pipeline.beginTranslucents();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Inject(method = "renderWorld(FJ)V", at = @At(value="INVOKE", target="Lorg/lwjgl/opengl/GL11;glClear(I)V", shift=At.Shift.AFTER, ordinal=0))
|
||||||
|
private void iris$beginLevelRender(CallbackInfo callback) {
|
||||||
|
pipeline.beginLevelRendering();
|
||||||
|
pipeline.setPhase(WorldRenderingPhase.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "renderWorld(FJ)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/culling/ClippingHelperImpl;getInstance()Lnet/minecraft/client/renderer/culling/ClippingHelper;", shift = At.Shift.AFTER, ordinal = 0))
|
||||||
|
private void iris$startFrame(float partialTicks, long startTime, CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
|
||||||
|
CapturedRenderingState.INSTANCE.setTickDelta(partialTicks);
|
||||||
|
SystemTimeUniforms.COUNTER.beginFrame();
|
||||||
|
SystemTimeUniforms.TIMER.beginFrame(System.nanoTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Inject(method = "renderWorld(FJ)V", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;dispatchRenderLast(Lnet/minecraft/client/renderer/RenderGlobal;F)V", remap = false))
|
||||||
|
private void iris$endLevelRender(float partialTicks, long limitTime, CallbackInfo callback) {
|
||||||
|
final Camera camera = new Camera(mc.renderViewEntity, partialTicks);
|
||||||
|
HandRenderer.INSTANCE.renderTranslucent(partialTicks, camera, mc.renderGlobal, pipeline);
|
||||||
|
Minecraft.getMinecraft().mcProfiler.endStartSection("iris_final");
|
||||||
|
pipeline.finalizeLevelRendering();
|
||||||
|
pipeline = null;
|
||||||
|
|
||||||
|
IrisRenderSystem.restoreCullingState();
|
||||||
|
|
||||||
|
if (IrisArchaic.shouldActivateWireframe() && mc.isSingleplayer()) {
|
||||||
|
IrisRenderSystem.setPolygonMode(GL43C.GL_FILL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@WrapWithCondition(method = "renderHand", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItemInFirstPerson(F)V"))
|
||||||
|
private boolean iris$disableVanillaRenderHand(ItemRenderer instance, float itemstack) {
|
||||||
|
return !CeleritasShadersApi.getInstance().isShaderPackInUse();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+98
@@ -0,0 +1,98 @@
|
|||||||
|
package org.taumc.celeritas.mixin.shaders;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.shader.Framebuffer;
|
||||||
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL14;
|
||||||
|
import org.lwjgl.opengl.GL30;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.taumc.celeritas.interfaces.IRenderTargetExt;
|
||||||
|
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(Framebuffer.class)
|
||||||
|
public abstract class MixinFramebuffer_Shaders implements IRenderTargetExt {
|
||||||
|
private int iris$depthBufferVersion;
|
||||||
|
|
||||||
|
private int iris$colorBufferVersion;
|
||||||
|
|
||||||
|
@Getter public boolean iris$useDepth;
|
||||||
|
@Getter public int iris$depthTextureId = -1;
|
||||||
|
|
||||||
|
@Shadow public boolean useDepth;
|
||||||
|
|
||||||
|
|
||||||
|
@Inject(method = "deleteFramebuffer()V", at = @At(value="INVOKE", target="Lnet/minecraft/client/shader/Framebuffer;unbindFramebuffer()V", shift = At.Shift.AFTER))
|
||||||
|
private void iris$onDestroyBuffers(CallbackInfo ci) {
|
||||||
|
iris$depthBufferVersion++;
|
||||||
|
iris$colorBufferVersion++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int iris$getDepthBufferVersion() {
|
||||||
|
return iris$depthBufferVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int iris$getColorBufferVersion() {
|
||||||
|
return iris$colorBufferVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use a depth texture instead of a depth drawScreen buffer
|
||||||
|
@Inject(method="Lnet/minecraft/client/shader/Framebuffer;createBindFramebuffer(II)V", at=@At(value="HEAD"))
|
||||||
|
private void iris$useDepthTexture(int width, int height, CallbackInfo ci) {
|
||||||
|
if(this.useDepth) {
|
||||||
|
this.useDepth = false;
|
||||||
|
this.iris$useDepth = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method="deleteFramebuffer()V", at=@At(value="FIELD", target="Lnet/minecraft/client/shader/Framebuffer;depthBuffer:I", shift = At.Shift.BEFORE, ordinal = 0))
|
||||||
|
private void iris$deleteDepthBuffer(CallbackInfo ci) {
|
||||||
|
if(this.iris$depthTextureId > -1 ) {
|
||||||
|
GL11.glDeleteTextures(this.iris$depthTextureId);
|
||||||
|
this.iris$depthTextureId = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method="createFramebuffer(II)V", at=@At(value="FIELD", target="Lnet/minecraft/client/shader/Framebuffer;useDepth:Z", shift=At.Shift.BEFORE, ordinal = 0))
|
||||||
|
private void iris$createDepthTextureID(int width, int height, CallbackInfo ci) {
|
||||||
|
if (this.iris$useDepth) {
|
||||||
|
this.iris$depthTextureId = GL11.glGenTextures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method="createFramebuffer(II)V", at=@At(value="FIELD", target="Lnet/minecraft/client/shader/Framebuffer;useDepth:Z", shift=At.Shift.BEFORE, ordinal = 1))
|
||||||
|
private void iris$createDepthTexture(int width, int height, CallbackInfo ci) {
|
||||||
|
if(this.iris$useDepth) {
|
||||||
|
if(this.iris$depthTextureId == -1) {
|
||||||
|
this.iris$depthTextureId = GL11.glGenTextures();
|
||||||
|
}
|
||||||
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.iris$depthTextureId);
|
||||||
|
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_MODE, 0);
|
||||||
|
if (MinecraftForgeClient.getStencilBits() != 0) {
|
||||||
|
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL30.GL_DEPTH24_STENCIL8, width, height, 0, GL30.GL_DEPTH_STENCIL, GL30.GL_UNSIGNED_INT_24_8, (IntBuffer) null);
|
||||||
|
} else {
|
||||||
|
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (IntBuffer) null);
|
||||||
|
}
|
||||||
|
OpenGlHelper.func_153188_a/*glFramebufferTexture2D*/(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, this.iris$depthTextureId, 0);
|
||||||
|
if (MinecraftForgeClient.getStencilBits() != 0) {
|
||||||
|
OpenGlHelper.func_153188_a/*glFramebufferTexture2D*/(GL30.GL_FRAMEBUFFER, GL30.GL_STENCIL_ATTACHMENT, GL11.GL_TEXTURE_2D, this.iris$depthTextureId, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package org.taumc.celeritas.mixin.shaders;
|
||||||
|
|
||||||
|
import net.minecraftforge.client.GuiIngameForge;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
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(value = GuiIngameForge.class, remap = false)
|
||||||
|
public class MixinGuiIngameForge_Shaders {
|
||||||
|
@Inject(method="renderCrosshairs", at= @At(value = "INVOKE", target = "Lnet/minecraftforge/client/GuiIngameForge;bind(Lnet/minecraft/util/ResourceLocation;)V", shift = At.Shift.AFTER))
|
||||||
|
private void renderCrosshairs(CallbackInfo ci) {
|
||||||
|
// Set the same state as vanilla so we don't break with textures that set a color value on transparent pixels for the crosshairs
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package org.taumc.celeritas.mixin.shaders;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.pathways.HandRenderer;
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
|
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;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
import org.taumc.celeritas.compat.InteractionHand;
|
||||||
|
|
||||||
|
@Mixin(ItemRenderer.class)
|
||||||
|
public class MixinItemRenderer_Shaders {
|
||||||
|
@Inject(method = "renderItemInFirstPerson", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void iris$skipTranslucentHands(float partialTicks, CallbackInfo ci) {
|
||||||
|
if (CeleritasShadersApi.getInstance().isShaderPackInUse()) {
|
||||||
|
boolean isHandTranslucent = HandRenderer.INSTANCE.isHandTranslucent(InteractionHand.MAIN_HAND);
|
||||||
|
if (HandRenderer.INSTANCE.isRenderingSolid() && isHandTranslucent) {
|
||||||
|
ci.cancel();
|
||||||
|
} else if (!HandRenderer.INSTANCE.isRenderingSolid() && !isHandTranslucent) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package org.taumc.celeritas.mixin.shaders;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.api.v0.item.IrisItemLightProvider;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
|
@Mixin(Item.class)
|
||||||
|
public class MixinItem_Shaders implements IrisItemLightProvider {
|
||||||
|
// Interface Injection
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package org.taumc.celeritas.mixin.shaders.statelisteners;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.taumc.celeritas.state.MatrixRenderingState;
|
||||||
|
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
@Mixin(ActiveRenderInfo.class)
|
||||||
|
public class MixinActiveRenderInfo_MatrixState {
|
||||||
|
@Shadow private static FloatBuffer modelview;
|
||||||
|
@Shadow private static FloatBuffer projection;
|
||||||
|
|
||||||
|
@Inject(method = "updateRenderInfo", at = @At(value = "TAIL"))
|
||||||
|
private static void angelica$onUpdateRenderInfo(CallbackInfo ci) {
|
||||||
|
MatrixRenderingState.INSTANCE.setProjectionMatrix(projection);
|
||||||
|
MatrixRenderingState.INSTANCE.setModelViewMatrix(modelview);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package org.taumc.celeritas.state;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.lwjgl.BufferUtils;
|
||||||
|
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
public class MatrixRenderingState {
|
||||||
|
public static final MatrixRenderingState INSTANCE = new MatrixRenderingState();
|
||||||
|
|
||||||
|
@Getter private final FloatBuffer projectionBuffer = BufferUtils.createFloatBuffer(16);
|
||||||
|
@Getter private final FloatBuffer modelViewBuffer = BufferUtils.createFloatBuffer(16);
|
||||||
|
@Getter private final Matrix4f projectionMatrix = new Matrix4f().identity();
|
||||||
|
@Getter private final Matrix4f modelViewMatrix = new Matrix4f().identity();
|
||||||
|
|
||||||
|
|
||||||
|
public void setProjectionMatrix(FloatBuffer projection) {
|
||||||
|
projectionMatrix.set(projection);
|
||||||
|
projectionMatrix.get(0, projectionBuffer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModelViewMatrix(FloatBuffer modelview) {
|
||||||
|
modelViewMatrix.set(modelview);
|
||||||
|
modelViewMatrix.get(0, modelViewBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user