From f46930763e4e048a38808ed4946ce71a49b5f278 Mon Sep 17 00:00:00 2001
From: Andrew Heather <>
Date: Fri, 1 Nov 2019 11:03:30 +0000
Subject: [PATCH] ENH: Function objects - runTimePostProcessing - updated and
 exposed culling options

---
 src/runTimePostProcessing/surface.C | 6 ++++++
 src/runTimePostProcessing/surface.H | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/runTimePostProcessing/surface.C b/src/runTimePostProcessing/surface.C
index 5b8a990..80c1077 100644
--- a/src/runTimePostProcessing/surface.C
+++ b/src/runTimePostProcessing/surface.C
@@ -115,11 +115,15 @@ void Foam::functionObjects::runTimePostPro::surface::setRepresentation
         case rtGlyph:
         case rtSurface:
         {
+            actor->GetProperty()->SetBackfaceCulling(backFaceCulling_);
+            actor->GetProperty()->SetFrontfaceCulling(frontFaceCulling_);
             actor->GetProperty()->SetRepresentationToSurface();
             break;
         }
         case rtSurfaceWithEdges:
         {
+            actor->GetProperty()->SetBackfaceCulling(backFaceCulling_);
+            actor->GetProperty()->SetFrontfaceCulling(frontFaceCulling_);
             actor->GetProperty()->SetRepresentationToSurface();
             actor->GetProperty()->EdgeVisibilityOn();
             break;
@@ -207,6 +211,8 @@ Foam::functionObjects::runTimePostPro::surface::surface
         representationTypeNames.get("representation", dict)
     ),
     featureEdges_(dict.getOrDefault("featureEdges", false)),
+    backFaceCulling_(dict.getOrDefault("backFaceCulling", false)),
+    frontFaceCulling_(dict.getOrDefault("frontFaceCulling", true)),
     surfaceColour_(nullptr),
     edgeColour_(nullptr),
     surfaceActor_(),
diff --git a/src/runTimePostProcessing/surface.H b/src/runTimePostProcessing/surface.H
index ae21df9..2648b4b 100644
--- a/src/runTimePostProcessing/surface.H
+++ b/src/runTimePostProcessing/surface.H
@@ -38,6 +38,8 @@ Description
         edgeColour    | Override edge colour                | no  |
         featureEdges  | Display surface feature edges       | no  | false
         maxGlyphLength | Limit for glyph representation     | yes | 0
+        backFaceCulling | Cull back face                    | no  | false
+        frontFaceCulling | Cull front face                  | no  | true
     \endtable
 
 SourceFiles
@@ -168,6 +170,12 @@ protected:
         //- Activate feature edges
         bool featureEdges_;
 
+        //- Back face culling option; default = off
+        bool backFaceCulling_;
+
+        //- Front face culling option; default = on
+        bool frontFaceCulling_;
+
         //- Surface colour
         autoPtr<Function1<vector>> surfaceColour_;
 
-- 
GitLab