use of net.minecraft.client.shader.ShaderGroup 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 net.minecraft.client.shader.ShaderGroup in project Client by Sol-Client.
the class ColourSaturationMod method update.
public void update() {
if (group == null) {
groupSaturation = saturation;
try {
group = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), RESOURCE_LOCATION);
group.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
} catch (JsonSyntaxException | IOException error) {
logger.error("Could not load saturation shader", error);
}
}
if (groupSaturation != saturation) {
((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
ShaderUniform saturationUniform = shader.getShaderManager().getShaderUniform("Saturation");
if (saturationUniform != null) {
saturationUniform.set(saturation);
}
});
groupSaturation = saturation;
}
}
use of net.minecraft.client.shader.ShaderGroup in project Client by Sol-Client.
the class MenuBlurMod method update.
public void update() {
if (group == null) {
try {
group = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), RESOURCE_LOCATION);
group.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
} catch (JsonSyntaxException | IOException error) {
logger.error("Could not load menu blur", error);
}
}
((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
ShaderUniform radius = shader.getShaderManager().getShaderUniform("Radius");
ShaderUniform progress = shader.getShaderManager().getShaderUniform("Progress");
if (radius != null) {
radius.set(blur);
}
if (progress != null) {
if (fadeTime > 0) {
progress.set(getProgress());
} else {
progress.set(1);
}
}
});
}
use of net.minecraft.client.shader.ShaderGroup in project sol-client-glassmc by danterusdev.
the class ColourSaturationMod method update.
public void update() {
if (group == null) {
groupSaturation = saturation;
try {
group = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), RESOURCE_LOCATION);
group.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
} catch (JsonSyntaxException | IOException error) {
logger.error("Could not load saturation shader", error);
}
}
if (groupSaturation != saturation) {
((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
ShaderUniform saturationUniform = shader.getShaderManager().getShaderUniform("Saturation");
if (saturationUniform != null) {
saturationUniform.set(saturation);
}
});
groupSaturation = saturation;
}
}
use of net.minecraft.client.shader.ShaderGroup in project sol-client-glassmc by danterusdev.
the class MenuBlurMod method update.
public void update() {
if (group == null) {
try {
group = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), RESOURCE_LOCATION);
group.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
} catch (JsonSyntaxException | IOException error) {
logger.error("Could not load menu blur", error);
}
}
((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
ShaderUniform radius = shader.getShaderManager().getShaderUniform("Radius");
ShaderUniform progress = shader.getShaderManager().getShaderUniform("Progress");
if (radius != null) {
radius.set(blur);
}
if (progress != null) {
if (fadeTime > 0) {
progress.set(getProgress());
} else {
progress.set(1);
}
}
});
}
Aggregations