]> OCCT Git - occt.git/commitdiff
Visualization - Implement interface to change myToFlipOutput of OpenGl_View #312
authorZernova Marina <36417100+mzernova@users.noreply.github.com>
Fri, 31 Jan 2025 13:44:31 +0000 (13:44 +0000)
committerGitHub <noreply@github.com>
Fri, 31 Jan 2025 13:44:31 +0000 (13:44 +0000)
src/Graphic3d/Graphic3d_CView.hxx
src/OpenGl/OpenGl_View.hxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx

index 3634288cb159e43a9776d40af5a6e7f5d9970315..05062a816a5094706ab340d04d2d181f6a99fc30 100644 (file)
@@ -89,6 +89,12 @@ public:
   //! Sets camera used by the view.
   virtual void SetCamera(const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
 
+  //! Returns necessity to flip OY in projection matrix
+  virtual Standard_Boolean ToFlipOutput() const { return Standard_False; }
+
+  //! Sets state of flip OY necessity in projection matrix
+  virtual void SetToFlipOutput(const Standard_Boolean) {}
+
 public:
   //! Returns default Shading Model of the view; Graphic3d_TypeOfShadingModel_Phong by default.
   Graphic3d_TypeOfShadingModel ShadingModel() const { return myRenderParams.ShadingModel; }
index 70c657014f26b13191667bed9a23eaff393c6c0d..146c8d457d11a05ad591b89fcc6f7c2518a98f0e 100644 (file)
@@ -340,6 +340,15 @@ public: //! @name obsolete Graduated Trihedron functionality
                                                               const Graphic3d_Vec3 theMax)
     Standard_OVERRIDE;
 
+  //! Returns necessity to flip OY in projection matrix
+  virtual Standard_Boolean ToFlipOutput() const Standard_OVERRIDE { return myToFlipOutput; }
+
+  //! Sets state of flip OY necessity in projection matrix
+  virtual void SetToFlipOutput(const Standard_Boolean theFlip) Standard_OVERRIDE
+  {
+    myToFlipOutput = theFlip;
+  }
+
 protected: //! @name Internal methods for managing GL resources
   //! Initializes OpenGl resource for environment texture.
   void initTextureEnv(const Handle(OpenGl_Context)& theContext);
index 089d8b56711d0f0f45bfd5fcfe25883b5de72b85..b06d579d41bcc8bb832fb2ccd19d069102289467 100644 (file)
@@ -11027,6 +11027,20 @@ static Standard_Integer VRenderParams(Draw_Interpretor& theDI,
         ++anArgIter;
       }
     }
+    else if (aFlag == "-flip")
+    {
+      if (toPrint)
+      {
+        theDI << (aView->View()->ToFlipOutput() ? "on " : "off ");
+        continue;
+      }
+      Standard_Boolean isToFlipOutput = Standard_False;
+      if (anArgIter + 1 < theArgNb && Draw::ParseOnOff(theArgVec[anArgIter + 1], isToFlipOutput))
+      {
+        aView->View()->SetToFlipOutput(isToFlipOutput);
+        ++anArgIter;
+      }
+    }
     else if (aFlag == "-rendscale" || aFlag == "-renderscale" || aFlag == "-renderresolutionscale")
     {
       if (toPrint)
@@ -14396,7 +14410,7 @@ vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}
               [-shadows {on|off}=on] [-shadowMapResolution value=1024] [-shadowMapBias value=0.005]
               [-depthPrePass {on|off}=off] [-alphaToCoverage {on|off}=on]
               [-frustumCulling {on|off|noupdate}=on] [-lineFeather width=1.0]
-              [-sync {default|views}] [-reset]
+              [-sync {default|views}] [-reset] [-flip {on|off}=off]
  -raster          Disables GPU ray-tracing.
  -shadingModel    Controls shading model.
  -msaa            Specifies number of samples for MSAA.
@@ -14418,6 +14432,7 @@ vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}
                    sets state to check structures culled previously.
   -sync            Sets active View parameters as Viewer defaults / to other Views.
   -reset           Resets active View parameters to Viewer defaults.
+  -flip            Flips View Vertically.
 
 Diagnostic output (on-screen overlay):
 vrenderparams [-perfCounters none|fps|cpu|layers|structures|groups|arrays|triangles|points