mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-26 15:13:01 +00:00
Beta (#461)
* Beta, maybe * Fixes for entityColor uniform in Iris * Handle Iris Texture input hook properly in GLSM * Iris Entity Fixes * Gbuffer progress * Wire up BlockEntity gbuffer * Move Entity gbuffer to a more appropriate place to avoid reentrancy * Wire up ENTITY_EYES and BEACOM_BEAM * Clean up unused RenderStateShard files * This seems marginally more correct? * Fix shadows from showing on sides of blocks * Remove overlay * yeet * More gl debugging * Grr, fix water textures * Add missed enable checks * Workaround for unset depth texture when using apitrace... Use a WrapOperation instead of an Inject with local capture - it wasn't working in dev w/ mixin debug set * update bs * Fix crosshair rendering with shaders * more final * Disable dynamic lights if shaders are in use * No light when in water * Add Void Particle Option + Mixin cleanup * update bs * less false --------- Co-authored-by: Darren Eberly <[email protected]> Co-authored-by: Caedis <[email protected]>
This commit is contained in:
51 files changed
+330
-400
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package me.jellysquid.mods.sodium.client.gl.shader;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLDebug;
|
||||
import me.jellysquid.mods.sodium.client.gl.GlObject;
|
||||
import me.jellysquid.mods.sodium.client.gl.device.RenderDevice;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -7,7 +8,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import org.lwjgl.opengl.KHRDebug;
|
||||
|
||||
/**
|
||||
* An OpenGL shader program.
|
||||
@@ -47,7 +48,7 @@ public abstract class GlProgram extends GlObject {
|
||||
* @throws NullPointerException If no uniform exists with the given name
|
||||
*/
|
||||
public int getUniformLocation(String name) {
|
||||
int index = GL20.glGetUniformLocation(this.handle(), name);
|
||||
final int index = GL20.glGetUniformLocation(this.handle(), name);
|
||||
|
||||
if (index < 0) {
|
||||
throw new NullPointerException("No uniform exists with name: " + name);
|
||||
@@ -69,6 +70,7 @@ public abstract class GlProgram extends GlObject {
|
||||
public Builder(ResourceLocation name) {
|
||||
this.name = name;
|
||||
this.program = GL20.glCreateProgram();
|
||||
GLDebug.nameObject(KHRDebug.GL_PROGRAM, program, name.toString());
|
||||
}
|
||||
|
||||
public Builder attachShader(GlShader shader) {
|
||||
@@ -89,13 +91,13 @@ public abstract class GlProgram extends GlObject {
|
||||
public <P extends GlProgram> P build(ProgramFactory<P> factory) {
|
||||
GL20.glLinkProgram(this.program);
|
||||
|
||||
String log = GL20.glGetProgramInfoLog(this.program, GL20.GL_INFO_LOG_LENGTH);
|
||||
final String log = GL20.glGetProgramInfoLog(this.program, GL20.GL_INFO_LOG_LENGTH);
|
||||
|
||||
if (!log.isEmpty()) {
|
||||
LOGGER.warn("Program link log for " + this.name + ": " + log);
|
||||
}
|
||||
|
||||
int result = GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS);
|
||||
final int result = GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS);
|
||||
|
||||
if (result != GL11.GL_TRUE) {
|
||||
throw new RuntimeException("Shader program linking failed, see log for details");
|
||||
|
||||
@@ -187,6 +187,7 @@ public class SodiumGameOptionPages {
|
||||
.setImpact(OptionImpact.LOW)
|
||||
.build())
|
||||
.add(Settings.PARTICLES_ENC_TABLE.option)
|
||||
.add(Settings.PARTICLES_VOID.option)
|
||||
.add(OptionImpl.createBuilder(GraphicsQuality.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.grass_quality.name"))
|
||||
.setTooltip(I18n.format("sodium.options.grass_quality.tooltip"))
|
||||
|
||||
+27
-27
@@ -72,7 +72,7 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
public void calculate(ModelQuadView quad, BlockPosImpl pos, QuadLightData out, ForgeDirection cullFace, ForgeDirection face, boolean shade) {
|
||||
this.updateCachedData(pos.asLong());
|
||||
|
||||
int flags = quad.getFlags();
|
||||
final int flags = quad.getFlags();
|
||||
|
||||
final AoNeighborInfo neighborInfo = AoNeighborInfo.get(face);
|
||||
|
||||
@@ -102,7 +102,7 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
* Flags: IS_ALIGNED, !IS_PARTIAL
|
||||
*/
|
||||
private void applyAlignedFullFace(AoNeighborInfo neighborInfo, BlockPosImpl pos, ForgeDirection dir, QuadLightData out) {
|
||||
AoFaceData faceData = this.getCachedFaceData(pos, dir, true);
|
||||
final AoFaceData faceData = this.getCachedFaceData(pos, dir, true);
|
||||
neighborInfo.mapCorners(faceData.lm, faceData.ao, out.lm, out.br);
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
private void applyAlignedPartialFace(AoNeighborInfo neighborInfo, ModelQuadView quad, BlockPosImpl pos, ForgeDirection dir, QuadLightData out) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// Clamp the vertex positions to the block's boundaries to prevent weird errors in lighting
|
||||
float cx = clamp(quad.getX(i));
|
||||
float cy = clamp(quad.getY(i));
|
||||
float cz = clamp(quad.getZ(i));
|
||||
final float cx = clamp(quad.getX(i));
|
||||
final float cy = clamp(quad.getY(i));
|
||||
final float cz = clamp(quad.getZ(i));
|
||||
|
||||
float[] weights = this.weights;
|
||||
final float[] weights = this.weights;
|
||||
neighborInfo.calculateCornerWeights(cx, cy, cz, weights);
|
||||
this.applyAlignedPartialFaceVertex(pos, dir, weights, i, out, true);
|
||||
}
|
||||
@@ -133,14 +133,14 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
private void applyParallelFace(AoNeighborInfo neighborInfo, ModelQuadView quad, BlockPosImpl pos, ForgeDirection dir, QuadLightData out) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// Clamp the vertex positions to the block's boundaries to prevent weird errors in lighting
|
||||
float cx = clamp(quad.getX(i));
|
||||
float cy = clamp(quad.getY(i));
|
||||
float cz = clamp(quad.getZ(i));
|
||||
final float cx = clamp(quad.getX(i));
|
||||
final float cy = clamp(quad.getY(i));
|
||||
final float cz = clamp(quad.getZ(i));
|
||||
|
||||
float[] weights = this.weights;
|
||||
final float[] weights = this.weights;
|
||||
neighborInfo.calculateCornerWeights(cx, cy, cz, weights);
|
||||
|
||||
float depth = neighborInfo.getDepth(cx, cy, cz);
|
||||
final float depth = neighborInfo.getDepth(cx, cy, cz);
|
||||
|
||||
// If the quad is approximately grid-aligned (not inset) to the other side of the block, avoid unnecessary
|
||||
// computation by treating it is as aligned
|
||||
@@ -160,14 +160,14 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
private void applyNonParallelFace(AoNeighborInfo neighborInfo, ModelQuadView quad, BlockPosImpl pos, ForgeDirection dir, QuadLightData out) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// Clamp the vertex positions to the block's boundaries to prevent weird errors in lighting
|
||||
float cx = clamp(quad.getX(i));
|
||||
float cy = clamp(quad.getY(i));
|
||||
float cz = clamp(quad.getZ(i));
|
||||
final float cx = clamp(quad.getX(i));
|
||||
final float cy = clamp(quad.getY(i));
|
||||
final float cz = clamp(quad.getZ(i));
|
||||
|
||||
float[] weights = this.weights;
|
||||
final float[] weights = this.weights;
|
||||
neighborInfo.calculateCornerWeights(cx, cy, cz, weights);
|
||||
|
||||
float depth = neighborInfo.getDepth(cx, cy, cz);
|
||||
final float depth = neighborInfo.getDepth(cx, cy, cz);
|
||||
|
||||
// If the quad is approximately grid-aligned (not inset), avoid unnecessary computation by treating it is as aligned
|
||||
if (DoubleMath.fuzzyEquals(depth, 0.0F, TOLERANCE)) {
|
||||
@@ -183,22 +183,22 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
}
|
||||
|
||||
private void applyAlignedPartialFaceVertex(BlockPosImpl pos, ForgeDirection dir, float[] w, int i, QuadLightData out, boolean offset) {
|
||||
AoFaceData faceData = this.getCachedFaceData(pos, dir, offset);
|
||||
final AoFaceData faceData = this.getCachedFaceData(pos, dir, offset);
|
||||
|
||||
if (!faceData.hasUnpackedLightData()) {
|
||||
faceData.unpackLightData();
|
||||
}
|
||||
|
||||
float sl = faceData.getBlendedSkyLight(w);
|
||||
float bl = faceData.getBlendedBlockLight(w);
|
||||
float ao = faceData.getBlendedShade(w);
|
||||
final float sl = faceData.getBlendedSkyLight(w);
|
||||
final float bl = faceData.getBlendedBlockLight(w);
|
||||
final float ao = faceData.getBlendedShade(w);
|
||||
|
||||
out.br[i] = ao;
|
||||
out.lm[i] = getLightMapCoord(sl, bl);
|
||||
}
|
||||
|
||||
private void applyInsetPartialFaceVertex(BlockPosImpl pos, ForgeDirection dir, float n1d, float n2d, float[] w, int i, QuadLightData out) {
|
||||
AoFaceData n1 = this.getCachedFaceData(pos, dir, false);
|
||||
final AoFaceData n1 = this.getCachedFaceData(pos, dir, false);
|
||||
|
||||
if (!n1.hasUnpackedLightData()) {
|
||||
n1.unpackLightData();
|
||||
@@ -211,9 +211,9 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
}
|
||||
|
||||
// Blend between the direct neighbors and above based on the passed weights
|
||||
float ao = (n1.getBlendedShade(w) * n1d) + (n2.getBlendedShade(w) * n2d);
|
||||
float sl = (n1.getBlendedSkyLight(w) * n1d) + (n2.getBlendedSkyLight(w) * n2d);
|
||||
float bl = (n1.getBlendedBlockLight(w) * n1d) + (n2.getBlendedBlockLight(w) * n2d);
|
||||
final float ao = (n1.getBlendedShade(w) * n1d) + (n2.getBlendedShade(w) * n2d);
|
||||
final float sl = (n1.getBlendedSkyLight(w) * n1d) + (n2.getBlendedSkyLight(w) * n2d);
|
||||
final float bl = (n1.getBlendedBlockLight(w) * n1d) + (n2.getBlendedBlockLight(w) * n2d);
|
||||
|
||||
out.br[i] = ao;
|
||||
out.lm[i] = getLightMapCoord(sl, bl);
|
||||
@@ -224,8 +224,8 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
return;
|
||||
}
|
||||
|
||||
float brightness = this.lightCache.getWorld().getBrightness(face, shade);
|
||||
float[] br = out.br;
|
||||
final float brightness = this.lightCache.getWorld().getBrightness(face, shade);
|
||||
final float[] br = out.br;
|
||||
|
||||
for (int i = 0; i < br.length; i++) {
|
||||
br[i] *= brightness;
|
||||
@@ -236,7 +236,7 @@ public class SmoothLightPipeline implements LightPipeline {
|
||||
* Returns the cached data for a given facing or calculates it if it hasn't been cached.
|
||||
*/
|
||||
private AoFaceData getCachedFaceData(BlockPosImpl pos, ForgeDirection face, boolean offset) {
|
||||
AoFaceData data = this.cachedFaceData[offset ? face.ordinal() : face.ordinal() + 6];
|
||||
final AoFaceData data = this.cachedFaceData[offset ? face.ordinal() : face.ordinal() + 6];
|
||||
|
||||
if (!data.hasLightData()) {
|
||||
data.initLightData(this.lightCache, pos, face, offset);
|
||||
|
||||
@@ -30,10 +30,13 @@ import me.jellysquid.mods.sodium.client.util.math.FrustumExtended;
|
||||
import me.jellysquid.mods.sodium.client.world.ChunkStatusListener;
|
||||
import me.jellysquid.mods.sodium.common.util.ListUtil;
|
||||
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.coderbot.iris.pipeline.ShadowRenderer;
|
||||
import net.coderbot.iris.shadows.ShadowRenderingState;
|
||||
import net.coderbot.iris.sodium.shadow_map.SwappableChunkRenderManager;
|
||||
import net.coderbot.iris.sodium.vertex_format.IrisModelVertexFormats;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
@@ -339,7 +342,13 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
|
||||
return;
|
||||
|
||||
try {
|
||||
if(AngelicaConfig.enableIris) {
|
||||
final Block block = tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
CapturedRenderingState.INSTANCE.setCurrentBlockEntity(Block.getIdFromBlock(block));
|
||||
GbufferPrograms.beginBlockEntities();
|
||||
}
|
||||
TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks);
|
||||
|
||||
} catch(RuntimeException e) {
|
||||
if(tileEntity.isInvalid()) {
|
||||
SodiumClientMod.logger().error("Suppressing crash from invalid tile entity", e);
|
||||
@@ -347,10 +356,16 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if(AngelicaConfig.enableIris) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentBlockEntity(-1);
|
||||
GbufferPrograms.endBlockEntities();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderTileEntities(EntityLivingBase entity, ICamera camera, float partialTicks) {
|
||||
int pass = MinecraftForgeClient.getRenderPass();
|
||||
final int pass = MinecraftForgeClient.getRenderPass();
|
||||
for (TileEntity tileEntity : this.chunkRenderManager.getVisibleTileEntities()) {
|
||||
renderTE(tileEntity, pass, partialTicks);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user