the compiler is saying no field named 'x' in struct 'tracer.Triangle' at o.x
switch (obj) {
.triangle => {
},
else => {
const x = switch (obj) { inline else => |o| o.x };
const y = switch (obj) { inline else => |o| o.y };
const z = switch (obj) { inline else => |o| o.z };
const lightVector = Vec3.normalize(vec3(f32,
x - intersection.x,
y - intersection.y,
z - intersection.z
));
const shade = Vec3.dot(lightVector, normalVector);
if (shade > 0) {
totalShade += shade;
}
}
}
However the flow of execution will only ever reach o.x if the obj union is not Triangle