System : Replaced tab with four spaces in ApplicationCode and subfolders

This commit is contained in:
Magne Sjaastad
2015-10-23 15:46:25 +02:00
parent 830874bc20
commit 0405584bb6
73 changed files with 1791 additions and 1791 deletions

View File

@@ -31,14 +31,14 @@
//--------------------------------------------------------------------------------------------------
TEST(TernaryScalarMapperTest, BasicFunctions)
{
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
cvf::ref<cvf::TextureImage> texImage = new cvf::TextureImage;
scalarMapper->updateTexture(texImage.p(), 1.0);
cvf::ref<cvf::TextureImage> texImage = new cvf::TextureImage;
scalarMapper->updateTexture(texImage.p(), 1.0);
QImage img = cvfqt::Utils::toQImage(*(texImage.p()));
QImage img = cvfqt::Utils::toQImage(*(texImage.p()));
img.save("c:/tmp/test.png");
img.save("c:/tmp/test.png");
}
//--------------------------------------------------------------------------------------------------
@@ -46,58 +46,58 @@ TEST(TernaryScalarMapperTest, BasicFunctions)
//--------------------------------------------------------------------------------------------------
TEST(TernaryScalarMapperTest, TextureMapping)
{
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
// Without opacity
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, false);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
// Without opacity
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, false);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(1.0, 0.0, false);
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(1.0, 0.0, false);
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, false);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, false);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(3.0, 3.0, false);
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(3.0, 3.0, false);
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(-1.0, -1.0, false);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(-1.0, -1.0, false);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.5, 3.0, false);
EXPECT_DOUBLE_EQ(0.5, texCoord.x());
EXPECT_DOUBLE_EQ(0.25, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.5, 3.0, false);
EXPECT_DOUBLE_EQ(0.5, texCoord.x());
EXPECT_DOUBLE_EQ(0.25, texCoord.y());
}
// Opacity
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, true);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
}
// Opacity
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, true);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, true);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(1.0, texCoord.y());
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, true);
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
EXPECT_DOUBLE_EQ(1.0, texCoord.y());
}
}

View File

@@ -57,7 +57,7 @@ CellEdgeEffectGenerator::CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeSc
//--------------------------------------------------------------------------------------------------
void CellEdgeEffectGenerator::setScalarMapper(const cvf::ScalarMapper* cellScalarMapper)
{
m_cellScalarMapper = cellScalarMapper;
m_cellScalarMapper = cellScalarMapper;
}
//--------------------------------------------------------------------------------------------------
@@ -65,7 +65,7 @@ void CellEdgeEffectGenerator::setScalarMapper(const cvf::ScalarMapper* cellScala
//--------------------------------------------------------------------------------------------------
void CellEdgeEffectGenerator::setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper)
{
m_ternaryCellScalarMapper = ternaryScalarMapper;
m_ternaryCellScalarMapper = ternaryScalarMapper;
}
//--------------------------------------------------------------------------------------------------
@@ -78,8 +78,8 @@ bool CellEdgeEffectGenerator::isEqual(const EffectGenerator* other) const
if (otherCellFaceEffectGenerator
&& m_cellScalarMapper.p() == otherCellFaceEffectGenerator->m_cellScalarMapper.p()
&& m_edgeScalarMapper.p() == otherCellFaceEffectGenerator->m_edgeScalarMapper.p()
&& m_ternaryCellScalarMapper.p() == otherCellFaceEffectGenerator->m_ternaryCellScalarMapper.p()
&& m_cullBackfaces == otherCellFaceEffectGenerator->m_cullBackfaces
&& m_ternaryCellScalarMapper.p() == otherCellFaceEffectGenerator->m_ternaryCellScalarMapper.p()
&& m_cullBackfaces == otherCellFaceEffectGenerator->m_cullBackfaces
&& m_opacityLevel == otherCellFaceEffectGenerator->m_opacityLevel
&& m_undefinedColor == otherCellFaceEffectGenerator->m_undefinedColor
&& m_defaultCellColor == otherCellFaceEffectGenerator->m_defaultCellColor
@@ -114,8 +114,8 @@ bool CellEdgeEffectGenerator::isEqual(const EffectGenerator* other) const
caf::EffectGenerator* CellEdgeEffectGenerator::copy() const
{
CellEdgeEffectGenerator * newEffect = new CellEdgeEffectGenerator(m_edgeScalarMapper.p());
newEffect->setScalarMapper(m_cellScalarMapper.p());
newEffect->setTernaryScalarMapper(m_ternaryCellScalarMapper.p());
newEffect->setScalarMapper(m_cellScalarMapper.p());
newEffect->setTernaryScalarMapper(m_ternaryCellScalarMapper.p());
newEffect->m_edgeTextureImage = m_edgeTextureImage;
newEffect->m_cellTextureImage = m_cellTextureImage;
@@ -133,54 +133,54 @@ caf::EffectGenerator* CellEdgeEffectGenerator::copy() const
//--------------------------------------------------------------------------------------------------
void CellEdgeEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) const
{
cvf::ref<cvf::Effect> eff = effect;
cvf::ref<cvf::Effect> eff = effect;
// Set up shader program
// Set up shader program
cvf::ShaderProgramGenerator shaderGen("CellEdgeFaceShaderProgramGenerator", cvf::ShaderSourceProvider::instance());
{
QFile data(":/Shader/fs_CellFace.glsl");
if (data.open(QFile::ReadOnly))
{
QTextStream in(&data);
cvf::ShaderProgramGenerator shaderGen("CellEdgeFaceShaderProgramGenerator", cvf::ShaderSourceProvider::instance());
{
QFile data(":/Shader/fs_CellFace.glsl");
if (data.open(QFile::ReadOnly))
{
QTextStream in(&data);
QString data = in.readAll();
cvf::String cvfString = cvfqt::Utils::toString(data);
QString data = in.readAll();
cvf::String cvfString = cvfqt::Utils::toString(data);
shaderGen.addFragmentCode(cvfString);
}
}
shaderGen.addFragmentCode(cvfString);
}
}
if (m_ternaryCellScalarMapper.notNull())
{
{
QFile data(":/Shader/vs_2dTextureCellFace.glsl");
if (data.open(QFile::ReadOnly))
{
QTextStream in(&data);
if (m_ternaryCellScalarMapper.notNull())
{
{
QFile data(":/Shader/vs_2dTextureCellFace.glsl");
if (data.open(QFile::ReadOnly))
{
QTextStream in(&data);
QString data = in.readAll();
cvf::String cvfString = cvfqt::Utils::toString(data);
QString data = in.readAll();
cvf::String cvfString = cvfqt::Utils::toString(data);
shaderGen.addVertexCode(cvfString);
}
}
}
else
{
{
QFile data(":/Shader/vs_CellFace.glsl");
if (data.open(QFile::ReadOnly))
{
QTextStream in(&data);
shaderGen.addVertexCode(cvfString);
}
}
}
else
{
{
QFile data(":/Shader/vs_CellFace.glsl");
if (data.open(QFile::ReadOnly))
{
QTextStream in(&data);
QString data = in.readAll();
cvf::String cvfString = cvfqt::Utils::toString(data);
QString data = in.readAll();
cvf::String cvfString = cvfqt::Utils::toString(data);
shaderGen.addVertexCode(cvfString);
}
}
}
shaderGen.addVertexCode(cvfString);
}
}
}
if (m_disableLighting)
{
@@ -203,11 +203,11 @@ void CellEdgeEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect)
cvf::ref<cvf::TextureImage> modifiedCellTextImage;
m_edgeScalarMapper->updateTexture(m_edgeTextureImage.p());
if (m_ternaryCellScalarMapper.notNull())
{
m_ternaryCellScalarMapper->updateTexture(m_cellTextureImage.p(), m_opacityLevel);
modifiedCellTextImage = m_cellTextureImage;
}
if (m_ternaryCellScalarMapper.notNull())
{
m_ternaryCellScalarMapper->updateTexture(m_cellTextureImage.p(), m_opacityLevel);
modifiedCellTextImage = m_cellTextureImage;
}
else if (m_cellScalarMapper.notNull())
{
m_cellScalarMapper->updateTexture(m_cellTextureImage.p());

View File

@@ -101,10 +101,10 @@ class RivTernaryScalarMapper;
class CellEdgeEffectGenerator : public caf::EffectGenerator
{
public:
CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper);
CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper);
void setScalarMapper(const cvf::ScalarMapper* cellScalarMapper);
void setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper);
void setScalarMapper(const cvf::ScalarMapper* cellScalarMapper);
void setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper);
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
@@ -125,9 +125,9 @@ private:
cvf::cref<cvf::ScalarMapper> m_cellScalarMapper;
mutable cvf::ref<cvf::TextureImage> m_cellTextureImage;
cvf::cref<RivTernaryScalarMapper> m_ternaryCellScalarMapper;
cvf::cref<RivTernaryScalarMapper> m_ternaryCellScalarMapper;
float m_opacityLevel;
float m_opacityLevel;
caf::FaceCulling m_cullBackfaces;
cvf::Color3f m_undefinedColor;
cvf::Color3f m_defaultCellColor;

