Open CASCADE Technology
7.7.0
|
Stores geometry of ray-tracing scene. More...
#include <OpenGl_SceneGeometry.hxx>
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_TriangleSet * | TriangleSet (Standard_Integer theNodeIdx) |
Returns triangulation data for given leaf node. If the node index is not valid the function returns NULL. More... | |
const QuadBvhHandle & | QuadBVH () |
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_ObjectList & | Objects () |
Returns reference to the array of geometric objects. More... | |
const BVH_ObjectList & | Objects () 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< GLuint64 > | myTextureHandles |
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... | |
Stores geometry of ray-tracing scene.
|
inline |
Creates uninitialized ray-tracing geometry.
|
inline |
Releases resources of ray-tracing geometry.
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.
Standard_Boolean OpenGl_RaytraceGeometry::AcquireTextures | ( | const Handle< OpenGl_Context > & | theContext | ) |
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.
|
inline |
Returns maximum depth of bottom-level scene BVHs from last build.
|
overridevirtual |
Clears ray-tracing geometry.
Reimplemented from BVH_ObjectSet< Standard_ShortReal, N >.
|
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.
|
inline |
Checks if scene contains textured objects.
Standard_Boolean OpenGl_RaytraceGeometry::ProcessAcceleration | ( | ) |
Performs post-processing of high-level scene BVH.
const QuadBvhHandle& OpenGl_RaytraceGeometry::QuadBVH | ( | ) |
|
inline |
Releases OpenGL resources.
Standard_Boolean OpenGl_RaytraceGeometry::ReleaseTextures | ( | const Handle< OpenGl_Context > & | theContext | ) | const |
Makes the OpenGL texture handles non-resident (must be called after using).
|
inline |
Returns array of texture handles.
|
inline |
Returns depth of top-level scene BVH from last build.
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.
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.
BVH_Vec4f OpenGl_RaytraceGeometry::Ambient |
Global ambient from all light sources.
|
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.
|
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).
|
protected |
Maximum depth of bottom-level scene BVHs from last build.
|
protected |
QBVH produced from binary BVH tree.
|
protected |
Array of unique 64-bit texture handles obtained from OpenGL.
|
protected |
Array of texture maps shared between rendered objects.
|
protected |
Depth of high-level scene BVH from last build.
std::vector<OpenGl_RaytraceLight, NCollection_StdAllocator<OpenGl_RaytraceLight> > OpenGl_RaytraceGeometry::Sources |
Array of properties of light sources.