1 // Created on: 2011-09-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _OpenGl_View_Header
17 #define _OpenGl_View_Header
19 #include <MMgt_TShared.hxx>
20 #include <Standard_DefineHandle.hxx>
22 #include <TColStd_Array2OfReal.hxx>
23 #include <NCollection_List.hxx>
25 #include <Quantity_NameOfColor.hxx>
26 #include <Aspect_FillMethod.hxx>
27 #include <Aspect_GradientFillMethod.hxx>
28 #include <Aspect_TypeOfTriedronPosition.hxx>
29 #include <Aspect_CLayer2d.hxx>
31 #include <InterfaceGraphic_Graphic3d.hxx>
32 #include <InterfaceGraphic_Visual3d.hxx>
34 #include <Graphic3d_CView.hxx>
35 #include <Graphic3d_GraduatedTrihedron.hxx>
36 #include <Graphic3d_SequenceOfHClipPlane.hxx>
37 #include <Graphic3d_ZLayerSettings.hxx>
38 #include <Visual3d_TypeOfSurfaceDetail.hxx>
39 #include <Visual3d_TypeOfModel.hxx>
41 #include <OpenGl_AspectFace.hxx>
42 #include <OpenGl_BackgroundArray.hxx>
43 #include <OpenGl_BVHTreeSelector.hxx>
44 #include <OpenGl_LayerList.hxx>
45 #include <OpenGl_Light.hxx>
46 #include <OpenGl_LineAttributes.hxx>
47 #include <OpenGl_Trihedron.hxx>
48 #include <OpenGl_GraduatedTrihedron.hxx>
50 #include <Handle_OpenGl_Context.hxx>
51 #include <Handle_OpenGl_GraphicDriver.hxx>
52 #include <Handle_OpenGl_Workspace.hxx>
53 #include <Handle_OpenGl_View.hxx>
54 #include <Handle_OpenGl_Texture.hxx>
59 Standard_Boolean IsOn;
60 Standard_ShortReal Limit; /* in the range [0., 1.] */
63 Standard_Boolean IsOn;
64 Standard_ShortReal Limit; /* in the range [0., 1.] */
70 Standard_Boolean IsOn;
71 Standard_ShortReal Front; /* in the range [0., 1.] */
72 Standard_ShortReal Back; /* in the range [0., 1.] */
77 class OpenGl_Structure;
78 class Handle(OpenGl_PrinterContext);
79 class OpenGl_StateCounter;
81 class OpenGl_View : public MMgt_TShared
84 OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext, OpenGl_StateCounter* theCounter);
85 virtual ~OpenGl_View ();
87 void ReleaseGlResources (const Handle(OpenGl_Context)& theCtx);
89 void SetTextureEnv (const Handle(OpenGl_Context)& theCtx,
90 const Handle(Graphic3d_TextureEnv)& theTexture);
91 void SetSurfaceDetail (const Visual3d_TypeOfSurfaceDetail AMode);
92 void SetBackfacing (const Standard_Integer AMode);
93 void SetLights (const CALL_DEF_VIEWCONTEXT &AContext);
94 void SetAntiAliasing (const Standard_Boolean AMode) { myAntiAliasing = AMode; }
95 void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane &thePlanes) { myClipPlanes = thePlanes; }
96 void SetVisualisation (const CALL_DEF_VIEWCONTEXT &AContext);
98 const Handle(Graphic3d_Camera)& Camera() { return myCamera; }
99 void SetCamera (const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
101 void SetClipLimit (const Graphic3d_CView& theCView);
103 void SetFog (const Graphic3d_CView& theCView, const Standard_Boolean theFlag);
105 OpenGl_Trihedron& ChangeTrihedron() { return myTrihedron; }
106 void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition,
107 const Quantity_NameOfColor theColor,
108 const Standard_Real theScale,
109 const Standard_Boolean theAsWireframe);
110 void TriedronErase (const Handle(OpenGl_Context)& theCtx);
112 OpenGl_GraduatedTrihedron& ChangeGraduatedTrihedron() { return myGraduatedTrihedron; }
113 void GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
114 const Graphic3d_GraduatedTrihedron& theCubic);
115 void GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx);
117 Standard_Real Height () const { return myCamera->ViewDimensions().X(); }
118 Standard_Real Width () const { return myCamera->ViewDimensions().Y(); }
120 Standard_Integer Backfacing () const { return myBackfacing; }
122 const TEL_TRANSFORM_PERSISTENCE * BeginTransformPersistence (const Handle(OpenGl_Context)& theCtx,
123 const TEL_TRANSFORM_PERSISTENCE *theTransPers,
124 Standard_Integer theWidth,
125 Standard_Integer theHeight);
126 void EndTransformPersistence (const Handle(OpenGl_Context)& theCtx);
128 //! Add structure to display list with specified priority.
129 //! The structure will be added to associated with it z layer.
130 //! If the z layer is not presented in the view, the structure will
131 //! be displayed in default bottom-level z layer.
132 void DisplayStructure (const Handle(Graphic3d_Structure)& theStructure,
133 const Standard_Integer thePriority);
135 //! Erase structure from display list.
136 void EraseStructure (const Handle(Graphic3d_Structure)& theStructure);
138 //! Add structure to the list of immediate structures.
139 void DisplayImmediateStructure (const Handle(Graphic3d_Structure)& theStructure);
141 //! Erase structure from display list.
142 void EraseImmediateStructure (const OpenGl_Structure* theStructure);
144 //! Insert a new top-level z layer with ID <theLayerId>
145 void AddZLayer (const Graphic3d_ZLayerId theLayerId);
147 //! Remove a z layer with ID <theLayerId>
148 void RemoveZLayer (const Graphic3d_ZLayerId theLayerId);
150 //! Display structure in z layer with ID <theNewLayerId>
151 //! If the layer with ID <theNewLayerId> is not presented in the view,
152 //! the structure will be displayed in default bottom-level layer.
153 void ChangeZLayer (const OpenGl_Structure* theStructure,
154 const Graphic3d_ZLayerId theNewLayerId);
156 //! Sets the settings for a single Z layer of specified view.
157 void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
158 const Graphic3d_ZLayerSettings& theSettings);
160 //! Changes the priority of a structure within its ZLayer
161 void ChangePriority (const OpenGl_Structure* theStructure,
162 const Standard_Integer theNewPriority);
164 void CreateBackgroundTexture (const Standard_CString AFileName,
165 const Aspect_FillMethod AFillStyle);
167 void SetBackgroundTextureStyle (const Aspect_FillMethod FillStyle);
168 void SetBackgroundGradient (const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod AType);
169 void SetBackgroundGradientType (const Aspect_GradientFillMethod AType);
171 void Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
172 const Handle(OpenGl_Workspace)& theWorkspace,
173 OpenGl_FrameBuffer* theReadDrawFbo,
174 Graphic3d_Camera::Projection theProjection,
175 const Graphic3d_CView& theCView,
176 const Aspect_CLayer2d& theCUnderLayer,
177 const Aspect_CLayer2d& theCOverLayer,
178 const Standard_Boolean theToDrawImmediate);
181 void DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace);
183 //! Returns list of OpenGL Z-layers.
184 const OpenGl_LayerList& LayerList() const { return myZLayers; }
186 //! Returns list of openGL light sources.
187 const OpenGl_ListOfLight& LightList() const { return myLights; }
189 //! Returns OpenGL environment map.
190 const Handle(OpenGl_Texture)& TextureEnv() const { return myTextureEnv; }
192 //! Returns visualization mode for objects in the view.
193 Visual3d_TypeOfSurfaceDetail SurfaceDetail() const { return mySurfaceDetail; }
195 //! Returns selector for BVH tree, providing a possibility to store information
196 //! about current view volume and to detect which objects are overlapping it.
197 OpenGl_BVHTreeSelector& BVHTreeSelector() { return myBVHSelector; }
199 //! Marks BVH tree for given priority list as dirty and
200 //! marks primitive set for rebuild.
201 void InvalidateBVHData (const Standard_Integer theLayerId);
203 //! Returns list of immediate structures rendered on top of main presentation
204 const OpenGl_IndexedMapOfStructure& ImmediateStructures() const
206 return myImmediateList;
209 //! Returns true if there are immediate structures to display
210 bool HasImmediateStructures() const
212 return !myImmediateList.IsEmpty()
213 || myZLayers.NbImmediateStructures() != 0;
218 void RenderStructs (const Handle(OpenGl_Workspace)& theWorkspace,
219 OpenGl_FrameBuffer* theReadDrawFbo,
220 const Graphic3d_CView& theCView,
221 const Standard_Boolean theToDrawImmediate);
223 void RedrawLayer2d (const Handle(OpenGl_PrinterContext)& thePrintContext,
224 const Handle(OpenGl_Workspace)& theWorkspace,
225 const Graphic3d_CView& theCView,
226 const Aspect_CLayer2d& theCLayer);
228 void RedrawTrihedron (const Handle(OpenGl_Workspace) &theWorkspace);
230 //! Redraw contents of model scene: clipping planes,
231 //! lights, structures. The peculiar properties of "scene" is that
232 //! it requires empty Z-Buffer and uses projection and orientation
233 //! matrices supplied by 3d view.
234 void RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintContext,
235 const Handle(OpenGl_Workspace)& theWorkspace,
236 OpenGl_FrameBuffer* theReadDrawFbo,
237 const Graphic3d_CView& theCView,
238 const Standard_Boolean theToDrawImmediate);
240 Handle(OpenGl_LineAttributes) myLineAttribs;
241 Handle(OpenGl_Texture) myTextureEnv;
242 Visual3d_TypeOfSurfaceDetail mySurfaceDetail;
243 Standard_Integer myBackfacing;
245 OPENGL_ZCLIP myZClip;
247 Graphic3d_SequenceOfHClipPlane myClipPlanes;
249 Handle(Graphic3d_Camera) myCamera;
252 OpenGl_Trihedron myTrihedron;
253 OpenGl_GraduatedTrihedron myGraduatedTrihedron;
254 bool myToShowTrihedron;
255 bool myToShowGradTrihedron;
257 //View_LABViewContext
259 Visual3d_TypeOfModel myShadingModel; //!< lighting shading model
262 OpenGl_ListOfLight myLights;
266 Standard_Boolean myAntiAliasing;
268 //View_LABDepthCueing - fixed index used
270 OpenGl_LayerList myZLayers; //!< main list of displayed structure, sorted by layers
271 OpenGl_IndexedMapOfStructure myImmediateList; //!< list of immediate structures rendered on top of main presentation
273 const TEL_TRANSFORM_PERSISTENCE *myTransPers;
274 Standard_Boolean myIsTransPers;
276 //! Modification state
277 Standard_Size myProjectionState;
278 Standard_Size myModelViewState;
279 OpenGl_StateCounter* myStateCounter;
281 Standard_Size myCurrLightSourceState;
283 typedef std::pair<Standard_Size, Standard_Size> StateInfo;
285 StateInfo myLastOrientationState;
286 StateInfo myLastViewMappingState;
287 StateInfo myLastLightSourceState;
289 //! Is needed for selection of overlapping objects and storage of the current view volume
290 OpenGl_BVHTreeSelector myBVHSelector;
292 protected: //! @name Background parameters
294 OpenGl_AspectFace* myTextureParams; //!< Stores texture and its parameters for textured background
295 OpenGl_BackgroundArray* myBgGradientArray; //!< Primitive array for gradient background
296 OpenGl_BackgroundArray* myBgTextureArray; //!< Primitive array for texture background
298 protected: //! @name data types related to ray-tracing
300 //! Result of OpenGL shaders initialization.
301 enum RaytraceInitStatus
308 //! Describes update mode (state).
309 enum RaytraceUpdateMode
311 OpenGl_GUM_CHECK, //!< check geometry state
312 OpenGl_GUM_PREPARE, //!< collect unchanged objects
313 OpenGl_GUM_REBUILD //!< rebuild changed and new objects
316 //! Defines frequently used shader variables.
317 enum ShaderVariableIndex
329 OpenGl_RT_uUnviewMat,
333 OpenGl_RT_uLightAmbnt,
334 OpenGl_RT_uLightCount,
336 OpenGl_RT_uShadEnabled,
337 OpenGl_RT_uReflEnabled,
338 OpenGl_RT_uEnvMapEnable,
348 OpenGl_RT_NbVariables // special field
351 //! Defines texture samplers.
352 enum ShaderSamplerNames
354 OpenGl_RT_SceneNodeInfoTexture = 0,
355 OpenGl_RT_SceneMinPointTexture = 1,
356 OpenGl_RT_SceneMaxPointTexture = 2,
357 OpenGl_RT_SceneTransformTexture = 3,
359 OpenGl_RT_GeometryVertexTexture = 4,
360 OpenGl_RT_GeometryNormalTexture = 5,
361 OpenGl_RT_GeometryTexCrdTexture = 6,
362 OpenGl_RT_GeometryTriangTexture = 7,
364 OpenGl_RT_EnvironmentMapTexture = 8,
366 OpenGl_RT_RaytraceMaterialTexture = 9,
367 OpenGl_RT_RaytraceLightSrcTexture = 10,
369 OpenGl_RT_FSAAInputTexture = 11,
371 OpenGl_RT_OpenGlColorTexture = 12,
372 OpenGl_RT_OpenGlDepthTexture = 13
375 //! Tool class for management of shader sources.
380 //! Creates new uninitialized shader source.
386 //! Creates new shader source from specified file.
387 ShaderSource (const TCollection_AsciiString& theFileName)
389 Load (&theFileName, 1);
394 //! Returns prefix to insert before the source.
395 const TCollection_AsciiString& Prefix() const
400 //! Sets prefix to insert before the source.
401 void SetPrefix (const TCollection_AsciiString& thePrefix)
403 myPrefix = thePrefix;
406 //! Returns shader source combined with prefix.
407 TCollection_AsciiString Source() const;
409 //! Loads shader source from specified files.
410 void Load (const TCollection_AsciiString* theFileNames, const Standard_Integer theCount);
414 TCollection_AsciiString mySource; //!< Source string of the shader object
415 TCollection_AsciiString myPrefix; //!< Prefix to insert before the source
419 //! Default ray-tracing depth.
420 static const Standard_Integer THE_DEFAULT_NB_BOUNCES = 3;
422 //! Default size of traversal stack.
423 static const Standard_Integer THE_DEFAULT_STACK_SIZE = 24;
425 //! Compile-time ray-tracing parameters.
426 struct RaytracingParams
428 //! Actual size of traversal stack in shader program.
429 Standard_Integer StackSize;
431 //! Actual ray-tracing depth (number of ray bounces).
432 Standard_Integer NbBounces;
434 //! Enables/disables light propagation through transparent media.
435 Standard_Boolean TransparentShadows;
437 //! Enables/disables the use of OpenGL bindless textures.
438 Standard_Boolean UseBindlessTextures;
440 //! Creates default compile-time ray-tracing parameters.
442 : StackSize (THE_DEFAULT_STACK_SIZE),
443 NbBounces (THE_DEFAULT_NB_BOUNCES),
444 TransparentShadows (Standard_False),
445 UseBindlessTextures (Standard_False)
451 //! Describes state of OpenGL structure.
454 Standard_Size StructureState;
455 Standard_Size InstancedState;
457 //! Creates new structure state.
458 StructState (const Standard_Size theStructureState = 0,
459 const Standard_Size theInstancedState = 0)
460 : StructureState (theStructureState),
461 InstancedState (theInstancedState)
466 //! Creates new structure state.
467 StructState (const OpenGl_Structure* theStructure)
469 StructureState = theStructure->ModificationState();
471 InstancedState = theStructure->InstancedStructure() != NULL ?
472 theStructure->InstancedStructure()->ModificationState() : 0;
476 protected: //! @name methods related to ray-tracing
478 //! Updates 3D scene geometry for ray-tracing.
479 Standard_Boolean updateRaytraceGeometry (const RaytraceUpdateMode theMode,
480 const Standard_Integer theViewId,
481 const Handle(OpenGl_Context)& theGlContext);
483 //! Updates 3D scene light sources for ray-tracing.
484 Standard_Boolean updateRaytraceLightSources (const OpenGl_Mat4& theInvModelView, const Handle(OpenGl_Context)& theGlContext);
486 //! Updates environment map for ray-tracing.
487 Standard_Boolean updateRaytraceEnvironmentMap (const Handle(OpenGl_Context)& theGlContext);
489 //! Checks to see if the OpenGL structure is modified.
490 Standard_Boolean toUpdateStructure (const OpenGl_Structure* theStructure);
492 //! Adds OpenGL structure to ray-traced scene geometry.
493 Standard_Boolean addRaytraceStructure (const OpenGl_Structure* theStructure,
494 const Handle(OpenGl_Context)& theGlContext);
496 //! Adds OpenGL groups to ray-traced scene geometry.
497 Standard_Boolean addRaytraceGroups (const OpenGl_Structure* theStructure,
498 const Standard_Integer theStructMat,
499 const Standard_ShortReal* theTransform,
500 const Handle(OpenGl_Context)& theGlContext);
502 //! Creates ray-tracing material properties.
503 OpenGl_RaytraceMaterial convertMaterial (const OpenGl_AspectFace* theAspect,
504 const Handle(OpenGl_Context)& theGlContext);
506 //! Adds OpenGL primitive array to ray-traced scene geometry.
507 OpenGl_TriangleSet* addRaytracePrimitiveArray (const OpenGl_PrimitiveArray* theArray,
508 const Standard_Integer theMatID,
509 const OpenGl_Mat4* theTrans);
511 //! Adds vertex indices from OpenGL primitive array to ray-traced scene geometry.
512 Standard_Boolean addRaytraceVertexIndices (OpenGl_TriangleSet& theSet,
513 const Standard_Integer theMatID,
514 const Standard_Integer theCount,
515 const Standard_Integer theOffset,
516 const OpenGl_PrimitiveArray& theArray);
518 //! Adds OpenGL triangle array to ray-traced scene geometry.
519 Standard_Boolean addRaytraceTriangleArray (OpenGl_TriangleSet& theSet,
520 const Standard_Integer theMatID,
521 const Standard_Integer theCount,
522 const Standard_Integer theOffset,
523 const Handle(Graphic3d_IndexBuffer)& theIndices);
525 //! Adds OpenGL triangle fan array to ray-traced scene geometry.
526 Standard_Boolean addRaytraceTriangleFanArray (OpenGl_TriangleSet& theSet,
527 const Standard_Integer theMatID,
528 const Standard_Integer theCount,
529 const Standard_Integer theOffset,
530 const Handle(Graphic3d_IndexBuffer)& theIndices);
532 //! Adds OpenGL triangle strip array to ray-traced scene geometry.
533 Standard_Boolean addRaytraceTriangleStripArray (OpenGl_TriangleSet& theSet,
534 const Standard_Integer theMatID,
535 const Standard_Integer theCount,
536 const Standard_Integer theOffset,
537 const Handle(Graphic3d_IndexBuffer)& theIndices);
539 //! Adds OpenGL quadrangle array to ray-traced scene geometry.
540 Standard_Boolean addRaytraceQuadrangleArray (OpenGl_TriangleSet& theSet,
541 const Standard_Integer theMatID,
542 const Standard_Integer theCount,
543 const Standard_Integer theOffset,
544 const Handle(Graphic3d_IndexBuffer)& theIndices);
546 //! Adds OpenGL quadrangle strip array to ray-traced scene geometry.
547 Standard_Boolean addRaytraceQuadrangleStripArray (OpenGl_TriangleSet& theSet,
548 const Standard_Integer theMatID,
549 const Standard_Integer theCount,
550 const Standard_Integer theOffset,
551 const Handle(Graphic3d_IndexBuffer)& theIndices);
553 //! Adds OpenGL polygon array to ray-traced scene geometry.
554 Standard_Boolean addRaytracePolygonArray (OpenGl_TriangleSet& theSet,
555 const Standard_Integer theMatID,
556 const Standard_Integer theCount,
557 const Standard_Integer theOffset,
558 const Handle(Graphic3d_IndexBuffer)& theIndices);
560 //! Uploads ray-trace data to the GPU.
561 Standard_Boolean uploadRaytraceData (const Handle(OpenGl_Context)& theGlContext);
563 //! Generates shader prefix based on current ray-tracing options.
564 TCollection_AsciiString generateShaderPrefix (const Handle(OpenGl_Context)& theGlContext) const;
566 //! Performs safe exit when shaders initialization fails.
567 Standard_Boolean safeFailBack (const TCollection_ExtendedString& theMessage,
568 const Handle(OpenGl_Context)& theGlContext);
570 //! Loads and compiles shader object from specified source.
571 Handle(OpenGl_ShaderObject) initShader (const GLenum theType,
572 const ShaderSource& theSource,
573 const Handle(OpenGl_Context)& theGlContext);
575 //! Initializes OpenGL/GLSL shader programs.
576 Standard_Boolean initRaytraceResources (const Graphic3d_CView& theCView,
577 const Handle(OpenGl_Context)& theGlContext);
579 //! Releases OpenGL/GLSL shader programs.
580 void releaseRaytraceResources (const Handle(OpenGl_Context)& theGlContext);
582 //! Resizes OpenGL frame buffers.
583 Standard_Boolean resizeRaytraceBuffers (const Standard_Integer theSizeX,
584 const Standard_Integer theSizeY,
585 const Handle(OpenGl_Context)& theGlContext);
587 //! Generates viewing rays for corners of screen quad.
588 void updateCamera (const OpenGl_Mat4& theOrientation,
589 const OpenGl_Mat4& theViewMapping,
590 OpenGl_Vec3* theOrigins,
591 OpenGl_Vec3* theDirects,
592 OpenGl_Mat4& theUnView);
594 //! Binds ray-trace textures to corresponding texture units.
595 void bindRaytraceTextures (const Handle(OpenGl_Context)& theGlContext);
597 //! Unbinds ray-trace textures from corresponding texture unit.
598 void unbindRaytraceTextures (const Handle(OpenGl_Context)& theGlContext);
600 //! Sets uniform state for the given ray-tracing shader program.
601 Standard_Boolean setUniformState (const Graphic3d_CView& theCView,
602 const OpenGl_Vec3* theOrigins,
603 const OpenGl_Vec3* theDirects,
604 const OpenGl_Mat4& theUnviewMat,
605 const Standard_Integer theProgramId,
606 const Handle(OpenGl_Context)& theGlContext);
608 //! Runs ray-tracing shader programs.
609 Standard_Boolean runRaytraceShaders (const Graphic3d_CView& theCView,
610 const Standard_Integer theSizeX,
611 const Standard_Integer theSizeY,
612 const OpenGl_Vec3* theOrigins,
613 const OpenGl_Vec3* theDirects,
614 const OpenGl_Mat4& theUnviewMat,
615 OpenGl_FrameBuffer* theReadDrawFbo,
616 const Handle(OpenGl_Context)& theGlContext);
618 //! Redraws the window using OpenGL/GLSL ray-tracing.
619 Standard_Boolean raytrace (const Graphic3d_CView& theCView,
620 const Standard_Integer theSizeX,
621 const Standard_Integer theSizeY,
622 OpenGl_FrameBuffer* theReadDrawFbo,
623 const Handle(OpenGl_Context)& theGlContext);
625 protected: //! @name fields related to ray-tracing
627 //! Result of shaders initialization.
628 RaytraceInitStatus myRaytraceInitStatus;
630 //! Is geometry data valid?
631 Standard_Boolean myIsRaytraceDataValid;
633 //! Warning about missing extension GL_ARB_bindless_texture has been displayed?
634 Standard_Boolean myIsRaytraceWarnTextures;
636 //! 3D scene geometry data for ray-tracing.
637 OpenGl_RaytraceGeometry myRaytraceGeometry;
639 //! Compile-time ray-tracing parameters.
640 RaytracingParams myRaytraceParameters;
642 //! Radius of bounding sphere of the scene.
643 Standard_ShortReal myRaytraceSceneRadius;
644 //! Scene epsilon to prevent self-intersections.
645 Standard_ShortReal myRaytraceSceneEpsilon;
647 //! OpenGL/GLSL source of ray-tracing fragment shader.
648 ShaderSource myRaytraceShaderSource;
649 //! OpenGL/GLSL source of adaptive-AA fragment shader.
650 ShaderSource myPostFSAAShaderSource;
652 //! OpenGL/GLSL ray-tracing fragment shader.
653 Handle(OpenGl_ShaderObject) myRaytraceShader;
654 //! OpenGL/GLSL adaptive-AA fragment shader.
655 Handle(OpenGl_ShaderObject) myPostFSAAShader;
657 //! OpenGL/GLSL ray-tracing shader program.
658 Handle(OpenGl_ShaderProgram) myRaytraceProgram;
659 //! OpenGL/GLSL adaptive-AA shader program.
660 Handle(OpenGl_ShaderProgram) myPostFSAAProgram;
662 //! Texture buffer of data records of bottom-level BVH nodes.
663 Handle(OpenGl_TextureBufferArb) mySceneNodeInfoTexture;
664 //! Texture buffer of minimum points of bottom-level BVH nodes.
665 Handle(OpenGl_TextureBufferArb) mySceneMinPointTexture;
666 //! Texture buffer of maximum points of bottom-level BVH nodes.
667 Handle(OpenGl_TextureBufferArb) mySceneMaxPointTexture;
668 //! Texture buffer of transformations of high-level BVH nodes.
669 Handle(OpenGl_TextureBufferArb) mySceneTransformTexture;
671 //! Texture buffer of vertex coords.
672 Handle(OpenGl_TextureBufferArb) myGeometryVertexTexture;
673 //! Texture buffer of vertex normals.
674 Handle(OpenGl_TextureBufferArb) myGeometryNormalTexture;
675 //! Texture buffer of vertex UV coords.
676 Handle(OpenGl_TextureBufferArb) myGeometryTexCrdTexture;
677 //! Texture buffer of triangle indices.
678 Handle(OpenGl_TextureBufferArb) myGeometryTriangTexture;
680 //! Texture buffer of material properties.
681 Handle(OpenGl_TextureBufferArb) myRaytraceMaterialTexture;
682 //! Texture buffer of light source properties.
683 Handle(OpenGl_TextureBufferArb) myRaytraceLightSrcTexture;
685 //! 1st framebuffer (FBO) to perform adaptive FSAA.
686 Handle(OpenGl_FrameBuffer) myRaytraceFBO1;
687 //! 2nd framebuffer (FBO) to perform adaptive FSAA.
688 Handle(OpenGl_FrameBuffer) myRaytraceFBO2;
689 //! Framebuffer (FBO) for preliminary OpenGL output.
690 Handle(OpenGl_FrameBuffer) myOpenGlFBO;
692 //! Vertex buffer (VBO) for drawing dummy quad.
693 OpenGl_VertexBuffer myRaytraceScreenQuad;
695 //! Cached locations of frequently used uniform variables.
696 Standard_Integer myUniformLocations[2][OpenGl_RT_NbVariables];
698 //! State of OpenGL structures reflected to ray-tracing.
699 std::map<const OpenGl_Structure*, StructState> myStructureStates;
701 //! PrimitiveArray to TriangleSet map for scene partial update.
702 std::map<Standard_Size, OpenGl_TriangleSet*> myArrayToTrianglesMap;
704 //! Graphical ray-tracing filter to filter out all raytracable structures.
705 Handle(OpenGl_RaytraceFilter) myRaytraceFilter;
707 //! Marks if environment map should be updated.
708 Standard_Boolean myToUpdateEnvironmentMap;
710 //! State of OpenGL layer list.
711 Standard_Size myLayersModificationStatus;
715 DEFINE_STANDARD_ALLOC
716 DEFINE_STANDARD_RTTI(OpenGl_View) // Type definition
718 friend class OpenGl_Workspace;
722 #endif // _OpenGl_View_Header