Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Sep 18, 2024
1 parent 81f2c3c commit ee91a8f
Show file tree
Hide file tree
Showing 83 changed files with 261 additions and 441 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#ifdef VSH
#endif

const int shadowDistance = 128; // How far away should shadows be rendered in blocks [16 32 48 64 128 256 512]
const int shadowDistanceRenderMul = 1; // [-1 0 1] Controls shadow culling modes
const float ambientOcclusionLevel = 1.0; // [0.0] Allows disabling vanilla ambient occlusion
const int shadowDistance = 128;// How far away should shadows be rendered in blocks [16 32 48 64 128 256 512]
const int shadowDistanceRenderMul = 1;// [-1 0 1] Controls shadow culling modes
const float ambientOcclusionLevel = 1.0;// [0.0] Allows disabling vanilla ambient occlusion

void main() {
// we're not really doing anything in particular
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#version 120

#define GODRAYS 32 // [16 32 64 128] Number of godrays
#define SHADOWS
#define GODRAYS 32// [16 32 64 128] Number of godrays
#define SHADOWS

#define GRASS_SHADOWS // whether tallgrass casts shadows
#define GRASS_SHADOWS// whether tallgrass casts shadows
//#define // not really a valid define
//#define GALAXIES

const int shadowDistance = 128; // How far away should shadows be rendered in blocks [16 32 48 64 128 256 512]
const int shadowDistanceRenderMul = 1; // [-1 0 1] Controls shadow culling modes
const float ambientOcclusionLevel = 1.0; // [0.0] Allows disabling vanilla ambient occlusion
const int shadowDistance = 128;// How far away should shadows be rendered in blocks [16 32 48 64 128 256 512]
const int shadowDistanceRenderMul = 1;// [-1 0 1] Controls shadow culling modes
const float ambientOcclusionLevel = 1.0;// [0.0] Allows disabling vanilla ambient occlusion

// #define volumetricLighting
//#define ANNOYING_STUFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.minecraft.client.gui.screens.Screen;

@FunctionalInterface
@SuppressWarnings("deprecation")
public interface ConfigScreenFactory<S extends Screen> {
S create(Screen parent);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

/**
* Tracks whether or not the world is being rendered, and manages grouping
Expand Down
4 changes: 1 addition & 3 deletions common/src/main/java/net/irisshaders/iris/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.mojang.blaze3d.platform.GlDebug;
import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializerRegistry;
import net.irisshaders.iris.compat.dh.DHCompat;
import net.irisshaders.iris.config.IrisConfig;
Expand All @@ -15,6 +14,7 @@
import net.irisshaders.iris.gui.debug.DebugLoadFailedGridScreen;
import net.irisshaders.iris.gui.screen.ShaderPackScreen;
import net.irisshaders.iris.helpers.OptionalBoolean;
import net.irisshaders.iris.pbr.texture.PBRTextureManager;
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
import net.irisshaders.iris.pipeline.PipelineManager;
import net.irisshaders.iris.pipeline.VanillaRenderingPipeline;
Expand All @@ -29,7 +29,6 @@
import net.irisshaders.iris.shaderpack.option.values.MutableOptionValues;
import net.irisshaders.iris.shaderpack.option.values.OptionValues;
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
import net.irisshaders.iris.pbr.texture.PBRTextureManager;
import net.irisshaders.iris.vertices.IrisVertexFormats;
import net.irisshaders.iris.vertices.sodium.EntityToTerrainVertexSerializer;
import net.irisshaders.iris.vertices.sodium.GlyphExtVertexSerializer;
Expand All @@ -46,7 +45,6 @@
import net.minecraft.network.chat.HoverEvent;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.system.Configuration;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public Optional<String> getUpdateLink() {
}
}

static class UpdateInfo {
public static class UpdateInfo {
public String semanticVersion;
public Map<String, String> updateInfo;
public String modHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.api.v0.IrisApi;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.gl.framebuffer.GlFramebuffer;
import net.irisshaders.iris.gl.texture.DepthBufferFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBox;
import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBoxGroupShading;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.api.v0.IrisApi;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.gl.blending.BlendModeOverride;
import net.irisshaders.iris.gl.blending.BufferBlendOverride;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.api.v0.IrisApi;
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
import net.irisshaders.iris.shadows.ShadowRenderer;
import net.irisshaders.iris.shadows.ShadowRenderingState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class MixinAdvancedShadowCullingFrustum extends Frustum implements IDhApi
private int worldMinYDH;
@Unique
private int worldMaxYDH;

public MixinAdvancedShadowCullingFrustum(Matrix4f matrix4f, Matrix4f matrix4f2) {
super(matrix4f, matrix4f2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer;
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.TerrainRenderPass;
import net.caffeinemc.mods.sodium.client.render.frapi.mesh.MutableQuadViewImpl;
import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package net.irisshaders.iris.compat.sodium.mixin;

import net.caffeinemc.mods.sodium.client.render.chunk.region.RenderRegion;
import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkMeshFormats;
import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType;
import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
import net.irisshaders.iris.vertices.sodium.terrain.IrisModelVertexFormats;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
import net.irisshaders.iris.vertices.sodium.terrain.IrisModelVertexFormats;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,38 @@

@Mixin(SodiumWorldRenderer.class)
public class MixinSodiumWorldRenderer {
@Unique
private static boolean renderLightsOnly = false;
@Unique
private static int beList = 0;

static {
ShadowRenderingState.setBlockEntityRenderFunction((shadowRenderer, bufferSource, modelView, camera, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum, lightsOnly) -> {
renderLightsOnly = lightsOnly;

SodiumWorldRenderer.instance().renderBlockEntities(modelView, bufferSource, ((LevelRendererAccessor) Minecraft.getInstance().levelRenderer).getDestructionProgress(), camera, tickDelta, null);

int finalBeList = beList;

beList = 0;

return finalBeList;
});
}

@Unique
private float lastSunAngle;

@Inject(method = "renderBlockEntity", at = @At("HEAD"), cancellable = true)
private static void checkRenderShadow(PoseStack matrices, RenderBuffers bufferBuilders, Long2ObjectMap<SortedSet<BlockDestructionProgress>> blockBreakingProgressions, float tickDelta, MultiBufferSource.BufferSource immediate, double x, double y, double z, BlockEntityRenderDispatcher dispatcher, BlockEntity entity, LocalPlayer player, LocalBooleanRef isGlowing, CallbackInfo ci) {
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
if (renderLightsOnly && entity.getBlockState().getLightEmission() == 0) {
ci.cancel();
}
beList++;
}
}

@Redirect(method = "setupTerrain", remap = false,
at = @At(value = "INVOKE",
target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/RenderSectionManager;needsUpdate()Z", ordinal = 0,
Expand All @@ -40,11 +69,9 @@ public class MixinSodiumWorldRenderer {
lastSunAngle = sunAngle;
return true;
}

return instance.needsUpdate();
} else {
return instance.needsUpdate();
}

return instance.needsUpdate();
}

@Redirect(method = "setupTerrain", remap = false,
Expand All @@ -59,33 +86,4 @@ public class MixinSodiumWorldRenderer {
return instance.needsUpdate();
}
}

@Unique
private static boolean renderLightsOnly = false;
@Unique
private static int beList = 0;

static {
ShadowRenderingState.setBlockEntityRenderFunction((shadowRenderer, bufferSource, modelView, camera, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum, lightsOnly) -> {
renderLightsOnly = lightsOnly;

SodiumWorldRenderer.instance().renderBlockEntities(modelView, bufferSource, ((LevelRendererAccessor) Minecraft.getInstance().levelRenderer).getDestructionProgress(), camera, tickDelta, null);

int finalBeList = beList;

beList = 0;

return finalBeList;
});
}

@Inject(method = "renderBlockEntity", at = @At("HEAD"), cancellable = true)
private static void checkRenderShadow(PoseStack matrices, RenderBuffers bufferBuilders, Long2ObjectMap<SortedSet<BlockDestructionProgress>> blockBreakingProgressions, float tickDelta, MultiBufferSource.BufferSource immediate, double x, double y, double z, BlockEntityRenderDispatcher dispatcher, BlockEntity entity, LocalPlayer player, LocalBooleanRef isGlowing, CallbackInfo ci) {
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
if (renderLightsOnly && entity.getBlockState().getLightEmission() == 0) {
ci.cancel();
}
beList++;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public int createTexture(int target) {

@Override
public int createBuffers() {
return GlStateManager._glGenBuffers();
return GlStateManager._glGenBuffers();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package net.irisshaders.iris.gl.buffer;

public record BuiltShaderStorageInfo(long size, boolean relative, float scaleX, float scaleY, byte[] content) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
public class ShaderStorageBuffer {
protected final int index;
protected final BuiltShaderStorageInfo info;
protected int id;
protected final ByteBuffer content;
protected int id;

public ShaderStorageBuffer(int index, BuiltShaderStorageInfo info) {
this.id = IrisRenderSystem.createBuffers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import java.util.Deque;

public class NavigationController {
private final Deque<String> history = new ArrayDeque<>();
private final Deque<String> history = new ArrayDeque<>();
private ShaderPackOptionList optionList;
private String currentScreen = null;

public NavigationController(OptionMenuContainer container) {
}
}

public void back() {
if (!history.isEmpty()) {
Expand Down
Loading

0 comments on commit ee91a8f

Please sign in to comment.