View File

@@ -42,141 +42,141 @@
///
//--------------------------------------------------------------------------------------------------
void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo,
size_t gridIndex,
float opacityLevel)
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo,
size_t gridIndex,
float opacityLevel)
{
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
CVF_ASSERT(eclipseCase != NULL);
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
CVF_ASSERT(eclipseCase != NULL);
// Create result access objects
// Create result access objects
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
size_t vertexCount = geo->vertexArray()->size();
size_t quadCount = vertexCount / 4;
size_t vertexCount = geo->vertexArray()->size();
size_t quadCount = vertexCount / 4;
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
localCoords->resize(vertexCount);
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
localCoords->resize(vertexCount);
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
faceIndexArray->resize(vertexCount);
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
faceIndexArray->resize(vertexCount);
cvf::ref<cvf::FloatArray> cellColorTextureCoordArray = new cvf::FloatArray;
cellColorTextureCoordArray->resize(vertexCount);
cvf::ref<cvf::FloatArray> cellColorTextureCoordArray = new cvf::FloatArray;
cellColorTextureCoordArray->resize(vertexCount);
// Build six cell face color arrays
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
size_t idx;
for (idx = 0; idx < 6; idx++)
{
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
colorArray->resize(vertexCount);
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
}
// Build six cell face color arrays
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
size_t idx;
for (idx = 0; idx < 6; idx++)
{
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
colorArray->resize(vertexCount);
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
}
cvf::ScalarMapper* cellResultScalarMapper = cellResultColors->legendConfig()->scalarMapper();
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
cvf::ScalarMapper* cellResultScalarMapper = cellResultColors->legendConfig()->scalarMapper();
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
const std::vector<cvf::ubyte>* isWellPipeVisible = NULL;
cvf::ref<cvf::UIntArray> gridCellToWellindexMap;
const std::vector<cvf::ubyte>* isWellPipeVisible = NULL;
cvf::ref<cvf::UIntArray> gridCellToWellindexMap;
if (opacityLevel < 1.0f)
{
isWellPipeVisible = &(cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex));
gridCellToWellindexMap = eclipseCase->gridCellToWellIndex(gridIndex);
}
if (opacityLevel < 1.0f)
{
isWellPipeVisible = &(cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex));
gridCellToWellindexMap = eclipseCase->gridCellToWellIndex(gridIndex);
}
#pragma omp parallel for
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
{
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
{
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
{
cvf::StructGridInterface::FaceType cellFace = quadToCellFaceMapper->cellFace(quadIdx);
double scalarValue = cellCenterDataAccessObject->cellFaceScalar(cellIndex, cellFace);
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
{
cvf::StructGridInterface::FaceType cellFace = quadToCellFaceMapper->cellFace(quadIdx);
double scalarValue = cellCenterDataAccessObject->cellFaceScalar(cellIndex, cellFace);
{
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
if (scalarValue != HUGE_VAL)
{
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
// If we are dealing with wellcells, the default is transparent.
// we need to make cells opaque if there are no wellpipe through them.
if (opacityLevel < 1.0f)
{
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
if (wellIndex != cvf::UNDEFINED_UINT)
{
if (!(*isWellPipeVisible)[wellIndex])
{
cellColorTextureCoord += 2.0f; // The shader must interpret values in the range 2-3 as "opaque"
}
}
}
}
else
{
cellColorTextureCoord = -1.0f; // Undefined texture coord. Shader handles this.
}
{
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
if (scalarValue != HUGE_VAL)
{
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
// If we are dealing with wellcells, the default is transparent.
// we need to make cells opaque if there are no wellpipe through them.
if (opacityLevel < 1.0f)
{
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
if (wellIndex != cvf::UNDEFINED_UINT)
{
if (!(*isWellPipeVisible)[wellIndex])
{
cellColorTextureCoord += 2.0f; // The shader must interpret values in the range 2-3 as "opaque"
}
}
}
}
else
{
cellColorTextureCoord = -1.0f; // Undefined texture coord. Shader handles this.
}
cellColorTextureCoordArray->set(quadIdx * 4 + 0, cellColorTextureCoord);
cellColorTextureCoordArray->set(quadIdx * 4 + 1, cellColorTextureCoord);
cellColorTextureCoordArray->set(quadIdx * 4 + 2, cellColorTextureCoord);
cellColorTextureCoordArray->set(quadIdx * 4 + 3, cellColorTextureCoord);
}
}
cellColorTextureCoordArray->set(quadIdx * 4 + 0, cellColorTextureCoord);
cellColorTextureCoordArray->set(quadIdx * 4 + 1, cellColorTextureCoord);
cellColorTextureCoordArray->set(quadIdx * 4 + 2, cellColorTextureCoord);
cellColorTextureCoordArray->set(quadIdx * 4 + 3, cellColorTextureCoord);
}
}
float edgeColor;
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
{
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
float edgeColor;
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
{
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
if (!hideScalarValue(scalarValue, ignoredScalarValue, 1e-2))
{
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
}
{
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
}
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
colArr->set(quadIdx * 4 + 0, edgeColor);
colArr->set(quadIdx * 4 + 1, edgeColor);
colArr->set(quadIdx * 4 + 2, edgeColor);
colArr->set(quadIdx * 4 + 3, edgeColor);
}
}
colArr->set(quadIdx * 4 + 0, edgeColor);
colArr->set(quadIdx * 4 + 1, edgeColor);
colArr->set(quadIdx * 4 + 2, edgeColor);
colArr->set(quadIdx * 4 + 3, edgeColor);
}
}
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorCell", cellColorTextureCoordArray.p()));
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorCell", cellColorTextureCoordArray.p()));
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
geo->setVertexAttribute(faceIntAttribute.p());
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
geo->setVertexAttribute(faceIntAttribute.p());
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
}
bool RivCellEdgeGeometryUtils::hideScalarValue(double scalarValue, double scalarValueToHide, double tolerance)
@@ -188,96 +188,96 @@ bool RivCellEdgeGeometryUtils::hideScalarValue(double scalarValue, double scalar
///
//--------------------------------------------------------------------------------------------------
void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
{
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
CVF_ASSERT(eclipseCase != NULL);
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
CVF_ASSERT(eclipseCase != NULL);
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
size_t vertexCount = geo->vertexArray()->size();
size_t quadCount = vertexCount / 4;
size_t vertexCount = geo->vertexArray()->size();
size_t quadCount = vertexCount / 4;
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
localCoords->resize(vertexCount);
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
localCoords->resize(vertexCount);
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
faceIndexArray->resize(vertexCount);
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
faceIndexArray->resize(vertexCount);
cvf::ref<cvf::Vec2fArray> vCellColorTextureCoordArray = new cvf::Vec2fArray;
vCellColorTextureCoordArray->resize(vertexCount);
cvf::ref<cvf::Vec2fArray> vCellColorTextureCoordArray = new cvf::Vec2fArray;
vCellColorTextureCoordArray->resize(vertexCount);
// Build six cell face color arrays
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
size_t idx;
for (idx = 0; idx < 6; idx++)
{
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
colorArray->resize(vertexCount);
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
}
// Build six cell face color arrays
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
size_t idx;
for (idx = 0; idx < 6; idx++)
{
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
colorArray->resize(vertexCount);
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
}
RivTernaryScalarMapper* ternaryCellResultScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
RivTernaryScalarMapper* ternaryCellResultScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
gridIndex,
quadToCellFaceMapper);
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
gridIndex,
quadToCellFaceMapper);
texturer.createTextureCoords(vCellColorTextureCoordArray.p());
texturer.createTextureCoords(vCellColorTextureCoordArray.p());
#pragma omp parallel for
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
{
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
{
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
float edgeColor;
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
{
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
float edgeColor;
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
{
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
if (!hideScalarValue(scalarValue, ignoredScalarValue, 1e-2))
{
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
}
{
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
}
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
colArr->set(quadIdx * 4 + 0, edgeColor);
colArr->set(quadIdx * 4 + 1, edgeColor);
colArr->set(quadIdx * 4 + 2, edgeColor);
colArr->set(quadIdx * 4 + 3, edgeColor);
}
}
colArr->set(quadIdx * 4 + 0, edgeColor);
colArr->set(quadIdx * 4 + 1, edgeColor);
colArr->set(quadIdx * 4 + 2, edgeColor);
colArr->set(quadIdx * 4 + 3, edgeColor);
}
}
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_cellTextureCoord", vCellColorTextureCoordArray.p()));
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_cellTextureCoord", vCellColorTextureCoordArray.p()));
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
geo->setVertexAttribute(faceIntAttribute.p());
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
geo->setVertexAttribute(faceIntAttribute.p());
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
}
@@ -285,28 +285,28 @@ void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t tim
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeCenterResultAccessor(
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
size_t timeStepIndex,
RigCaseData* eclipseCase,
const RigGridBase* grid)
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
size_t timeStepIndex,
RigCaseData* eclipseCase,
const RigGridBase* grid)
{
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
{
size_t resultIndices[6];
cellEdgeResultColors->gridScalarIndices(resultIndices);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
{
size_t resultIndices[6];
cellEdgeResultColors->gridScalarIndices(resultIndices);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
size_t cubeFaceIdx;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
{
// Assuming static values to be mapped onto cell edge, always using time step zero
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, 0, resultIndices[cubeFaceIdx]);
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
}
}
size_t cubeFaceIdx;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
{
// Assuming static values to be mapped onto cell edge, always using time step zero
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, 0, resultIndices[cubeFaceIdx]);
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
}
}
return cellEdgeResultAccessor;
return cellEdgeResultAccessor;
}
//--------------------------------------------------------------------------------------------------
@@ -314,26 +314,26 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeCenterResult
//--------------------------------------------------------------------------------------------------
cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellCenterResultAccessor(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, RigCaseData* eclipseCase, const RigGridBase* grid)
{
cvf::ref<RigResultAccessor> resultAccessor = NULL;
cvf::ref<RigResultAccessor> resultAccessor = NULL;
if (cellResultColors->hasResult())
{
if (!cellResultColors->hasDynamicResult())
{
// Static result values are located at time step 0
timeStepIndex = 0;
}
if (cellResultColors->hasResult())
{
if (!cellResultColors->hasDynamicResult())
{
// Static result values are located at time step 0
timeStepIndex = 0;
}
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, timeStepIndex, cellResultColors->resultVariable());
}
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, timeStepIndex, cellResultColors->resultVariable());
}
if (resultAccessor.isNull())
{
resultAccessor = new RigHugeValResultAccessor;
}
if (resultAccessor.isNull())
{
resultAccessor = new RigHugeValResultAccessor;
}
return resultAccessor;
return resultAccessor;
}

