Fix item drops for items with textures.

Fixes the first half of #635
This commit is contained in:
IntegratedQuantum 2024-08-10 21:43:49 +02:00
parent 85ce42d023
commit d8a3df1aa4
2 changed files with 6 additions and 8 deletions

View File

@ -280,11 +280,9 @@ void mainItemDrop() {
vec4 color = decodeColor(block);
color.a = 1; // No transparency supported!
color = color*vec4(ambientLight*normalVariations[lastNormal], 1);
fragColor.rgb /= 4;
fragColor = decodeColor(block);
fragColor.a = 1; // No transparency supported!
fragColor = fragColor*vec4(ambientLight*normalVariations[lastNormal], 1);
}
void main() {

View File

@ -541,9 +541,9 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer
var z: u32 = 0;
while(z < 1) : (z += 1) {
var x: u32 = 0;
while(x < self.size[0]) : (x += 1) {
while(x < img.width) : (x += 1) {
var y: u32 = 0;
while(y < self.size[1]) : (y += 1) {
while(y < img.height) : (y += 1) {
dataSection[i] = img.getRGB(x, y).toARBG();
i += 1;
}
@ -690,7 +690,7 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer
modelMatrix = modelMatrix.mul(Mat4f.rotationZ(-rot[2]));
c.glUniformMatrix4fv(itemUniforms.modelMatrix, 1, c.GL_TRUE, @ptrCast(&modelMatrix));
if(item == .baseItem and item.baseItem.block != null) {
if(item == .baseItem and item.baseItem.block != null and item.baseItem.image.imageData.ptr == graphics.Image.defaultImage.imageData.ptr) {
const blockType = item.baseItem.block.?;
const block = blocks.Block{.typ = blockType, .data = 0};
c.glUniform1i(itemUniforms.modelIndex, block.mode().model(block));