c357e426 |
1 | // Copyright (c) 2015 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #ifndef _Graphic3d_CView_HeaderFile |
15 | #define _Graphic3d_CView_HeaderFile |
16 | |
c357e426 |
17 | #include <Aspect_GraphicCallbackProc.hxx> |
18 | #include <Aspect_Handle.hxx> |
19 | #include <Aspect_PrintAlgo.hxx> |
20 | #include <Aspect_RenderingContext.hxx> |
21 | #include <Aspect_TypeOfTriedronEcho.hxx> |
22 | #include <Aspect_TypeOfTriedronPosition.hxx> |
23 | #include <Aspect_TypeOfUpdate.hxx> |
24 | #include <Aspect_Window.hxx> |
25 | #include <Graphic3d_BufferType.hxx> |
b5ac8292 |
26 | #include <Graphic3d_Camera.hxx> |
12381341 |
27 | #include <Graphic3d_CLight.hxx> |
c357e426 |
28 | #include <Graphic3d_CStructure.hxx> |
29 | #include <Graphic3d_DataStructureManager.hxx> |
30 | #include <Graphic3d_ExportFormat.hxx> |
31 | #include <Graphic3d_GraduatedTrihedron.hxx> |
32 | #include <Graphic3d_MapOfStructure.hxx> |
33 | #include <Graphic3d_NMapOfTransient.hxx> |
34 | #include <Graphic3d_PtrFrameBuffer.hxx> |
35 | #include <Graphic3d_RenderingParams.hxx> |
51b10cd4 |
36 | #include <Graphic3d_SequenceOfHClipPlane.hxx> |
c357e426 |
37 | #include <Graphic3d_SequenceOfStructure.hxx> |
38 | #include <Graphic3d_SortType.hxx> |
39 | #include <Graphic3d_Structure.hxx> |
40 | #include <Graphic3d_StructureManagerPtr.hxx> |
41 | #include <Graphic3d_TextureEnv.hxx> |
42 | #include <Graphic3d_TypeOfAnswer.hxx> |
43 | #include <Graphic3d_TypeOfBackfacingModel.hxx> |
44 | #include <Graphic3d_TypeOfShadingModel.hxx> |
45 | #include <Graphic3d_TypeOfSurfaceDetail.hxx> |
46 | #include <Graphic3d_TypeOfVisualization.hxx> |
47 | #include <Graphic3d_Vec3.hxx> |
48 | #include <Graphic3d_ZLayerId.hxx> |
49 | #include <Graphic3d_ZLayerSettings.hxx> |
50 | #include <Image_PixMap.hxx> |
51 | #include <Quantity_NameOfColor.hxx> |
52 | #include <Standard_Address.hxx> |
53 | #include <Standard_Transient.hxx> |
54 | |
55 | class Graphic3d_CView; |
56 | class Graphic3d_GraphicDriver; |
57 | class Graphic3d_StructureManager; |
58 | |
59 | DEFINE_STANDARD_HANDLE (Graphic3d_CView, Graphic3d_DataStructureManager) |
60 | |
61 | //! Base class of a graphical view that carries out rendering process for a concrete |
62 | //! implementation of graphical driver. Provides virtual interfaces for redrawing its |
63 | //! contents, management of displayed structures and render settings. The source code |
64 | //! of the class itself implements functionality related to management of |
65 | //! computed (HLR or "view-dependent") structures. |
66 | class Graphic3d_CView : public Graphic3d_DataStructureManager |
bf75be98 |
67 | { |
bf75be98 |
68 | public: |
69 | |
c357e426 |
70 | //! Constructor. |
71 | Standard_EXPORT Graphic3d_CView (const Handle(Graphic3d_StructureManager)& theMgr); |
72 | |
73 | //! Destructor. |
74 | Standard_EXPORT virtual ~Graphic3d_CView(); |
75 | |
76 | //! Returns the identification number of the view. |
77 | Standard_Integer Identification() const { return myId; } |
78 | |
79 | //! Activates the view. Map the associated window on the screen and post the view in this window. |
80 | //! Warning: Raises ViewDefinitionError if the associated window isn't defined. |
81 | Standard_EXPORT virtual void Activate(); |
82 | |
83 | //! Deactivates the view. Unmap the associated window on the screen and unpost the view in this window. |
84 | //! Warning: Raises ViewDefinitionError if the associated window isn't defined. |
85 | Standard_EXPORT virtual void Deactivate(); |
86 | |
87 | //! Returns the activity flag of the view. |
88 | Standard_Boolean IsActive() const { return myIsActive; } |
89 | |
90 | //! Erases the view and removes from graphic driver. |
91 | //! No more graphic operations are allowed in this view after the call. |
92 | Standard_EXPORT virtual void Remove(); |
93 | |
94 | //! Returns true if the view was removed. |
95 | Standard_Boolean IsRemoved() const { return myIsRemoved; } |
bf75be98 |
96 | |
97 | public: |
98 | |
c357e426 |
99 | //! Returns visualization type of the view. |
100 | Graphic3d_TypeOfVisualization VisualizationType() const { return myVisualization; } |
bf75be98 |
101 | |
c357e426 |
102 | //! Sets visualization type of the view. |
103 | void SetVisualizationType (const Graphic3d_TypeOfVisualization theType) { myVisualization = theType; } |
bf75be98 |
104 | |
c357e426 |
105 | //! Switches computed HLR mode in the view |
106 | Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode); |
bf75be98 |
107 | |
c357e426 |
108 | //! Returns the computed HLR mode state |
109 | Standard_Boolean ComputedMode() const { return myIsInComputedMode; } |
bf75be98 |
110 | |
c357e426 |
111 | //! Computes the new presentation of the structure displayed in this view with the type Graphic3d_TOS_COMPUTED. |
112 | Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure); |
bf75be98 |
113 | |
c357e426 |
114 | //! Updates screen in function of modifications of the structures. |
115 | Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode); |
bf75be98 |
116 | |
c357e426 |
117 | //! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles. |
118 | Standard_EXPORT Standard_Boolean ContainsFacet() const; |
bf75be98 |
119 | |
c357e426 |
120 | //! Returns Standard_True if one of the structures in the set contains Polygons, Triangles or Quadrangles. |
121 | Standard_EXPORT Standard_Boolean ContainsFacet (const Graphic3d_MapOfStructure& theSet) const; |
bf75be98 |
122 | |
c357e426 |
123 | //! Returns the set of structures displayed in this view. |
124 | Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& theStructures) const; |
b5ac8292 |
125 | |
c357e426 |
126 | //! Returns number of displayed structures in the view. |
127 | Standard_Integer NumberOfDisplayedStructures() const { return myStructsDisplayed.Extent(); } |
bf75be98 |
128 | |
c357e426 |
129 | //! Returns map of objects hidden within this specific view (not viewer-wise). |
130 | const Handle(Graphic3d_NMapOfTransient)& HiddenObjects() const { return myHiddenObjects; } |
131 | |
132 | //! Returns map of objects hidden within this specific view (not viewer-wise). |
133 | Handle(Graphic3d_NMapOfTransient)& ChangeHiddenObjects() { return myHiddenObjects; } |
134 | |
135 | //! Returns Standard_True in case if the structure with the given <theStructId> is |
136 | //! in list of structures to be computed and stores computed struct to <theComputedStruct>. |
137 | Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId, |
138 | Handle(Graphic3d_Structure)& theComputedStruct) const; |
139 | |
140 | //! Returns the coordinates of the boundary box of all |
141 | //! structures displayed in the view. |
142 | //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box |
143 | //! also includes minimum and maximum limits of graphical elements |
144 | //! forming parts of infinite structures. |
145 | Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
146 | |
147 | //! Returns the coordinates of the boundary box of all structures in the set <theSet>. |
148 | //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box |
149 | //! also includes minimum and maximum limits of graphical elements |
150 | //! forming parts of infinite structures. |
151 | Standard_EXPORT Bnd_Box MinMaxValues (const Graphic3d_MapOfStructure& theSet, |
152 | const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
153 | |
154 | //! Returns the structure manager handle which manage structures associated with this view. |
155 | const Handle(Graphic3d_StructureManager)& StructureManager() const { return myStructureManager; } |
156 | |
157 | private: |
158 | |
159 | friend class Graphic3d_StructureManager; |
160 | |
161 | //! Is it possible to display the structure in the view? |
162 | Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const; |
163 | |
164 | //! Computes the new presentation of the structures displayed in this view with the type Graphic3d_TOS_COMPUTED. |
165 | Standard_EXPORT void Compute(); |
166 | |
167 | //! Clears the structure in this view. |
168 | Standard_EXPORT void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction); |
169 | |
170 | //! Connects the structures. |
171 | Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& theMother, |
172 | const Handle(Graphic3d_Structure)& theDaughter); |
173 | |
174 | //! Disconnects the structures. |
175 | Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& theMother, |
176 | const Handle(Graphic3d_Structure)& theDaughter); |
177 | |
178 | //! Displays the structure in the view. |
179 | Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure); |
180 | |
181 | //! Display the structure in the view. |
182 | Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure, |
183 | const Aspect_TypeOfUpdate theUpdateMode); |
184 | |
185 | //! Erases the structure from the view. |
186 | Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure); |
187 | |
188 | //! Erases the structure from the view. |
189 | Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure, |
190 | const Aspect_TypeOfUpdate theUpdateMode); |
191 | |
192 | //! Highlights the structure in the view. |
193 | Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& theStructure, |
194 | const Aspect_TypeOfHighlightMethod theMethod); |
195 | |
196 | //! Transforms the structure in the view. |
197 | Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& theStructure, |
198 | const TColStd_Array2OfReal& theTrsf); |
199 | |
200 | //! Suppress the highlighting on the structure <AStructure> |
201 | //! in the view <me>. |
202 | Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& theStructure); |
203 | |
204 | //! Returns an index != 0 if the structure have another structure computed for the view <me>. |
205 | Standard_EXPORT Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const; |
206 | |
207 | //! Returns true if the structure is displayed in the view. |
208 | Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& theStructure) const; |
209 | |
210 | //! Changes the display priority of the structure. |
211 | Standard_EXPORT void ChangePriority (const Handle(Graphic3d_Structure)& theStructure, |
212 | const Standard_Integer theOldPriority, |
213 | const Standard_Integer theNewPriority); |
214 | |
215 | //! Change Z layer of already displayed structure in the view. |
216 | Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, |
217 | const Graphic3d_ZLayerId theLayerId); |
218 | |
219 | //! Returns an index != 0 if the structure have the same owner than another structure |
220 | //! in the sequence of the computed structures. |
221 | Standard_EXPORT Standard_Integer HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const; |
bf75be98 |
222 | |
223 | public: |
224 | |
c357e426 |
225 | //! Redraw content of the view. |
226 | virtual void Redraw() = 0; |
227 | |
228 | //! Redraw immediate content of the view. |
229 | virtual void RedrawImmediate() = 0; |
230 | |
231 | //! Invalidates content of the view but does not redraw it. |
232 | virtual void Invalidate() = 0; |
233 | |
234 | //! Return true if view content cache has been invalidated. |
235 | virtual Standard_Boolean IsInvalidated() = 0; |
236 | |
237 | //! Handle changing size of the rendering window. |
238 | virtual void Resized() = 0; |
239 | |
240 | //! @param theDrawToFrontBuffer Advanced option to modify rendering mode: |
241 | //! 1. TRUE. Drawing immediate mode structures directly to the front buffer over the scene image. |
242 | //! Fast, so preferred for interactive work (used by default). |
243 | //! However these extra drawings will be missed in image dump since it is performed from back buffer. |
244 | //! Notice that since no pre-buffering used the V-Sync will be ignored and rendering could be seen |
245 | //! in run-time (in case of slow hardware) and/or tearing may appear. |
246 | //! So this is strongly recommended to draw only simple (fast) structures. |
247 | //! 2. FALSE. Drawing immediate mode structures to the back buffer. |
248 | //! The complete scene is redrawn first, so this mode is slower if scene contains complex data and/or V-Sync |
249 | //! is turned on. But it works in any case and is especially useful for view dump because the dump image is read |
250 | //! from the back buffer. |
251 | //! @return previous mode. |
252 | virtual Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer) = 0; |
253 | |
254 | //! Creates and maps rendering window to the view. |
255 | //! @param theView [in] the view to associate with the window. |
256 | //! @param theWindow [in] the window. |
257 | //! @param theContext [in] the rendering context. If NULL the context will be created internally. |
258 | //! @param theDisplayCB [in] the display callback function. If is not a NULL value, then the callback will be |
259 | //! invoked at the end of the OCC graphic traversal and just before the swap of buffers. |
260 | //! @param theClientData [in] the client data for the callback. |
261 | virtual void SetWindow (const Handle(Aspect_Window)& theWindow, |
262 | const Aspect_RenderingContext theContext = NULL, |
263 | const Aspect_GraphicCallbackProc& theDisplayCB = NULL, |
264 | const Standard_Address theClientData = NULL) = 0; |
265 | |
266 | //! Returns the window associated to the view. |
267 | virtual Handle(Aspect_Window) Window() const = 0; |
268 | |
269 | //! Returns True if the window associated to the view is defined. |
270 | virtual Standard_Boolean IsDefined() const = 0; |
271 | |
272 | //! Displays z-buffer trihedron. |
273 | virtual void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER, |
274 | const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, |
275 | const Standard_Real theScale = 0.02, |
276 | const Standard_Boolean theAsWireframe = Standard_True) = 0; |
277 | |
278 | //! Erases z-buffer trihedron. |
279 | virtual void TriedronErase() = 0; |
280 | |
281 | //! Setup parameters of z-buffer trihedron. |
282 | virtual void ZBufferTriedronSetup (const Quantity_NameOfColor theXColor = Quantity_NOC_RED, |
283 | const Quantity_NameOfColor theYColor = Quantity_NOC_GREEN, |
284 | const Quantity_NameOfColor theZColor = Quantity_NOC_BLUE1, |
285 | const Standard_Real theSizeRatio = 0.8, |
286 | const Standard_Real theAxisDiametr = 0.05, |
287 | const Standard_Integer theNbFacettes = 12) = 0; |
288 | |
289 | //! Displays trihedron echo. |
290 | virtual void TriedronEcho (const Aspect_TypeOfTriedronEcho theType = Aspect_TOTE_NONE) = 0; |
291 | |
292 | //! Returns data of a graduated trihedron |
293 | virtual const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() = 0; |
294 | |
295 | //! Displays Graduated Trihedron. |
296 | virtual void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData) = 0; |
297 | |
298 | //! Erases Graduated Trihedron. |
299 | virtual void GraduatedTrihedronErase() = 0; |
300 | |
301 | //! Sets minimum and maximum points of scene bounding box for Graduated Trihedron stored in graphic view object. |
302 | //! @param theMin [in] the minimum point of scene. |
303 | //! @param theMax [in] the maximum point of scene. |
304 | virtual void GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax) = 0; |
305 | |
306 | //! Reads depths of shown pixels of the given rectangle. |
307 | virtual void ReadDepths (const Standard_Integer theX, |
308 | const Standard_Integer theY, |
309 | const Standard_Integer theWidth, |
310 | const Standard_Integer theHeight, |
311 | const Standard_Address theBuffer) const = 0; |
312 | |
313 | //! Dump active rendering buffer into specified memory buffer. |
314 | virtual Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0; |
315 | |
316 | //! Print the contents of the view to the printer. |
317 | //! @param thePrinterDC pass the PrinterDeviceContext (HDC) |
318 | //! @param theToShowBackground when set to FALSE then print the view without background |
319 | //! color (background is white) else set to TRUE for printing |
320 | //! with current background color |
321 | //! @param theFileName if != NULL, then the view will be printed to a file |
322 | //! @param thePrintAlgorithm select print algorithm: stretch, tile |
323 | //! @param theScaleFactor scaling coefficient, used internally to scale the printings |
324 | //! accordingly to the scale factor selected in the printer properties dialog |
325 | //! @return Standard_True if the data is passed to the printer, otherwise Standard_False if |
326 | //! the print operation failed due to the printer errors, or lack of system memory. This might be related |
327 | //! to insufficient memory or some internal errors. |
328 | //! All this errors are indicated by the message boxes (on level of OpenGl_GraphicDriver). |
329 | //! Warning: This function can reuse FBO assigned to the view, please take it into account |
330 | //! if you use it for your purposes. |
331 | virtual Standard_Boolean Print (const Aspect_Handle thePrinterDC, |
332 | const Standard_Boolean theToShowBackground, |
333 | const Standard_CString theFileName, |
334 | const Aspect_PrintAlgo thePrintAlgorithm = Aspect_PA_STRETCH, |
335 | const Standard_Real theScaleFactor = 1.0) = 0; |
336 | |
337 | //! Export scene into the one of the Vector graphics formats (SVG, PS, PDF...). |
338 | //! In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits |
339 | //! on printing to laser printer). Notice however that results may differ a lot and |
340 | //! do not contain some elements. |
341 | virtual Standard_Boolean Export (const Standard_CString theFileName, |
342 | const Graphic3d_ExportFormat theFormat, |
343 | const Graphic3d_SortType theSortType = Graphic3d_ST_BSP_Tree) = 0; |
344 | |
345 | //! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated. |
346 | virtual void InvalidateBVHData (const Standard_Integer theLayerId) = 0; |
347 | |
348 | //! Add a new top-level z layer with ID <theLayerId> for |
349 | //! the view. Z layers allow drawing structures in higher layers |
350 | //! in foreground of structures in lower layers. To add a structure |
351 | //! to desired layer on display it is necessary to set the layer |
352 | //! ID for the structure. |
353 | virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0; |
354 | |
355 | //! Remove Z layer from the specified view. All structures |
356 | //! displayed at the moment in layer will be displayed in default layer |
357 | //! ( the bottom-level z layer ). To unset layer ID from associated |
358 | //! structures use method UnsetZLayer (...). |
359 | virtual void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0; |
360 | |
361 | //! Sets the settings for a single Z layer of specified view. |
362 | virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, |
363 | const Graphic3d_ZLayerSettings& theSettings) = 0; |
364 | |
365 | //! Returns pointer to an assigned framebuffer object. |
366 | virtual Graphic3d_PtrFrameBuffer FBO() const = 0; |
367 | |
368 | //! Sets framebuffer object for offscreen rendering. |
369 | virtual void SetFBO (const Graphic3d_PtrFrameBuffer theFBO) = 0; |
370 | |
371 | //! Generate offscreen FBO in the graphic library. |
372 | //! If not supported on hardware returns NULL. |
373 | virtual Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, |
374 | const Standard_Integer theHeight) = 0; |
375 | |
376 | //! Remove offscreen FBO from the graphic library |
377 | virtual void FBORelease (Graphic3d_PtrFrameBuffer& theFBOPtr) = 0; |
378 | |
379 | //! Read offscreen FBO configuration. |
380 | virtual void FBOGetDimensions (const Graphic3d_PtrFrameBuffer theFBOPtr, |
381 | Standard_Integer& theWidth, |
382 | Standard_Integer& theHeight, |
383 | Standard_Integer& theWidthMax, |
384 | Standard_Integer& theHeightMax) = 0; |
385 | |
386 | //! Change offscreen FBO viewport. |
387 | virtual void FBOChangeViewport (Graphic3d_PtrFrameBuffer& theFBOPtr, |
388 | const Standard_Integer theWidth, |
389 | const Standard_Integer theHeight) = 0; |
bf75be98 |
390 | |
391 | public: |
392 | |
c357e426 |
393 | //! Copy visualization settings from another view. |
394 | //! Method is used for cloning views in viewer when its required to create view |
395 | //! with same view properties. |
396 | Standard_EXPORT virtual void CopySettings (const Handle(Graphic3d_CView)& theOther); |
397 | |
398 | //! Returns current rendering parameters and effect settings. |
399 | const Graphic3d_RenderingParams& RenderingParams() const { return myRenderParams; } |
400 | |
401 | //! Returns reference to current rendering parameters and effect settings. |
402 | Graphic3d_RenderingParams& ChangeRenderingParams() { return myRenderParams; } |
403 | |
404 | //! Returns true if anti-aliasing is enabled for the view. |
405 | virtual Standard_Boolean IsAntialiasingEnabled() const = 0; |
406 | |
407 | //! Enable or disable anti-aliasing in the view. |
408 | virtual void SetAntialiasingEnabled (const Standard_Boolean theIsEnabled) = 0; |
409 | |
410 | //! Returns background fill color. |
411 | virtual Aspect_Background Background() const = 0; |
412 | |
413 | //! Sets background fill color. |
414 | virtual void SetBackground (const Aspect_Background& theBackground) = 0; |
415 | |
416 | //! Returns gradient background fill colors. |
417 | virtual Aspect_GradientBackground GradientBackground() const = 0; |
418 | |
419 | //! Sets gradient background fill colors. |
420 | virtual void SetGradientBackground (const Aspect_GradientBackground& theBackground) = 0; |
421 | |
422 | //! Returns background image texture file path. |
423 | virtual TCollection_AsciiString BackgroundImage() = 0; |
424 | |
425 | //! Sets background image texture file path. |
426 | virtual void SetBackgroundImage (const TCollection_AsciiString& theFilePath) = 0; |
427 | |
428 | //! Returns background image fill style. |
429 | virtual Aspect_FillMethod BackgroundImageStyle() const = 0; |
430 | |
431 | //! Sets background image fill style. |
432 | virtual void SetBackgroundImageStyle (const Aspect_FillMethod theFillStyle) = 0; |
433 | |
434 | //! Returns environment texture set for the view. |
435 | virtual Handle(Graphic3d_TextureEnv) TextureEnv() const = 0; |
436 | |
437 | //! Sets environment texture for the view. |
438 | virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) = 0; |
439 | |
440 | //! Returns the state of frustum culling optimization. |
441 | virtual Standard_Boolean IsCullingEnabled() const = 0; |
442 | |
443 | //! Enables or disables frustum culling optimization. |
444 | virtual void SetCullingEnabled (const Standard_Boolean theIsEnabled) = 0; |
445 | |
446 | //! Returns shading model of the view. |
447 | virtual Graphic3d_TypeOfShadingModel ShadingModel() const = 0; |
448 | |
449 | //! Sets shading model of the view. |
450 | virtual void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel) = 0; |
451 | |
452 | //! Returns surface detail type of the view. |
453 | virtual Graphic3d_TypeOfSurfaceDetail SurfaceDetailType() const = 0; |
454 | |
455 | //! Sets surface detail type of the view. |
456 | virtual void SetSurfaceDetailType (const Graphic3d_TypeOfSurfaceDetail theType) = 0; |
bf75be98 |
457 | |
c357e426 |
458 | //! Return backfacing model used for the view. |
459 | virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0; |
bf75be98 |
460 | |
c357e426 |
461 | //! Sets backfacing model for the view. |
462 | virtual void SetBackfacingModel (const Graphic3d_TypeOfBackfacingModel theModel) = 0; |
bf75be98 |
463 | |
c357e426 |
464 | //! Returns camera object of the view. |
465 | virtual const Handle(Graphic3d_Camera)& Camera() const = 0; |
bf75be98 |
466 | |
c357e426 |
467 | //! Sets camera used by the view. |
468 | virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) = 0; |
bf75be98 |
469 | |
c357e426 |
470 | //! Returns the activity of back z-clipping plane. |
471 | virtual Standard_Boolean BackZClippingIsOn() const = 0; |
bf75be98 |
472 | |
c357e426 |
473 | //! Activates the back Z-clipping plane. |
474 | virtual void SetBackZClippingOn (const Standard_Boolean theIsOn) = 0; |
bf75be98 |
475 | |
c357e426 |
476 | //! Returns the definition of the back Z-clipping plane. |
477 | virtual Standard_Real ZClippingBackPlane() const = 0; |
bf75be98 |
478 | |
c357e426 |
479 | //! Sets the definition of the back Z-clipping plane. |
480 | virtual void SetZClippingBackPlane (const Standard_Real theValue) = 0; |
bf75be98 |
481 | |
c357e426 |
482 | //! Returns the activity of front z-clipping plane. |
483 | virtual Standard_Boolean FrontZClippingIsOn() const = 0; |
e276548b |
484 | |
c357e426 |
485 | //! Activates the front Z-clipping plane. |
486 | virtual void SetFrontZClippingOn (const Standard_Boolean theIsOn) = 0; |
e276548b |
487 | |
c357e426 |
488 | //! Returns the definition of the front Z-clipping plane. |
489 | virtual Standard_Real ZClippingFrontPlane() const = 0; |
b7cd4ba7 |
490 | |
c357e426 |
491 | //! Sets the definition of the front Z-clipping plane. |
492 | virtual void SetZClippingFrontPlane (const Standard_Real theValue) = 0; |
493 | |
494 | //! Returns the activity of depth cueing. |
495 | virtual Standard_Boolean DepthCueingIsOn() const = 0; |
496 | |
497 | //! Sets the activity of depth cueing. |
498 | virtual void SetDepthCueingOn (const Standard_Boolean theIsOn) = 0; |
499 | |
500 | //! Returns the back depth cueing plane. |
501 | virtual Standard_Real DepthCueingBackPlane() const = 0; |
502 | |
503 | //! Set the back depth cueing plane. |
504 | virtual void SetDepthCueingBackPlane (const Standard_Real theValue) = 0; |
505 | |
506 | //! Returns the front depth cueing plane. |
507 | virtual Standard_Real DepthCueingFrontPlane() const = 0; |
508 | |
509 | //! Set the front depth cueing plane. |
510 | virtual void SetDepthCueingFrontPlane (const Standard_Real theValue) = 0; |
511 | |
512 | //! Returns true if GL lighting is enabled. |
513 | virtual Standard_Boolean IsGLLightEnabled() const = 0; |
514 | |
515 | //! Sets GL lighting enabled or disable state. |
516 | virtual void SetGLLightEnabled (const Standard_Boolean theIsEnabled) = 0; |
517 | |
518 | //! Returns list of lights of the view. |
519 | virtual const Graphic3d_ListOfCLight& Lights() const = 0; |
520 | |
521 | //! Sets list of lights for the view. |
522 | virtual void SetLights (const Graphic3d_ListOfCLight& theLights) = 0; |
523 | |
524 | //! Returns list of clip planes set for the view. |
525 | virtual const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const = 0; |
526 | |
527 | //! Sets list of clip planes for the view. |
528 | virtual void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) = 0; |
529 | |
530 | private: |
531 | |
532 | //! Adds the structure to display lists of the view. |
533 | virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure, |
534 | const Standard_Integer thePriority) = 0; |
535 | |
536 | //! Erases the structure from display lists of the view. |
537 | virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) = 0; |
538 | |
539 | //! Change Z layer of a structure already presented in view. |
540 | virtual void changeZLayer (const Handle(Graphic3d_CStructure)& theCStructure, |
541 | const Graphic3d_ZLayerId theNewLayerId) = 0; |
542 | |
543 | //! Changes the priority of a structure within its Z layer in the specified view. |
544 | virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure, |
545 | const Standard_Integer theNewPriority) = 0; |
546 | |
547 | protected: |
548 | |
549 | struct CachedMinMax |
550 | { |
551 | CachedMinMax() { Invalidate(); } |
552 | |
553 | Bnd_Box& BoundingBox (const Standard_Boolean theToIgnoreInfiniteFlag) |
554 | { |
555 | return !theToIgnoreInfiniteFlag ? myBoundingBox[0] : myBoundingBox[1]; |
556 | } |
557 | Standard_Boolean& IsOutdated (const Standard_Boolean theToIgnoreInfiniteFlag) |
558 | { |
559 | return !theToIgnoreInfiniteFlag ? myIsOutdated[0] : myIsOutdated[1]; |
560 | } |
561 | void Invalidate() |
562 | { |
563 | myIsOutdated[0] = Standard_True; |
564 | myIsOutdated[1] = Standard_True; |
565 | } |
566 | |
567 | Standard_Boolean myIsOutdated [2]; |
568 | Bnd_Box myBoundingBox[2]; |
569 | }; |
570 | |
571 | protected: |
572 | |
573 | Standard_Integer myId; |
574 | Graphic3d_RenderingParams myRenderParams; |
575 | Handle(Graphic3d_StructureManager) myStructureManager; |
576 | Graphic3d_SequenceOfStructure myStructsToCompute; |
577 | Graphic3d_SequenceOfStructure myStructsComputed; |
578 | Graphic3d_MapOfStructure myStructsDisplayed; |
579 | Handle(Graphic3d_NMapOfTransient) myHiddenObjects; |
580 | Standard_Boolean myIsInComputedMode; |
581 | Standard_Boolean myIsActive; |
582 | Standard_Boolean myIsRemoved; |
583 | Graphic3d_TypeOfVisualization myVisualization; |
584 | mutable CachedMinMax myMinMax; |
585 | |
586 | private: |
587 | |
588 | DEFINE_STANDARD_RTTI (Graphic3d_CView, Graphic3d_DataStructureManager) |
bf75be98 |
589 | }; |
590 | |
c357e426 |
591 | #endif // _Graphic3d_CView_HeaderFile |