diff --git a/src/Graphic3d/Graphic3d_CView.hxx b/src/Graphic3d/Graphic3d_CView.hxx index 3634288cb1..05062a816a 100644 --- a/src/Graphic3d/Graphic3d_CView.hxx +++ b/src/Graphic3d/Graphic3d_CView.hxx @@ -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; } diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx index 70c657014f..146c8d457d 100644 --- a/src/OpenGl/OpenGl_View.hxx +++ b/src/OpenGl/OpenGl_View.hxx @@ -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); diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 1a65e32729..07fd433588 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -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) @@ -14382,7 +14396,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. @@ -14404,6 +14418,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