Open CASCADE Technology 7.8.0
|
Stores geometry of ray-tracing scene. More...
#include <OpenGl_SceneGeometry.hxx>
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_TriangleSet * | TriangleSet (Standard_Integer theNodeIdx) |
Returns triangulation data for given leaf node. If the node index is not valid the function returns NULL. | |
const QuadBvhHandle & | QuadBVH () |
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_ObjectList & | Objects () |
Returns reference to the array of geometric objects. | |
const BVH_ObjectList & | Objects () 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. | |
virtual T | Center (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< GLuint64 > | myTextureHandles |
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. | |
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< T, 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).
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_OccAllocator<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_OccAllocator<OpenGl_RaytraceLight> > OpenGl_RaytraceGeometry::Sources |
Array of properties of light sources.