Up until now every Structure
was rendered with a colored rectangle and some text.
I added support for rendering textures/images via OpenGL. With the image crate I am now able to load and convert images to a GPU-friendly format.
I introduced GlShapes
to hold all the different texture and quad shapes. I create a single instance of it, so there’s only ever one GPU (texture) allocation for every GlShape
/ Structure
type:
pub struct GlShapes {
pub quad: GlColorQuad,
pub furnace: GlTexQuad,
pub belt: GlTexQuad,
...
}
The GlFoo
types implement a render()
method that can then be used to render for example the Structure
s of a Blueprint
:
...
match structure {
Structure::Furnace(_) => {
self.shapes
.furnace
.render(0.5, &from_matrix4(&model), &view, &perspective)
}
Structure::Arm(_) => {
self.shapes
.arm
.render(0.5, &from_matrix4(&model), &view, &perspective)
}
...
All that was left now was to use my years of experience as software developer to create some of the most stunning and photorealistic graphics: