Reset off offsets

- Fix frame uniforms reserving too much space
- Fix level uniforms reserving too little space
- Actually move flw_constantAmbientLight to level uniforms
This commit is contained in:
Jozufozu 2024-03-08 12:45:22 -08:00
parent 04e66cad59
commit 2b39b13744
4 changed files with 6 additions and 11 deletions

View File

@ -8,21 +8,17 @@ import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.api.event.RenderContext;
import com.jozufozu.flywheel.api.visualization.VisualizationManager;
import com.jozufozu.flywheel.backend.mixin.GameRendererAccessor;
import com.jozufozu.flywheel.lib.math.MatrixMath;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
public class FrameUniforms implements UniformProvider {
public static final int SIZE = 1188;
public static final int SIZE = 800;
public int debugMode;
@Nullable
@ -135,7 +131,7 @@ public class FrameUniforms implements UniformProvider {
MatrixMath.writeUnsafe(viewProjection, ptr + 64 * 6);
MatrixMath.writeUnsafe(viewProjection.invert(viewProjectionInverse), ptr + 64 * 7);
MatrixMath.writeUnsafe(viewProjectionPrev, ptr + 64 * 8);
return ptr + 64 * 15;
return ptr + 64 * 9;
}
private long writeCamera(long ptr, float camX, float camY, float camZ) {

View File

@ -5,14 +5,13 @@ import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.api.event.RenderContext;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
public class LevelUniforms implements UniformProvider {
public static final int SIZE = 12 * 4 + 2 * 16;
public static final int SIZE = 13 * 4 + 2 * 16;
@Nullable
private RenderContext context;

View File

@ -34,8 +34,6 @@ layout(std140) uniform _FlwFrameUniforms {
float flw_aspectRatio;
float flw_viewDistance;
uint flw_constantAmbientLight;
uint flw_ticks;
float flw_partialTick;

View File

@ -22,6 +22,8 @@ layout(std140) uniform _FlwLevelUniforms {
float flw_skyDarken;
uint flw_constantAmbientLight;
/** Use FLW_DIMENSION_* ids to determine the dimension. May eventually be implemented for custom dimensions. */
uint flw_dimension;
};