0024847: CLang warnings -Wdeprecated-writable-strings in OpenGl_Display
[occt.git] / src / OpenGl / OpenGl_Workspace.hxx
CommitLineData
b311480e 1// Created on: 2011-09-20
2// Created by: Sergey ZERCHANINOV
1981cb22 3// Copyright (c) 2011-2013 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
2166f0fa
SK
16#ifndef _OpenGl_Workspace_Header
17#define _OpenGl_Workspace_Header
18
fc73a202 19#include <map>
20#include <set>
e276548b 21
2166f0fa
SK
22#include <Handle_OpenGl_Workspace.hxx>
23#include <OpenGl_Window.hxx>
24
25#include <TColStd_Array2OfReal.hxx>
26#include <Quantity_Color.hxx>
bf75be98 27#include <Graphic3d_CView.hxx>
2166f0fa 28#include <Graphic3d_TypeOfComposition.hxx>
bf75be98 29#include <Graphic3d_TypeOfTexture.hxx>
30#include <Graphic3d_PtrFrameBuffer.hxx>
31#include <Graphic3d_BufferType.hxx>
32#include <Handle_Graphic3d_TextureParams.hxx>
2166f0fa 33
2166f0fa
SK
34#include <Aspect_CLayer2d.hxx>
35#include <Aspect_Handle.hxx>
36#include <Aspect_PrintAlgo.hxx>
2166f0fa
SK
37
38#include <InterfaceGraphic_Graphic3d.hxx>
39#include <InterfaceGraphic_Visual3d.hxx>
40
1981cb22 41#include <NCollection_Sequence.hxx>
42
bf75be98 43#include <OpenGl_AspectFace.hxx>
fc73a202 44#include <OpenGl_FrameBuffer.hxx>
2166f0fa
SK
45#include <OpenGl_Matrix.hxx>
46#include <OpenGl_NamedStatus.hxx>
a174a3c5 47#include <OpenGl_PrinterContext.hxx>
fc73a202 48#include <OpenGl_SceneGeometry.hxx>
2166f0fa 49#include <OpenGl_TextParam.hxx>
4269bd1b 50#include <OpenGl_RenderFilter.hxx>
0adbd30f 51#include <OpenGl_Vec.hxx>
73192b37 52#include <OpenGl_LineAttributes.hxx>
2166f0fa
SK
53
54#include <Handle_OpenGl_View.hxx>
bf75be98 55#include <Handle_OpenGl_Texture.hxx>
2166f0fa 56
fc73a202 57#include <OpenGl_ShaderObject.hxx>
58#include <OpenGl_ShaderProgram.hxx>
59#include <OpenGl_TextureBufferArb.hxx>
60
2166f0fa 61class OpenGl_AspectLine;
2166f0fa
SK
62class OpenGl_AspectMarker;
63class OpenGl_AspectText;
64class OpenGl_FrameBuffer;
65class OpenGl_Structure;
4269bd1b 66class OpenGl_Element;
692613e5 67class Image_PixMap;
2166f0fa 68
0adbd30f 69//! OpenGL material definition
70struct OpenGl_Material
71{
72
73 OpenGl_Vec4 Ambient; //!< ambient reflection coefficient
74 OpenGl_Vec4 Diffuse; //!< diffuse reflection coefficient
75 OpenGl_Vec4 Specular; //!< glossy reflection coefficient
76 OpenGl_Vec4 Emission; //!< material emission
77 OpenGl_Vec4 Params; //!< extra packed parameters
78
79 Standard_ShortReal Shine() const { return Params.x(); }
80 Standard_ShortReal& ChangeShine() { return Params.x(); }
81
82 Standard_ShortReal Transparency() const { return Params.y(); }
83 Standard_ShortReal& ChangeTransparency() { return Params.y(); }
84
85 //! Initialize material
86 void Init (const OPENGL_SURF_PROP& theProps);
87
88 //! Returns packed (serialized) representation of material properties
89 const OpenGl_Vec4* Packed() const { return reinterpret_cast<const OpenGl_Vec4*> (this); }
90 static Standard_Integer NbOfVec4() { return 5; }
91
92};
93
e276548b 94//! Represents window with GL context.
95//! Provides methods to render primitives and maintain GL state.
2166f0fa
SK
96class OpenGl_Workspace : public OpenGl_Window
97{
98public:
99
100 //! Main constructor - prepare GL context for specified window.
73192b37 101 OpenGl_Workspace (const Handle(Aspect_DisplayConnection)& theDisplayConnection,
2166f0fa 102 const CALL_DEF_WINDOW& theCWindow,
5e27df78 103 Aspect_RenderingContext theGContext,
58655684 104 const Handle(OpenGl_Caps)& theCaps,
5e27df78 105 const Handle(OpenGl_Context)& theShareCtx);
2166f0fa
SK
106
107 //! Destructor
108 virtual ~OpenGl_Workspace();
109
110 void SetActiveView (const Handle(OpenGl_View)& theView) { myView = theView; }
111 const Handle(OpenGl_View)& ActiveView () const { return myView; }
112
113 //! Redraw the window.
114 void Redraw (const Graphic3d_CView& theCView,
115 const Aspect_CLayer2d& theCUnderLayer,
116 const Aspect_CLayer2d& theCOverLayer);
117
679ecdee 118 Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer);
119 void RedrawImmediate (const Graphic3d_CView& theCView,
120 const Aspect_CLayer2d& theCUnderLayer,
121 const Aspect_CLayer2d& theCOverLayer,
122 const Standard_Boolean theToForce = Standard_False);
123
124 void Invalidate (const Graphic3d_CView& /*theCView*/)
2166f0fa 125 {
679ecdee 126 myBackBufferRestored = Standard_False;
2166f0fa
SK
127 }
128
129 //! Special method to perform printing.
130 //! System-specific and currently only Win platform implemented.
a174a3c5 131 Standard_Boolean Print (const Handle(OpenGl_PrinterContext)& thePrintContext,
132 const Graphic3d_CView& theCView,
bf75be98 133 const Aspect_CLayer2d& theCUnderLayer,
2166f0fa
SK
134 const Aspect_CLayer2d& theCOverLayer,
135 const Aspect_Handle theHPrintDC,
136 const Standard_Boolean theToShowBackground,
137 const Standard_CString theFileName,
138 const Aspect_PrintAlgo thePrintAlgorithm,
139 const Standard_Real theScaleFactor);
140
a174a3c5 141 const Handle(OpenGl_PrinterContext)& PrinterContext() const
142 {
143 return myPrintContext;
144 }
145
2166f0fa
SK
146 void DisplayCallback (const Graphic3d_CView& theCView, int theReason);
147
2166f0fa
SK
148 Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
149 void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
692613e5 150 Standard_Boolean BufferDump (OpenGl_FrameBuffer* theFBOPtr,
151 Image_PixMap& theImage,
152 const Graphic3d_BufferType& theBufferType);
2166f0fa 153
2166f0fa
SK
154 void UseTransparency (const Standard_Boolean theFlag);
155 Standard_Boolean& UseZBuffer() { return myUseZBuffer; }
156 Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
157 Standard_Boolean& UseGLLight() { return myUseGLLight; }
158
73192b37 159 Standard_Integer AntiAliasingMode() const { return myAntiAliasingMode; }
160
2166f0fa
SK
161 //// RELATED TO STATUS ////
162
163 Standard_Integer NamedStatus;
164
2166f0fa
SK
165 const TEL_COLOUR* HighlightColor;
166
167 const OpenGl_Matrix* SetViewMatrix (const OpenGl_Matrix* );
30f0ad28 168 const OpenGl_Matrix* SetStructureMatrix (const OpenGl_Matrix*, bool aRevert = false);
2166f0fa 169
0f8c0fb8 170 //! Updates current model-view matrix
171 //! replacing it with StructureMatrixT*ViewMatrix from the workspace.
172 const void UpdateModelViewMatrix();
173
2166f0fa
SK
174 const OpenGl_AspectLine* SetAspectLine (const OpenGl_AspectLine* theAspect);
175 const OpenGl_AspectFace* SetAspectFace (const OpenGl_AspectFace* theAspect);
176 const OpenGl_AspectMarker* SetAspectMarker (const OpenGl_AspectMarker* theAspect);
177 const OpenGl_AspectText* SetAspectText (const OpenGl_AspectText* theAspect);
178
179 void SetTextParam (const OpenGl_TextParam* theParam) { TextParam_set = theParam; }
180
3946774d 181 //// THESE METHODS ARE EXPORTED AS THEY PROVIDE STATE INFO TO USERDRAW
182 Standard_EXPORT const OpenGl_AspectLine* AspectLine (const Standard_Boolean theWithApply);
183 Standard_EXPORT const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply);
184 Standard_EXPORT const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply);
185 Standard_EXPORT const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply);
a174a3c5 186 inline const OpenGl_TextParam* AspectTextParams() const
187 {
188 return TextParam_applied;
189 }
2166f0fa 190
34a44cbd 191 //! Clear the applied aspect state.
192 void ResetAppliedAspect();
193
bf75be98 194 Standard_EXPORT Handle(OpenGl_Texture) DisableTexture();
195 Standard_EXPORT Handle(OpenGl_Texture) EnableTexture (const Handle(OpenGl_Texture)& theTexture,
196 const Handle(Graphic3d_TextureParams)& theParams = NULL);
197
4269bd1b 198 //! Set filter for restricting rendering of particular elements.
199 //! Filter can be applied for rendering passes used by recursive
200 //! rendering algorithms for rendering elements of groups.
201 //! @param theFilter [in] the filter instance.
202 inline void SetRenderFilter (const Handle(OpenGl_RenderFilter)& theFilter)
203 {
5322131b 204 myRenderFilter = theFilter;
4269bd1b 205 }
206
207 //! Get rendering filter.
208 //! @return filter instance.
5322131b 209 inline const Handle(OpenGl_RenderFilter)& GetRenderFilter() const
210 {
211 return myRenderFilter;
4269bd1b 212 }
213
214 //! @return applied view matrix.
215 inline const OpenGl_Matrix* ViewMatrix() const { return ViewMatrix_applied; }
216
217 //! @return applied model structure matrix.
218 inline const OpenGl_Matrix* ModelMatrix() const { return StructureMatrix_applied; }
219
2166f0fa
SK
220protected:
221
679ecdee 222 //! Copy content of Back buffer to the Front buffer
223 void copyBackToFront();
2166f0fa
SK
224
225 virtual Standard_Boolean Activate();
226
679ecdee 227 void redraw1 (const Graphic3d_CView& theCView,
bf75be98 228 const Aspect_CLayer2d& theCUnderLayer,
2166f0fa 229 const Aspect_CLayer2d& theCOverLayer,
679ecdee 230 const int theToSwap);
2166f0fa 231
0adbd30f 232 void updateMaterial (const int theFlag);
2166f0fa 233
bf75be98 234 void setTextureParams (Handle(OpenGl_Texture)& theTexture,
235 const Handle(Graphic3d_TextureParams)& theParams);
2166f0fa 236
fc73a202 237protected:
e276548b 238
fc73a202 239 //! Result of OpenGL shaders initialization.
240 enum RaytraceInitStatus
241 {
242 OpenGl_RT_NONE,
243 OpenGl_RT_INIT,
244 OpenGl_RT_FAIL
245 };
e276548b 246
84c71f29 247 //! Describes update mode (state).
248 enum GeomUpdateMode
249 {
250 OpenGl_GUM_CHECK, //!< check if geometry update is necessary
251 OpenGl_GUM_PREPARE, //!< collect unchanged objects
252 OpenGl_GUM_UPDATE //!< update raytracing data, rebuild changed objects
253 };
254
fc73a202 255 //! Defines frequently used shader variables.
256 enum ShaderVariableIndex
257 {
258 OpenGl_RT_aPosition,
259
260 OpenGl_RT_uOriginLT,
261 OpenGl_RT_uOriginLB,
262 OpenGl_RT_uOriginRT,
263 OpenGl_RT_uOriginRB,
264
265 OpenGl_RT_uDirectLT,
266 OpenGl_RT_uDirectLB,
267 OpenGl_RT_uDirectRT,
268 OpenGl_RT_uDirectRB,
269
270 OpenGl_RT_uSceneRad,
271 OpenGl_RT_uSceneEps,
272
273 OpenGl_RT_uLightAmbnt,
274 OpenGl_RT_uLightCount,
275
276 OpenGl_RT_uShadEnabled,
277 OpenGl_RT_uReflEnabled,
278
279 OpenGl_RT_uInputTexture,
280
281 OpenGl_RT_uOffsetX,
282 OpenGl_RT_uOffsetY,
283 OpenGl_RT_uSamples,
284
84c71f29 285 OpenGl_RT_uEnvironmentEnable,
286
fc73a202 287 OpenGl_RT_NbVariables // special field
288 };
e276548b 289
fc73a202 290 //! Defines texture samplers.
291 enum ShaderSamplerNames
292 {
293 OpenGl_RT_SceneNodeInfoTexture = 0,
294 OpenGl_RT_SceneMinPointTexture = 1,
295 OpenGl_RT_SceneMaxPointTexture = 2,
296
297 OpenGl_RT_ObjectNodeInfoTexture = 3,
298 OpenGl_RT_ObjectMinPointTexture = 4,
299 OpenGl_RT_ObjectMaxPointTexture = 5,
300
301 OpenGl_RT_GeometryVertexTexture = 6,
302 OpenGl_RT_GeometryNormalTexture = 7,
303 OpenGl_RT_GeometryTriangTexture = 8,
e276548b 304
fc73a202 305 OpenGl_RT_EnvironmentMapTexture = 9,
306
307 OpenGl_RT_RaytraceMaterialTexture = 10,
308 OpenGl_RT_RaytraceLightSrcTexture = 11,
309
84c71f29 310 OpenGl_RT_FSAAInputTexture = 12,
311
312 OpenGl_RT_SceneTransformTexture = 13
fc73a202 313 };
314
315 //! Tool class for management of shader sources.
316 class ShaderSource
e276548b 317 {
fc73a202 318 public:
319
320 //! Creates new uninitialized shader source.
321 ShaderSource()
322 {
323 //
324 }
325
326 //! Creates new shader source from specified file.
327 ShaderSource (const TCollection_AsciiString& theFileName)
328 {
329 Load (&theFileName, 1);
330 }
331
332 public:
333
334 //! Returns prefix to insert before the source.
335 const TCollection_AsciiString& Prefix() const
336 {
337 return myPrefix;
338 }
339
340 //! Sets prefix to insert before the source.
341 void SetPrefix (const TCollection_AsciiString& thePrefix)
342 {
343 myPrefix = thePrefix;
344 }
345
346 //! Returns shader source combined with prefix.
347 TCollection_AsciiString Source() const;
348
349 //! Loads shader source from specified files.
350 void Load (const TCollection_AsciiString* theFileNames, const Standard_Integer theCount);
351
352 private:
353
354 TCollection_AsciiString mySource; //!< Source string of the shader object
355 TCollection_AsciiString myPrefix; //!< Prefix to insert before the source
356
e276548b 357 };
358
fc73a202 359 //! Default size of traversal stack.
360 static const Standard_Integer THE_DEFAULT_STACK_SIZE = 24;
361
e276548b 362protected: //! @name methods related to ray-tracing
363
364 //! Updates 3D scene geometry for ray-tracing.
84c71f29 365 Standard_Boolean UpdateRaytraceGeometry (GeomUpdateMode theMode);
e276548b 366
367 //! Checks to see if the structure is modified.
368 Standard_Boolean CheckRaytraceStructure (const OpenGl_Structure* theStructure);
369
370 //! Updates 3D scene light sources for ray-tracing.
371 Standard_Boolean UpdateRaytraceLightSources (const GLdouble theInvModelView[16]);
372
373 //! Updates environment map for ray-tracing.
374 Standard_Boolean UpdateRaytraceEnvironmentMap();
5322131b 375
e276548b 376 //! Adds OpenGL structure to ray-traced scene geometry.
265d4508 377 Standard_Boolean AddRaytraceStructure (const OpenGl_Structure* theStructure,
378 const Standard_ShortReal* theTransform, std::set<const OpenGl_Structure*>& theElements);
e276548b 379
380 //! Adds OpenGL primitive array to ray-traced scene geometry.
265d4508 381 OpenGl_TriangleSet* AddRaytracePrimitiveArray (
84c71f29 382 const OpenGl_PrimitiveArray* theArray, int theMatID, const Standard_ShortReal* theTrans);
e276548b 383
384 //! Adds vertex indices from OpenGL primitive array to ray-traced scene geometry.
871fa103 385 Standard_Boolean AddRaytraceVertexIndices (OpenGl_TriangleSet& theSet,
386 const OpenGl_PrimitiveArray& theArray,
387 Standard_Integer theOffset,
388 Standard_Integer theCount,
389 Standard_Integer theMatID);
e276548b 390
391 //! Adds OpenGL triangle array to ray-traced scene geometry.
871fa103 392 Standard_Boolean AddRaytraceTriangleArray (OpenGl_TriangleSet& theSet,
393 const Handle(Graphic3d_IndexBuffer)& theIndices,
394 Standard_Integer theOffset,
395 Standard_Integer theCount,
396 Standard_Integer theMatID);
e276548b 397
398 //! Adds OpenGL triangle fan array to ray-traced scene geometry.
871fa103 399 Standard_Boolean AddRaytraceTriangleFanArray (OpenGl_TriangleSet& theSet,
400 const Handle(Graphic3d_IndexBuffer)& theIndices,
401 Standard_Integer theOffset,
402 Standard_Integer theCount,
403 Standard_Integer theMatID);
e276548b 404
265d4508 405 //! Adds OpenGL triangle strip array to ray-traced scene geometry.
871fa103 406 Standard_Boolean AddRaytraceTriangleStripArray (OpenGl_TriangleSet& theSet,
407 const Handle(Graphic3d_IndexBuffer)& theIndices,
408 Standard_Integer theOffset,
409 Standard_Integer theCount,
410 Standard_Integer theMatID);
e276548b 411
412 //! Adds OpenGL quadrangle array to ray-traced scene geometry.
871fa103 413 Standard_Boolean AddRaytraceQuadrangleArray (OpenGl_TriangleSet& theSet,
414 const Handle(Graphic3d_IndexBuffer)& theIndices,
415 Standard_Integer theOffset,
416 Standard_Integer theCount,
417 Standard_Integer theMatID);
e276548b 418
419 //! Adds OpenGL quadrangle strip array to ray-traced scene geometry.
871fa103 420 Standard_Boolean AddRaytraceQuadrangleStripArray (OpenGl_TriangleSet& theSet,
421 const Handle(Graphic3d_IndexBuffer)& theIndices,
422 Standard_Integer theOffset,
423 Standard_Integer theCount,
424 Standard_Integer theMatID);
e276548b 425
426 //! Adds OpenGL polygon array to ray-traced scene geometry.
871fa103 427 Standard_Boolean AddRaytracePolygonArray (OpenGl_TriangleSet& theSet,
428 const Handle(Graphic3d_IndexBuffer)& theIndices,
429 Standard_Integer theOffset,
430 Standard_Integer theCount,
431 Standard_Integer theMatID);
e276548b 432
fc73a202 433 //! Loads and compiles shader object from specified source.
434 Handle(OpenGl_ShaderObject) LoadShader (const ShaderSource& theSource, GLenum theType);
435
436 //! Performs safe exit when shaders initialization fails.
437 Standard_Boolean SafeFailBack (const TCollection_ExtendedString& theMessage);
438
439 //! Initializes OpenGL/GLSL shader programs.
440 Standard_Boolean InitRaytraceResources();
5322131b 441
fc73a202 442 //! Releases OpenGL/GLSL shader programs.
443 void ReleaseRaytraceResources();
e276548b 444
fc73a202 445 //! Uploads ray-trace data to the GPU.
446 Standard_Boolean UploadRaytraceData();
e276548b 447
fc73a202 448 //! Resizes OpenGL frame buffers.
449 Standard_Boolean ResizeRaytraceBuffers (const Standard_Integer theSizeX,
450 const Standard_Integer theSizeY);
e276548b 451
fc73a202 452 //! Generates viewing rays for corners of screen quad.
453 void UpdateCamera (const NCollection_Mat4<GLdouble>& theOrientation,
454 const NCollection_Mat4<GLdouble>& theViewMapping,
455 OpenGl_Vec3 theOrigins[4],
456 OpenGl_Vec3 theDirects[4]);
e276548b 457
fc73a202 458 //! Runs ray-tracing shader programs.
459 Standard_Boolean RunRaytraceShaders (const Graphic3d_CView& theCView,
460 const Standard_Integer theSizeX,
461 const Standard_Integer theSizeY,
462 const OpenGl_Vec3 theOrigins[4],
463 const OpenGl_Vec3 theDirects[4],
464 OpenGl_FrameBuffer* theFrameBuffer);
265d4508 465
fc73a202 466 //! Redraws the window using OpenGL/GLSL ray-tracing.
e276548b 467 Standard_Boolean Raytrace (const Graphic3d_CView& theCView,
fc73a202 468 const Standard_Integer theSizeX,
469 const Standard_Integer theSizeY,
470 const Standard_Boolean theToSwap,
471 OpenGl_FrameBuffer* theFrameBuffer);
e276548b 472
473protected: //! @name fields related to ray-tracing
474
fc73a202 475 //! Result of shaders initialization.
476 RaytraceInitStatus myComputeInitStatus;
e276548b 477
478 //! Is geometry data valid?
479 Standard_Boolean myIsRaytraceDataValid;
5322131b 480
e276548b 481 //! 3D scene geometry data for ray-tracing.
265d4508 482 OpenGl_RaytraceGeometry myRaytraceGeometry;
e276548b 483
484 //! Radius of bounding sphere of the scene.
265d4508 485 Standard_ShortReal myRaytraceSceneRadius;
e276548b 486 //! Scene epsilon to prevent self-intersections.
265d4508 487 Standard_ShortReal myRaytraceSceneEpsilon;
e276548b 488
fc73a202 489 //! Actual size of traversal stack in shader program.
490 Standard_Integer myTraversalStackSize;
491
492 //! OpenGL/GLSL source of ray-tracing fragment shader.
493 ShaderSource myRaytraceShaderSource;
494 //! OpenGL/GLSL source of adaptive-AA fragment shader.
495 ShaderSource myPostFSAAShaderSource;
496
497 //! OpenGL/GLSL ray-tracing fragment shader.
498 Handle(OpenGl_ShaderObject) myRaytraceShader;
499 //! OpenGL/GLSL adaptive-AA fragment shader.
500 Handle(OpenGl_ShaderObject) myPostFSAAShader;
501
502 //! OpenGL/GLSL ray-tracing shader program.
503 Handle(OpenGl_ShaderProgram) myRaytraceProgram;
504 //! OpenGL/GLSL adaptive-AA shader program.
505 Handle(OpenGl_ShaderProgram) myPostFSAAProgram;
506
507 //! Texture buffer of data records of high-level BVH nodes.
508 Handle(OpenGl_TextureBufferArb) mySceneNodeInfoTexture;
509 //! Texture buffer of minimum points of high-level BVH nodes.
510 Handle(OpenGl_TextureBufferArb) mySceneMinPointTexture;
511 //! Texture buffer of maximum points of high-level BVH nodes.
512 Handle(OpenGl_TextureBufferArb) mySceneMaxPointTexture;
84c71f29 513 //! Texture buffer of transformations of high-level BVH nodes.
514 Handle(OpenGl_TextureBufferArb) mySceneTransformTexture;
fc73a202 515
516 //! Texture buffer of data records of bottom-level BVH nodes.
517 Handle(OpenGl_TextureBufferArb) myObjectNodeInfoTexture;
518 //! Texture buffer of minimum points of bottom-level BVH nodes.
519 Handle(OpenGl_TextureBufferArb) myObjectMinPointTexture;
520 //! Texture buffer of maximum points of bottom-level BVH nodes.
521 Handle(OpenGl_TextureBufferArb) myObjectMaxPointTexture;
522
523 //! Texture buffer of vertex coords.
524 Handle(OpenGl_TextureBufferArb) myGeometryVertexTexture;
525 //! Texture buffer of vertex normals.
526 Handle(OpenGl_TextureBufferArb) myGeometryNormalTexture;
527 //! Texture buffer of triangle indices.
528 Handle(OpenGl_TextureBufferArb) myGeometryTriangTexture;
529
530 //! Texture buffer of material properties.
531 Handle(OpenGl_TextureBufferArb) myRaytraceMaterialTexture;
532 //! Texture buffer of light source properties.
533 Handle(OpenGl_TextureBufferArb) myRaytraceLightSrcTexture;
534
535 //! Vertex buffer (VBO) for drawing dummy quad.
536 OpenGl_VertexBuffer myRaytraceScreenQuad;
537
538 //! Framebuffer (FBO) to perform adaptive FSAA.
539 Handle(OpenGl_FrameBuffer) myRaytraceFBO1;
540 //! Framebuffer (FBO) to perform adaptive FSAA.
541 Handle(OpenGl_FrameBuffer) myRaytraceFBO2;
265d4508 542
e276548b 543 //! State of OpenGL view.
544 Standard_Size myViewModificationStatus;
e276548b 545 //! State of OpenGL layer list.
546 Standard_Size myLayersModificationStatus;
547
265d4508 548 //! State of OpenGL structures reflected to ray-tracing.
e276548b 549 std::map<const OpenGl_Structure*, Standard_Size> myStructureStates;
550
84c71f29 551 //! PrimitiveArray to TriangleSet map for scene partial update.
552 std::map<const OpenGl_PrimitiveArray*, OpenGl_TriangleSet*> myArrayToTrianglesMap;
553
fc73a202 554 //! Cached locations of frequently used uniform variables.
555 Standard_Integer myUniformLocations[2][OpenGl_RT_NbVariables];
e276548b 556
bf75be98 557protected: //! @name protected fields
2166f0fa 558
a174a3c5 559 Handle(OpenGl_PrinterContext) myPrintContext;
73192b37 560 Handle(OpenGl_View) myView;
561 Handle(OpenGl_LineAttributes) myLineAttribs;
562 Standard_Integer myAntiAliasingMode;
1981cb22 563 Standard_Boolean myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
679ecdee 564 Standard_Boolean myBackBufferRestored;
565 Standard_Boolean myIsImmediateDrawn; //!< flag indicates that immediate mode buffer contains some data
bf75be98 566 Standard_Boolean myUseTransparency;
567 Standard_Boolean myUseZBuffer;
568 Standard_Boolean myUseDepthTest;
569 Standard_Boolean myUseGLLight;
2166f0fa 570
bf75be98 571protected: //! @name fields related to status
572
4269bd1b 573 Handle(OpenGl_RenderFilter) myRenderFilter;
bf75be98 574 Handle(OpenGl_Texture) myTextureBound; //!< currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
2166f0fa
SK
575 const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied;
576 const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied;
577 const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied;
578 const OpenGl_AspectText *AspectText_set, *AspectText_applied;
579
580 const OpenGl_TextParam *TextParam_set, *TextParam_applied;
581
582 const OpenGl_Matrix* ViewMatrix_applied;
583 const OpenGl_Matrix* StructureMatrix_applied;
584
3b1817a9 585 OpenGl_Material myMatFront; //!< current front material state (cached to reduce GL context updates)
586 OpenGl_Material myMatBack; //!< current back material state
587 OpenGl_Material myMatTmp; //!< temporary variable
588 TelCullMode myCullingMode; //!< back face culling mode, applied from face aspect
0adbd30f 589
0f8c0fb8 590 //! Model matrix with applied structure transformations
591 OpenGl_Matrix myModelViewMatrix;
592
2166f0fa
SK
593 const TEL_POFFSET_PARAM* PolygonOffset_applied;
594
bf75be98 595 OpenGl_AspectFace myAspectFaceHl; // Hiddenline aspect
596
597public: //! @name type definition
2166f0fa 598
bf75be98 599 DEFINE_STANDARD_RTTI(OpenGl_Workspace)
1c35b92f 600 DEFINE_STANDARD_ALLOC
2166f0fa
SK
601
602};
603
bf75be98 604#endif // _OpenGl_Workspace_Header