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