1 #ifndef RAYLIB_CPP_INCLUDE_SHADER_HPP_
2 #define RAYLIB_CPP_INCLUDE_SHADER_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
16 Shader(const ::Shader& shader) {
20 Shader(
unsigned int id,
int* locs =
nullptr) :
::Shader{id, locs} {}
22 Shader(
const std::string& vsFileName,
const std::string& fsFileName) {
23 set(::LoadShader(vsFileName.c_str(), fsFileName.c_str()));
38 static ::Shader
Load(
const std::string& vsFileName,
const std::string& fsFileName) {
39 return ::LoadShader(vsFileName.c_str(), fsFileName.c_str());
42 static ::Shader LoadFromMemory(
const std::string& vsCode,
const std::string& fsCode) {
43 return ::LoadShaderFromMemory(vsCode.c_str(), fsCode.c_str());
46 GETTERSETTER(
unsigned int, Id,
id)
47 GETTERSETTER(
int*, Locs, locs)
73 if (locs !=
nullptr) {
74 ::UnloadShader(*
this);
82 ::BeginShaderMode(*
this);
99 inline int GetLocation(
const std::string& uniformName)
const {
100 return ::GetShaderLocation(*
this, uniformName.c_str());
109 return ::GetShaderLocationAttrib(*
this, attribName.c_str());
117 inline Shader&
SetValue(
int uniformLoc,
const std::string& value,
int uniformType) {
118 ::SetShaderValue(*
this, uniformLoc, value.c_str(), uniformType);
127 inline Shader&
SetValue(
int uniformLoc,
const std::string& value,
int uniformType,
int count) {
128 ::SetShaderValueV(*
this, uniformLoc, value.c_str(), uniformType, count);
138 ::SetShaderValueMatrix(*
this, uniformLoc, mat);
148 ::SetShaderValueTexture(*
this, uniformLoc, texture);
153 inline void set(const ::Shader& shader) {
160 #endif // RAYLIB_CPP_INCLUDE_SHADER_HPP_