Open CASCADE Technology  6.9.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...
 
void Clear ()
 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...
 
methods related to texture management
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) const
 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...
 
Standard_Boolean HasTextures () const
 Checks if scene contains textured objects. More...
 
- Public Member Functions inherited from BVH_Geometry< Standard_ShortReal, 3 >
 BVH_Geometry ()
 Creates uninitialized BVH geometry. More...
 
virtual ~BVH_Geometry ()
 Releases resources of BVH geometry. More...
 
virtual void MarkDirty ()
 Marks geometry as outdated. More...
 
virtual BVH_Box
< Standard_ShortReal, N > 
Box () const
 Returns AABB of the whole geometry. More...
 
virtual const
NCollection_Handle< BVH_Tree
< Standard_ShortReal, N > > & 
BVH ()
 Returns BVH tree (and builds it if necessary). More...
 
virtual const
NCollection_Handle
< BVH_Builder
< Standard_ShortReal, N > > & 
Builder () const
 Returns the method (builder) used to construct BVH. More...
 
virtual void SetBuilder (NCollection_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
 Return total number of objects. More...
 
virtual BVH_Box
< Standard_ShortReal, N > 
Box (const Standard_Integer theIndex) const
 Returns AABB of the given object. More...
 
virtual Standard_ShortReal Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const
 Returns centroid position along the given axis. More...
 
virtual void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2)
 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 ()=0
 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< GLuint64 > myTextureHandles
 Array of unique 64-bit texture handles obtained from OpenGL. More...
 
Standard_Integer myHighLevelTreeDepth
 Depth of high-level scene BVH from last build. More...
 
Standard_Integer myBottomLevelTreeDepth
 Maximum depth of bottom-level scene BVHs from last build. More...
 
Standard_Integer HighLevelTreeDepth () const
 Returns depth of high-level scene BVH from last build. More...
 
Standard_Integer BottomLevelTreeDepth () 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
< NCollection_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...
 
NCollection_Handle< BVH_Tree
< Standard_ShortReal, N > > 
myBVH
 Constructed hight-level BVH. More...
 
NCollection_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 ( )
inline

Creates uninitialized ray-tracing geometry.

OpenGl_RaytraceGeometry::~OpenGl_RaytraceGeometry ( )
inline

Releases resources of ray-tracing geometry.

Member Function Documentation

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.
Standard_Boolean OpenGl_RaytraceGeometry::AcquireTextures ( const Handle< OpenGl_Context > &  theContext) const

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

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

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

Standard_Integer OpenGl_RaytraceGeometry::BottomLevelTreeDepth ( ) const
inline

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

void OpenGl_RaytraceGeometry::Clear ( )
virtual

Clears ray-tracing geometry.

Reimplemented from BVH_ObjectSet< Standard_ShortReal, N >.

void OpenGl_RaytraceGeometry::ClearMaterials ( )
inline

Clears only ray-tracing materials.

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.
Standard_Boolean OpenGl_RaytraceGeometry::HasTextures ( ) const
inline

Checks if scene contains textured objects.

Standard_Integer OpenGl_RaytraceGeometry::HighLevelTreeDepth ( ) const
inline

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

Standard_Boolean OpenGl_RaytraceGeometry::ProcessAcceleration ( )

Performs post-processing of high-level scene BVH.

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

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

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

Returns array of texture handles.

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.
Standard_Boolean OpenGl_RaytraceGeometry::UpdateTextureHandles ( const Handle< OpenGl_Context > &  theContext)

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

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

BVH_Vec4f OpenGl_RaytraceGeometry::Ambient

Global ambient from all light sources.

const Standard_Integer OpenGl_RaytraceGeometry::INVALID_OFFSET = -1
static

Value of invalid offset to return in case of errors.

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

Array of 'front' material properties.

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).

Standard_Integer OpenGl_RaytraceGeometry::myBottomLevelTreeDepth
protected

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

Standard_Integer OpenGl_RaytraceGeometry::myHighLevelTreeDepth
protected

Depth of high-level scene BVH from last build.

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

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

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

Array of texture maps shared between rendered objects.

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: