|
| 1 | +/* |
| 2 | + * Copyright 2025 Lambda |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package com.lambda.mixin.render; |
| 19 | + |
| 20 | +import com.lambda.graphics.buffer.Buffer; |
| 21 | +import com.mojang.blaze3d.buffers.GpuBuffer; |
| 22 | +import com.mojang.blaze3d.vertex.VertexFormat; |
| 23 | +import net.minecraft.client.gl.GlGpuBuffer; |
| 24 | +import org.spongepowered.asm.mixin.Mixin; |
| 25 | +import org.spongepowered.asm.mixin.injection.At; |
| 26 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 27 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
| 28 | + |
| 29 | +import java.nio.ByteBuffer; |
| 30 | + |
| 31 | +@Mixin(VertexFormat.class) |
| 32 | +public class VertexFormatMixin { |
| 33 | + @Inject(method = "uploadImmediateVertexBuffer(Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/buffers/GpuBuffer;", at = @At("RETURN")) |
| 34 | + void interceptIndexBufferConfiguration(ByteBuffer vertexBuffer, CallbackInfoReturnable<GpuBuffer> cir) { |
| 35 | + GlGpuBuffer value = (GlGpuBuffer)cir.getReturnValue(); |
| 36 | + Buffer.lastIbo = value.id; |
| 37 | + } |
| 38 | +} |
0 commit comments