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()));
26 Shader(
const char* vsFileName,
const char* fsFileName) {
27 set(::LoadShader(vsFileName, fsFileName));
44 static ::Shader
Load(
const std::string& vsFileName,
const std::string& fsFileName) {
45 return ::LoadShader(vsFileName.c_str(), fsFileName.c_str());
53 static ::Shader
LoadFromMemory(
const std::string& vsCode,
const std::string& fsCode) {
54 return ::LoadShaderFromMemory(vsCode.c_str(), fsCode.c_str());
57 GETTERSETTER(
unsigned int, Id,
id)
58 GETTERSETTER(
int*, Locs, locs)
86 if (locs !=
nullptr) {
87 ::UnloadShader(*
this);
95 ::BeginShaderMode(*
this);
113 return ::GetShaderLocation(*
this, uniformName.c_str());
122 return ::GetShaderLocationAttrib(*
this, attribName.c_str());
131 ::SetShaderValue(*
this, uniformLoc, value, uniformType);
140 inline Shader&
SetValue(
int uniformLoc,
const void* value,
int uniformType,
int count) {
141 ::SetShaderValueV(*
this, uniformLoc, value, uniformType, count);
151 ::SetShaderValueMatrix(*
this, uniformLoc, mat);
161 ::SetShaderValueTexture(*
this, uniformLoc, texture);
169 return id != 0 && locs !=
nullptr;
173 inline void set(const ::Shader& shader) {
180 #endif // RAYLIB_CPP_INCLUDE_SHADER_HPP_