3D Well Log Curves (#2674): Show what the value axis direction is

This commit is contained in:
Gaute Lindkvist
2018-04-19 13:35:11 +02:00
parent 4dc9d1ba8a
commit 5d89ad3a6d
7 changed files with 126 additions and 31 deletions

View File

@@ -991,4 +991,58 @@ void TextEffectGenerator::updateForFixedFunctionRendering(cvf::Effect* effect) c
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
VectorEffectGenerator::VectorEffectGenerator()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool VectorEffectGenerator::isEqual(const EffectGenerator* other) const
{
const VectorEffectGenerator* otherSurfaceEffect = dynamic_cast<const VectorEffectGenerator*>(other);
if (otherSurfaceEffect)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
EffectGenerator* VectorEffectGenerator::copy() const
{
VectorEffectGenerator* effGen = new VectorEffectGenerator;
return effGen;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void VectorEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) const
{
cvf::ShaderProgramGenerator gen("VectorDrawerShaderProgram", cvf::ShaderSourceProvider::instance());
gen.addVertexCode(cvf::ShaderSourceRepository::vs_VectorDrawer);
gen.addFragmentCode(cvf::ShaderSourceRepository::fs_VectorDrawer);
cvf::ref<cvf::ShaderProgram> shaderProg = gen.generate();
shaderProg->disableUniformTrackingForUniform("u_transformationMatrix");
shaderProg->disableUniformTrackingForUniform("u_color");
cvf::ref<cvf::Effect> eff = effect;
eff->setShaderProgram(shaderProg.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void VectorEffectGenerator::updateForFixedFunctionRendering(cvf::Effect* effect) const {}
} // End namespace caf

View File

@@ -276,4 +276,21 @@ protected:
};
//==================================================================================================
//
// VectorEffectGenerator
//
//==================================================================================================
class VectorEffectGenerator : public EffectGenerator
{
public:
VectorEffectGenerator();
protected:
virtual bool isEqual(const EffectGenerator* other) const;
virtual EffectGenerator* copy() const;
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
};
}

View File

@@ -125,6 +125,12 @@ void DrawableVectors::setSingleColor(Color3f color)
}
void DrawableVectors::setUniformNames(String vectorMatrixUniformName, String colorUniformName)
{
m_vectorMatrixUniformName = vectorMatrixUniformName;
m_colorUniformName = colorUniformName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -63,6 +63,7 @@ public:
void setGlyph(UShortArray* triangles, Vec3fArray* vertices);
void setSingleColor(Color3f color);
void setUniformNames(String vectorMatrixUniformName, String colorUniformName);
void setVectors(Vec3fArray* vertexArray, Vec3fArray* vectorArray);
void setColors(Color3fArray* vectorColorArray);
size_t vectorCount() const;