mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1243 AppFwk : Added line width to mesh line effect
This commit is contained in:
parent
e19373ec9d
commit
e41979563b
@ -36,27 +36,29 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "cafEffectGenerator.h"
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
|
#include "cafEffectCache.h"
|
||||||
#include "cafUtils.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 "cvfMatrixState.h"
|
||||||
#include "cvfTexture.h"
|
#include "cvfRenderState_FF.h"
|
||||||
#include "cvfSampler.h"
|
|
||||||
#include "cvfRenderStatePolygonOffset.h"
|
|
||||||
#include "cvfRenderStateBlending.h"
|
#include "cvfRenderStateBlending.h"
|
||||||
#include "cvfRenderStateCullFace.h"
|
#include "cvfRenderStateCullFace.h"
|
||||||
#include "cvfRenderStateTextureBindings.h"
|
|
||||||
#include "cvfRenderStatePolygonMode.h"
|
|
||||||
#include "cvfRenderStateDepth.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 <QtOpenGL/QGLFormat>
|
||||||
#include "cafEffectCache.h"
|
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
|
|
||||||
@ -807,6 +809,15 @@ MeshEffectGenerator::MeshEffectGenerator(const cvf::Color3f& color)
|
|||||||
{
|
{
|
||||||
m_color = color;
|
m_color = color;
|
||||||
m_lineStipple = false;
|
m_lineStipple = false;
|
||||||
|
m_lineWidth = cvf::UNDEFINED_FLOAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void MeshEffectGenerator::setLineWidth(float lineWidth)
|
||||||
|
{
|
||||||
|
m_lineWidth = lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -830,6 +841,11 @@ void MeshEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) con
|
|||||||
// TODO: Use when VizFwk is updated
|
// TODO: Use when VizFwk is updated
|
||||||
//eff->setRenderState(new cvf::RenderStateLineStipple_FF);
|
//eff->setRenderState(new cvf::RenderStateLineStipple_FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_lineWidth < cvf::UNDEFINED_FLOAT)
|
||||||
|
{
|
||||||
|
eff->setRenderState(new cvf::RenderStateLine(m_lineWidth));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -870,6 +886,11 @@ bool MeshEffectGenerator::isEqual(const EffectGenerator* other) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_lineWidth != otherMesh->m_lineWidth)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,6 +904,7 @@ EffectGenerator* MeshEffectGenerator::copy() const
|
|||||||
{
|
{
|
||||||
MeshEffectGenerator* effGen = new MeshEffectGenerator(m_color);
|
MeshEffectGenerator* effGen = new MeshEffectGenerator(m_color);
|
||||||
effGen->setLineStipple(m_lineStipple);
|
effGen->setLineStipple(m_lineStipple);
|
||||||
|
effGen->setLineWidth(m_lineWidth);
|
||||||
|
|
||||||
return effGen;
|
return effGen;
|
||||||
}
|
}
|
||||||
|
@ -239,6 +239,7 @@ class MeshEffectGenerator : public EffectGenerator
|
|||||||
public:
|
public:
|
||||||
MeshEffectGenerator(const cvf::Color3f& color);
|
MeshEffectGenerator(const cvf::Color3f& color);
|
||||||
void setLineStipple(bool enable) { m_lineStipple = enable; }
|
void setLineStipple(bool enable) { m_lineStipple = enable; }
|
||||||
|
void setLineWidth(float lineWidth);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool isEqual(const EffectGenerator* other) const;
|
virtual bool isEqual(const EffectGenerator* other) const;
|
||||||
@ -250,6 +251,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
cvf::Color3f m_color;
|
cvf::Color3f m_color;
|
||||||
bool m_lineStipple;
|
bool m_lineStipple;
|
||||||
|
float m_lineWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user