mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Faults: Face culling handles flipaxis
This commit is contained in:
parent
a20e08237b
commit
b7f305b142
@ -150,7 +150,7 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
|
|||||||
{
|
{
|
||||||
double * point = mainGrid->nodes()[nodeStartIndex + localCellIdx * 8 + cellMappingECLRi[cIdx]].ptr();
|
double * point = mainGrid->nodes()[nodeStartIndex + localCellIdx * 8 + cellMappingECLRi[cIdx]].ptr();
|
||||||
ecl_grid_get_corner_xyz1(localEclGrid, localCellIdx, cIdx, &(point[0]), &(point[1]), &(point[2]));
|
ecl_grid_get_corner_xyz1(localEclGrid, localCellIdx, cIdx, &(point[0]), &(point[1]), &(point[2]));
|
||||||
point[2] = -point[2];
|
point[2] = -point[2]; // Flipping Z making depth become negative z values
|
||||||
cell.cornerIndices()[cIdx] = nodeStartIndex + localCellIdx*8 + cIdx;
|
cell.cornerIndices()[cIdx] = nodeStartIndex + localCellIdx*8 + cIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,18 +372,9 @@ void RivFaultPartMgr::updatePartEffect()
|
|||||||
|
|
||||||
// Set default effect
|
// Set default effect
|
||||||
caf::SurfaceEffectGenerator geometryEffgen(partColor, caf::PO_1);
|
caf::SurfaceEffectGenerator geometryEffgen(partColor, caf::PO_1);
|
||||||
bool isShowingGrid = m_rimFaultCollection->isGridVisualizationMode();
|
|
||||||
if (!isShowingGrid )
|
geometryEffgen.setCullBackfaces(faceCullingMode());
|
||||||
{
|
|
||||||
if (m_rimFaultCollection->faultFaceCulling() == RimFaultCollection::FAULT_BACK_FACE_CULLING)
|
|
||||||
{
|
|
||||||
geometryEffgen.setCullBackfaces(caf::FC_FRONT); // Because the cells are inverted
|
|
||||||
}
|
|
||||||
else if (m_rimFaultCollection->faultFaceCulling() == RimFaultCollection::FAULT_FRONT_FACE_CULLING)
|
|
||||||
{
|
|
||||||
geometryEffgen.setCullBackfaces(caf::FC_BACK); // Because the cells are inverted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
|
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
|
||||||
|
|
||||||
if (m_nativeFaultFaces.notNull())
|
if (m_nativeFaultFaces.notNull())
|
||||||
@ -640,19 +631,8 @@ cvf::ref<cvf::Effect> RivFaultPartMgr::cellResultEffect(const cvf::ScalarMapper*
|
|||||||
|
|
||||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||||
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
||||||
|
|
||||||
bool isShowingGrid = m_rimFaultCollection->isGridVisualizationMode();
|
scalarEffgen.setCullBackfaces(faceCullingMode());
|
||||||
if (!isShowingGrid )
|
|
||||||
{
|
|
||||||
if (m_rimFaultCollection->faultFaceCulling() == RimFaultCollection::FAULT_BACK_FACE_CULLING)
|
|
||||||
{
|
|
||||||
scalarEffgen.setCullBackfaces(caf::FC_FRONT);// Because the cells are inverted
|
|
||||||
}
|
|
||||||
else if (m_rimFaultCollection->faultFaceCulling() == RimFaultCollection::FAULT_FRONT_FACE_CULLING)
|
|
||||||
{
|
|
||||||
scalarEffgen.setCullBackfaces(caf::FC_BACK);// Because the cells are inverted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scalarEffgen.setOpacityLevel(m_opacityLevel);
|
scalarEffgen.setOpacityLevel(m_opacityLevel);
|
||||||
|
|
||||||
@ -661,3 +641,33 @@ cvf::ref<cvf::Effect> RivFaultPartMgr::cellResultEffect(const cvf::ScalarMapper*
|
|||||||
return scalarEffect;
|
return scalarEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caf::FaceCulling RivFaultPartMgr::faceCullingMode() const
|
||||||
|
{
|
||||||
|
bool isShowingGrid = m_rimFaultCollection->isGridVisualizationMode();
|
||||||
|
if (!isShowingGrid )
|
||||||
|
{
|
||||||
|
if (m_rimFaultCollection->faultFaceCulling() == RimFaultCollection::FAULT_BACK_FACE_CULLING)
|
||||||
|
{
|
||||||
|
if (m_grid->mainGrid()->faceNormalsIsOutwards())
|
||||||
|
{
|
||||||
|
return caf::FC_BACK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return caf::FC_FRONT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_rimFaultCollection->faultFaceCulling() == RimFaultCollection::FAULT_FRONT_FACE_CULLING)
|
||||||
|
{
|
||||||
|
if (m_grid->mainGrid()->faceNormalsIsOutwards())
|
||||||
|
{
|
||||||
|
return caf::FC_FRONT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return caf::FC_BACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return caf::FC_NONE;
|
||||||
|
}
|
@ -26,6 +26,7 @@
|
|||||||
#include "cvfColor4.h"
|
#include "cvfColor4.h"
|
||||||
#include "RivNNCGeometryGenerator.h"
|
#include "RivNNCGeometryGenerator.h"
|
||||||
#include "cvfEffect.h"
|
#include "cvfEffect.h"
|
||||||
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
namespace cvf
|
namespace cvf
|
||||||
{
|
{
|
||||||
@ -66,11 +67,11 @@ private:
|
|||||||
void updatePartEffect();
|
void updatePartEffect();
|
||||||
|
|
||||||
cvf::ref<cvf::Effect> cellResultEffect(const cvf::ScalarMapper* mapper) const;
|
cvf::ref<cvf::Effect> cellResultEffect(const cvf::ScalarMapper* mapper) const;
|
||||||
|
caf::FaceCulling faceCullingMode() const;
|
||||||
|
|
||||||
void createLabelWithAnchorLine(const cvf::Part* part);
|
void createLabelWithAnchorLine(const cvf::Part* part);
|
||||||
|
|
||||||
static cvf::Vec3f findClosestVertex(const cvf::Vec3f& point, const cvf::Vec3fArray* vertices);
|
static cvf::Vec3f findClosestVertex(const cvf::Vec3f& point, const cvf::Vec3fArray* vertices);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::cref<RigGridBase> m_grid;
|
cvf::cref<RigGridBase> m_grid;
|
||||||
const RimFault* m_rimFault;
|
const RimFault* m_rimFault;
|
||||||
|
@ -356,3 +356,12 @@ void RigMainGrid::calculateFaults()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// The cell is normally inverted due to Depth becoming -Z at import,
|
||||||
|
/// but if (only) one of the flipX/Y is done, the cell is back to nomal
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RigMainGrid::faceNormalsIsOutwards() const
|
||||||
|
{
|
||||||
|
return m_flipXAxis ^ m_flipYAxis;
|
||||||
|
}
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
void setFaults(const cvf::Collection<RigFault>& faults);
|
void setFaults(const cvf::Collection<RigFault>& faults);
|
||||||
const cvf::Collection<RigFault>& faults() { return m_faults; }
|
const cvf::Collection<RigFault>& faults() { return m_faults; }
|
||||||
void calculateFaults();
|
void calculateFaults();
|
||||||
|
bool faceNormalsIsOutwards() const;
|
||||||
|
|
||||||
void computeCachedData();
|
void computeCachedData();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user