mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
#1243 AppFwk : Added line width to mesh line effect
This commit is contained in:
parent
f5edd780a5
commit
61f94d90d9
@ -36,27 +36,29 @@
|
||||
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
#include "cafEffectCache.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "cvfRenderState_FF.h"
|
||||
#include "cvfTextureImage.h"
|
||||
#include "cvfTexture2D_FF.h"
|
||||
#include "cvfShaderProgramGenerator.h"
|
||||
#include "cvfShaderSourceProvider.h"
|
||||
#include "cvfUniform.h"
|
||||
#include "cvfShaderProgram.h"
|
||||
#include "cvfMatrixState.h"
|
||||
#include "cvfTexture.h"
|
||||
#include "cvfSampler.h"
|
||||
#include "cvfRenderStatePolygonOffset.h"
|
||||
#include "cvfRenderState_FF.h"
|
||||
#include "cvfRenderStateBlending.h"
|
||||
#include "cvfRenderStateCullFace.h"
|
||||
#include "cvfRenderStateTextureBindings.h"
|
||||
#include "cvfRenderStatePolygonMode.h"
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfRenderStateLine.h"
|
||||
#include "cvfRenderStatePolygonMode.h"
|
||||
#include "cvfRenderStatePolygonOffset.h"
|
||||
#include "cvfRenderStateTextureBindings.h"
|
||||
#include "cvfSampler.h"
|
||||
#include "cvfShaderProgram.h"
|
||||
#include "cvfShaderProgramGenerator.h"
|
||||
#include "cvfShaderSourceProvider.h"
|
||||
#include "cvfTexture.h"
|
||||
#include "cvfTexture2D_FF.h"
|
||||
#include "cvfTextureImage.h"
|
||||
#include "cvfUniform.h"
|
||||
|
||||
#include <QtOpenGL/QGLFormat>
|
||||
#include "cafEffectCache.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
@ -831,6 +833,15 @@ MeshEffectGenerator::MeshEffectGenerator(const cvf::Color3f& color)
|
||||
{
|
||||
m_color = color;
|
||||
m_lineStipple = false;
|
||||
m_lineWidth = cvf::UNDEFINED_FLOAT;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MeshEffectGenerator::setLineWidth(float lineWidth)
|
||||
{
|
||||
m_lineWidth = lineWidth;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -854,6 +865,11 @@ void MeshEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) con
|
||||
// TODO: Use when VizFwk is updated
|
||||
//eff->setRenderState(new cvf::RenderStateLineStipple_FF);
|
||||
}
|
||||
|
||||
if (m_lineWidth < cvf::UNDEFINED_FLOAT)
|
||||
{
|
||||
eff->setRenderState(new cvf::RenderStateLine(3.0f));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -894,6 +910,11 @@ bool MeshEffectGenerator::isEqual(const EffectGenerator* other) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_lineWidth != otherMesh->m_lineWidth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -907,6 +928,7 @@ EffectGenerator* MeshEffectGenerator::copy() const
|
||||
{
|
||||
MeshEffectGenerator* effGen = new MeshEffectGenerator(m_color);
|
||||
effGen->setLineStipple(m_lineStipple);
|
||||
effGen->setLineWidth(m_lineWidth);
|
||||
|
||||
return effGen;
|
||||
}
|
||||
|
@ -241,6 +241,7 @@ class MeshEffectGenerator : public EffectGenerator
|
||||
public:
|
||||
MeshEffectGenerator(const cvf::Color3f& color);
|
||||
void setLineStipple(bool enable) { m_lineStipple = enable; }
|
||||
void setLineWidth(float lineWidth);
|
||||
|
||||
protected:
|
||||
virtual bool isEqual(const EffectGenerator* other) const;
|
||||
@ -252,6 +253,7 @@ protected:
|
||||
private:
|
||||
cvf::Color3f m_color;
|
||||
bool m_lineStipple;
|
||||
float m_lineWidth;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user