(#656) Added text effect to effect generator

This commit is contained in:
Magne Sjaastad
2015-11-17 16:26:07 +01:00
parent 4469d32a2d
commit 08c04f5052
5 changed files with 75 additions and 17 deletions

View File

@@ -36,7 +36,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivGridBoxGenerator::RivGridBoxGenerator(cvf::ShaderProgram* textShaderProgram)
RivGridBoxGenerator::RivGridBoxGenerator()
: m_gridColor(cvf::Color3f::LIGHT_GRAY),
m_gridLegendColor(cvf::Color3f::BLACK)
{
@@ -44,12 +44,6 @@ RivGridBoxGenerator::RivGridBoxGenerator(cvf::ShaderProgram* textShaderProgram)
m_scaleZ = 1.0;
m_displayModelOffset = cvf::Vec3d::ZERO;
m_textEffect = new cvf::Effect;
if (textShaderProgram)
{
m_textEffect->setShaderProgram(textShaderProgram);
}
}
//--------------------------------------------------------------------------------------------------
@@ -562,7 +556,9 @@ void RivGridBoxGenerator::createLegend(EdgeType edge, cvf::Collection<cvf::Part>
part->setDrawable(geo.p());
part->updateBoundingBox();
part->setEffect(m_textEffect.p());
caf::TextEffectGenerator textGen;
cvf::ref<cvf::Effect> eff = textGen.generateCachedEffect();
part->setEffect(eff.p());
parts->push_back(part.p());
}

View File

@@ -43,7 +43,7 @@ namespace cvf
class RivGridBoxGenerator
{
public:
RivGridBoxGenerator(cvf::ShaderProgram* textShaderProgram);
RivGridBoxGenerator();
void setScaleZ(double scaleZ);
void setDisplayModelOffset(cvf::Vec3d offset);
@@ -126,7 +126,5 @@ private:
cvf::Color3f m_gridColor;
cvf::Color3f m_gridLegendColor;
cvf::ref<cvf::Effect> m_textEffect;
};

View File

@@ -167,12 +167,7 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
// which solves the problem
setContextMenuPolicy(Qt::PreventContextMenu);
cvf::ShaderProgram* textShaderProgram = NULL;
if (format.directRendering())
{
textShaderProgram = cvfOpenGLContext()->resourceManager()->getLinkedTextShaderProgram(cvfOpenGLContext());
}
m_gridBoxGenerator = new RivGridBoxGenerator(textShaderProgram);
m_gridBoxGenerator = new RivGridBoxGenerator;
}