Open CASCADE Technology  7.7.0
Public Member Functions | Data Fields | Static Public Attributes
OpenGl_RaytraceGeometry Class Reference

Stores geometry of ray-tracing scene. More...

#include <OpenGl_SceneGeometry.hxx>

Inheritance diagram for OpenGl_RaytraceGeometry:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_RaytraceGeometry ()
 Creates uninitialized ray-tracing geometry. More...
 
 ~OpenGl_RaytraceGeometry ()
 Releases resources of ray-tracing geometry. More...
 
void ClearMaterials ()
 Clears only ray-tracing materials. More...
 
virtual void Clear () override
 Clears ray-tracing geometry. More...
 
methods related to acceleration structure
Standard_Boolean ProcessAcceleration ()
 Performs post-processing of high-level scene BVH. More...
 
Standard_Integer AccelerationOffset (Standard_Integer theNodeIdx)
 Returns offset of bottom-level BVH for given leaf node. If the node index is not valid the function returns -1. More...
 
Standard_Integer VerticesOffset (Standard_Integer theNodeIdx)
 Returns offset of triangulation vertices for given leaf node. If the node index is not valid the function returns -1. More...
 
Standard_Integer ElementsOffset (Standard_Integer theNodeIdx)
 Returns offset of triangulation elements for given leaf node. If the node index is not valid the function returns -1. More...
 
OpenGl_TriangleSetTriangleSet (Standard_Integer theNodeIdx)
 Returns triangulation data for given leaf node. If the node index is not valid the function returns NULL. More...
 
const QuadBvhHandleQuadBVH ()
 Returns quad BVH (QBVH) tree produced from binary BVH. More...
 
methods related to texture management
Standard_Boolean HasTextures () const
 Checks if scene contains textured objects. More...
 
Standard_Integer AddTexture (const Handle< OpenGl_Texture > &theTexture)
 Adds new OpenGL texture to the scene and returns its index. More...
 
Standard_Boolean UpdateTextureHandles (const Handle< OpenGl_Context > &theContext)
 Updates unique 64-bit texture handles to use in shaders. More...
 
Standard_Boolean AcquireTextures (const Handle< OpenGl_Context > &theContext)
 Makes the OpenGL texture handles resident (must be called before using). More...
 
Standard_Boolean ReleaseTextures (const Handle< OpenGl_Context > &theContext) const
 Makes the OpenGL texture handles non-resident (must be called after using). More...
 
const std::vector< GLuint64 > & TextureHandles () const
 Returns array of texture handles. More...
 
void ReleaseResources (const Handle< OpenGl_Context > &)
 Releases OpenGL resources. More...
 
- Public Member Functions inherited from BVH_Geometry< Standard_ShortReal, 3 >
 BVH_Geometry ()
 Creates uninitialized BVH geometry. More...
 
 BVH_Geometry (const opencascade::handle< BVH_Builder< Standard_ShortReal, N > > &theBuilder)
 Creates uninitialized BVH geometry. More...
 
virtual ~BVH_Geometry ()
 Releases resources of BVH geometry. More...
 
virtual Standard_Boolean IsDirty () const
 Returns TRUE if geometry state should be updated. More...
 
virtual void MarkDirty ()
 Marks geometry as outdated. More...
 
virtual BVH_Box< Standard_ShortReal, N > Box () const override
 Returns AABB of the whole geometry. More...
 
virtual const opencascade::handle< BVH_Tree< Standard_ShortReal, N > > & BVH ()
 Returns BVH tree (and builds it if necessary). More...
 
virtual const opencascade::handle< BVH_Builder< Standard_ShortReal, N > > & Builder () const
 Returns the method (builder) used to construct BVH. More...
 
virtual void SetBuilder (const opencascade::handle< BVH_Builder< Standard_ShortReal, N > > &theBuilder)
 Sets the method (builder) used to construct BVH. More...
 
- Public Member Functions inherited from BVH_ObjectSet< Standard_ShortReal, N >
 BVH_ObjectSet ()
 Creates new set of geometric objects. More...
 
virtual ~BVH_ObjectSet ()
 Releases resources of set of geometric objects. More...
 
BVH_ObjectListObjects ()
 Returns reference to the array of geometric objects. More...
 
const BVH_ObjectListObjects () const
 Returns reference to the array of geometric objects. More...
 
virtual Standard_Integer Size () const override
 Return total number of objects. More...
 
virtual BVH_Box< Standard_ShortReal, N > Box (const Standard_Integer theIndex) const override
 Returns AABB of the given object. More...
 
virtual Standard_ShortReal Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const override
 Returns centroid position along the given axis. More...
 
virtual void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2) override
 Performs transposing the two given objects in the set. More...
 
