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