mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 03:25:10 +00:00
adding position in shader
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
#include "Exceptions/RayError.hpp"
|
||||
#include "Vector/Vector3.hpp"
|
||||
|
||||
namespace RAY
|
||||
{
|
||||
@@ -38,6 +39,7 @@ namespace RAY
|
||||
SetShaderValue(*this->_rayLibShader, this->_shaderIndexVars[varName], &value, SHADER_UNIFORM_FLOAT);
|
||||
}
|
||||
|
||||
|
||||
void Shader::setShaderUniformVar(const std::string &varName, int value)
|
||||
{
|
||||
if (this->_shaderIndexVars.find(varName) == this->_shaderIndexVars.end()) {
|
||||
@@ -60,4 +62,18 @@ namespace RAY
|
||||
{
|
||||
EndShaderMode();
|
||||
}
|
||||
|
||||
void Shader::setShaderUniformVar(const std::string &varName, const RAY::Vector3 &vector)
|
||||
{
|
||||
if (this->_shaderIndexVars.find(varName) == this->_shaderIndexVars.end()) {
|
||||
int varShaderIndex = GetShaderLocation(*this->_rayLibShader, varName.c_str());
|
||||
|
||||
if (varShaderIndex < 0) {
|
||||
throw Exception::WrongInputError("The loaded shader doesn't have a variable called: " + varName);
|
||||
}
|
||||
this->_shaderIndexVars[varName] = varShaderIndex;
|
||||
}
|
||||
SetShaderValue(*this->_rayLibShader, this->_shaderIndexVars[varName], &vector, SHADER_UNIFORM_VEC3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <map>
|
||||
#include <raylib.h>
|
||||
#include "Utils/Cache.hpp"
|
||||
#include "Vector/Vector3.hpp"
|
||||
|
||||
namespace RAY
|
||||
{
|
||||
@@ -46,6 +47,8 @@ namespace RAY
|
||||
//! @note Throw if the var is not found
|
||||
void setShaderUniformVar(const std::string &varName, int value);
|
||||
|
||||
void setShaderUniformVar(const std::string &varName, const RAY::Vector3 &vector);
|
||||
|
||||
void setLocation(::ShaderLocationIndex, const std::string &name);
|
||||
|
||||
//! @brief ctor if no vertexfile in needed set it to nullptr
|
||||
|
||||
Reference in New Issue
Block a user