Buildings
Buildings are represented by an object model and a list of transformations.
It is assumed that the transformation for each building will remain relatively static and as such all of the transformations for each building shape is stored together (see src/Building.cppm
).
The buildings are drawn using the ObjectPipe
pipelines draw_objects
function. This function takes in a model along with a list of transforms, sends the model to the GPU once and then redraws that model for each transform in the list (See src/ObjectPipe.cppm
).
From src/cos3712.cpp
Lines 204-208.
The model for each building is loaded when the building is initialized. Locations are later added by calling the function add_instance
. add_instance
takes an angle that the model will be rotated by (around the UP axis) and the location that the building will be drawn at (It is assumed that the building is near the origin of the model).
There are a total of 8 buildings that is drawn in the world.
From src/cos3712.cpp
Lines 130-143.