everything
This commit is contained in:
parent
79fa59c3aa
commit
8998bc3936
19 changed files with 855 additions and 7504 deletions
|
|
@ -42,8 +42,8 @@ public:
|
|||
fragmentCode = fragmentStream.str();
|
||||
|
||||
// Fix encoding issues, specifically for Linux
|
||||
vertexCode.erase(std::remove(vertexCode.begin(), vertexCode.end(), '\r'), vertexCode.end());
|
||||
fragmentCode.erase(std::remove(fragmentCode.begin(), fragmentCode.end(), '\r'), fragmentCode.end());
|
||||
//vertexCode.erase(std::remove(vertexCode.begin(), vertexCode.end(), '\r'), vertexCode.end());
|
||||
//fragmentCode.erase(std::remove(fragmentCode.begin(), fragmentCode.end(), '\r'), fragmentCode.end());
|
||||
}
|
||||
catch (std::ifstream::failure& e)
|
||||
{
|
||||
|
|
@ -112,6 +112,11 @@ public:
|
|||
void setVec3(const std::string &name, float x, float y, float z) const
|
||||
{
|
||||
glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void setArr(const std::string &name, const GLint value[], const int &count) const
|
||||
{
|
||||
glUniform1iv(glGetUniformLocation(ID, name.c_str()), count, value);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void setVec4(const std::string &name, const glm::vec4 &value) const
|
||||
|
|
@ -137,7 +142,21 @@ public:
|
|||
{
|
||||
glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);
|
||||
}
|
||||
|
||||
|
||||
void setDecal(int index, GLint tex, float opacity, const glm::vec4& uvCoords) const {
|
||||
std::string indexStr = std::to_string(index);
|
||||
|
||||
GLint texLoc = glGetUniformLocation(ID, ("decals[" + indexStr + "].tex").c_str());
|
||||
if (texLoc != -1) glUniform1i(texLoc, tex);
|
||||
|
||||
GLint opLoc = glGetUniformLocation(ID, ("decals[" + indexStr + "].opacity").c_str());
|
||||
if (opLoc != -1) glUniform1f(opLoc, opacity);
|
||||
|
||||
GLint uvLoc = glGetUniformLocation(ID, ("decals[" + indexStr + "].uvCoords").c_str());
|
||||
if (uvLoc != -1) {
|
||||
glUniform4fv(uvLoc, 1, &uvCoords[0]);
|
||||
}
|
||||
}
|
||||
private:
|
||||
void checkCompileErrors(unsigned int shader, std::string type)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue