From 832ae82d0a665946099909170a0817796c78ae8e Mon Sep 17 00:00:00 2001 From: isk Date: Tue, 10 Nov 2015 13:14:17 +0300 Subject: [PATCH] 0026821: Visualization - define default Rendering Parameters for Interactive Context Define default Rendering Parameters within V3d_Viewer. New instances of V3d_View use default Rendering Parameters. --- src/V3d/V3d_View.cxx | 2 ++ src/V3d/V3d_View.hxx | 3 +++ src/V3d/V3d_Viewer.cxx | 18 ++++++++++++++++++ src/V3d/V3d_Viewer.hxx | 9 +++++++++ 4 files changed, 32 insertions(+) diff --git a/src/V3d/V3d_View.cxx b/src/V3d/V3d_View.cxx index dccc1f8689..9464ca61e3 100644 --- a/src/V3d/V3d_View.cxx +++ b/src/V3d/V3d_View.cxx @@ -136,6 +136,8 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView th myView->SetBackground (theViewer->GetBackgroundColor()); myView->SetGradientBackground (theViewer->GetGradientBackground()); + ChangeRenderingParams() = theViewer->DefaultRenderingParams(); + // camera init Handle(Graphic3d_Camera) aCamera = new Graphic3d_Camera(); aCamera->SetFOVy (45.0); diff --git a/src/V3d/V3d_View.hxx b/src/V3d/V3d_View.hxx index b8ce27e4be..9f14ea1047 100644 --- a/src/V3d/V3d_View.hxx +++ b/src/V3d/V3d_View.hxx @@ -967,6 +967,9 @@ public: Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const; //! Returns current rendering parameters and effect settings. + //! By default it returns default parameters of current viewer. + //! To define view-specific settings use method V3d_View::ChangeRenderingParams(). + //! @sa V3d_Viewer::DefaultRenderingParams() Standard_EXPORT const Graphic3d_RenderingParams& RenderingParams() const; //! Returns reference to current rendering parameters and effect settings. diff --git a/src/V3d/V3d_Viewer.cxx b/src/V3d/V3d_Viewer.cxx index 497ad06a34..0a7261e751 100644 --- a/src/V3d/V3d_Viewer.cxx +++ b/src/V3d/V3d_Viewer.cxx @@ -534,3 +534,21 @@ void V3d_Viewer::IncrCount() { myNextCount++; } + +//======================================================================= +//function : DefaultRenderingParams +//purpose : +//======================================================================= +const Graphic3d_RenderingParams& V3d_Viewer::DefaultRenderingParams() const +{ + return myDefaultRenderingParams; +} + +//======================================================================= +//function : SetDefaultRenderingParams +//purpose : +//======================================================================= +void V3d_Viewer::SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams) +{ + myDefaultRenderingParams = theParams; +} diff --git a/src/V3d/V3d_Viewer.hxx b/src/V3d/V3d_Viewer.hxx index 29fcb98fab..c042e76a5a 100644 --- a/src/V3d/V3d_Viewer.hxx +++ b/src/V3d/V3d_Viewer.hxx @@ -433,12 +433,20 @@ public: //! Returns the settings of a single Z layer. Standard_EXPORT Graphic3d_ZLayerSettings ZLayerSettings (const Standard_Integer theLayerId); + //! Return Graphic Driver instance. Standard_EXPORT const Handle(Graphic3d_GraphicDriver)& Driver() const; Standard_EXPORT Standard_ExtString NextName() const; Standard_EXPORT Standard_CString Domain() const; + //! Return default Rendering Parameters. + //! By default these parameters are set in a new V3d_View. + Standard_EXPORT const Graphic3d_RenderingParams& DefaultRenderingParams() const; + + //! Set default Rendering Parameters. + Standard_EXPORT void SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams); + friend class V3d_View; friend class V3d_Light; @@ -484,6 +492,7 @@ private: V3d_TypeOfSurfaceDetail MySurfaceDetail; Quantity_PlaneAngle MyDefaultAngle; V3d_TypeOfView MyDefaultTypeOfView; + Graphic3d_RenderingParams myDefaultRenderingParams; Handle(V3d_Light) MyCurrentSelectedLight; TColStd_ListIteratorOfListOfTransient myActiveViewsIterator; TColStd_ListIteratorOfListOfTransient myDefinedViewsIterator; -- 2.39.5