//
// Created by sebastian on 08.02.26.
//

#include "TerrainShader.h"

TerrainShader::TerrainShader(): ShaderProgram(VERTEX_FILE, FRAGMENT_FILE) {
    TerrainShader::bindAttributes();
    TerrainShader::getAllUniformLocations();
}

void TerrainShader::loadTransformationMatrix(glm::mat4 matrix) {
    loadMatrix(location_transformationMatrix, matrix);
}

void TerrainShader::loadProjectionMatrix(glm::mat4 matrix) {
    loadMatrix(location_projectionMatrix, matrix);
}

void TerrainShader::loadViewMatrix(glm::mat4 matrix) {
    loadMatrix(location_viewMatrix, matrix);
}

void TerrainShader::loadLight(glm::vec3 position, glm::vec3 color) {
    loadVector(location_lightPosition, position);
    loadVector(location_lightColor, color);
}

void TerrainShader::loadIsHighlighted(bool isHighlighted) {
    loadBoolean(location_isHighlighted, isHighlighted);
}


void TerrainShader::bindAttributes() const {
    bindAttribute(0, "position");
    bindAttribute(1, "textureCoords");
    bindAttribute(2, "normal");
}

void TerrainShader::getAllUniformLocations() {
    location_transformationMatrix = getUniformLocation("transformationMatrix");
    location_projectionMatrix = getUniformLocation("projectionMatrix");
    location_viewMatrix = getUniformLocation("viewMatrix");
    location_lightPosition = getUniformLocation("lightPosition");
    location_lightColor = getUniformLocation("lightColor");

    location_isHighlighted = getUniformLocation("isHighlighted");
}


