VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
backgroundBvhBuilder.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
14 #include <memory>
15 #include <tbb/concurrent_queue.h>
16 #include <tbb/task_group.h>
17 #include <tbb/task_arena.h>
18 #include <thread>
19 #include <mutex>
20 #include <condition_variable>
21 
37 {
38 public:
42  explicit DtBackgroundBvhBuilder(size_t maxThreads);
43 
48  virtual ~DtBackgroundBvhBuilder();
49 
58  virtual void addTrianleMeshShape(DtBvhTriangleMeshShape::Ptr shape);
59 
60 protected:
67  static void threadMain(DtBackgroundBvhBuilder* builder);
68 
73  tbb::concurrent_queue<DtBvhTriangleMeshShape::Ptr> myShapesToProcess;
74 
78  std::atomic<bool> myShutdownFlag;
79 
84  std::thread* myProcessingThread;
85 
90  std::mutex myMutex;
91 
96  std::condition_variable myThreadCV;
97 
102  std::unique_ptr<tbb::task_arena> myTaskArena;
103 
108  std::unique_ptr<tbb::task_group> myTaskGroup;
109 };
std::atomic< bool > myShutdownFlag
Atomic flag indicating whether the processing thread should shutdown.
Definition: backgroundBvhBuilder.h:78
std::mutex myMutex
Mutex for protecting access to the condition variable and shutdown coordination.
Definition: backgroundBvhBuilder.h:90
tbb::concurrent_queue< DtBvhTriangleMeshShape::Ptr > myShapesToProcess
Thread-safe queue containing shapes waiting to be processed.
Definition: backgroundBvhBuilder.h:73
std::condition_variable myThreadCV
Condition variable for waking up the worker thread.
Definition: backgroundBvhBuilder.h:96
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
std::unique_ptr< tbb::task_arena > myTaskArena
TBB task arena that limits the number of threads used for parallel processing.
Definition: backgroundBvhBuilder.h:102
std::thread * myProcessingThread
Worker thread that processes the shape queue.
Definition: backgroundBvhBuilder.h:84
std::shared_ptr< DtBvhTriangleMeshShape > Ptr
Definition: bvhTriangleMeshShape.h:83
std::unique_ptr< tbb::task_group > myTaskGroup
TBB task group for managing parallel BVH building operations.
Definition: backgroundBvhBuilder.h:108
Background BVH builder that processes triangle mesh shapes in parallel.
Definition: backgroundBvhBuilder.h:36

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)