Skip to content

Commit

Permalink
Implement #213. Setting a uniform int to specify if a texture is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanmunawar committed Jul 16, 2023
1 parent e8e534a commit bde9322
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions external/chai3d/src/world/CMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,17 @@ void cMesh::renderMesh(cRenderOptions& a_options)
// enable shader
m_shaderProgram->use(this, a_options);

// Set a flag if texture is available
if (m_shaderProgram->isUsed())
{
if ((m_texture != nullptr) && (m_useTextureMapping) && (a_options.m_render_materials)){
m_shaderProgram->setUniformi("uTextureEnabled", 1);
}
else{
m_shaderProgram->setUniformi("uTextureEnabled", 0);
}
}

// render normal texture if enabled
if (m_normalMap != nullptr)
{
Expand Down

0 comments on commit bde9322

Please sign in to comment.