what would cause a seg fault when accessing the fields of a struct that was copied by value
f.zig:98:25: 0x1784143 in resampleLight (a)
q.ao.red = light.red;
^
f.zig:219:44: 0x1752820 in setupLights (a)
chunk.opaque_mesh.resampleLight();
pub fn resampleLight(self: *Mesh) void {
for (self.quads.items) |*q| {
const local_pos = int3.new(q.pos_and_model.x, q.pos_and_model.y, q.pos_and_model.z);
const neighbour_local = local_pos.add(int3.getFaceDirection(q.pos_and_model.face));
const light = self.parent_chunk.getLight(local_pos, neighbour_local);
q.ao.red = light.red;
q.ao.green = light.green;
q.ao.blue = light.blue;
q.ao.sunlight = light.sunlight;
}
getLight returns a struct that is copied by value. the struct is a packed u32 with bit-compressed information
There is no multi threading.