View File

@@ -24,8 +24,8 @@
namespace cvf
{
class DrawableGeo;
class StructGridQuadToCellFaceMapper;
class DrawableGeo;
class StructGridQuadToCellFaceMapper;
}
class RimCellEdgeColors;
@@ -38,36 +38,36 @@ class RigCaseData;
class RivCellEdgeGeometryUtils
{
public:
static void addCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo,
size_t gridIndex,
float opacityLevel);
static void addCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo,
size_t gridIndex,
float opacityLevel);
static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo,
size_t gridIndex,
float opacityLevel);
static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo,
size_t gridIndex,
float opacityLevel);
private:
static cvf::ref<RigResultAccessor> createCellCenterResultAccessor(
RimEclipseCellColors* cellResultColors,
size_t timeStepIndex,
RigCaseData* eclipseCase,
const RigGridBase* grid);
static cvf::ref<RigResultAccessor> createCellCenterResultAccessor(
RimEclipseCellColors* cellResultColors,
size_t timeStepIndex,
RigCaseData* eclipseCase,
const RigGridBase* grid);
static cvf::ref<RigResultAccessor> createCellEdgeCenterResultAccessor(
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
size_t timeStepIndex,
RigCaseData* eclipseCase,
const RigGridBase* grid);
static cvf::ref<RigResultAccessor> createCellEdgeCenterResultAccessor(
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
size_t timeStepIndex,
RigCaseData* eclipseCase,
const RigGridBase* grid);
static bool hideScalarValue(double scalarValue, double scalarValueToHide, double tolerance);
};

View File

@@ -50,8 +50,8 @@ public:
// Mapping between cells and geometry
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper() { return m_quadMapper.p(); }
const cvf::StuctGridTriangleToCellFaceMapper* triangleToCellFaceMapper() { return m_triangleMapper.p(); }
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper() { return m_quadMapper.p(); }
const cvf::StuctGridTriangleToCellFaceMapper* triangleToCellFaceMapper() { return m_triangleMapper.p(); }
// Generated geometry
cvf::ref<cvf::DrawableGeo> generateSurface();

View File

