From 1b7102768fb1f7e2d0421cdf6ff6993b0a9480b6 Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Sun, 30 Mar 2025 12:13:15 +0200 Subject: [PATCH] Remove the time from itemdrop rendering. This was used for animated textures which isn't necessary anymore. --- assets/cubyz/shaders/item_drop.fs | 1 - src/itemdrop.zig | 12 +++++------- src/renderer.zig | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/assets/cubyz/shaders/item_drop.fs b/assets/cubyz/shaders/item_drop.fs index 04734b3d..dc55d66e 100644 --- a/assets/cubyz/shaders/item_drop.fs +++ b/assets/cubyz/shaders/item_drop.fs @@ -16,7 +16,6 @@ layout(location = 0) out vec4 fragColor; uniform vec3 ambientLight; uniform mat4 projectionMatrix; uniform float sizeScale; -uniform int time; uniform sampler2DArray texture_sampler; uniform sampler2DArray emissionSampler; diff --git a/src/itemdrop.zig b/src/itemdrop.zig index 67e8a154..873c6000 100644 --- a/src/itemdrop.zig +++ b/src/itemdrop.zig @@ -552,7 +552,6 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer ambientLight: c_int, modelIndex: c_int, block: c_int, - time: c_int, texture_sampler: c_int, emissionSampler: c_int, reflectivityAndAbsorptionSampler: c_int, @@ -681,14 +680,13 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer return voxelModels.findOrCreate(compareObject, ItemVoxelModel.init, null); } - fn bindCommonUniforms(projMatrix: Mat4f, viewMatrix: Mat4f, ambientLight: Vec3f, time: u32) void { + fn bindCommonUniforms(projMatrix: Mat4f, viewMatrix: Mat4f, ambientLight: Vec3f) void { itemShader.bind(); c.glUniform1i(itemUniforms.texture_sampler, 0); c.glUniform1i(itemUniforms.emissionSampler, 1); c.glUniform1i(itemUniforms.reflectivityAndAbsorptionSampler, 2); c.glUniform1i(itemUniforms.reflectionMap, 4); c.glUniform1f(itemUniforms.reflectionMapSize, main.renderer.reflectionCubeMapSize); - c.glUniform1i(itemUniforms.time, @as(u31, @truncate(time))); c.glUniformMatrix4fv(itemUniforms.projectionMatrix, 1, c.GL_TRUE, @ptrCast(&projMatrix)); c.glUniform3fv(itemUniforms.ambientLight, 1, @ptrCast(&ambientLight)); c.glUniformMatrix4fv(itemUniforms.viewMatrix, 1, c.GL_TRUE, @ptrCast(&viewMatrix)); @@ -713,10 +711,10 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer c.glDrawElements(c.GL_TRIANGLES, vertices, c.GL_UNSIGNED_INT, null); } - pub fn renderItemDrops(projMatrix: Mat4f, ambientLight: Vec3f, playerPos: Vec3d, time: u32) void { + pub fn renderItemDrops(projMatrix: Mat4f, ambientLight: Vec3f, playerPos: Vec3d) void { game.world.?.itemDrops.updateInterpolationData(); - bindCommonUniforms(projMatrix, game.camera.viewMatrix, ambientLight, time); + bindCommonUniforms(projMatrix, game.camera.viewMatrix, ambientLight); const itemDrops = &game.world.?.itemDrops.super; for(itemDrops.indices[0..itemDrops.size]) |i| { if(itemDrops.list.items(.itemStack)[i].item) |item| { @@ -763,12 +761,12 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer return result; } - pub fn renderDisplayItems(ambientLight: Vec3f, playerPos: Vec3d, time: u32) void { + pub fn renderDisplayItems(ambientLight: Vec3f, playerPos: Vec3d) void { if(!ItemDisplayManager.showItem) return; const projMatrix: Mat4f = Mat4f.perspective(std.math.degreesToRadians(65), @as(f32, @floatFromInt(main.renderer.lastWidth))/@as(f32, @floatFromInt(main.renderer.lastHeight)), 0.01, 3); const viewMatrix = Mat4f.identity(); - bindCommonUniforms(projMatrix, viewMatrix, ambientLight, time); + bindCommonUniforms(projMatrix, viewMatrix, ambientLight); const selectedItem = game.Player.inventory.getItem(game.Player.selectedSlot); if(selectedItem) |item| { diff --git a/src/renderer.zig b/src/renderer.zig index f16ce7b5..eeedcf60 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -222,7 +222,7 @@ pub fn renderWorld(world: *World, ambientLight: Vec3f, skyColor: Vec3f, playerPo gpu_performance_measuring.startQuery(.entity_rendering); entity.ClientEntityManager.render(game.projectionMatrix, ambientLight, .{1, 0.5, 0.25}, playerPos); - itemdrop.ItemDropRenderer.renderItemDrops(game.projectionMatrix, ambientLight, playerPos, time); + itemdrop.ItemDropRenderer.renderItemDrops(game.projectionMatrix, ambientLight, playerPos); gpu_performance_measuring.stopQuery(); // Render transparent chunk meshes: @@ -253,7 +253,7 @@ pub fn renderWorld(world: *World, ambientLight: Vec3f, skyColor: Vec3f, playerPo c.glBlendFunc(c.GL_SRC_ALPHA, c.GL_ONE_MINUS_SRC_ALPHA); c.glDepthRange(0, 0.001); - itemdrop.ItemDropRenderer.renderDisplayItems(ambientLight, playerPos, time); + itemdrop.ItemDropRenderer.renderDisplayItems(ambientLight, playerPos); c.glDepthRange(0.001, 1); chunk_meshing.endRender();