#define _OpenGl_View_Header
#include <MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
+#include <Standard_Type.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <NCollection_List.hxx>
+#include <math_BullardGenerator.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Aspect_FillMethod.hxx>
#include <Graphic3d_CView.hxx>
#include <Graphic3d_GraduatedTrihedron.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
+#include <Graphic3d_WorldViewProjState.hxx>
#include <Graphic3d_ZLayerSettings.hxx>
#include <Visual3d_TypeOfSurfaceDetail.hxx>
#include <Visual3d_TypeOfModel.hxx>
#include <OpenGl_Trihedron.hxx>
#include <OpenGl_GraduatedTrihedron.hxx>
-#include <Handle_OpenGl_Context.hxx>
-#include <Handle_OpenGl_GraphicDriver.hxx>
-#include <Handle_OpenGl_Workspace.hxx>
-#include <Handle_OpenGl_View.hxx>
-#include <Handle_OpenGl_Texture.hxx>
struct OPENGL_ZCLIP
{
struct OpenGl_Matrix;
class OpenGl_Structure;
-class Handle(OpenGl_PrinterContext);
class OpenGl_StateCounter;
+class OpenGl_View;
+DEFINE_STANDARD_HANDLE(OpenGl_View,MMgt_TShared)
+
class OpenGl_View : public MMgt_TShared
{
public:
- OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext, OpenGl_StateCounter* theCounter);
- virtual ~OpenGl_View ();
+ Standard_EXPORT OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext, OpenGl_StateCounter* theCounter);
+ Standard_EXPORT virtual ~OpenGl_View ();
- void ReleaseGlResources (const Handle(OpenGl_Context)& theCtx);
+ Standard_EXPORT void ReleaseGlResources (const Handle(OpenGl_Context)& theCtx);
void SetTextureEnv (const Handle(OpenGl_Context)& theCtx,
const Handle(Graphic3d_TextureEnv)& theTexture);
Standard_Integer Backfacing () const { return myBackfacing; }
- const TEL_TRANSFORM_PERSISTENCE * BeginTransformPersistence (const Handle(OpenGl_Context)& theCtx,
- const TEL_TRANSFORM_PERSISTENCE *theTransPers,
- Standard_Integer theWidth,
- Standard_Integer theHeight);
- void EndTransformPersistence (const Handle(OpenGl_Context)& theCtx);
-
//! Add structure to display list with specified priority.
//! The structure will be added to associated with it z layer.
//! If the z layer is not presented in the view, the structure will
const Aspect_CLayer2d& theCOverLayer,
const Standard_Boolean theToDrawImmediate);
-
void DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace);
//! Returns list of OpenGL Z-layers.
OpenGl_LayerList myZLayers; //!< main list of displayed structure, sorted by layers
OpenGl_IndexedMapOfStructure myImmediateList; //!< list of immediate structures rendered on top of main presentation
- const TEL_TRANSFORM_PERSISTENCE *myTransPers;
- Standard_Boolean myIsTransPers;
-
//! Modification state
- Standard_Size myProjectionState;
- Standard_Size myModelViewState;
+ Graphic3d_WorldViewProjState myWorldViewProjState;
OpenGl_StateCounter* myStateCounter;
Standard_Size myCurrLightSourceState;
{
OpenGl_RT_aPosition,
+ // camera position
OpenGl_RT_uOriginLT,
OpenGl_RT_uOriginLB,
OpenGl_RT_uOriginRT,
OpenGl_RT_uDirectRB,
OpenGl_RT_uUnviewMat,
+ // 3D scene params
OpenGl_RT_uSceneRad,
OpenGl_RT_uSceneEps,
OpenGl_RT_uLightAmbnt,
OpenGl_RT_uLightCount,
- OpenGl_RT_uShadEnabled,
- OpenGl_RT_uReflEnabled,
- OpenGl_RT_uEnvMapEnable,
+ // background params
+ OpenGl_RT_uBackColorTop,
+ OpenGl_RT_uBackColorBot,
+
+ // ray-tracing params
+ OpenGl_RT_uShadowsEnabled,
+ OpenGl_RT_uReflectEnabled,
+ OpenGl_RT_uSphereMapEnabled,
+ OpenGl_RT_uSphereMapForBack,
+ OpenGl_RT_uTexSamplersArray,
+ OpenGl_RT_uBlockedRngEnabled,
+ // sampled frame params
+ OpenGl_RT_uSampleWeight,
+ OpenGl_RT_uFrameRndSeed,
+
+ // adaptive FSAA params
OpenGl_RT_uOffsetX,
OpenGl_RT_uOffsetY,
OpenGl_RT_uSamples,
- OpenGl_RT_uWinSizeX,
- OpenGl_RT_uWinSizeY,
-
- OpenGl_RT_uTextures,
OpenGl_RT_NbVariables // special field
};
OpenGl_RT_RaytraceMaterialTexture = 9,
OpenGl_RT_RaytraceLightSrcTexture = 10,
- OpenGl_RT_FSAAInputTexture = 11,
+ OpenGl_RT_FsaaInputTexture = 11,
+ OpenGl_RT_PrevAccumTexture = 12,
- OpenGl_RT_OpenGlColorTexture = 12,
- OpenGl_RT_OpenGlDepthTexture = 13
+ OpenGl_RT_OpenGlColorTexture = 13,
+ OpenGl_RT_OpenGlDepthTexture = 14
};
//! Tool class for management of shader sources.
{
public:
+ //! Default shader prefix - empty string.
+ static const TCollection_AsciiString EMPTY_PREFIX;
+
//! Creates new uninitialized shader source.
ShaderSource()
{
//
}
- //! Creates new shader source from specified file.
- ShaderSource (const TCollection_AsciiString& theFileName)
+ public:
+
+ //! Returns error description in case of load fail.
+ const TCollection_AsciiString& ErrorDescription() const
{
- Load (&theFileName, 1);
+ return myError;
}
- public:
-
//! Returns prefix to insert before the source.
const TCollection_AsciiString& Prefix() const
{
TCollection_AsciiString Source() const;
//! Loads shader source from specified files.
- void Load (const TCollection_AsciiString* theFileNames, const Standard_Integer theCount);
+ Standard_Boolean Load (const TCollection_AsciiString* theFileNames, const TCollection_AsciiString& thePrefix = EMPTY_PREFIX);
private:
TCollection_AsciiString mySource; //!< Source string of the shader object
TCollection_AsciiString myPrefix; //!< Prefix to insert before the source
+ TCollection_AsciiString myError; //!< error state
};
//! Enables/disables light propagation through transparent media.
Standard_Boolean TransparentShadows;
+ //! Enables/disables global illumination (GI) effects.
+ Standard_Boolean GlobalIllumination;
+
//! Enables/disables the use of OpenGL bindless textures.
Standard_Boolean UseBindlessTextures;
: StackSize (THE_DEFAULT_STACK_SIZE),
NbBounces (THE_DEFAULT_NB_BOUNCES),
TransparentShadows (Standard_False),
+ GlobalIllumination (Standard_False),
UseBindlessTextures (Standard_False)
{
//
const Handle(OpenGl_Context)& theGlContext);
//! Adds OpenGL groups to ray-traced scene geometry.
- Standard_Boolean addRaytraceGroups (const OpenGl_Structure* theStructure,
- const Standard_Integer theStructMat,
- const Standard_ShortReal* theTransform,
- const Handle(OpenGl_Context)& theGlContext);
+ Standard_Boolean addRaytraceGroups (const OpenGl_Structure* theStructure,
+ const OpenGl_RaytraceMaterial& theStructMat,
+ const Standard_ShortReal* theTransform,
+ const Handle(OpenGl_Context)& theGlContext);
//! Creates ray-tracing material properties.
OpenGl_RaytraceMaterial convertMaterial (const OpenGl_AspectFace* theAspect,
const ShaderSource& theSource,
const Handle(OpenGl_Context)& theGlContext);
+ //! Creates shader program from the given vertex and fragment shaders.
+ Handle(OpenGl_ShaderProgram) initProgram (const Handle(OpenGl_Context)& theGlContext,
+ const Handle(OpenGl_ShaderObject)& theVertShader,
+ const Handle(OpenGl_ShaderObject)& theFragShader);
+
//! Initializes OpenGL/GLSL shader programs.
Standard_Boolean initRaytraceResources (const Graphic3d_CView& theCView,
const Handle(OpenGl_Context)& theGlContext);
Handle(OpenGl_ShaderProgram) myRaytraceProgram;
//! OpenGL/GLSL adaptive-AA shader program.
Handle(OpenGl_ShaderProgram) myPostFSAAProgram;
+ //! OpenGL/GLSL program for displaying texture.
+ Handle(OpenGl_ShaderProgram) myOutImageProgram;
//! Texture buffer of data records of bottom-level BVH nodes.
Handle(OpenGl_TextureBufferArb) mySceneNodeInfoTexture;
//! PrimitiveArray to TriangleSet map for scene partial update.
std::map<Standard_Size, OpenGl_TriangleSet*> myArrayToTrianglesMap;
- //! Graphical ray-tracing filter to filter out all raytracable structures.
+ //! Set of IDs of non-raytracable elements (to detect updates).
+ std::set<Standard_Integer> myNonRaytraceStructureIDs;
+
+ //! Render filter to filter out all raytracable structures.
Handle(OpenGl_RaytraceFilter) myRaytraceFilter;
//! Marks if environment map should be updated.
Standard_Boolean myToUpdateEnvironmentMap;
//! State of OpenGL layer list.
- Standard_Size myLayersModificationStatus;
+ Standard_Size myLayerListState;
+
+ //! Number of accumulated frames (for progressive rendering).
+ Standard_Integer myAccumFrames;
+
+ //! Stored ray origins used for detection of camera movements.
+ OpenGl_Vec3 myPreviousOrigins[3];
+
+ //! Bullard RNG to produce random sequence.
+ math_BullardGenerator myRNG;
public:
DEFINE_STANDARD_ALLOC
- DEFINE_STANDARD_RTTI(OpenGl_View) // Type definition
+ DEFINE_STANDARD_RTTI(OpenGl_View, MMgt_TShared) // Type definition
friend class OpenGl_Workspace;