@@ -115,16 +115,16 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
{
if (cellResultColors->isTernarySaturationSelected())
{
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_nativeFaultGenerator->quadToCellFaceMapper());
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_nativeFaultGenerator->quadToCellFaceMapper());
texturer.createTextureCoords(m_nativeFaultFacesTextureCoords.p());
texturer.createTextureCoords(m_nativeFaultFacesTextureCoords.p());
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_nativeFaultFaces.p(), m_nativeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
}
}
else
{
RivTextureCoordsCreator texturer(cellResultColors,
@@ -132,50 +132,50 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
m_grid->gridIndex(),
m_nativeFaultGenerator->quadToCellFaceMapper());
if (!texturer.isValid())
{
return;
}
if (!texturer.isValid())
{
return;
}
texturer.createTextureCoords(m_nativeFaultFacesTextureCoords.p());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
RivScalarMapperUtils::applyTextureResultsToPart(m_nativeFaultFaces.p(), m_nativeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
}
}
if (m_oppositeFaultFaces.notNull())
{
if (cellResultColors->isTernarySaturationSelected())
{
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_oppositeFaultGenerator->quadToCellFaceMapper());
if (cellResultColors->isTernarySaturationSelected())
{
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_oppositeFaultGenerator->quadToCellFaceMapper());
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_oppositeFaultFaces.p(), m_oppositeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
}
else
{
RivTextureCoordsCreator texturer(cellResultColors,
timeStepIndex,
m_grid->gridIndex(),
m_oppositeFaultGenerator->quadToCellFaceMapper());
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_oppositeFaultFaces.p(), m_oppositeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
}
else
{
RivTextureCoordsCreator texturer(cellResultColors,
timeStepIndex,
m_grid->gridIndex(),
m_oppositeFaultGenerator->quadToCellFaceMapper());
if (!texturer.isValid())
{
return;
}
if (!texturer.isValid())
{
return;
}
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
RivScalarMapperUtils::applyTextureResultsToPart(m_oppositeFaultFaces.p(), m_oppositeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -185,30 +185,30 @@ void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipse
{
updateNNCColors(cellResultColors);
if (m_nativeFaultFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_nativeFaultFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_nativeFaultGenerator->quadToCellFaceMapper(),
m_grid->gridIndex(),
if (m_nativeFaultFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_nativeFaultFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_nativeFaultGenerator->quadToCellFaceMapper(),
m_grid->gridIndex(),
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, this->faceCullingMode(), cellResultColors->reservoirView()->isLightingDisabled());
m_nativeFaultFaces->setEffect(eff.p());
}
}
m_nativeFaultFaces->setEffect(eff.p());
}
}
if (m_oppositeFaultFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_oppositeFaultFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_oppositeFaultGenerator->quadToCellFaceMapper(), m_grid->gridIndex(),
if (m_oppositeFaultFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_oppositeFaultFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_oppositeFaultGenerator->quadToCellFaceMapper(), m_grid->gridIndex(),
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, this->faceCullingMode(), cellResultColors->reservoirView()->isLightingDisabled());
m_oppositeFaultFaces->setEffect(eff.p());
}
}
m_oppositeFaultFaces->setEffect(eff.p());
}
}
}
const int priFaultGeo = 1;

View File

