Added time variable to shader to see difference in different values

This commit is contained in:
Warwick 2022-07-18 14:36:08 +01:00
parent a0819a4e98
commit 187936bea6
2 changed files with 8 additions and 1 deletions

View file

@ -8,10 +8,16 @@ in vec3 FragPos;
// TODO: make temporary hard coded world/camera pos dynamic
uniform vec3 WorldPos ;
uniform vec3 CameraPos;
uniform int tick;
//vec3 WorldPos = vec3(0.0f, 0.0f, 0.0f);
//vec3 CameraPos = vec3(0.0f, 0.0f, -1.0f);
//TODO: make these values rely on associated textures.
vec3 albedo = vec3(0.8f, 0.8f, 0.8f);
//float metallic = sin(tick / 60 * 0.3f);
//float roughness = sin(tick / 60 * 0.3f);
//float ao = sin(tick / 60 * 0.8f);
float metallic = 0.3f;
float roughness = 0.3f;
float ao = 0.8f;

View file

@ -115,9 +115,10 @@ int main(int argc, char **argv) {
// Make every shader/rendering call from this point on use our shader
// glUseProgram(shaderProgram);
// Send our glsl shader our mvp
// Send our glsl shader our camera information
shader.setMat4("MVP", camera.getMVP());
shader.setVec3("CameraPos", camera.getCameraPosition());
shader.setInt("tick", SDL_GetTicks());
// Draw Meshes
cube.draw(shader);