- Public Member Functions inherited from BVH_Set< Standard_ShortReal, N >
 BVH_Set ()
 Creates new abstract set of objects. More...
 
virtual ~BVH_Set ()
 Releases resources of set of objects. More...
 

Data Fields

std::vector< OpenGl_RaytraceLight, NCollection_StdAllocator< OpenGl_RaytraceLight > > Sources
 Array of properties of light sources. More...
 
std::vector< OpenGl_RaytraceMaterial, NCollection_StdAllocator< OpenGl_RaytraceMaterial > > Materials
 Array of 'front' material properties. More...
 
BVH_Vec4f Ambient
 Global ambient from all light sources. More...
 

Static Public Attributes

static const Standard_Integer INVALID_OFFSET = -1
 Value of invalid offset to return in case of errors. More...
 
static const Standard_Integer MAX_TEX_NUMBER = 32
 Maximum number of textures used in ray-tracing shaders. This is not restriction of the solution implemented, but rather the reasonable limit of the number of textures in various applications (can be increased if needed). More...
 

auxiliary methods

NCollection_Vector< Handle< OpenGl_Texture > > myTextures
 Array of texture maps shared between rendered objects. More...
 
std::vector< GLuint64myTextureHandles
 Array of unique 64-bit texture handles obtained from OpenGL. More...
 
Standard_Integer myTopLevelTreeDepth
 Depth of high-level scene BVH from last build. More...
 
Standard_Integer myBotLevelTreeDepth
 Maximum depth of bottom-level scene BVHs from last build. More...
 
QuadBvhHandle myQuadBVH
 QBVH produced from binary BVH tree. More...
 
Standard_Integer TopLevelTreeDepth () const
 Returns depth of top-level scene BVH from last build. More...
 
Standard_Integer BotLevelTreeDepth () const
 Returns maximum depth of bottom-level scene BVHs from last build. More...
 

Additional Inherited Members

- Public Types inherited from BVH_ObjectSet< Standard_ShortReal, N >
typedef NCollection_Vector< opencascade::handle< BVH_Object< Standard_ShortReal, N > > > BVH_ObjectList
 Type of array of geometric objects. More...
 
- Public Types inherited from BVH_Set< Standard_ShortReal, N >
typedef BVH_Box< Standard_ShortReal, N > BVH_BoxNt
 
- Protected Member Functions inherited from BVH_Geometry< Standard_ShortReal, 3 >
virtual void Update ()
 Updates internal geometry state. More...
 
- Protected Attributes inherited from BVH_Geometry< Standard_ShortReal, 3 >
Standard_Boolean myIsDirty
 Is geometry state outdated? More...
 
opencascade::handle< BVH_Tree< Standard_ShortReal, N > > myBVH
 Constructed hight-level BVH. More...
 
opencascade::handle< BVH_Builder< Standard_ShortReal, N > > myBuilder
 Builder for hight-level BVH. More...
 
BVH_Box< Standard_ShortReal, N > myBox
 Cached bounding box of geometric objects. More...
 
- Protected Attributes inherited from BVH_ObjectSet< Standard_ShortReal, N >
BVH_ObjectList myObjects
 Array of geometric objects. More...
 

Detailed Description

Stores geometry of ray-tracing scene.

Constructor & Destructor Documentation

◆ OpenGl_RaytraceGeometry()

OpenGl_RaytraceGeometry::OpenGl_RaytraceGeometry ( )
inline

Creates uninitialized ray-tracing geometry.

◆ ~OpenGl_RaytraceGeometry()

OpenGl_RaytraceGeometry::~OpenGl_RaytraceGeometry ( )
inline

Releases resources of ray-tracing geometry.

Member Function Documentation

◆ AccelerationOffset()

Standard_Integer OpenGl_RaytraceGeometry::AccelerationOffset ( Standard_Integer  theNodeIdx)

Returns offset of bottom-level BVH for given leaf node. If the node index is not valid the function returns -1.

Note
Can be used after processing acceleration structure.

◆ AcquireTextures()

Standard_Boolean OpenGl_RaytraceGeometry::AcquireTextures ( const Handle< OpenGl_Context > &  theContext)

Makes the OpenGL texture handles resident (must be called before using).

◆ AddTexture()

Standard_Integer OpenGl_RaytraceGeometry::AddTexture ( const Handle< OpenGl_Texture > &  theTexture)

Adds new OpenGL texture to the scene and returns its index.

◆ BotLevelTreeDepth()

Standard_Integer OpenGl_RaytraceGeometry::BotLevelTreeDepth ( ) const
inline

Returns maximum depth of bottom-level scene BVHs from last build.

◆ Clear()

virtual void OpenGl_RaytraceGeometry::Clear ( )
overridevirtual

