Yelbegen/src/graphics/base_drawers.zig
2025-09-11 04:24:52 +03:00

35 lines
1.5 KiB
Zig
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const std = @import("std");
const rl = @import("raylib");
const cm = @import("Cam");
const b_inp = @import("InputOps");
// Raylib döngüsünde kullanmak için çizim fonksiyonu
pub fn drawShapes(shapes : *std.ArrayList(b_inp.Shape)) void {
for (shapes.items, 0..) |shape, index| {
// Seçili nesneyi işaretle
if (b_inp.selected_shape_index) |sel_index| {
if (index == sel_index) {
// Seçili nesnenin sınırlarını çiz
switch (shape.data) {
.cube => |d| {
//const box = getBoundingBoxForCube(shape.position, d.width, d.height, d.length);
//rl.drawCubeWiresV(box.min, box.max, .yellow);
rl.drawCubeWires(shape.position, d.width + 0.5, d.height + 0.5, d.length + 0.5, .green);
},
.sphere => |d| rl.drawSphereWires(shape.position, d.radius + 0.5, 16, 16, .green),
.cylinder => |d| rl.drawCylinderWires(shape.position, d.radius + 0.5, d.radius + 0.5, d.height, 10, .green),
}
}
}
// Asıl nesneyi çiz
switch (shape.data) {
.cube => |d| rl.drawCubeV(shape.position, rl.Vector3.init(d.width, d.height, d.length), shape.color),
.sphere => |d| rl.drawSphere(shape.position, d.radius, shape.color),
.cylinder => |d| rl.drawCylinder(shape.position, d.radius, d.radius, d.height, 10, shape.color),
}
}
}