mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Poorly done emissive texture
This commit is contained in:
@ -67,7 +67,7 @@ Shader::Shader(std::string vertexPath, std::string fragmentPath, std::string com
|
||||
const char *fragmentCode = loadFileWithIncludes(fragmentPath);
|
||||
const char *computeCode = loadFileWithIncludes(computePath);
|
||||
|
||||
// printWithLineNumbers(computeCode);
|
||||
printWithLineNumbers(computeCode);
|
||||
|
||||
_vertex = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
||||
@ -208,7 +208,7 @@ void Shader::set_mat4(const std::string &name, const glm::mat4 &value) const
|
||||
glUniformMatrix4fv(glGetUniformLocation(_program_compute, name.c_str()), 1, GL_FALSE, glm::value_ptr(value));
|
||||
}
|
||||
|
||||
void Shader::set_textures(const std::vector<GLuint> textureIDs)
|
||||
void Shader::set_textures(std::vector<GLuint> textureIDs)
|
||||
{
|
||||
for (size_t i = 0; i < textureIDs.size(); i++)
|
||||
{
|
||||
@ -220,6 +220,18 @@ void Shader::set_textures(const std::vector<GLuint> textureIDs)
|
||||
}
|
||||
}
|
||||
|
||||
void Shader::set_emission_textures(std::vector<GLuint> textureIDs)
|
||||
{
|
||||
for (size_t i = 0; i < textureIDs.size(); i++)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, textureIDs[i]);
|
||||
|
||||
std::string uniform_name = "emission_textures[" + std::to_string(i) + "]";
|
||||
glUniform1i(glGetUniformLocation(_program_compute, uniform_name.c_str()), i);
|
||||
}
|
||||
}
|
||||
|
||||
GLuint Shader::getProgram(void) const
|
||||
{
|
||||
return (_program);
|
||||
|
Reference in New Issue
Block a user