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)
75 if (locs !=
nullptr) {
76 ::UnloadShader(*
this);
84 ::BeginShaderMode(*
this);
102 return ::GetShaderLocation(*
this, uniformName.c_str());
111 return ::GetShaderLocationAttrib(*
this, attribName.c_str());
119 inline Shader&
SetValue(
int uniformLoc,
const std::string& value,
int uniformType) {
120 ::SetShaderValue(*
this, uniformLoc, value.c_str(), uniformType);
129 inline Shader&
SetValue(
int uniformLoc,
const std::string& value,
int uniformType,
int count) {
130 ::SetShaderValueV(*
this, uniformLoc, value.c_str(), uniformType, count);
140 ::SetShaderValueMatrix(*
this, uniformLoc, mat);
150 ::SetShaderValueTexture(*
this, uniformLoc, texture);
155 inline void set(const ::Shader& shader) {
162 #endif // RAYLIB_CPP_INCLUDE_SHADER_HPP_