Renderer
This is a WIP project - Expect breaking changes to occur.
Overview
Handles rendering of GameObject instances using OpenGL.
Each call to #renderMesh binds the object’s VAO, activates the shader,
uploads all required uniforms (model view, projection matrices, plus Phong lighting parameters),
issues a draw call, then cleans up state.
Renderer(...)
public Renderer(Shader shader) {}Constructor for the Renderer that uses the given shader for all draw calls.
renderMesh(...)
public void renderMesh(GameObject object,
Matrix4f view, Matrix4f projection,
TextureAtlas atlas, boolean useTexture) {}Renders a single GameObject using the provided view and projection matrices.
Uploads the following uniforms each frame:
model- Object transform (position x rotation x scale)view- Camera view matrixprojection- Perspective projection matrixlightPos- World-space position of the point lightlightColor- RGB color/intensity of the point lightviewPos- World-space camera position for specular lighting calculationsatlas- Texture sampler bound to unit 0useTexture- Whether to sample from the texture atlas or use a vertex color
Last updated on