2014-08-11 03:49:42 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-24 00:14:52 -05:00
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2014-08-11 03:49:42 -05:00
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "cafEffectGenerator.h"
|
|
|
|
|
|
|
|
class RivTernaryScalarMapper;
|
|
|
|
|
|
|
|
namespace cvf
|
|
|
|
{
|
2015-10-23 08:46:25 -05:00
|
|
|
class TextureImage;
|
2014-08-11 03:49:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
//
|
|
|
|
// ScalarMapperEffectGenerator
|
|
|
|
//
|
|
|
|
//==================================================================================================
|
|
|
|
class RivTernaryScalarMapperEffectGenerator : public caf::EffectGenerator
|
|
|
|
{
|
|
|
|
public:
|
2015-10-23 08:46:25 -05:00
|
|
|
RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset);
|
2014-08-11 03:49:42 -05:00
|
|
|
|
2015-10-23 08:46:25 -05:00
|
|
|
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f, 1.0f); }
|
|
|
|
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
|
|
|
|
void setFaceCulling(caf::FaceCulling faceCulling) { m_faceCulling = faceCulling; }
|
|
|
|
void enableDepthWrite(bool enableWrite) { m_enableDepthWrite = enableWrite; }
|
2015-06-17 08:00:20 -05:00
|
|
|
void disableLighting(bool disable) { m_disableLighting = disable; }
|
2014-08-11 03:49:42 -05:00
|
|
|
|
|
|
|
|
|
|
|
public:
|
2015-10-23 08:46:25 -05:00
|
|
|
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
|
2014-08-11 03:49:42 -05:00
|
|
|
|
|
|
|
protected:
|
2015-10-23 08:46:25 -05:00
|
|
|
virtual bool isEqual(const caf::EffectGenerator* other) const;
|
|
|
|
virtual caf::EffectGenerator* copy() const;
|
2014-08-11 03:49:42 -05:00
|
|
|
|
2015-10-23 08:46:25 -05:00
|
|
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
|
|
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
2014-08-11 03:49:42 -05:00
|
|
|
|
|
|
|
private:
|
2015-10-23 08:46:25 -05:00
|
|
|
void updateCommonEffect(cvf::Effect* effect) const;
|
2014-08-11 03:49:42 -05:00
|
|
|
|
|
|
|
private:
|
2015-10-23 08:46:25 -05:00
|
|
|
cvf::cref<RivTernaryScalarMapper> m_scalarMapper;
|
|
|
|
mutable cvf::ref<cvf::TextureImage> m_textureImage;
|
|
|
|
caf::PolygonOffset m_polygonOffset;
|
|
|
|
float m_opacityLevel;
|
|
|
|
cvf::Color3f m_undefinedColor;
|
|
|
|
caf::FaceCulling m_faceCulling;
|
|
|
|
bool m_enableDepthWrite;
|
2015-06-17 08:00:20 -05:00
|
|
|
bool m_disableLighting;
|
2014-08-11 03:49:42 -05:00
|
|
|
};
|
|
|
|
|