Skip to content

Commit

Permalink
#6043: If there's a diffuse stage, link it to the editor preview shad…
Browse files Browse the repository at this point in the history
…er pass. It will inherit texture matrix calculations from the diffuse layer.
  • Loading branch information
codereader committed Aug 6, 2022
1 parent 278ad3d commit 4d93238
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions radiantcore/rendersystem/backend/OpenGLShader.cpp
Expand Up @@ -626,6 +626,17 @@ void OpenGLShader::constructEditorPreviewPassFromMaterial()
auto editorTex = _material->getEditorImage();
previewPass.texture0 = editorTex ? editorTex->getGLTexNum() : 0;

// If there's a diffuse stage's, link it to this shader pass to inherit
// settings like scale and translate
for (const auto& layer : _material->getAllLayers())
{
if (layer->getType() == IShaderLayer::DIFFUSE)
{
previewPass.stage0 = layer;
break;
}
}

previewPass.setRenderFlag(RENDER_FILL);
previewPass.setRenderFlag(RENDER_TEXTURE_2D);
previewPass.setRenderFlag(RENDER_DEPTHTEST);
Expand Down

0 comments on commit 4d93238

Please sign in to comment.