Commit 96165933 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

* Introducing TFGeometry1D::createRamp() factory method

* fixed shader (de)activation in AbstractTransferFunction::bind()
parent 7d1be057
......@@ -61,9 +61,14 @@ namespace campvis {
{
tbb::mutex::scoped_lock lock(_localMutex);
if (_texture == 0 || _dirtyTexture) {
shader->deactivate();
createTexture();
shader->activate();
if (shader->isActivated()) {
shader->deactivate();
createTexture();
shader->activate();
}
else {
createTexture();
}
}
}
......
......@@ -107,6 +107,9 @@ namespace campvis {
return new TFGeometry1D(keyPoints);
}
TFGeometry1D* TFGeometry1D::crateRamp(const tgt::vec2& interval, const tgt::col4& color) {
return createQuad(interval, tgt::col4(color.xyz(), 0), tgt::col4(color.xyz(), 255));
}
TFGeometry1D* TFGeometry1D::createDivergingColorMap(const tgt::vec2& interval, const tgt::col4& leftColor, const tgt::col4& rightColor, float bias /*= 0.5f*/) {
tgtAssert(interval.x >= 0.f && interval.y <= 1.f, "Interval out of bounds, must be in [0, 1].");
......
......@@ -103,6 +103,15 @@ namespace campvis {
* \return A TFGeometry1D modelling a quad with two KeyPoints.
*/
static TFGeometry1D* createQuad(const tgt::vec2& interval, const tgt::col4& leftColor, const tgt::col4& rightColor);
/**
* Creates a ramp geometry for the given interval.
* A quad geometry consists of two KeyPoints, the left one having 0 opacity, the right one with full opacity.
* \param interval Interval the geometry resides in, must be in [0, 1].
* \param color Color for ramp
* \return A TFGeometry1D modelling a ramp with two KeyPoints.
*/
static TFGeometry1D* crateRamp(const tgt::vec2& interval, const tgt::col4& color);
/**
* Creates a diverging color map of two diverging colors blending over white.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment