1 // Copyright (c) 2015 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _Graphic3d_CView_HeaderFile
15 #define _Graphic3d_CView_HeaderFile
17 #include <Aspect_Handle.hxx>
18 #include <Aspect_RenderingContext.hxx>
19 #include <Aspect_Window.hxx>
20 #include <Graphic3d_BufferType.hxx>
21 #include <Graphic3d_Camera.hxx>
22 #include <Graphic3d_CubeMap.hxx>
23 #include <Graphic3d_CLight.hxx>
24 #include <Graphic3d_CStructure.hxx>
25 #include <Graphic3d_DataStructureManager.hxx>
26 #include <Graphic3d_DiagnosticInfo.hxx>
27 #include <Graphic3d_GraduatedTrihedron.hxx>
28 #include <Graphic3d_MapOfStructure.hxx>
29 #include <Graphic3d_NMapOfTransient.hxx>
30 #include <Graphic3d_RenderingParams.hxx>
31 #include <Graphic3d_SequenceOfHClipPlane.hxx>
32 #include <Graphic3d_SequenceOfStructure.hxx>
33 #include <Graphic3d_Structure.hxx>
34 #include <Graphic3d_TextureEnv.hxx>
35 #include <Graphic3d_TypeOfAnswer.hxx>
36 #include <Graphic3d_TypeOfBackfacingModel.hxx>
37 #include <Graphic3d_TypeOfShadingModel.hxx>
38 #include <Graphic3d_TypeOfVisualization.hxx>
39 #include <Graphic3d_Vec3.hxx>
40 #include <Graphic3d_ZLayerId.hxx>
41 #include <Graphic3d_ZLayerSettings.hxx>
42 #include <Image_PixMap.hxx>
43 #include <Quantity_NameOfColor.hxx>
44 #include <Standard_Address.hxx>
45 #include <Standard_Transient.hxx>
46 #include <TColStd_IndexedDataMapOfStringString.hxx>
48 class Aspect_XRSession;
49 class Graphic3d_CView;
50 class Graphic3d_GraphicDriver;
51 class Graphic3d_Layer;
52 class Graphic3d_StructureManager;
54 DEFINE_STANDARD_HANDLE (Graphic3d_CView, Graphic3d_DataStructureManager)
56 //! Base class of a graphical view that carries out rendering process for a concrete
57 //! implementation of graphical driver. Provides virtual interfaces for redrawing its
58 //! contents, management of displayed structures and render settings. The source code
59 //! of the class itself implements functionality related to management of
60 //! computed (HLR or "view-dependent") structures.
61 class Graphic3d_CView : public Graphic3d_DataStructureManager
63 friend class Graphic3d_StructureManager;
64 DEFINE_STANDARD_RTTIEXT(Graphic3d_CView, Graphic3d_DataStructureManager)
68 Standard_EXPORT Graphic3d_CView (const Handle(Graphic3d_StructureManager)& theMgr);
71 Standard_EXPORT virtual ~Graphic3d_CView();
73 //! Returns the identification number of the view.
74 Standard_Integer Identification() const { return myId; }
76 //! Activates the view. Maps presentations defined within structure manager onto this view.
77 Standard_EXPORT virtual void Activate();
79 //! Deactivates the view. Unmaps presentations defined within structure manager.
80 //! The view in deactivated state will ignore actions on structures such as Display().
81 Standard_EXPORT virtual void Deactivate();
83 //! Returns the activity flag of the view.
84 Standard_Boolean IsActive() const { return myIsActive; }
86 //! Erases the view and removes from graphic driver.
87 //! No more graphic operations are allowed in this view after the call.
88 Standard_EXPORT virtual void Remove();
90 //! Returns true if the view was removed.
91 Standard_Boolean IsRemoved() const { return myIsRemoved; }
93 //! Returns camera object of the view.
94 virtual const Handle(Graphic3d_Camera)& Camera() const Standard_OVERRIDE { return myCamera; }
96 //! Sets camera used by the view.
97 virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
101 //! Returns default Shading Model of the view; Graphic3d_TOSM_FRAGMENT by default.
102 Graphic3d_TypeOfShadingModel ShadingModel() const { return myShadingModel; }
104 //! Sets default Shading Model of the view.
105 //! Will throw an exception on attempt to set Graphic3d_TOSM_DEFAULT.
106 Standard_EXPORT void SetShadingModel (Graphic3d_TypeOfShadingModel theModel);
108 //! Returns visualization type of the view.
109 Graphic3d_TypeOfVisualization VisualizationType() const { return myVisualization; }
111 //! Sets visualization type of the view.
112 void SetVisualizationType (const Graphic3d_TypeOfVisualization theType) { myVisualization = theType; }
114 //! Switches computed HLR mode in the view
115 Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
117 //! Returns the computed HLR mode state
118 Standard_Boolean ComputedMode() const { return myIsInComputedMode; }
120 //! Computes the new presentation of the structure displayed in this view with the type Graphic3d_TOS_COMPUTED.
121 Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
123 //! Invalidates bounding box of specified ZLayerId.
124 Standard_EXPORT void Update (const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN);
126 //! Computes the new presentation of the structures displayed in this view with the type Graphic3d_TOS_COMPUTED.
127 Standard_EXPORT void Compute();
129 //! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
130 Standard_EXPORT Standard_Boolean ContainsFacet() const;
132 //! Returns Standard_True if one of the structures in the set contains Polygons, Triangles or Quadrangles.
133 Standard_EXPORT Standard_Boolean ContainsFacet (const Graphic3d_MapOfStructure& theSet) const;
135 //! Returns the set of structures displayed in this view.
136 Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& theStructures) const;
138 //! Returns number of displayed structures in the view.
139 virtual Standard_Integer NumberOfDisplayedStructures() const { return myStructsDisplayed.Extent(); }
141 //! Returns map of objects hidden within this specific view (not viewer-wise).
142 const Handle(Graphic3d_NMapOfTransient)& HiddenObjects() const { return myHiddenObjects; }
144 //! Returns map of objects hidden within this specific view (not viewer-wise).
145 Handle(Graphic3d_NMapOfTransient)& ChangeHiddenObjects() { return myHiddenObjects; }
147 //! Returns Standard_True in case if the structure with the given <theStructId> is
148 //! in list of structures to be computed and stores computed struct to <theComputedStruct>.
149 Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
150 Handle(Graphic3d_Structure)& theComputedStruct) const;
152 //! Returns the bounding box of all structures displayed in the view.
153 //! If theToIncludeAuxiliary is TRUE, then the boundary box also includes minimum and maximum limits
154 //! of graphical elements forming parts of infinite and other auxiliary structures.
155 //! @param theToIncludeAuxiliary consider also auxiliary presentations (with infinite flag or with trihedron transformation persistence)
156 //! @return computed bounding box
157 Standard_EXPORT virtual Bnd_Box MinMaxValues (const Standard_Boolean theToIncludeAuxiliary = Standard_False) const;
159 //! Returns the coordinates of the boundary box of all structures in the set <theSet>.
160 //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
161 //! also includes minimum and maximum limits of graphical elements
162 //! forming parts of infinite structures.
163 Standard_EXPORT Bnd_Box MinMaxValues (const Graphic3d_MapOfStructure& theSet,
164 const Standard_Boolean theToIncludeAuxiliary = Standard_False) const;
166 //! Returns the structure manager handle which manage structures associated with this view.
167 const Handle(Graphic3d_StructureManager)& StructureManager() const { return myStructureManager; }
171 //! Is it possible to display the structure in the view?
172 Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const;
174 //! Clears the structure in this view.
175 Standard_EXPORT void Clear (Graphic3d_Structure* theStructure,
176 const Standard_Boolean theWithDestruction);
178 //! Connects the structures.
179 Standard_EXPORT void Connect (const Graphic3d_Structure* theMother,
180 const Graphic3d_Structure* theDaughter);
182 //! Disconnects the structures.
183 Standard_EXPORT void Disconnect (const Graphic3d_Structure* theMother,
184 const Graphic3d_Structure* theDaughter);
186 //! Displays the structure in the view.
187 Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure);
189 //! Erases the structure from the view.
190 Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure);
192 //! Highlights the structure in the view.
193 Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& theStructure);
195 //! Transforms the structure in the view.
196 Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& theStructure,
197 const Handle(TopLoc_Datum3D)& theTrsf);
199 //! Suppress the highlighting on the structure <AStructure>
200 //! in the view <me>.
201 Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& theStructure);
203 //! Returns an index != 0 if the structure have another structure computed for the view <me>.
204 Standard_EXPORT Standard_Integer IsComputed (const Graphic3d_Structure* theStructure) const;
206 Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const { return IsComputed (theStructure.get()); }
208 //! Returns true if the structure is displayed in the view.
209 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& theStructure) const;
211 //! Changes the display priority of the structure.
212 Standard_EXPORT void ChangePriority (const Handle(Graphic3d_Structure)& theStructure,
213 const Standard_Integer theOldPriority,
214 const Standard_Integer theNewPriority);
216 //! Change Z layer of already displayed structure in the view.
217 Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
218 const Graphic3d_ZLayerId theLayerId);
220 //! Returns an index != 0 if the structure have the same owner than another structure
221 //! in the sequence of the computed structures.
222 Standard_EXPORT Standard_Integer HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const;
226 //! Redraw content of the view.
227 virtual void Redraw() = 0;
229 //! Redraw immediate content of the view.
230 virtual void RedrawImmediate() = 0;
232 //! Invalidates content of the view but does not redraw it.
233 virtual void Invalidate() = 0;
235 //! Return true if view content cache has been invalidated.
236 virtual Standard_Boolean IsInvalidated() = 0;
238 //! Handle changing size of the rendering window.
239 virtual void Resized() = 0;
241 //! @param theDrawToFrontBuffer Advanced option to modify rendering mode:
242 //! 1. TRUE. Drawing immediate mode structures directly to the front buffer over the scene image.
243 //! Fast, so preferred for interactive work (used by default).
244 //! However these extra drawings will be missed in image dump since it is performed from back buffer.
245 //! Notice that since no pre-buffering used the V-Sync will be ignored and rendering could be seen
246 //! in run-time (in case of slow hardware) and/or tearing may appear.
247 //! So this is strongly recommended to draw only simple (fast) structures.
248 //! 2. FALSE. Drawing immediate mode structures to the back buffer.
249 //! The complete scene is redrawn first, so this mode is slower if scene contains complex data and/or V-Sync
250 //! is turned on. But it works in any case and is especially useful for view dump because the dump image is read
251 //! from the back buffer.
252 //! @return previous mode.
253 virtual Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer) = 0;
255 //! Creates and maps rendering window to the view.
256 //! @param theWindow [in] the window.
257 //! @param theContext [in] the rendering context. If NULL the context will be created internally.
258 virtual void SetWindow (const Handle(Aspect_Window)& theWindow,
259 const Aspect_RenderingContext theContext = NULL) = 0;
261 //! Returns the window associated to the view.
262 virtual Handle(Aspect_Window) Window() const = 0;
264 //! Returns True if the window associated to the view is defined.
265 virtual Standard_Boolean IsDefined() const = 0;
267 //! Dump active rendering buffer into specified memory buffer.
268 virtual Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0;
270 //! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
271 virtual void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId) = 0;
273 //! Add a layer to the view.
274 //! @param theNewLayerId [in] id of new layer, should be > 0 (negative values are reserved for default layers).
275 //! @param theSettings [in] new layer settings
276 //! @param theLayerAfter [in] id of layer to append new layer before
277 virtual void InsertLayerBefore (const Graphic3d_ZLayerId theNewLayerId,
278 const Graphic3d_ZLayerSettings& theSettings,
279 const Graphic3d_ZLayerId theLayerAfter) = 0;
281 //! Add a layer to the view.
282 //! @param theNewLayerId [in] id of new layer, should be > 0 (negative values are reserved for default layers).
283 //! @param theSettings [in] new layer settings
284 //! @param theLayerBefore [in] id of layer to append new layer after
285 virtual void InsertLayerAfter (const Graphic3d_ZLayerId theNewLayerId,
286 const Graphic3d_ZLayerSettings& theSettings,
287 const Graphic3d_ZLayerId theLayerBefore) = 0;
289 //! Returns the maximum Z layer ID.
290 //! First layer ID is Graphic3d_ZLayerId_Default, last ID is ZLayerMax().
291 virtual Standard_Integer ZLayerMax() const = 0;
293 //! Returns the list of layers.
294 virtual const NCollection_List<Handle(Graphic3d_Layer)>& Layers() const = 0;
296 //! Returns layer with given ID or NULL if undefined.
297 virtual Handle(Graphic3d_Layer) Layer (const Graphic3d_ZLayerId theLayerId) const = 0;
299 //! Returns the bounding box of all structures displayed in the Z layer.
300 Standard_EXPORT virtual void InvalidateZLayerBoundingBox (const Graphic3d_ZLayerId theLayerId);
302 //! Remove Z layer from the specified view. All structures
303 //! displayed at the moment in layer will be displayed in default layer
304 //! ( the bottom-level z layer ). To unset layer ID from associated
305 //! structures use method UnsetZLayer (...).
306 virtual void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
308 //! Sets the settings for a single Z layer of specified view.
309 virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
310 const Graphic3d_ZLayerSettings& theSettings) = 0;
312 //! Returns zoom-scale factor.
313 Standard_EXPORT Standard_Real ConsiderZoomPersistenceObjects();
315 //! Returns pointer to an assigned framebuffer object.
316 virtual Handle(Standard_Transient) FBO() const = 0;
318 //! Sets framebuffer object for offscreen rendering.
319 virtual void SetFBO (const Handle(Standard_Transient)& theFbo) = 0;
321 //! Generate offscreen FBO in the graphic library.
322 //! If not supported on hardware returns NULL.
323 virtual Handle(Standard_Transient) FBOCreate (const Standard_Integer theWidth,
324 const Standard_Integer theHeight) = 0;
326 //! Remove offscreen FBO from the graphic library
327 virtual void FBORelease (Handle(Standard_Transient)& theFbo) = 0;
329 //! Read offscreen FBO configuration.
330 virtual void FBOGetDimensions (const Handle(Standard_Transient)& theFbo,
331 Standard_Integer& theWidth,
332 Standard_Integer& theHeight,
333 Standard_Integer& theWidthMax,
334 Standard_Integer& theHeightMax) = 0;
336 //! Change offscreen FBO viewport.
337 virtual void FBOChangeViewport (const Handle(Standard_Transient)& theFbo,
338 const Standard_Integer theWidth,
339 const Standard_Integer theHeight) = 0;
343 //! Copy visualization settings from another view.
344 //! Method is used for cloning views in viewer when its required to create view
345 //! with same view properties.
346 Standard_EXPORT virtual void CopySettings (const Handle(Graphic3d_CView)& theOther);
348 //! Returns current rendering parameters and effect settings.
349 const Graphic3d_RenderingParams& RenderingParams() const { return myRenderParams; }
351 //! Returns reference to current rendering parameters and effect settings.
352 Graphic3d_RenderingParams& ChangeRenderingParams() { return myRenderParams; }
354 //! Returns background fill color.
355 virtual Aspect_Background Background() const { return Aspect_Background (myBgColor.GetRGB()); }
357 //! Sets background fill color.
358 virtual void SetBackground (const Aspect_Background& theBackground) { myBgColor.SetRGB (theBackground.Color()); }
360 //! Returns gradient background fill colors.
361 virtual Aspect_GradientBackground GradientBackground() const = 0;
363 //! Sets gradient background fill colors.
364 virtual void SetGradientBackground (const Aspect_GradientBackground& theBackground) = 0;
366 //! Returns background image texture file path.
367 virtual TCollection_AsciiString BackgroundImage() = 0;
369 //! Sets background image texture file path.
370 virtual void SetBackgroundImage (const TCollection_AsciiString& theFilePath) = 0;
372 //! Returns background image fill style.
373 virtual Aspect_FillMethod BackgroundImageStyle() const = 0;
375 //! Sets background image fill style.
376 virtual void SetBackgroundImageStyle (const Aspect_FillMethod theFillStyle) = 0;
378 //! Returns cubemap being setted last time on background.
379 virtual Handle(Graphic3d_CubeMap) BackgroundCubeMap() const = 0;
381 //! Sets environment cubemap as background.
382 //! @param theCubeMap cubemap source to be set as background
383 //! @param theToUpdatePBREnv defines whether IBL maps will be generated or not (see 'GeneratePBREnvironment')
384 virtual void SetBackgroundCubeMap (const Handle(Graphic3d_CubeMap)& theCubeMap,
385 Standard_Boolean theToUpdatePBREnv = Standard_True) = 0;
387 //! Generates PBR specular probe and irradiance map
388 //! in order to provide environment indirect illumination in PBR shading model (Image Based Lighting).
389 //! The source of environment data is background cubemap.
390 //! If PBR is unavailable it does nothing.
391 //! If PBR is available but there is no cubemap being set to background it clears all IBL maps (see 'ClearPBREnvironment').
392 virtual void GeneratePBREnvironment() = 0;
394 //! Fills PBR specular probe and irradiance map with white color.
395 //! So that environment indirect illumination will be constant
396 //! and will be fully controlled by ambient light sources.
397 //! If PBR is unavailable it does nothing.
398 virtual void ClearPBREnvironment() = 0;
400 //! Returns environment texture set for the view.
401 virtual Handle(Graphic3d_TextureEnv) TextureEnv() const = 0;
403 //! Sets environment texture for the view.
404 virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) = 0;
406 //! Return backfacing model used for the view.
407 virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0;
409 //! Sets backfacing model for the view.
410 virtual void SetBackfacingModel (const Graphic3d_TypeOfBackfacingModel theModel) = 0;
412 //! Returns list of lights of the view.
413 virtual const Handle(Graphic3d_LightSet)& Lights() const = 0;
415 //! Sets list of lights for the view.
416 virtual void SetLights (const Handle(Graphic3d_LightSet)& theLights) = 0;
418 //! Returns list of clip planes set for the view.
419 virtual const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const = 0;
421 //! Sets list of clip planes for the view.
422 virtual void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) = 0;
424 //! Fill in the dictionary with diagnostic info.
425 //! Should be called within rendering thread.
427 //! This API should be used only for user output or for creating automated reports.
428 //! The format of returned information (e.g. key-value layout)
429 //! is NOT part of this API and can be changed at any time.
430 //! Thus application should not parse returned information to weed out specific parameters.
431 Standard_EXPORT virtual void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
432 Graphic3d_DiagnosticInfo theFlags) const = 0;
434 //! Returns string with statistic performance info.
435 virtual TCollection_AsciiString StatisticInformation() const = 0;
437 //! Fills in the dictionary with statistic performance info.
438 virtual void StatisticInformation (TColStd_IndexedDataMapOfStringString& theDict) const = 0;
442 //! Return unit scale factor defined as scale factor for m (meters); 1.0 by default.
443 //! Normally, view definition is unitless, however some operations like VR input requires proper units mapping.
444 Standard_Real UnitFactor() const { return myUnitFactor; }
446 //! Set unit scale factor.
447 Standard_EXPORT void SetUnitFactor (Standard_Real theFactor);
449 //! Return XR session.
450 const Handle(Aspect_XRSession)& XRSession() const { return myXRSession; }
453 void SetXRSession (const Handle(Aspect_XRSession)& theSession) { myXRSession = theSession; }
455 //! Return TRUE if there is active XR session.
456 Standard_EXPORT bool IsActiveXR() const;
458 //! Initialize XR session.
459 Standard_EXPORT virtual bool InitXR();
461 //! Release XR session.
462 Standard_EXPORT virtual void ReleaseXR();
465 Standard_EXPORT virtual void ProcessXRInput();
467 //! Compute PosedXRCamera() based on current XR head pose and make it active.
468 Standard_EXPORT void SetupXRPosedCamera();
470 //! Set current camera back to BaseXRCamera() and copy temporary modifications of PosedXRCamera().
471 //! Calls SynchronizeXRPosedToBaseCamera() beforehand.
472 Standard_EXPORT void UnsetXRPosedCamera();
474 //! Returns transient XR camera position with tracked head orientation applied.
475 const Handle(Graphic3d_Camera)& PosedXRCamera() const { return myPosedXRCamera; }
477 //! Sets transient XR camera position with tracked head orientation applied.
478 void SetPosedXRCamera (const Handle(Graphic3d_Camera)& theCamera) { myPosedXRCamera = theCamera; }
480 //! Returns anchor camera definition (without tracked head orientation).
481 const Handle(Graphic3d_Camera)& BaseXRCamera() const { return myBaseXRCamera; }
483 //! Sets anchor camera definition.
484 void SetBaseXRCamera (const Handle(Graphic3d_Camera)& theCamera) { myBaseXRCamera = theCamera; }
486 //! Convert XR pose to world space.
487 //! @param theTrsfXR [in] transformation defined in VR local coordinate system,
488 //! oriented as Y-up, X-right and -Z-forward
489 //! @return transformation defining orientation of XR pose in world space
490 gp_Trsf PoseXRToWorld (const gp_Trsf& thePoseXR) const
492 const Handle(Graphic3d_Camera)& anOrigin = myBaseXRCamera;
493 const gp_Ax3 anAxVr (gp::Origin(), gp::DZ(), gp::DX());
494 const gp_Ax3 aCameraCS (anOrigin->Eye().XYZ(), -anOrigin->Direction(), -anOrigin->SideRight());
496 aTrsfCS.SetTransformation (aCameraCS, anAxVr);
497 return aTrsfCS * thePoseXR;
500 //! Recomputes PosedXRCamera() based on BaseXRCamera() and head orientation.
501 Standard_EXPORT void SynchronizeXRBaseToPosedCamera();
503 //! Checks if PosedXRCamera() has been modified since SetupXRPosedCamera()
504 //! and copies these modifications to BaseXRCamera().
505 Standard_EXPORT void SynchronizeXRPosedToBaseCamera();
507 //! Compute camera position based on XR pose.
508 Standard_EXPORT void ComputeXRPosedCameraFromBase (Graphic3d_Camera& theCam,
509 const gp_Trsf& theXRTrsf) const;
511 //! Update based camera from posed camera by applying reversed transformation.
512 Standard_EXPORT void ComputeXRBaseCameraFromPosed (const Graphic3d_Camera& theCamPosed,
513 const gp_Trsf& thePoseTrsf);
515 //! Turn XR camera direction using current (head) eye position as anchor.
516 Standard_EXPORT void TurnViewXRCamera (const gp_Trsf& theTrsfTurn);
518 public: //! @name obsolete Graduated Trihedron functionality
520 //! Returns data of a graduated trihedron
521 virtual const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() { return myGTrihedronData; }
523 //! Displays Graduated Trihedron.
524 virtual void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData) { (void )theTrihedronData; }
526 //! Erases Graduated Trihedron.
527 virtual void GraduatedTrihedronErase() {}
529 //! Sets minimum and maximum points of scene bounding box for Graduated Trihedron stored in graphic view object.
530 //! @param theMin [in] the minimum point of scene.
531 //! @param theMax [in] the maximum point of scene.
532 virtual void GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax)
540 //! Adds the structure to display lists of the view.
541 virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure,
542 const Standard_Integer thePriority) = 0;
544 //! Erases the structure from display lists of the view.
545 virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) = 0;
547 //! Change Z layer of a structure already presented in view.
548 virtual void changeZLayer (const Handle(Graphic3d_CStructure)& theCStructure,
549 const Graphic3d_ZLayerId theNewLayerId) = 0;
551 //! Changes the priority of a structure within its Z layer in the specified view.
552 virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
553 const Standard_Integer theNewPriority) = 0;
557 Standard_Integer myId;
558 Graphic3d_RenderingParams myRenderParams;
559 Quantity_ColorRGBA myBgColor;
560 Handle(Graphic3d_StructureManager) myStructureManager;
561 Handle(Graphic3d_Camera) myCamera;
562 Graphic3d_SequenceOfStructure myStructsToCompute;
563 Graphic3d_SequenceOfStructure myStructsComputed;
564 Graphic3d_MapOfStructure myStructsDisplayed;
565 Handle(Graphic3d_NMapOfTransient) myHiddenObjects;
566 Standard_Boolean myIsInComputedMode;
567 Standard_Boolean myIsActive;
568 Standard_Boolean myIsRemoved;
569 Graphic3d_TypeOfShadingModel myShadingModel;
570 Graphic3d_TypeOfVisualization myVisualization;
572 Handle(Aspect_XRSession) myXRSession;
573 Handle(Graphic3d_Camera) myBackXRCamera; //!< camera projection parameters to restore after closing XR session (FOV, aspect and similar)
574 Handle(Graphic3d_Camera) myBaseXRCamera; //!< neutral camera orientation defining coordinate system in which head tracking is defined
575 Handle(Graphic3d_Camera) myPosedXRCamera; //!< transient XR camera orientation with tracked head orientation applied (based on myBaseXRCamera)
576 Handle(Graphic3d_Camera) myPosedXRCameraCopy; //!< neutral camera orientation copy at the beginning of processing input
577 Standard_Real myUnitFactor; //!< unit scale factor defined as scale factor for m (meters)
581 Graphic3d_GraduatedTrihedron myGTrihedronData;
585 #endif // _Graphic3d_CView_HeaderFile