inlined robot init

This commit is contained in:
2026-03-28 23:12:50 +01:00
parent 4375062980
commit 40dc03ff58

View File

@@ -96,7 +96,36 @@ pub fn main() !void {
const floor = initFloor(floor_texture); const floor = initFloor(floor_texture);
defer floor.delete(); defer floor.delete();
var robot = try initRobot(allocator, robot_texture); var shape = Shape.initCube();
defer shape.deinit();
shape.unweld();
shape.computeNormals();
shape.translate(-0.5, -1, -0.5);
var chest = shape.clone();
defer chest.deinit();
chest.scale(0.3, 0.4, 0.15);
var model_data = Tree(Model.JointData).init(.{
.mesh = Mesh.initShape(chest, robot_texture, .triangles),
.translation = zm.translation(0, 0.425 + 0.4, 0),
.rotation = zm.qidentity(),
});
var head = shape.clone();
defer head.deinit();
head.scale(0.1, 0.1, 0.1);
try model_data.root.append(allocator, .{
.mesh = Mesh.initShape(head, robot_texture, .triangles),
.translation = zm.translation(0, 0.425 + 0.4 + 0.1, 0),
.rotation = zm.qidentity(),
});
var robot = Model.init(model_data);
// var robot = try initRobot(allocator, robot_texture);
defer robot.deinit(allocator); defer robot.deinit(allocator);
// uniform data // uniform data