Shader
SafiEngine::Shader compiles and manages GLSL shader programs with automatic uniform location caching.
Header: Core/include/Core/Shader.h
Methods
LoadFromFile
Reads vertex and fragment shader source from files, then compiles and links them into a program.
Returns true on success, false on failure (logs errors via Log::Error).
Load
Compiles a vertex and fragment shader from source strings, links them into a program.
Returns true on success, false on failure (logs compile/link errors).
Use
Activates the shader program for subsequent draw calls.
Uniform Setters
Set uniform values on the shader program by name. The shader must be active (via Use()) before calling these. All setters check that the program is valid and skip silently if the uniform name is not found (returns -1).
Uniform locations are cached in an std::unordered_map — repeated calls with the same name avoid the glGetUniformLocation string lookup.
GetID
Returns the OpenGL program ID.
Default Shader Uniforms
The engine's built-in default shader uses these uniforms:
Vertex Shader
Fragment Shader
If no lights are present, the shader uses a fallback directional fill light with ambient lighting.