Search in sources :

Example 1 with IEGameRenderer

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);
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) Camera(net.minecraft.client.render.Camera) IEGameRenderer(com.qouteall.immersive_portals.ducks.IEGameRenderer)

Example 2 with IEGameRenderer

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);
}
Also used : IEGameRenderer(com.qouteall.immersive_portals.ducks.IEGameRenderer)

Example 3 with IEGameRenderer

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);
}
Also used : IEWorldRenderer(com.qouteall.immersive_portals.ducks.IEWorldRenderer) IEPlayerListEntry(com.qouteall.immersive_portals.ducks.IEPlayerListEntry) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) IEGameRenderer(com.qouteall.immersive_portals.ducks.IEGameRenderer) IEWorldRenderer(com.qouteall.immersive_portals.ducks.IEWorldRenderer) IEPlayerListEntry(com.qouteall.immersive_portals.ducks.IEPlayerListEntry) GameMode(net.minecraft.world.GameMode) IEChunkRenderList(com.qouteall.immersive_portals.ducks.IEChunkRenderList) IEGameRenderer(com.qouteall.immersive_portals.ducks.IEGameRenderer) List(java.util.List) IEChunkRenderList(com.qouteall.immersive_portals.ducks.IEChunkRenderList) ClientWorld(net.minecraft.client.world.ClientWorld)

Aggregations

IEGameRenderer (com.qouteall.immersive_portals.ducks.IEGameRenderer)3 IEChunkRenderList (com.qouteall.immersive_portals.ducks.IEChunkRenderList)1 IEPlayerListEntry (com.qouteall.immersive_portals.ducks.IEPlayerListEntry)1 IEWorldRenderer (com.qouteall.immersive_portals.ducks.IEWorldRenderer)1 List (java.util.List)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 PlayerListEntry (net.minecraft.client.network.PlayerListEntry)1 Camera (net.minecraft.client.render.Camera)1 ClientWorld (net.minecraft.client.world.ClientWorld)1 GameMode (net.minecraft.world.GameMode)1