mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 19:50:23 -04:00
Scale the item drops to 0.25
This commit is contained in:
parent
3abe7e4950
commit
f0f64e369c
@ -675,11 +675,12 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer
|
||||
Vec3f{light >> 16 & 255, light >> 8 & 255, light & 255}/@as(Vec3f, @splat(255))
|
||||
)));
|
||||
pos -= playerPos;
|
||||
var modelMatrix = Mat4f.translation(@floatCast(pos + Vec3d{0.5, 0.5, 0.5}));
|
||||
var modelMatrix = Mat4f.translation(@floatCast(pos));
|
||||
modelMatrix = modelMatrix.mul(Mat4f.rotationX(-rot[0]));
|
||||
modelMatrix = modelMatrix.mul(Mat4f.rotationY(-rot[1]));
|
||||
modelMatrix = modelMatrix.mul(Mat4f.rotationZ(-rot[2]));
|
||||
modelMatrix = modelMatrix.mul(Mat4f.translation(.{-0.5, -0.5, -0.5}));
|
||||
modelMatrix = modelMatrix.mul(Mat4f.scale(@splat(0.25)));
|
||||
modelMatrix = modelMatrix.mul(Mat4f.translation(@splat(-0.5)));
|
||||
c.glUniformMatrix4fv(itemUniforms.modelMatrix, 1, c.GL_TRUE, @ptrCast(&modelMatrix));
|
||||
|
||||
const model = getModel(item);
|
||||
|
11
src/vec.zig
11
src/vec.zig
@ -104,6 +104,17 @@ pub const Mat4f = struct { // MARK: Mat4f
|
||||
};
|
||||
}
|
||||
|
||||
pub fn scale(vector: Vec3f) Mat4f {
|
||||
return Mat4f {
|
||||
.rows = [4]Vec4f {
|
||||
Vec4f{vector[0], 0, 0, 0},
|
||||
Vec4f{0, vector[1], 0, 0},
|
||||
Vec4f{0, 0, vector[2], 0},
|
||||
Vec4f{0, 0, 0, 1},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn rotationX(rad: f32) Mat4f {
|
||||
const s = @sin(rad);
|
||||
const c = @cos(rad);
|
||||
|
Loading…
x
Reference in New Issue
Block a user