Added extra texture bind function to shader

This commit is contained in:
Antoine Pilote
2024-07-28 10:59:30 -04:00
parent d4f783a1dc
commit d4feaa15ec
2 changed files with 10 additions and 0 deletions

View File

@@ -347,4 +347,12 @@ namespace Nuake
SetUniform1i(name, slot);
texture->Bind(slot);
}
void Shader::SetUniformTex(const std::string& name, Ref<Texture> texture, unsigned int slot)
{
//ASSERT(texture != nullptr);
SetUniform1i(name, slot);
texture->Bind(slot);
}
}

View File

@@ -6,6 +6,7 @@
#include "glm/gtc/matrix_transform.hpp"
#include "src/Core/Maths.h"
#include "src/Rendering/Textures/Texture.h"
#include "src/Core/Core.h"
namespace Nuake
{
@@ -42,6 +43,7 @@ namespace Nuake
void SetUniform1f(const std::string& name, float v0);
void SetUniform1b(const std::string& name, bool v0);
void SetUniformTex(const std::string& name, Texture* texture, unsigned int slot = 0);
void SetUniformTex(const std::string& name, Ref<Texture> texture, unsigned int slot = 0);
void SetUniform1i(const std::string& name, int v0);
void SetUniform1i(uint32_t location, int v0);