mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-18 11:29:08 +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,9 +0,0 @@
|
||||
package net.coderbot.batchedentityrendering.impl;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.DrawState;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public interface BufferBuilderExt {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.coderbot.batchedentityrendering.impl;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.DrawState;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -9,12 +8,10 @@ import java.nio.ByteBuffer;
|
||||
public class BufferSegment {
|
||||
private final ByteBuffer slice;
|
||||
@Getter
|
||||
private final DrawState drawState;
|
||||
private final RenderLayer type;
|
||||
|
||||
public BufferSegment(ByteBuffer slice, DrawState drawState, RenderLayer type) {
|
||||
public BufferSegment(ByteBuffer slice, RenderLayer type) {
|
||||
this.slice = slice;
|
||||
this.drawState = drawState;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,29 +5,19 @@ public class InputAvailability {
|
||||
|
||||
public final boolean texture;
|
||||
public final boolean lightmap;
|
||||
public final boolean overlay;
|
||||
|
||||
public InputAvailability(boolean texture, boolean lightmap, boolean overlay) {
|
||||
public InputAvailability(boolean texture, boolean lightmap) {
|
||||
this.texture = texture;
|
||||
this.lightmap = lightmap;
|
||||
this.overlay = overlay;
|
||||
}
|
||||
|
||||
public InputAvailability withoutOverlay() {
|
||||
return new InputAvailability(texture, lightmap, false);
|
||||
}
|
||||
|
||||
public static InputAvailability unpack(int packed) {
|
||||
return new InputAvailability((packed & 1) == 1, (packed & 2) == 2, (packed & 4) == 4);
|
||||
return new InputAvailability((packed & 1) == 1, (packed & 2) == 2);
|
||||
}
|
||||
|
||||
public int pack() {
|
||||
int packed = 0;
|
||||
|
||||
if (overlay) {
|
||||
packed |= 4;
|
||||
}
|
||||
|
||||
if (lightmap) {
|
||||
packed |= 2;
|
||||
}
|
||||
@@ -44,7 +34,6 @@ public class InputAvailability {
|
||||
return "InputAvailability{" +
|
||||
"texture=" + texture +
|
||||
", lightmap=" + lightmap +
|
||||
", overlay=" + overlay +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -53,7 +42,6 @@ public class InputAvailability {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (lightmap ? 1231 : 1237);
|
||||
result = prime * result + (overlay ? 1231 : 1237);
|
||||
result = prime * result + (texture ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
@@ -69,8 +57,6 @@ public class InputAvailability {
|
||||
InputAvailability other = (InputAvailability) obj;
|
||||
if (lightmap != other.lightmap)
|
||||
return false;
|
||||
if (overlay != other.overlay)
|
||||
return false;
|
||||
if (texture != other.texture)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
@@ -11,12 +11,8 @@ public class StateTracker {
|
||||
public boolean albedoSampler;
|
||||
// LightmapStateShard / TextureUnit.LIGHTMAP
|
||||
public boolean lightmapSampler;
|
||||
// OverlayStateShard / TextureUnit.OVERLAY
|
||||
public boolean overlaySampler;
|
||||
|
||||
public InputAvailability getInputs() {
|
||||
return new InputAvailability(albedoSampler,
|
||||
lightmapSampler,
|
||||
overlaySampler);
|
||||
return new InputAvailability(albedoSampler, lightmapSampler);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package net.coderbot.iris.layer;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderPhase;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
|
||||
public final class BlockEntityRenderStateShard extends RenderPhase {
|
||||
private static final BlockEntityRenderStateShard UNIDENTIFIED = new BlockEntityRenderStateShard(-1);
|
||||
|
||||
private final int entityId;
|
||||
|
||||
private BlockEntityRenderStateShard(int entityId) {
|
||||
super("iris:is_block_entity", () -> {
|
||||
CapturedRenderingState.INSTANCE.setCurrentBlockEntity(entityId);
|
||||
GbufferPrograms.beginBlockEntities();
|
||||
}, () -> {
|
||||
CapturedRenderingState.INSTANCE.setCurrentBlockEntity(-1);
|
||||
GbufferPrograms.endBlockEntities();
|
||||
});
|
||||
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public static BlockEntityRenderStateShard forId(int entityId) {
|
||||
if (entityId == -1) {
|
||||
return UNIDENTIFIED;
|
||||
} else {
|
||||
// TODO: Cache all created render phases to avoid allocations?
|
||||
return new BlockEntityRenderStateShard(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == null || object.getClass() != this.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockEntityRenderStateShard other = (BlockEntityRenderStateShard) object;
|
||||
|
||||
return this.entityId == other.entityId;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package net.coderbot.iris.layer;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderPhase;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
|
||||
public final class EntityRenderStateShard extends RenderPhase {
|
||||
private static final EntityRenderStateShard UNIDENTIFIED = new EntityRenderStateShard(-1);
|
||||
|
||||
private final int entityId;
|
||||
|
||||
private EntityRenderStateShard(int entityId) {
|
||||
super("iris:is_entity", () -> {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(entityId);
|
||||
GbufferPrograms.beginEntities();
|
||||
}, () -> {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(-1);
|
||||
GbufferPrograms.endEntities();
|
||||
});
|
||||
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public static EntityRenderStateShard forId(int entityId) {
|
||||
if (entityId == -1) {
|
||||
return UNIDENTIFIED;
|
||||
} else {
|
||||
// TODO: Cache all created render phases to avoid allocations?
|
||||
return new EntityRenderStateShard(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == null || object.getClass() != this.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EntityRenderStateShard other = (EntityRenderStateShard) object;
|
||||
|
||||
return this.entityId == other.entityId;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class GbufferPrograms {
|
||||
}
|
||||
|
||||
public static WorldRenderingPhase getCurrentPhase() {
|
||||
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
final WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
|
||||
if (pipeline != null) {
|
||||
return pipeline.getPhase();
|
||||
@@ -75,7 +75,7 @@ public class GbufferPrograms {
|
||||
}
|
||||
|
||||
private static void setPhase(WorldRenderingPhase phase) {
|
||||
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
final WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
|
||||
if (pipeline != null) {
|
||||
pipeline.setPhase(phase);
|
||||
@@ -83,7 +83,7 @@ public class GbufferPrograms {
|
||||
}
|
||||
|
||||
public static void setOverridePhase(WorldRenderingPhase phase) {
|
||||
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
final WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
|
||||
if (pipeline != null) {
|
||||
pipeline.setOverridePhase(phase);
|
||||
@@ -100,7 +100,7 @@ public class GbufferPrograms {
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setSpecialCondition(override));
|
||||
}
|
||||
|
||||
public static void teardownSpecialRenderCondition(SpecialCondition override) {
|
||||
public static void teardownSpecialRenderCondition() {
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setSpecialCondition(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package net.coderbot.iris.layer;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderPhase;
|
||||
|
||||
public class IsBlockEntityRenderStateShard extends RenderPhase {
|
||||
public static final IsBlockEntityRenderStateShard INSTANCE = new IsBlockEntityRenderStateShard();
|
||||
|
||||
private IsBlockEntityRenderStateShard() {
|
||||
super("iris:is_block_entity", GbufferPrograms::beginBlockEntities, GbufferPrograms::endBlockEntities);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package net.coderbot.iris.layer;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderPhase;
|
||||
|
||||
public class IsEntityRenderStateShard extends RenderPhase {
|
||||
public static final IsEntityRenderStateShard INSTANCE = new IsEntityRenderStateShard();
|
||||
|
||||
private IsEntityRenderStateShard() {
|
||||
super("iris:is_entity", GbufferPrograms::beginEntities, GbufferPrograms::endEntities);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package net.coderbot.iris.layer;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderPhase;
|
||||
|
||||
public class IsOutlineRenderStateShard extends RenderPhase {
|
||||
public static final IsOutlineRenderStateShard INSTANCE = new IsOutlineRenderStateShard();
|
||||
|
||||
private IsOutlineRenderStateShard() {
|
||||
super("iris:is_outline", GbufferPrograms::beginOutline, GbufferPrograms::endOutline);
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
private WorldRenderingPhase phase = WorldRenderingPhase.NONE;
|
||||
private boolean isBeforeTranslucent;
|
||||
private boolean isRenderingShadow = false;
|
||||
private InputAvailability inputs = new InputAvailability(false, false, false);
|
||||
private InputAvailability inputs = new InputAvailability(false, false);
|
||||
private SpecialCondition special = null;
|
||||
|
||||
private boolean shouldBindPBR;
|
||||
@@ -344,7 +344,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
if (programs.getPackDirectives().getShadowDirectives().isShadowEnabled().orElse(true)) {
|
||||
this.shadowRenderer = new ShadowRenderer(programs.getShadow().orElse(null),
|
||||
programs.getPackDirectives(), shadowRenderTargets);
|
||||
Program shadowProgram = table.match(RenderCondition.SHADOW, new InputAvailability(true, true, true)).getProgram();
|
||||
Program shadowProgram = table.match(RenderCondition.SHADOW, new InputAvailability(true, true)).getProgram();
|
||||
shadowRenderer.setUsesImages(shadowProgram != null && shadowProgram.getActiveImages() > 0);
|
||||
} else {
|
||||
shadowRenderer = null;
|
||||
@@ -367,7 +367,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
ProgramSamplers.CustomTextureSamplerInterceptor customTextureSamplerInterceptor = ProgramSamplers.customTextureSamplerInterceptor(builder, customTextureManager.getCustomTextureIdMap(TextureStage.GBUFFERS_AND_SHADOW));
|
||||
|
||||
IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, flipped, renderTargets, false);
|
||||
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true, false));
|
||||
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true));
|
||||
IrisSamplers.addWorldDepthSamplers(customTextureSamplerInterceptor, renderTargets);
|
||||
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
|
||||
|
||||
@@ -395,7 +395,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
ProgramSamplers.CustomTextureSamplerInterceptor customTextureSamplerInterceptor = ProgramSamplers.customTextureSamplerInterceptor(builder, customTextureManager.getCustomTextureIdMap(TextureStage.GBUFFERS_AND_SHADOW));
|
||||
|
||||
IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, () -> flippedAfterPrepare, renderTargets, false);
|
||||
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true, false));
|
||||
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true));
|
||||
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
|
||||
|
||||
// Only initialize these samplers if the shadow map renderer exists. Otherwise, this program shouldn't be used at all?
|
||||
@@ -548,7 +548,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
}
|
||||
|
||||
if (sodiumTerrainRendering) {
|
||||
beginPass(table.match(getCondition(getPhase()), new InputAvailability(true, true, false)));
|
||||
beginPass(table.match(getCondition(getPhase()), new InputAvailability(true, true)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, flipped, renderTargets, false);
|
||||
IrisImages.addRenderTargetImages(builder, flipped, renderTargets);
|
||||
|
||||
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true, false));
|
||||
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true));
|
||||
|
||||
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class AttributeTransformer {
|
||||
// lightmap texture coordinate.
|
||||
// See https://github.com/IrisShaders/Iris/issues/1149
|
||||
if (parameters.inputs.lightmap) {
|
||||
root.rename("gl_MultiTexCoord1", "gl_MultiTexCoord2");
|
||||
root.rename("gl_MultiTexCoord2", "gl_MultiTexCoord1");
|
||||
}
|
||||
|
||||
Stream<Identifier> stream = Stream.empty();
|
||||
@@ -59,10 +59,6 @@ class AttributeTransformer {
|
||||
|
||||
patchTextureMatrices(t, tree, root, parameters.inputs.lightmap);
|
||||
|
||||
if (parameters.inputs.overlay) {
|
||||
patchOverlayColor(t, tree, root, parameters);
|
||||
}
|
||||
|
||||
if (parameters.type.glShaderType == ShaderType.VERTEX
|
||||
&& root.identifierIndex.has("gl_MultiTexCoord3")
|
||||
&& !root.identifierIndex.has("mc_midTexCoord")) {
|
||||
@@ -91,7 +87,7 @@ class AttributeTransformer {
|
||||
"const float iris_ONE_OVER_32 = iris_ONE_OVER_256 * 8;");
|
||||
if (hasLightmap) {
|
||||
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
|
||||
"mat4 iris_LightmapTextureMatrix = gl_TextureMatrix[2];");
|
||||
"mat4 iris_LightmapTextureMatrix = gl_TextureMatrix[1];");
|
||||
} else {
|
||||
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS, "mat4 iris_LightmapTextureMatrix =" +
|
||||
"mat4(iris_ONE_OVER_256, 0.0, 0.0, 0.0," +
|
||||
@@ -112,56 +108,4 @@ class AttributeTransformer {
|
||||
"mat4(1.0)" +
|
||||
");");
|
||||
}
|
||||
|
||||
private static final AutoHintedMatcher<ExternalDeclaration> uniformVec4EntityColor = new AutoHintedMatcher<>(
|
||||
"uniform vec4 entityColor;", Matcher.externalDeclarationPattern);
|
||||
|
||||
// Add entity color -> overlay color attribute support.
|
||||
private static void patchOverlayColor(
|
||||
ASTParser t,
|
||||
TranslationUnit tree,
|
||||
Root root,
|
||||
AttributeParameters parameters) {
|
||||
// delete original declaration
|
||||
root.processMatches(t, uniformVec4EntityColor, ASTNode::detachAndDelete);
|
||||
|
||||
if (parameters.type.glShaderType == ShaderType.VERTEX) {
|
||||
// add our own declarations
|
||||
// TODO: We're exposing entityColor to this stage even if it isn't declared in
|
||||
// this stage. But this is needed for the pass-through behavior.
|
||||
tree.parseAndInjectNodes(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
|
||||
"uniform sampler2D iris_overlay;",
|
||||
"varying vec4 entityColor;");
|
||||
|
||||
// this is so we can pass through the overlay color at the end to the geometry
|
||||
// or fragment stage.
|
||||
tree.prependMain(t,
|
||||
"vec4 overlayColor = texture2D(iris_overlay, (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy);",
|
||||
"entityColor = vec4(overlayColor.rgb, 1.0 - overlayColor.a);",
|
||||
// Workaround for a shader pack bug:
|
||||
// https://github.com/IrisShaders/Iris/issues/1549
|
||||
// Some shader packs incorrectly ignore the alpha value, and assume that rgb
|
||||
// will be
|
||||
// zero if there is no hit flash, we try to emulate that here
|
||||
"entityColor.rgb *= float(entityColor.a != 0.0);");
|
||||
} else if (parameters.type.glShaderType == ShaderType.GEOMETRY) {
|
||||
// replace read references to grab the color from the first vertex.
|
||||
root.replaceReferenceExpressions(t, "entityColor", "entityColor[0]");
|
||||
|
||||
// TODO: this is passthrough behavior
|
||||
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
|
||||
"out vec4 entityColorGS;");
|
||||
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
|
||||
"in vec4 entityColor[];");
|
||||
tree.prependMain(t, "entityColorGS = entityColor[0];");
|
||||
} else if (parameters.type.glShaderType == ShaderType.FRAGMENT) {
|
||||
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_DECLARATIONS,
|
||||
"varying vec4 entityColor;");
|
||||
|
||||
// Different output name to avoid a name collision in the geometry shader.
|
||||
if (parameters.hasGeometry) {
|
||||
root.rename("entityColor", "entityColorGS");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.InputAvailability;
|
||||
import net.coderbot.iris.gl.sampler.SamplerHolder;
|
||||
import net.coderbot.iris.gl.state.StateUpdateNotifiers;
|
||||
import net.coderbot.iris.pipeline.DeferredWorldRenderingPipeline;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
|
||||
import net.coderbot.iris.rendertarget.RenderTarget;
|
||||
import net.coderbot.iris.rendertarget.RenderTargets;
|
||||
@@ -18,15 +19,13 @@ import java.util.function.Supplier;
|
||||
|
||||
public class IrisSamplers {
|
||||
public static final int ALBEDO_TEXTURE_UNIT = 0;
|
||||
// TODO: Find equivalent in 1.7.10
|
||||
public static final int OVERLAY_TEXTURE_UNIT = 1;
|
||||
public static final int LIGHTMAP_TEXTURE_UNIT = 1;
|
||||
|
||||
public static final ImmutableSet<Integer> WORLD_RESERVED_TEXTURE_UNITS = ImmutableSet.of(0, 1, 2);
|
||||
public static final ImmutableSet<Integer> WORLD_RESERVED_TEXTURE_UNITS = ImmutableSet.of(0, 1);
|
||||
|
||||
// TODO: In composite programs, there shouldn't be any reserved textures.
|
||||
// We need a way to restore these texture bindings.
|
||||
public static final ImmutableSet<Integer> COMPOSITE_RESERVED_TEXTURE_UNITS = ImmutableSet.of(1, 2);
|
||||
public static final ImmutableSet<Integer> COMPOSITE_RESERVED_TEXTURE_UNITS = ImmutableSet.of(1);
|
||||
|
||||
private IrisSamplers() {
|
||||
// no construction allowed
|
||||
@@ -139,14 +138,6 @@ public class IrisSamplers {
|
||||
samplers.addDynamicSampler(whitePixel::getGlTextureId, "lightmap");
|
||||
}
|
||||
|
||||
if (availability.overlay) {
|
||||
// TODO: Overlay equivalent in 1.7.10?
|
||||
// samplers.addExternalSampler(OVERLAY_TEXTURE_UNIT, "iris_overlay");
|
||||
samplers.addDynamicSampler(whitePixel::getGlTextureId, "iris_overlay");
|
||||
} else {
|
||||
samplers.addDynamicSampler(whitePixel::getGlTextureId, "iris_overlay");
|
||||
}
|
||||
|
||||
samplers.addDynamicSampler(pipeline::getCurrentNormalTexture, StateUpdateNotifiers.normalTextureChangeNotifier, "normals");
|
||||
samplers.addDynamicSampler(pipeline::getCurrentSpecularTexture, StateUpdateNotifiers.specularTextureChangeNotifier, "specular");
|
||||
}
|
||||
@@ -158,11 +149,8 @@ public class IrisSamplers {
|
||||
}
|
||||
|
||||
public static void addCompositeSamplers(SamplerHolder samplers, RenderTargets renderTargets) {
|
||||
samplers.addDynamicSampler(renderTargets::getDepthTexture,
|
||||
"gdepthtex", "depthtex0");
|
||||
samplers.addDynamicSampler(renderTargets.getDepthTextureNoTranslucents()::getTextureId,
|
||||
"depthtex1");
|
||||
samplers.addDynamicSampler(renderTargets.getDepthTextureNoHand()::getTextureId,
|
||||
"depthtex2");
|
||||
samplers.addDynamicSampler(renderTargets::getDepthTexture, "gdepthtex", "depthtex0");
|
||||
samplers.addDynamicSampler(renderTargets.getDepthTextureNoTranslucents()::getTextureId, "depthtex1");
|
||||
samplers.addDynamicSampler(renderTargets.getDepthTextureNoHand()::getTextureId, "depthtex2");
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package net.coderbot.iris.sodium.vertex_format.entity_xhfp;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.OverlayTexture;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferView;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferWriterNio;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.formats.glyph.GlyphVertexSink;
|
||||
@@ -53,7 +52,7 @@ public class EntityVertexBufferWriterNio extends VertexBufferWriterNio implement
|
||||
|
||||
@Override
|
||||
public void writeGlyph(float x, float y, float z, int color, float u, float v, int light) {
|
||||
writeQuad(x, y, z, color, u, v, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
writeQuad(x, y, z, color, u, v, light, 0, 0);
|
||||
}
|
||||
|
||||
private void endQuad(int normal) {
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package net.coderbot.iris.sodium.vertex_format.entity_xhfp;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.lwjgl.CompatMemoryUtil;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.OverlayTexture;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferView;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferWriterUnsafe;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.formats.glyph.GlyphVertexSink;
|
||||
@@ -51,7 +50,7 @@ public class EntityVertexBufferWriterUnsafe extends VertexBufferWriterUnsafe imp
|
||||
|
||||
@Override
|
||||
public void writeGlyph(float x, float y, float z, int color, float u, float v, int light) {
|
||||
writeQuad(x, y, z, color, u, v, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
writeQuad(x, y, z, color, u, v, light, 0, 0);
|
||||
}
|
||||
|
||||
private void endQuad(int normal) {
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package net.coderbot.iris.sodium.vertex_format.entity_xhfp;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.OverlayTexture;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferView;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferWriterNio;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.formats.glyph.GlyphVertexSink;
|
||||
@@ -52,7 +51,7 @@ public class GlyphVertexBufferWriterNio extends VertexBufferWriterNio implements
|
||||
|
||||
@Override
|
||||
public void writeGlyph(float x, float y, float z, int color, float u, float v, int light) {
|
||||
writeQuad(x, y, z, color, u, v, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
writeQuad(x, y, z, color, u, v, light, 0, 0);
|
||||
}
|
||||
|
||||
private void endQuad(int normal) {
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package net.coderbot.iris.sodium.vertex_format.entity_xhfp;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.lwjgl.CompatMemoryUtil;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.OverlayTexture;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferView;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.buffer.VertexBufferWriterUnsafe;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.formats.glyph.GlyphVertexSink;
|
||||
@@ -50,7 +49,7 @@ public class GlyphVertexBufferWriterUnsafe extends VertexBufferWriterUnsafe impl
|
||||
|
||||
@Override
|
||||
public void writeGlyph(float x, float y, float z, int color, float u, float v, int light) {
|
||||
writeQuad(x, y, z, color, u, v, light, OverlayTexture.NO_OVERLAY, 0);
|
||||
writeQuad(x, y, z, color, u, v, light, 0, 0);
|
||||
}
|
||||
|
||||
private void endQuad(int normal) {
|
||||
|
||||
@@ -3,6 +3,8 @@ package net.coderbot.iris.uniforms;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.gl.state.ValueUpdateNotifier;
|
||||
|
||||
import org.joml.Vector4f;
|
||||
|
||||
public class CapturedRenderingState {
|
||||
public static final CapturedRenderingState INSTANCE = new CapturedRenderingState();
|
||||
|
||||
@@ -16,6 +18,10 @@ public class CapturedRenderingState {
|
||||
private int currentRenderedEntity = -1;
|
||||
private Runnable entityIdListener = null;
|
||||
|
||||
@Getter
|
||||
private final Vector4f currentEntityColor = new Vector4f();
|
||||
private Runnable entityColorListener = null;
|
||||
|
||||
private CapturedRenderingState() {
|
||||
}
|
||||
|
||||
@@ -39,6 +45,14 @@ public class CapturedRenderingState {
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentEntityColor(float r, float g, float b, float a) {
|
||||
this.currentEntityColor.set(r, g, b, a);
|
||||
|
||||
if (this.entityColorListener != null) {
|
||||
this.entityColorListener.run();
|
||||
}
|
||||
}
|
||||
|
||||
public ValueUpdateNotifier getEntityIdNotifier() {
|
||||
return listener -> this.entityIdListener = listener;
|
||||
}
|
||||
@@ -46,4 +60,6 @@ public class CapturedRenderingState {
|
||||
public ValueUpdateNotifier getBlockEntityIdNotifier() {
|
||||
return listener -> this.blockEntityIdListener = listener;
|
||||
}
|
||||
|
||||
public ValueUpdateNotifier getEntityColorNotifier() { return listener -> this.entityColorListener = listener; }
|
||||
}
|
||||
@@ -91,6 +91,8 @@ public final class CommonUniforms {
|
||||
|
||||
uniforms.uniform1i("renderStage", () -> GbufferPrograms.getCurrentPhase().ordinal(), StateUpdateNotifiers.phaseChangeNotifier);
|
||||
|
||||
uniforms.uniform4f("entityColor", CapturedRenderingState.INSTANCE::getCurrentEntityColor, CapturedRenderingState.INSTANCE.getEntityColorNotifier());
|
||||
|
||||
CommonUniforms.generalCommonUniforms(uniforms, updateNotifier, directives);
|
||||
}
|
||||
|
||||
@@ -115,8 +117,7 @@ public final class CommonUniforms {
|
||||
.uniform1f(PER_FRAME, "screenBrightness", () -> client.gameSettings.gammaSetting)
|
||||
// just a dummy value for shaders where entityColor isn't supplied through a vertex attribute (and thus is
|
||||
// not available) - suppresses warnings. See AttributeShaderTransformer for the actual entityColor code.
|
||||
.uniform4f(ONCE, "entityColor", Vector4f::new)
|
||||
.uniform1f(PER_TICK, "playerMood", CommonUniforms::getPlayerMood)
|
||||
.uniform1f(PER_TICK, "playerMood", CommonUniforms::getPlayerMood)
|
||||
.uniform2i(PER_FRAME, "eyeBrightness", CommonUniforms::getEyeBrightness)
|
||||
.uniform2i(PER_FRAME, "eyeBrightnessSmooth", () -> {
|
||||
final Vector2f smoothed = eyeBrightnessSmooth.get();
|
||||
|
||||
Reference in new issue
Block a user