@@ -230,37 +230,37 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
cvf::ref<cvf::Color3ubArray> surfaceFacesColorArray;
// Outer surface
if (m_surfaceFaces.notNull())
{
if (cellResultColors->isTernarySaturationSelected())
{
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_surfaceGenerator.quadToCellFaceMapper());
if (m_surfaceFaces.notNull())
{
if (cellResultColors->isTernarySaturationSelected())
{
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_surfaceGenerator.quadToCellFaceMapper());
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper, m_opacityLevel, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
}
else
{
RivTextureCoordsCreator texturer(cellResultColors,
timeStepIndex,
m_grid->gridIndex(),
m_surfaceGenerator.quadToCellFaceMapper());
if (!texturer.isValid())
{
return;
}
}
else
{
RivTextureCoordsCreator texturer(cellResultColors,
timeStepIndex,
m_grid->gridIndex(),
m_surfaceGenerator.quadToCellFaceMapper());
if (!texturer.isValid())
{
return;
}
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper, m_opacityLevel, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -268,17 +268,17 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
//--------------------------------------------------------------------------------------------------
void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
{
if (m_surfaceFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_surfaceGenerator.quadToCellFaceMapper(), m_grid->gridIndex(),
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
if (m_surfaceFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_surfaceGenerator.quadToCellFaceMapper(), m_grid->gridIndex(),
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
m_surfaceFaces->setEffect(eff.p());
}
}
m_surfaceFaces->setEffect(eff.p());
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -203,10 +203,10 @@ void RivReservoirPartMgr::setFaultForceVisibility(bool isGeneratedByFilter)
//--------------------------------------------------------------------------------------------------
void RivReservoirPartMgr::updateFaultCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
{
if (m_faultsPartMgr.notNull())
{
m_faultsPartMgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
}
if (m_faultsPartMgr.notNull())
{
m_faultsPartMgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
}
}

View File

@@ -67,9 +67,9 @@ public:
// Faults
void updateFaultColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
void updateFaultCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
void appendFaultPartsToModel(cvf::ModelBasicList* model);
void updateFaultCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
void appendFaultPartsToModel(cvf::ModelBasicList* model);
void appendFaultLabelPartsToModel(cvf::ModelBasicList* model);
private:

View File

@@ -800,7 +800,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(propertyFilter->resultDefinition()->porosityModel());
RigCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->reservoirData();
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStepIndex, propertyFilter->resultDefinition->resultVariable(), propertyFilter->resultDefinition->resultType());
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStepIndex, propertyFilter->resultDefinition->resultVariable(), propertyFilter->resultDefinition->resultType());
CVF_ASSERT(resultAccessor.notNull());
//#pragma omp parallel for schedule(dynamic)
@@ -867,7 +867,7 @@ void RivReservoirViewPartMgr::updateCellResultColor(RivCellSetEnum geometryType,
void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
{
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
}
//--------------------------------------------------------------------------------------------------
@@ -875,8 +875,8 @@ void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryT
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
{
RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex);
pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex);
pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -52,16 +52,16 @@ public:
void updateCellResultColor (RivCellSetEnum geometryType, size_t timeStepIndex,
RimEclipseCellColors* cellResultColors);
void updateCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
// Faults
void appendFaultsStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType);
void appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex);
void updateFaultColors(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
void updateFaultCellEdgeResultColor( RivCellSetEnum geometryType, size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
void updateFaultCellEdgeResultColor( RivCellSetEnum geometryType, size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors);
// Fault labels
RivCellSetEnum geometryTypeForFaultLabels(const std::vector<RivCellSetEnum>& geometryTypes) const;

View File

@@ -41,13 +41,13 @@
//--------------------------------------------------------------------------------------------------
void RivScalarMapperUtils::applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
{
CVF_ASSERT(part && textureCoords && mapper);
CVF_ASSERT(part && textureCoords && mapper);
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
if (dg) dg->setTextureCoordArray(textureCoords);
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
if (dg) dg->setTextureCoordArray(textureCoords);
cvf::ref<cvf::Effect> scalarEffect = RivScalarMapperUtils::createScalarMapperEffect(mapper, opacityLevel, faceCulling, disableLighting);
part->setEffect(scalarEffect.p());
cvf::ref<cvf::Effect> scalarEffect = RivScalarMapperUtils::createScalarMapperEffect(mapper, opacityLevel, faceCulling, disableLighting);
part->setEffect(scalarEffect.p());
}
//--------------------------------------------------------------------------------------------------
@@ -55,55 +55,55 @@ void RivScalarMapperUtils::applyTextureResultsToPart(cvf::Part* part, cvf::Vec2f
//--------------------------------------------------------------------------------------------------
void RivScalarMapperUtils::applyTernaryTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const RivTernaryScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
{
CVF_ASSERT(part && textureCoords && mapper);
CVF_ASSERT(part && textureCoords && mapper);
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
if (dg) dg->setTextureCoordArray(textureCoords);
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
if (dg) dg->setTextureCoordArray(textureCoords);
cvf::ref<cvf::Effect> scalarEffect = RivScalarMapperUtils::createTernaryScalarMapperEffect(mapper, opacityLevel, faceCulling, disableLighting);
part->setEffect(scalarEffect.p());
part->setEffect(scalarEffect.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGeo* dg,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
size_t gridIndex,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
float opacityLevel,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
size_t gridIndex,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
float opacityLevel,
cvf::Color3f defaultColor,
caf::FaceCulling faceCulling,
bool disableLighting)
{
CellEdgeEffectGenerator cellFaceEffectGen(cellEdgeResultColors->legendConfig()->scalarMapper());
CellEdgeEffectGenerator cellFaceEffectGen(cellEdgeResultColors->legendConfig()->scalarMapper());
if (cellResultColors->isTernarySaturationSelected())
{
RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
if (cellResultColors->isTernarySaturationSelected())
{
RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
}
else
{
RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
}
else
{
RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
cvf::ScalarMapper* cellScalarMapper = cellResultColors->legendConfig()->scalarMapper();
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
}
cvf::ScalarMapper* cellScalarMapper = cellResultColors->legendConfig()->scalarMapper();
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
}
cellFaceEffectGen.setOpacityLevel(opacityLevel);
cellFaceEffectGen.setDefaultCellColor(defaultColor);
cellFaceEffectGen.setOpacityLevel(opacityLevel);
cellFaceEffectGen.setDefaultCellColor(defaultColor);
cellFaceEffectGen.setFaceCulling(faceCulling);
cellFaceEffectGen.disableLighting(disableLighting);
cvf::ref<cvf::Effect> eff = cellFaceEffectGen.generateCachedEffect();
return eff;
return eff;
}
//--------------------------------------------------------------------------------------------------
@@ -111,17 +111,17 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGe
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Effect> RivScalarMapperUtils::createScalarMapperEffect(const cvf::ScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
{
CVF_ASSERT(mapper);
CVF_ASSERT(mapper);
caf::PolygonOffset polygonOffset = caf::PO_1;
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
scalarEffgen.setOpacityLevel(opacityLevel);
caf::PolygonOffset polygonOffset = caf::PO_1;
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
scalarEffgen.setOpacityLevel(opacityLevel);
scalarEffgen.setFaceCulling(faceCulling);
scalarEffgen.disableLighting(disableLighting);
cvf::ref<cvf::Effect> scalarEffect = scalarEffgen.generateCachedEffect();
return scalarEffect;
return scalarEffect;
}
//--------------------------------------------------------------------------------------------------
@@ -129,15 +129,15 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createScalarMapperEffect(const cvf::
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Effect> RivScalarMapperUtils::createTernaryScalarMapperEffect(const RivTernaryScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
{
CVF_ASSERT(mapper);
CVF_ASSERT(mapper);
caf::PolygonOffset polygonOffset = caf::PO_1;
RivTernaryScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
scalarEffgen.setOpacityLevel(opacityLevel);
caf::PolygonOffset polygonOffset = caf::PO_1;
RivTernaryScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
scalarEffgen.setOpacityLevel(opacityLevel);
scalarEffgen.setFaceCulling(faceCulling);
scalarEffgen.disableLighting(disableLighting);
cvf::ref<cvf::Effect> scalarEffect = scalarEffgen.generateCachedEffect();
return scalarEffect;
return scalarEffect;
}

View File

@@ -26,11 +26,11 @@
namespace cvf
{
class ScalarMapper;
class Part;
class Effect;
class StructGridQuadToCellFaceMapper;
class DrawableGeo;
class ScalarMapper;
class Part;
class Effect;
class StructGridQuadToCellFaceMapper;
class DrawableGeo;
}
class RivTernaryScalarMapper;
@@ -46,13 +46,13 @@ public:
static void applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting);
static void applyTernaryTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const RivTernaryScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting);
static cvf::ref<cvf::Effect> createCellEdgeEffect(cvf::DrawableGeo* dg,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
size_t gridIndex,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
float opacityLevel,
static cvf::ref<cvf::Effect> createCellEdgeEffect(cvf::DrawableGeo* dg,
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
size_t gridIndex,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors,
float opacityLevel,
cvf::Color3f defaultColor,
caf::FaceCulling faceCulling,
bool disableLighting);

View File

@@ -33,15 +33,15 @@
class RivTernaryResultToTextureMapper : public cvf::Object
{
public:
RivTernaryResultToTextureMapper(const RivTernaryScalarMapper* scalarMapper, const RigPipeInCellEvaluator* pipeInCellEvaluator)
RivTernaryResultToTextureMapper(const RivTernaryScalarMapper* scalarMapper, const RigPipeInCellEvaluator* pipeInCellEvaluator)
: m_scalarMapper(scalarMapper), m_pipeInCellEvaluator(pipeInCellEvaluator)
{}
cvf::Vec2f getTexCoord(double soil, double sgas, size_t cellIndex) const
{
bool isTransparent = m_pipeInCellEvaluator->isWellPipeInCell(cellIndex);
bool isTransparent = m_pipeInCellEvaluator->isWellPipeInCell(cellIndex);
return m_scalarMapper->mapToTextureCoord(soil, sgas, isTransparent);
return m_scalarMapper->mapToTextureCoord(soil, sgas, isTransparent);
}
private:

View File

@@ -26,10 +26,10 @@
///
//--------------------------------------------------------------------------------------------------
RivTernaryScalarMapper::RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor)
: m_undefScalarColor(undefScalarColor),
m_textureSize(128, 256)
: m_undefScalarColor(undefScalarColor),
m_textureSize(128, 256)
{
setTernaryRanges(0.0, 1.0, 0.0, 1.0);
setTernaryRanges(0.0, 1.0, 0.0, 1.0);
}
//--------------------------------------------------------------------------------------------------
@@ -61,12 +61,12 @@ cvf::Vec2f RivTernaryScalarMapper::mapToTextureCoord(double soil, double sgas, b
/// F *
/// * *
/// * *
/// * * Texture in this region is assigned the given opacity level
/// * * Texture in this region is assigned the given opacity level
/// * *
/// D *********** E
/// C * SGAS
/// * *
/// * * Texture in this region is opaque
/// * * Texture in this region is opaque
/// * *
/// * *
/// A *********** B
@@ -74,48 +74,48 @@ cvf::Vec2f RivTernaryScalarMapper::mapToTextureCoord(double soil, double sgas, b
//--------------------------------------------------------------------------------------------------
bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image, float opacityLevel) const
{
CVF_ASSERT(image);
image->allocate(m_textureSize.x(), m_textureSize.y());
CVF_ASSERT(image);
image->allocate(m_textureSize.x(), m_textureSize.y());
// For now fill with white so we can see any errors more easily
image->fill(cvf::Color4ub(cvf::Color3::WHITE));
// For now fill with white so we can see any errors more easily
image->fill(cvf::Color4ub(cvf::Color3::WHITE));
cvf::uint halfTextureHeight = m_textureSize.y() / 2;
// Create texture
cvf::uint halfTextureHeight = m_textureSize.y() / 2;
// Create texture
float xStride = static_cast<float>(1.0f / m_textureSize.x());
float yStride = static_cast<float>(1.0f / halfTextureHeight);
float xStride = static_cast<float>(1.0f / m_textureSize.x());
float yStride = static_cast<float>(1.0f / halfTextureHeight);
float sgas_red = 0.0f;
for (cvf::uint yPos = 0; yPos < halfTextureHeight; yPos++)
{
float soil_green = 0.0f;
for (cvf::uint xPos = 0; xPos < m_textureSize.x() - yPos; xPos++)
{
float swat_blue = 1.0f - sgas_red - soil_green;
float sgas_red = 0.0f;
for (cvf::uint yPos = 0; yPos < halfTextureHeight; yPos++)
{
float soil_green = 0.0f;
for (cvf::uint xPos = 0; xPos < m_textureSize.x() - yPos; xPos++)
{
float swat_blue = 1.0f - sgas_red - soil_green;
cvf::Color3f floatCol(sgas_red, soil_green, swat_blue);
cvf::Color3f floatCol(sgas_red, soil_green, swat_blue);
cvf::ubyte rByteCol = floatCol.rByte();
cvf::ubyte gByteCol = floatCol.gByte();
cvf::ubyte bByteCol = floatCol.bByte();
cvf::ubyte rByteCol = floatCol.rByte();
cvf::ubyte gByteCol = floatCol.gByte();
cvf::ubyte bByteCol = floatCol.bByte();
const cvf::Color4ub clr(rByteCol, gByteCol, bByteCol, 255);
image->setPixel(xPos, yPos, clr);
const cvf::Color4ub clr(rByteCol, gByteCol, bByteCol, 255);
image->setPixel(xPos, yPos, clr);
// Set opacity
const cvf::Color4ub clrOpacity(rByteCol, gByteCol, bByteCol, static_cast<cvf::ubyte>(255 * opacityLevel));
image->setPixel(xPos, yPos + halfTextureHeight, clrOpacity);
// Set opacity
const cvf::Color4ub clrOpacity(rByteCol, gByteCol, bByteCol, static_cast<cvf::ubyte>(255 * opacityLevel));
image->setPixel(xPos, yPos + halfTextureHeight, clrOpacity);
soil_green += xStride;
}
sgas_red += yStride;
}
soil_green += xStride;
}
sgas_red += yStride;
}
return true;
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -123,12 +123,12 @@ bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image, float opaci
//--------------------------------------------------------------------------------------------------
void RivTernaryScalarMapper::setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper)
{
m_rangeMinSoil = soilLower;
m_rangeMaxSoil = soilUpper;
m_soilFactor = 1.0 / (soilUpper - soilLower);
m_rangeMinSoil = soilLower;
m_rangeMaxSoil = soilUpper;
m_soilFactor = 1.0 / (soilUpper - soilLower);
m_rangeMinSgas = sgasLower;
m_rangeMaxSgas = sgasUpper;
m_sgasFactor = 1.0 / (sgasUpper - sgasLower);
m_rangeMinSgas = sgasLower;
m_rangeMaxSgas = sgasUpper;
m_sgasFactor = 1.0 / (sgasUpper - sgasLower);
}

View File

@@ -26,7 +26,7 @@
namespace cvf
{
class TextureImage;
class TextureImage;
}
//==================================================================================================
@@ -35,23 +35,23 @@ namespace cvf
class RivTernaryScalarMapper : public cvf::Object
{
public:
RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor);
RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor);
void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper);
void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper);
cvf::Vec2f mapToTextureCoord(double soil, double sgas, bool isTransparent) const;
bool updateTexture(cvf::TextureImage* image, float opacityLevel) const;
cvf::Vec2f mapToTextureCoord(double soil, double sgas, bool isTransparent) const;
bool updateTexture(cvf::TextureImage* image, float opacityLevel) const;
private:
cvf::Color3f m_undefScalarColor;
cvf::Vec2ui m_textureSize;
cvf::Color3f m_undefScalarColor;
cvf::Vec2ui m_textureSize;
double m_rangeMaxSoil;
double m_rangeMinSoil;
double m_soilFactor;
double m_rangeMaxSoil;
double m_rangeMinSoil;
double m_soilFactor;
double m_rangeMaxSgas;
double m_rangeMinSgas;
double m_sgasFactor;
double m_rangeMaxSgas;
double m_rangeMinSgas;
double m_sgasFactor;
};

View File

@@ -47,13 +47,13 @@
///
//--------------------------------------------------------------------------------------------------
RivTernaryScalarMapperEffectGenerator::RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset)
: m_undefinedColor(cvf::Color3::GRAY)
: m_undefinedColor(cvf::Color3::GRAY)
{
m_scalarMapper = scalarMapper;
m_polygonOffset = polygonOffset;
m_opacityLevel = 1.0f;
m_faceCulling = caf::FC_NONE;
m_enableDepthWrite = true;
m_scalarMapper = scalarMapper;
m_polygonOffset = polygonOffset;
m_opacityLevel = 1.0f;
m_faceCulling = caf::FC_NONE;
m_enableDepthWrite = true;
m_disableLighting = false;
}
@@ -62,11 +62,11 @@ RivTernaryScalarMapperEffectGenerator::RivTernaryScalarMapperEffectGenerator(con
//--------------------------------------------------------------------------------------------------
void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) const
{
cvf::ref<cvf::Effect> eff = effect;
cvf::ref<cvf::Effect> eff = effect;
cvf::ShaderProgramGenerator gen("ScalarMapperMeshEffectGenerator", cvf::ShaderSourceProvider::instance());
gen.addVertexCode(cvf::ShaderSourceRepository::vs_Standard);
gen.addFragmentCode(cvf::ShaderSourceRepository::src_Texture);
cvf::ShaderProgramGenerator gen("ScalarMapperMeshEffectGenerator", cvf::ShaderSourceProvider::instance());
gen.addVertexCode(cvf::ShaderSourceRepository::vs_Standard);
gen.addFragmentCode(cvf::ShaderSourceRepository::src_Texture);
if (m_disableLighting)
{
@@ -78,27 +78,27 @@ void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::E
gen.addFragmentCode(cvf::ShaderSourceRepository::fs_Standard);
}
cvf::ref<cvf::ShaderProgram> prog = gen.generate();
eff->setShaderProgram(prog.p());
cvf::ref<cvf::ShaderProgram> prog = gen.generate();
eff->setShaderProgram(prog.p());
// Result mapping texture
// Result mapping texture
m_textureImage = new cvf::TextureImage();
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
m_textureImage = new cvf::TextureImage();
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
cvf::ref<cvf::Texture> texture = new cvf::Texture(m_textureImage.p());
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
sampler->setWrapMode(cvf::Sampler::CLAMP_TO_EDGE);
sampler->setMinFilter(cvf::Sampler::NEAREST);
sampler->setMagFilter(cvf::Sampler::NEAREST);
cvf::ref<cvf::Texture> texture = new cvf::Texture(m_textureImage.p());
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
sampler->setWrapMode(cvf::Sampler::CLAMP_TO_EDGE);
sampler->setMinFilter(cvf::Sampler::NEAREST);
sampler->setMagFilter(cvf::Sampler::NEAREST);
cvf::ref<cvf::RenderStateTextureBindings> texBind = new cvf::RenderStateTextureBindings;
texBind->addBinding(texture.p(), sampler.p(), "u_texture2D");
eff->setRenderState(texBind.p());
cvf::ref<cvf::RenderStateTextureBindings> texBind = new cvf::RenderStateTextureBindings;
texBind->addBinding(texture.p(), sampler.p(), "u_texture2D");
eff->setRenderState(texBind.p());
// Hardware independent:
// Hardware independent:
updateCommonEffect(eff.p());
updateCommonEffect(eff.p());
}
//--------------------------------------------------------------------------------------------------
@@ -106,31 +106,31 @@ void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::E
//--------------------------------------------------------------------------------------------------
void RivTernaryScalarMapperEffectGenerator::updateForFixedFunctionRendering(cvf::Effect* effect) const
{
cvf::ref<cvf::Effect> eff = effect;
cvf::ref<cvf::Effect> eff = effect;
cvf::ref<cvf::RenderStateMaterial_FF> mat = new cvf::RenderStateMaterial_FF(cvf::Color3::WHITE);
eff->setRenderState(mat.p());
cvf::ref<cvf::RenderStateMaterial_FF> mat = new cvf::RenderStateMaterial_FF(cvf::Color3::WHITE);
eff->setRenderState(mat.p());
cvf::ref<cvf::RenderStateLighting_FF> lighting = new cvf::RenderStateLighting_FF;
lighting->enableTwoSided(true);
cvf::ref<cvf::RenderStateLighting_FF> lighting = new cvf::RenderStateLighting_FF;
lighting->enableTwoSided(true);
lighting->enable(!m_disableLighting);
eff->setRenderState(lighting.p());
eff->setRenderState(lighting.p());
// Result mapping texture
// Result mapping texture
m_textureImage = new cvf::TextureImage;
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
m_textureImage = new cvf::TextureImage;
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(m_textureImage.p());
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
texture->setMinFilter(cvf::Texture2D_FF::NEAREST);
texture->setMagFilter(cvf::Texture2D_FF::NEAREST);
cvf::ref<cvf::RenderStateTextureMapping_FF> texMapping = new cvf::RenderStateTextureMapping_FF(texture.p());
eff->setRenderState(texMapping.p());
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(m_textureImage.p());
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
texture->setMinFilter(cvf::Texture2D_FF::NEAREST);
texture->setMagFilter(cvf::Texture2D_FF::NEAREST);
cvf::ref<cvf::RenderStateTextureMapping_FF> texMapping = new cvf::RenderStateTextureMapping_FF(texture.p());
eff->setRenderState(texMapping.p());
// Hardware independent:
// Hardware independent:
updateCommonEffect(eff.p());
updateCommonEffect(eff.p());
}
@@ -140,48 +140,48 @@ void RivTernaryScalarMapperEffectGenerator::updateForFixedFunctionRendering(cvf:
//--------------------------------------------------------------------------------------------------
void RivTernaryScalarMapperEffectGenerator::updateCommonEffect(cvf::Effect* effect) const
{
CVF_ASSERT(effect);
CVF_ASSERT(effect);
if (m_polygonOffset != caf::PO_NONE)
{
cvf::ref<cvf::RenderStatePolygonOffset> polyOffset = EffectGenerator::createAndConfigurePolygonOffsetRenderState(m_polygonOffset);
effect->setRenderState(polyOffset.p());
}
if (m_polygonOffset != caf::PO_NONE)
{
cvf::ref<cvf::RenderStatePolygonOffset> polyOffset = EffectGenerator::createAndConfigurePolygonOffsetRenderState(m_polygonOffset);
effect->setRenderState(polyOffset.p());
}
// Simple transparency
if (m_opacityLevel < 1.0f)
{
cvf::ref<cvf::RenderStateBlending> blender = new cvf::RenderStateBlending;
blender->configureTransparencyBlending();
effect->setRenderState(blender.p());
}
// Simple transparency
if (m_opacityLevel < 1.0f)
{
cvf::ref<cvf::RenderStateBlending> blender = new cvf::RenderStateBlending;
blender->configureTransparencyBlending();
effect->setRenderState(blender.p());
}
// Backface culling
if (m_faceCulling != caf::FC_NONE)
{
cvf::ref<cvf::RenderStateCullFace> faceCulling = new cvf::RenderStateCullFace;
if (m_faceCulling == caf::FC_BACK)
{
faceCulling->setMode(cvf::RenderStateCullFace::BACK);
}
else if (m_faceCulling == caf::FC_FRONT)
{
faceCulling->setMode(cvf::RenderStateCullFace::FRONT);
}
else if (m_faceCulling == caf::FC_FRONT_AND_BACK)
{
faceCulling->setMode(cvf::RenderStateCullFace::FRONT_AND_BACK);
}
// Backface culling
if (m_faceCulling != caf::FC_NONE)
{
cvf::ref<cvf::RenderStateCullFace> faceCulling = new cvf::RenderStateCullFace;
if (m_faceCulling == caf::FC_BACK)
{
faceCulling->setMode(cvf::RenderStateCullFace::BACK);
}
else if (m_faceCulling == caf::FC_FRONT)
{
faceCulling->setMode(cvf::RenderStateCullFace::FRONT);
}
else if (m_faceCulling == caf::FC_FRONT_AND_BACK)
{
faceCulling->setMode(cvf::RenderStateCullFace::FRONT_AND_BACK);
}
effect->setRenderState(faceCulling.p());
}
effect->setRenderState(faceCulling.p());
}
if (!m_enableDepthWrite)
{
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
depth->enableDepthWrite(false);
effect->setRenderState(depth.p());
}
if (!m_enableDepthWrite)
{
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
depth->enableDepthWrite(false);
effect->setRenderState(depth.p());
}
}
@@ -190,26 +190,26 @@ void RivTernaryScalarMapperEffectGenerator::updateCommonEffect(cvf::Effect* effe
//--------------------------------------------------------------------------------------------------
bool RivTernaryScalarMapperEffectGenerator::isEqual(const EffectGenerator* other) const
{
const RivTernaryScalarMapperEffectGenerator* otherTextureResultEffect = dynamic_cast<const RivTernaryScalarMapperEffectGenerator*>(other);
const RivTernaryScalarMapperEffectGenerator* otherTextureResultEffect = dynamic_cast<const RivTernaryScalarMapperEffectGenerator*>(other);
if (otherTextureResultEffect)
{
if (m_scalarMapper.p() == otherTextureResultEffect->m_scalarMapper
&& m_polygonOffset == otherTextureResultEffect->m_polygonOffset
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
&& m_faceCulling == otherTextureResultEffect->m_faceCulling
&& m_enableDepthWrite == otherTextureResultEffect->m_enableDepthWrite
if (otherTextureResultEffect)
{
if (m_scalarMapper.p() == otherTextureResultEffect->m_scalarMapper
&& m_polygonOffset == otherTextureResultEffect->m_polygonOffset
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
&& m_faceCulling == otherTextureResultEffect->m_faceCulling
&& m_enableDepthWrite == otherTextureResultEffect->m_enableDepthWrite
&& m_disableLighting == otherTextureResultEffect->m_disableLighting)
{
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p(), m_opacityLevel);
{
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p(), m_opacityLevel);
return RivTernaryScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p());
}
}
return RivTernaryScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p());
}
}
return false;
return false;
}
//--------------------------------------------------------------------------------------------------
@@ -217,15 +217,15 @@ bool RivTernaryScalarMapperEffectGenerator::isEqual(const EffectGenerator* other
//--------------------------------------------------------------------------------------------------
caf::EffectGenerator* RivTernaryScalarMapperEffectGenerator::copy() const
{
RivTernaryScalarMapperEffectGenerator* scEffGen = new RivTernaryScalarMapperEffectGenerator(m_scalarMapper.p(), m_polygonOffset);
scEffGen->m_textureImage = m_textureImage;
scEffGen->m_opacityLevel = m_opacityLevel;
scEffGen->m_undefinedColor = m_undefinedColor;
scEffGen->m_faceCulling = m_faceCulling;
scEffGen->m_enableDepthWrite = m_enableDepthWrite;
RivTernaryScalarMapperEffectGenerator* scEffGen = new RivTernaryScalarMapperEffectGenerator(m_scalarMapper.p(), m_polygonOffset);
scEffGen->m_textureImage = m_textureImage;
scEffGen->m_opacityLevel = m_opacityLevel;
scEffGen->m_undefinedColor = m_undefinedColor;
scEffGen->m_faceCulling = m_faceCulling;
scEffGen->m_enableDepthWrite = m_enableDepthWrite;
scEffGen->m_disableLighting = m_disableLighting;
return scEffGen;
return scEffGen;
}
@@ -236,22 +236,22 @@ caf::EffectGenerator* RivTernaryScalarMapperEffectGenerator::copy() const
//--------------------------------------------------------------------------------------------------
bool RivTernaryScalarMapperEffectGenerator::isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2)
{
if (texImg1 == NULL && texImg2 == NULL) return true;
if (texImg1 == NULL && texImg2 == NULL) return true;
if (texImg1 != NULL && texImg2 != NULL
&& texImg1->height() == texImg2->height()
&& texImg1->width() == texImg2->width()
&& texImg1->width() > 0 && texImg1->height() > 0
&& texImg1->pixel(0, 0) == texImg2->pixel(0, 0)
&& texImg1->pixel(texImg1->width() - 1, texImg1->height() - 1) == texImg2->pixel(texImg1->width() - 1, texImg1->height() - 1)
&& texImg1->pixel(texImg1->width() / 2, texImg1->height() / 2) == texImg2->pixel(texImg1->width() / 2, texImg1->height() / 2)
&& texImg1->pixel(texImg1->width() / 4, texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 4, texImg1->height() / 4)
&& texImg1->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4)
)
{
return true;
}
if (texImg1 != NULL && texImg2 != NULL
&& texImg1->height() == texImg2->height()
&& texImg1->width() == texImg2->width()
&& texImg1->width() > 0 && texImg1->height() > 0
&& texImg1->pixel(0, 0) == texImg2->pixel(0, 0)
&& texImg1->pixel(texImg1->width() - 1, texImg1->height() - 1) == texImg2->pixel(texImg1->width() - 1, texImg1->height() - 1)
&& texImg1->pixel(texImg1->width() / 2, texImg1->height() / 2) == texImg2->pixel(texImg1->width() / 2, texImg1->height() / 2)
&& texImg1->pixel(texImg1->width() / 4, texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 4, texImg1->height() / 4)
&& texImg1->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4)
)
{
return true;
}
return false;
return false;
}

