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();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -372,18 +372,9 @@ void RivFaultPartMgr::updatePartEffect()
|
||||
|
||||
// Set default effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(partColor, caf::PO_1);
|
||||
bool isShowingGrid = m_rimFaultCollection->isGridVisualizationMode();
|
||||
if (!isShowingGrid )
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
geometryEffgen.setCullBackfaces(faceCullingMode());
|
||||
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
|
||||
|
||||
if (m_nativeFaultFaces.notNull())
|
||||
@ -641,18 +632,7 @@ cvf::ref<cvf::Effect> RivFaultPartMgr::cellResultEffect(const cvf::ScalarMapper*
|
||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
||||
|
||||
bool isShowingGrid = m_rimFaultCollection->isGridVisualizationMode();
|
||||
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.setCullBackfaces(faceCullingMode());
|
||||
|
||||
scalarEffgen.setOpacityLevel(m_opacityLevel);
|
||||
|
||||
@ -661,3 +641,33 @@ cvf::ref<cvf::Effect> RivFaultPartMgr::cellResultEffect(const cvf::ScalarMapper*
|
||||
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 "RivNNCGeometryGenerator.h"
|
||||
#include "cvfEffect.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -66,11 +67,11 @@ private:
|
||||
void updatePartEffect();
|
||||
|
||||
cvf::ref<cvf::Effect> cellResultEffect(const cvf::ScalarMapper* mapper) const;
|
||||
caf::FaceCulling faceCullingMode() const;
|
||||
|
||||
void createLabelWithAnchorLine(const cvf::Part* part);
|
||||
|
||||
static cvf::Vec3f findClosestVertex(const cvf::Vec3f& point, const cvf::Vec3fArray* vertices);
|
||||
|
||||
private:
|
||||
cvf::cref<RigGridBase> m_grid;
|
||||
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);
|
||||
const cvf::Collection<RigFault>& faults() { return m_faults; }
|
||||
void calculateFaults();
|
||||
bool faceNormalsIsOutwards() const;
|
||||
|
||||
void computeCachedData();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user