mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
System : Replaced tab with four spaces in ApplicationCode and subfolders
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user