//
// Created by sebastian on 29.07.26.
//

#include "Uniform.h"

#include <stdexcept>
#include <glad/glad.h>
void engine::Uniform::storeUniformLocation(unsigned int programID) {
    m_location = glGetUniformLocation(programID, m_name.c_str());
    if (m_location == -1) {
        throw std::runtime_error("Uniform " + m_name + " not found!");
    }
    m_locationSet = true;
}

int engine::Uniform::getLocation() const {
    if (!m_locationSet) throw std::runtime_error("Uniform location not set!");
    return m_location;
}