Clears ray-tracing geometry.

Reimplemented from BVH_ObjectSet< Standard_ShortReal, N >.

◆ ClearMaterials()

void OpenGl_RaytraceGeometry::ClearMaterials ( )
inline

Clears only ray-tracing materials.

◆ ElementsOffset()

Standard_Integer OpenGl_RaytraceGeometry::ElementsOffset ( Standard_Integer  theNodeIdx)

Returns offset of triangulation elements for given leaf node. If the node index is not valid the function returns -1.

Note
Can be used after processing acceleration structure.

◆ HasTextures()

Standard_Boolean OpenGl_RaytraceGeometry::HasTextures ( ) const
inline

Checks if scene contains textured objects.

◆ ProcessAcceleration()

Standard_Boolean OpenGl_RaytraceGeometry::ProcessAcceleration ( )

Performs post-processing of high-level scene BVH.

◆ QuadBVH()

const QuadBvhHandle& OpenGl_RaytraceGeometry::QuadBVH ( )

Returns quad BVH (QBVH) tree produced from binary BVH.

◆ ReleaseResources()

void OpenGl_RaytraceGeometry::ReleaseResources ( const Handle< OpenGl_Context > &  )
inline

Releases OpenGL resources.

◆ ReleaseTextures()

Standard_Boolean OpenGl_RaytraceGeometry::ReleaseTextures ( const Handle< OpenGl_Context > &  theContext) const

Makes the OpenGL texture handles non-resident (must be called after using).

◆ TextureHandles()

const std::vector<GLuint64>& OpenGl_RaytraceGeometry::TextureHandles ( ) const
inline

Returns array of texture handles.

◆ TopLevelTreeDepth()

Standard_Integer OpenGl_RaytraceGeometry::TopLevelTreeDepth ( ) const
inline

Returns depth of top-level scene BVH from last build.

◆ TriangleSet()

OpenGl_TriangleSet* OpenGl_RaytraceGeometry::TriangleSet ( Standard_Integer  theNodeIdx)

Returns triangulation data for given leaf node. If the node index is not valid the function returns NULL.

Note
Can be used after processing acceleration structure.

◆ UpdateTextureHandles()

Standard_Boolean OpenGl_RaytraceGeometry::UpdateTextureHandles ( const Handle< OpenGl_Context > &  theContext)

Updates unique 64-bit texture handles to use in shaders.

◆ VerticesOffset()

Standard_Integer OpenGl_RaytraceGeometry::VerticesOffset ( Standard_Integer  theNodeIdx)

Returns offset of triangulation vertices for given leaf node. If the node index is not valid the function returns -1.

Note
Can be used after processing acceleration structure.

Field Documentation

◆ Ambient

BVH_Vec4f OpenGl_RaytraceGeometry::Ambient

Global ambient from all light sources.

◆ INVALID_OFFSET

const Standard_Integer OpenGl_RaytraceGeometry::INVALID_OFFSET = -1
static

Value of invalid offset to return in case of errors.

◆ Materials

std::vector<OpenGl_RaytraceMaterial, NCollection_StdAllocator<OpenGl_RaytraceMaterial> > OpenGl_RaytraceGeometry::Materials

Array of 'front' material properties.

◆ MAX_TEX_NUMBER

const Standard_Integer OpenGl_RaytraceGeometry::MAX_TEX_NUMBER = 32
static

Maximum number of textures used in ray-tracing shaders. This is not restriction of the solution implemented, but rather the reasonable limit of the number of textures in various applications (can be increased if needed).

◆ myBotLevelTreeDepth

Standard_Integer OpenGl_RaytraceGeometry::myBotLevelTreeDepth
protected

Maximum depth of bottom-level scene BVHs from last build.

◆ myQuadBVH

QuadBvhHandle OpenGl_RaytraceGeometry::myQuadBVH
protected

QBVH produced from binary BVH tree.

◆ myTextureHandles

std::vector<GLuint64> OpenGl_RaytraceGeometry::myTextureHandles
protected

Array of unique 64-bit texture handles obtained from OpenGL.

◆ myTextures

NCollection_Vector<Handle< OpenGl_Texture > > OpenGl_RaytraceGeometry::myTextures
protected

Array of texture maps shared between rendered objects.

◆ myTopLevelTreeDepth

Standard_Integer OpenGl_RaytraceGeometry::myTopLevelTreeDepth
protected

Depth of high-level scene BVH from last build.

◆ Sources

std::vector<OpenGl_RaytraceLight, NCollection_StdAllocator<OpenGl_RaytraceLight> > OpenGl_RaytraceGeometry::Sources

Array of properties of light sources.


The documentation for this class was generated from the following file: