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

Data Fields

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

Static Public Attributes

static const Standard_Integer INVALID_OFFSET = -1
 Value of invalid offset to return in case of errors.
 
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).
 

auxiliary methods

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

Additional Inherited Members

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

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< T, 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_OccAllocator<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_OccAllocator<OpenGl_RaytraceLight> > OpenGl_RaytraceGeometry::Sources

Array of properties of light sources.


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