use of com.qouteall.immersive_portals.ducks.IEGameRenderer in project ImmersivePortalsMod by qouteall.
the class MyRenderHelper method setupCameraTransformation.
public static void setupCameraTransformation() {
MinecraftClient mc = MinecraftClient.getInstance();
// rendering post processing shader may change view port
if (OFInterface.isShaders.getAsBoolean()) {
// Shaders.setViewport(0, 0, mc.window.getFramebufferWidth(), mc.window.getFramebufferHeight());
} else {
GlStateManager.viewport(0, 0, mc.window.getFramebufferWidth(), mc.window.getFramebufferHeight());
}
((IEGameRenderer) PortalRenderer.mc.gameRenderer).applyCameraTransformations_(partialTicks);
Camera camera = PortalRenderer.mc.gameRenderer.getCamera();
camera.update(PortalRenderer.mc.world, (Entity) (PortalRenderer.mc.getCameraEntity() == null ? PortalRenderer.mc.player : PortalRenderer.mc.getCameraEntity()), PortalRenderer.mc.options.perspective > 0, PortalRenderer.mc.options.perspective == 2, partialTicks);
}
use of com.qouteall.immersive_portals.ducks.IEGameRenderer in project ImmersivePortalsMod by qouteall.
the class DimensionRenderHelper method switchToMe.
public void switchToMe() {
IEGameRenderer gameRenderer = (IEGameRenderer) mc.gameRenderer;
gameRenderer.setBackgroundRenderer(fogRenderer);
gameRenderer.setLightmapTextureManager(lightmapTexture);
}
use of com.qouteall.immersive_portals.ducks.IEGameRenderer in project ImmersivePortalsMod by qouteall.
the class MyGameRenderer method renderWorld.
public void renderWorld(float partialTicks, WorldRenderer newWorldRenderer, ClientWorld newWorld, Vec3d oldCameraPos) {
ChunkRenderDispatcher chunkRenderDispatcher = ((IEWorldRenderer) newWorldRenderer).getChunkRenderDispatcher();
chunkRenderDispatcher.updateCameraPosition(mc.player.x, mc.player.z);
IEGameRenderer ieGameRenderer = (IEGameRenderer) mc.gameRenderer;
DimensionRenderHelper helper = CGlobal.clientWorldLoader.getDimensionRenderHelper(newWorld.dimension.getType());
PlayerListEntry playerListEntry = CHelper.getClientPlayerListEntry();
Camera newCamera = new Camera();
// store old state
WorldRenderer oldWorldRenderer = mc.worldRenderer;
ClientWorld oldWorld = mc.world;
LightmapTextureManager oldLightmap = ieGameRenderer.getLightmapTextureManager();
BackgroundRenderer oldFogRenderer = ieGameRenderer.getBackgroundRenderer();
GameMode oldGameMode = playerListEntry.getGameMode();
boolean oldNoClip = mc.player.noClip;
boolean oldDoRenderHand = ieGameRenderer.getDoRenderHand();
List oldChunkInfos = ((IEWorldRenderer) mc.worldRenderer).getChunkInfos();
IEChunkRenderList oldChunkRenderList = (IEChunkRenderList) ((IEWorldRenderer) oldWorldRenderer).getChunkRenderList();
// List<ChunkRenderer> oldChunkRenderers = oldChunkRenderList.getChunkRenderers();
OFInterface.createNewRenderInfosNormal.accept(newWorldRenderer);
// switch
mc.worldRenderer = newWorldRenderer;
mc.world = newWorld;
ieGameRenderer.setBackgroundRenderer(helper.fogRenderer);
ieGameRenderer.setLightmapTextureManager(helper.lightmapTexture);
helper.lightmapTexture.update(0);
helper.lightmapTexture.enable();
BlockEntityRenderDispatcher.INSTANCE.world = newWorld;
((IEPlayerListEntry) playerListEntry).setGameMode(GameMode.SPECTATOR);
mc.player.noClip = true;
ieGameRenderer.setDoRenderHand(false);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.pushMatrix();
CGlobal.renderInfoNumMap.put(newWorld.dimension.getType(), ((IEWorldRenderer) mc.worldRenderer).getChunkInfos().size());
updateCullingPlane();
// this is important
GlStateManager.disableBlend();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GuiLighting.disable();
((GameRenderer) ieGameRenderer).disableLightmap();
mc.getProfiler().push("render_portal_content");
CGlobal.switchedFogRenderer = ieGameRenderer.getBackgroundRenderer();
// invoke it!
OFInterface.beforeRenderCenter.accept(partialTicks);
ieGameRenderer.renderCenter_(partialTicks, getChunkUpdateFinishTime());
OFInterface.afterRenderCenter.run();
mc.getProfiler().pop();
// recover
mc.worldRenderer = oldWorldRenderer;
mc.world = oldWorld;
ieGameRenderer.setBackgroundRenderer(oldFogRenderer);
ieGameRenderer.setLightmapTextureManager(oldLightmap);
BlockEntityRenderDispatcher.INSTANCE.world = oldWorld;
((IEPlayerListEntry) playerListEntry).setGameMode(oldGameMode);
mc.player.noClip = oldNoClip;
ieGameRenderer.setDoRenderHand(oldDoRenderHand);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.popMatrix();
GlStateManager.enableBlend();
((IEWorldRenderer) mc.worldRenderer).setChunkInfos(oldChunkInfos);
oldChunkRenderList.setCameraPos(oldCameraPos.x, oldCameraPos.y, oldCameraPos.z);
}
Aggregations