Added walls to the room and removed the pillars in the room itself. These can still be placed in the data structure but my random generator isn't using them at the moment. The geometry is now mostly done for my purposes. The next step will be tooling to create and edit rooms manually.
I've found a simple way to create UVs for my ceiling geometry, built from Bezier triangles.
For each triangle I compute a LookAt matrix with the normal of the triangle as the view direction. For the up vector I use one edge of the triangle. The UV coordinates can then be calculated by applying this matrix to each sampled points and discarding the Z component.
let mut ps = [
self.room.surface_point(*face, 0.0, 0.0, 1.0),
self.room.surface_point(*face, 1.0, 0.0, 0.0),
self.room.surface_point(*face, 0.0, 1.0, 0.0),
];
ps.sort_by(|x, y| x.y.partial_cmp(&y.y).unwrap());
let v1 = ps[1] - ps[0];
let v2 = ps[2] - ps[0];
let n1 = v1.cross(&v2);
let lt = Matrix3::look_to_rh(n1.normalize().into(), v1.normalize().into());
UV coordinates on pillars and floor working. I've tinkered with UVs for the ceiling surfaces but have not found a solution yet. There are always discontinuities. The ceiling is created with quadratic Bezier triangles.
Trader implementation: appear regularly at the tavern selling materials for crafting.
Adventurers implementation: Have a quest and can be booked into rooms. When the embark on a quest after their stay.
Reworked items: previously I had an enum to distinguish between different items. This would become infeasible once I start adding more items. Rework to have a generic item struct.
Reworked recipes: similar to items, each recipe is now a struct. The recipe defines the ingredient requirements and a function to generate the resulting item.