use of it.unimi.dsi.fastutil.objects.ObjectList in project Create_Aeronautics by Eriksonnaren.
the class AirshipContraptionRenderer method switchAndRenderTheWorld.
// code from immersive portals, test may not have been successful, code may be removed in future
private static void switchAndRenderTheWorld(ClientWorld newWorld, Vector3d thisTickCameraPos, Vector3d lastTickCameraPos, Consumer<Runnable> invokeWrapper, int renderDistance) {
resetGlStates();
Entity cameraEntity = client.cameraEntity;
Vector3d oldEyePos = McHelper.getEyePos(cameraEntity);
Vector3d oldLastTickEyePos = McHelper.getLastTickEyePos(cameraEntity);
RegistryKey<World> oldEntityDimension = cameraEntity.level.dimension();
ClientWorld oldEntityWorld = (ClientWorld) cameraEntity.level;
RegistryKey<World> newDimension = newWorld.dimension();
McHelper.setEyePos(cameraEntity, thisTickCameraPos, lastTickCameraPos);
cameraEntity.level = newWorld;
WorldRenderer worldRenderer = ClientWorldLoader.getWorldRenderer(newDimension);
// CHelper.checkGlError();
float tickDelta = RenderStates.tickDelta;
if (com.qouteall.immersive_portals.CGlobal.useHackedChunkRenderDispatcher) {
((IEWorldRenderer) worldRenderer).getBuiltChunkStorage().repositionCamera(cameraEntity.getX(), cameraEntity.getZ());
}
IEGameRenderer ieGameRenderer = (IEGameRenderer) client.gameRenderer;
DimensionRenderHelper helper = ClientWorldLoader.getDimensionRenderHelper(RenderDimensionRedirect.getRedirectedDimension(newDimension));
NetworkPlayerInfo playerListEntry = Minecraft.getInstance().getConnection().getPlayerInfo(Minecraft.getInstance().player.getGameProfile().getId());
ActiveRenderInfo newCamera = new ActiveRenderInfo();
WorldRenderer oldWorldRenderer = client.levelRenderer;
LightTexture oldLightmap = client.gameRenderer.lightTexture();
GameType oldGameMode = playerListEntry.getGameMode();
boolean oldNoClip = client.player.noPhysics;
boolean oldDoRenderHand = ieGameRenderer.getDoRenderHand();
OFInterface.createNewRenderInfosNormal.accept(worldRenderer);
ObjectList oldVisibleChunks = ((IEWorldRenderer) oldWorldRenderer).getVisibleChunks();
RayTraceResult oldCrosshairTarget = client.hitResult;
ActiveRenderInfo oldCamera = client.gameRenderer.getMainCamera();
ShaderGroup oldTransparencyShader = ((IEWorldRenderer) oldWorldRenderer).portal_getTransparencyShader();
ShaderGroup newTransparencyShader = ((IEWorldRenderer) worldRenderer).portal_getTransparencyShader();
RenderTypeBuffers oldBufferBuilder = ((IEWorldRenderer) worldRenderer).getBufferBuilderStorage();
RenderTypeBuffers oldClientBufferBuilder = client.renderBuffers();
boolean oldChunkCullingEnabled = client.smartCull;
((IEWorldRenderer) oldWorldRenderer).setVisibleChunks(new ObjectArrayList());
int oldRenderDistance = ((IEWorldRenderer) worldRenderer).portal_getRenderDistance();
((IEMinecraftClient) client).setWorldRenderer(worldRenderer);
client.level = newWorld;
ieGameRenderer.setLightmapTextureManager(helper.lightmapTexture);
TileEntityRendererDispatcher.instance.level = newWorld;
((IEPlayerListEntry) playerListEntry).setGameMode(GameType.SPECTATOR);
client.player.noPhysics = true;
ieGameRenderer.setDoRenderHand(false);
GlStateManager._matrixMode(5888);
GlStateManager._pushMatrix();
// FogRendererContext.swappingManager.pushSwapping(RenderDimensionRedirect.getRedirectedDimension(newDimension));
((IEParticleManager) client.particleEngine).mySetWorld(newWorld);
if (BlockManipulationClient.remotePointedDim == newDimension) {
client.hitResult = BlockManipulationClient.remoteHitResult;
}
ieGameRenderer.setCamera(newCamera);
if (Global.useSecondaryEntityVertexConsumer) {
// ((IEWorldRenderer)worldRenderer).setBufferBuilderStorage(secondaryBufferBuilderStorage);
// ((IEMinecraftClient)client).setBufferBuilderStorage(secondaryBufferBuilderStorage);
}
// ((IEWorldRenderer)worldRenderer).portal_setRenderDistance(renderDistance);
if (Global.looseVisibleChunkIteration) {
client.smartCull = false;
}
if (!RenderStates.isDimensionRendered(newDimension)) {
helper.lightmapTexture.updateLightTexture(0.0F);
}
try {
invokeWrapper.accept(() -> {
// /client.getProfiler().push("render_portal_content");
client.gameRenderer.renderLevel(tickDelta, Util.getNanos(), new MatrixStack());
// client.getProfiler().pop();
});
} catch (Throwable var34) {
// limitedLogger.invoke(var34::printStackTrace);
}
// SodiumInterface.switchRenderingContext.apply(worldRenderer, oldSodiumContext);
((IEMinecraftClient) client).setWorldRenderer(oldWorldRenderer);
client.level = oldEntityWorld;
ieGameRenderer.setLightmapTextureManager(oldLightmap);
TileEntityRendererDispatcher.instance.level = oldEntityWorld;
((IEPlayerListEntry) playerListEntry).setGameMode(oldGameMode);
client.player.noPhysics = oldNoClip;
ieGameRenderer.setDoRenderHand(oldDoRenderHand);
GlStateManager._matrixMode(5888);
GlStateManager._popMatrix();
((IEParticleManager) client.particleEngine).mySetWorld(oldEntityWorld);
client.hitResult = oldCrosshairTarget;
ieGameRenderer.setCamera(oldCamera);
// ((IEWorldRenderer)oldWorldRenderer).portal_setTransparencyShader(oldTransparencyShader);
// ((IEWorldRenderer)worldRenderer).portal_setTransparencyShader(newTransparencyShader);
// FogRendererContext.swappingManager.popSwapping();
((IEWorldRenderer) oldWorldRenderer).setVisibleChunks(oldVisibleChunks);
((IEWorldRenderer) worldRenderer).setBufferBuilderStorage(oldBufferBuilder);
((IEMinecraftClient) client).setBufferBuilderStorage(oldClientBufferBuilder);
((IEWorldRenderer) worldRenderer).portal_setRenderDistance(oldRenderDistance);
if (Global.looseVisibleChunkIteration) {
client.smartCull = oldChunkCullingEnabled;
}
client.getEntityRenderDispatcher().prepare(client.level, oldCamera, client.crosshairPickEntity);
// CHelper.checkGlError();
cameraEntity.level = oldEntityWorld;
McHelper.setEyePos(cameraEntity, oldEyePos, oldLastTickEyePos);
resetGlStates();
}
use of it.unimi.dsi.fastutil.objects.ObjectList in project Iris by IrisShaders.
the class MixinLevelRenderer method swap.
@Unique
private void swap() {
ObjectList tmpList = renderChunks;
renderChunks = savedRenderChunks;
savedRenderChunks = tmpList;
// TODO: If the normal chunks need a terrain update, these chunks probably do too...
// We probably should copy it over
boolean tmpBool = needsUpdate;
needsUpdate = savedNeedsTerrainUpdate;
savedNeedsTerrainUpdate = tmpBool;
double tmp;
tmp = lastCameraX;
lastCameraX = savedLastCameraX;
savedLastCameraX = tmp;
tmp = lastCameraY;
lastCameraY = savedLastCameraY;
savedLastCameraY = tmp;
tmp = lastCameraZ;
lastCameraZ = savedLastCameraZ;
savedLastCameraZ = tmp;
tmp = prevCamRotX;
prevCamRotX = savedLastCameraPitch;
savedLastCameraPitch = tmp;
tmp = prevCamRotY;
prevCamRotY = savedLastCameraYaw;
savedLastCameraYaw = tmp;
}
Aggregations