View File

@@ -25,7 +25,7 @@ class RivTernaryScalarMapper;
namespace cvf
{
class TextureImage;
class TextureImage;
}
//==================================================================================================
@@ -36,36 +36,36 @@ namespace cvf
class RivTernaryScalarMapperEffectGenerator : public caf::EffectGenerator
{
public:
RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset);
RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset);
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; }
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; }
void disableLighting(bool disable) { m_disableLighting = disable; }
public:
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
protected:
virtual bool isEqual(const caf::EffectGenerator* other) const;
virtual caf::EffectGenerator* copy() const;
virtual bool isEqual(const caf::EffectGenerator* other) const;
virtual caf::EffectGenerator* copy() const;
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
private:
void updateCommonEffect(cvf::Effect* effect) const;
void updateCommonEffect(cvf::Effect* effect) const;
private:
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;
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;
bool m_disableLighting;
};

View File

@@ -38,11 +38,11 @@
///
//--------------------------------------------------------------------------------------------------
RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
RimEclipseCellColors* cellResultColors,
RimTernaryLegendConfig* ternaryLegendConfig,
size_t timeStepIndex,
size_t gridIndex,
const cvf::StructGridQuadToCellFaceMapper* quadMapper)
RimEclipseCellColors* cellResultColors,
RimTernaryLegendConfig* ternaryLegendConfig,
size_t timeStepIndex,
size_t gridIndex,
const cvf::StructGridQuadToCellFaceMapper* quadMapper)
{
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
@@ -55,12 +55,12 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
cvf::ref<RigResultAccessor> soil = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL");
cvf::ref<RigResultAccessor> sgas = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SGAS");
cvf::ref<RigResultAccessor> swat = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SWAT");
m_resultAccessor = new RigTernaryResultAccessor();
m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p());
cvf::ref<RigResultAccessor> soil = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL");
cvf::ref<RigResultAccessor> sgas = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SGAS");
cvf::ref<RigResultAccessor> swat = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SWAT");
m_resultAccessor = new RigTernaryResultAccessor();
m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p());
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = new RigPipeInCellEvaluator( cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex),
eclipseCase->gridCellToWellIndex(gridIndex));
@@ -76,17 +76,17 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
//--------------------------------------------------------------------------------------------------
void RivTernaryTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCoords)
{
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTernaryTextureCoordsCreator::createTextureCoords(
cvf::Vec2fArray* quadTextureCoords,
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
const RigTernaryResultAccessor* resultAccessor,
const RivTernaryResultToTextureMapper* texMapper)
cvf::Vec2fArray* quadTextureCoords,
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
const RigTernaryResultAccessor* resultAccessor,
const RivTernaryResultToTextureMapper* texMapper)
{
CVF_ASSERT(quadTextureCoords && quadMapper && resultAccessor && texMapper);
@@ -94,7 +94,7 @@ void RivTernaryTextureCoordsCreator::createTextureCoords(
quadTextureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = quadTextureCoords->ptr();
cvf::Vec2d resultValue;
cvf::Vec2d resultValue;
cvf::Vec2f texCoord;
#pragma omp parallel for private(texCoord, resultValue)

View File

@@ -31,7 +31,7 @@ class RimTernaryLegendConfig;
namespace cvf
{
class StructGridQuadToCellFaceMapper;
class StructGridQuadToCellFaceMapper;
}
@@ -41,22 +41,22 @@ namespace cvf
class RivTernaryTextureCoordsCreator
{
public:
RivTernaryTextureCoordsCreator( RimEclipseCellColors* cellResultColors,
RimTernaryLegendConfig* ternaryLegendConfig,
size_t timeStepIndex,
size_t gridIndex,
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
RivTernaryTextureCoordsCreator( RimEclipseCellColors* cellResultColors,
RimTernaryLegendConfig* ternaryLegendConfig,
size_t timeStepIndex,
size_t gridIndex,
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
private:
static void createTextureCoords(cvf::Vec2fArray* quadTextureCoords,
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
const RigTernaryResultAccessor* resultAccessor,
const RigTernaryResultAccessor* resultAccessor,
const RivTernaryResultToTextureMapper* texMapper);
private:
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
cvf::ref<RigTernaryResultAccessor> m_resultAccessor;
cvf::ref<RigTernaryResultAccessor> m_resultAccessor;
cvf::ref<RivTernaryResultToTextureMapper> m_texMapper;
};

View File

@@ -61,12 +61,12 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul
//--------------------------------------------------------------------------------------------------
bool RivTextureCoordsCreator::isValid()
{
if (m_quadMapper.isNull() || m_resultAccessor.isNull() || m_texMapper.isNull())
{
return false;
}
if (m_quadMapper.isNull() || m_resultAccessor.isNull() || m_texMapper.isNull())
{
return false;
}
return true;
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -74,17 +74,17 @@ bool RivTextureCoordsCreator::isValid()
//--------------------------------------------------------------------------------------------------
void RivTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCoords)
{
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextureCoordsCreator::createTextureCoords(
cvf::Vec2fArray* quadTextureCoords,
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
const RigResultAccessor* resultAccessor,
const RivResultToTextureMapper* texMapper)
cvf::Vec2fArray* quadTextureCoords,
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
const RigResultAccessor* resultAccessor,
const RivResultToTextureMapper* texMapper)
{
CVF_ASSERT(quadTextureCoords && quadMapper && resultAccessor && texMapper);

View File

@@ -29,7 +29,7 @@ class RivResultToTextureMapper;
namespace cvf
{
class StructGridQuadToCellFaceMapper;
class StructGridQuadToCellFaceMapper;
}
@@ -41,7 +41,7 @@ public:
size_t gridIndex,
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
bool isValid();
bool isValid();
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
@@ -51,8 +51,8 @@ private:
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
const RigResultAccessor* resultAccessor,
const RivResultToTextureMapper* texMapper);
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
cvf::ref<RigResultAccessor> m_resultAccessor;
cvf::ref<RivResultToTextureMapper> m_texMapper;
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
cvf::ref<RigResultAccessor> m_resultAccessor;
cvf::ref<RivResultToTextureMapper> m_texMapper;
};