From 9b83919815f6a6ce5d73da1c28483970d0ca5589 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Feb 2021 14:22:28 -0600 Subject: added dev/MinGfx/ --- dev/MinGfx/docs/html/classmingfx_1_1_b_v_h.html | 232 ++++++++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 dev/MinGfx/docs/html/classmingfx_1_1_b_v_h.html (limited to 'dev/MinGfx/docs/html/classmingfx_1_1_b_v_h.html') diff --git a/dev/MinGfx/docs/html/classmingfx_1_1_b_v_h.html b/dev/MinGfx/docs/html/classmingfx_1_1_b_v_h.html new file mode 100644 index 0000000..032d128 --- /dev/null +++ b/dev/MinGfx/docs/html/classmingfx_1_1_b_v_h.html @@ -0,0 +1,232 @@ + + + + + + + +MinGfx Toolkit: mingfx::BVH Class Reference + + + + + + + + + + + + +
+
+ + + + + + +
+
MinGfx Toolkit +  1.0 +
+
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
mingfx::BVH Class Reference
+
+
+

Detailed Description

+

A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersection tests by carving up space into a hierarchy of partitions represented in a tree.

+

Each node of the tree is represented as an AABB (Axis-Aligned Bounding Box) that contains all of the nodes under it. Different objects can be stored inside each bounding box. For example, when a BVH is created for a mesh, each leaf node can contain a AABB that contains just a single triangle. Or, when a BVH is created for an entire scene, you could have each leaf node contain an entire mesh or other object within the scene. In each case, use AABB's set_user_data() and user_data() methods to store a handle for whetever you want to store inside the nodes.

+ +

Definition at line 40 of file bvh.h.

+
+

#include <bvh.h>

+ + + + + + + + + + + + + + + + +

+Public Member Functions

 BVH ()
 Initializes the class with an empty hierarchy. More...
 
virtual ~BVH ()
 
void CreateFromMesh (const Mesh &mesh)
 Creates a bounding volume hierarchy where each leaf node contains a single triangle from the mesh. More...
 
void CreateFromListOfBoxes (const std::vector< AABB > &boxes)
 Creates a BVH where each leaf node contains one of the boxes passed in to the function. More...
 
std::vector< int > IntersectAndReturnUserData (const Ray &r) const
 Traverse the BVH to find leaf nodes whose AABBs are intersected by the ray. More...
 
+

Constructor & Destructor Documentation

+ +

◆ BVH()

+ +
+
+ + + + + + + +
mingfx::BVH::BVH ()
+
+ +

Initializes the class with an empty hierarchy.

+ +
+
+ +

◆ ~BVH()

+ +
+
+ + + + + +
+ + + + + + + +
virtual mingfx::BVH::~BVH ()
+
+virtual
+
+ +
+
+

Member Function Documentation

+ +

◆ CreateFromListOfBoxes()

+ +
+
+ + + + + + + + +
void mingfx::BVH::CreateFromListOfBoxes (const std::vector< AABB > & boxes)
+
+ +

Creates a BVH where each leaf node contains one of the boxes passed in to the function.

+ +
+
+ +

◆ CreateFromMesh()

+ +
+
+ + + + + + + + +
void mingfx::BVH::CreateFromMesh (const Meshmesh)
+
+ +

Creates a bounding volume hierarchy where each leaf node contains a single triangle from the mesh.

+

For leaf nodes, the triangle index can be retrieved with:

int tri_id = leafnode->box.user_data();
+

The user_data will be -1 for non-leaf nodes. Once the structure has been created, it can be used to perform fast ray-mesh intersection tests. See Ray::FastIntersectMesh().

+ +
+
+ +

◆ IntersectAndReturnUserData()

+ +
+
+ + + + + + + + +
std::vector<int> mingfx::BVH::IntersectAndReturnUserData (const Rayr) const
+
+ +

Traverse the BVH to find leaf nodes whose AABBs are intersected by the ray.

+

These are candidates to test more thoroughly using whatever ray-object intersection test is appropriate for the objects stored inside the AABB. This routine returns the user_data for each AABB leaf node. In the case of a BVH created using CreateFromMesh, this means it stores the indices to the mesh triangles that should be tested for ray-triangle intersection.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + + -- cgit v1.2.3