|
wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
|
In-memory DDS scene graph. More...
#include <bgi_dds.h>
Public Member Functions | |
| std::shared_ptr< DdsObject > | append (std::shared_ptr< DdsObject > obj) |
Assigns an auto-generated ID to obj and appends it to the scene. | |
| std::shared_ptr< DdsObject > | appendWithId (std::shared_ptr< DdsObject > obj) |
Appends an object that already has its id field set (used during deserialization to restore the original ID strings). | |
| void | clearAll () |
| Clears ALL objects (cameras, UCS, drawing objects). | |
| void | clearDrawingObjects () |
| Clears all drawing-primitive objects (type not Camera, Ucs, WorldExtentsObj). | |
| void | compact () |
| Physically removes soft-deleted entries from order and index. | |
| int | count () const |
| Returns the number of non-deleted objects in the scene. | |
| int | countDrawing () const |
| Returns the number of non-deleted drawing-primitive objects only. | |
| DdsScene ()=default | |
| DdsScene (const DdsScene &)=delete | |
| std::shared_ptr< DdsObject > | findById (const std::string &id) const |
Returns the object with the given id, or nullptr if not found / deleted. | |
| std::shared_ptr< DdsObject > | findByLabel (const std::string &label) const |
Returns the first non-deleted object whose label equals label, or nullptr if none found. | |
| std::string | findIdByLabel (const std::string &label) const |
Returns the ID of the first non-deleted object with the given label, or "". | |
| template<typename Fn > | |
| void | forEach (Fn &&fn) const |
Calls fn(DdsObject&) for every non-deleted object in insertion order. | |
| template<typename Fn > | |
| void | forEachDrawing (Fn &&fn) const |
Calls fn(DdsObject&) for non-deleted drawing-primitive objects only. | |
| template<typename Fn > | |
| void | forEachRenderRoot (Fn &&fn) const |
Calls fn(DdsObject&) for top-level render roots only. | |
| std::string | idAt (int index) const |
Returns the insertion-order ID at position index (0-based). | |
| DdsScene & | operator= (const DdsScene &)=delete |
| bool | remove (const std::string &id) |
Soft-deletes the object with the given id. | |
| ~DdsScene ()=default | |
Data Fields | |
| std::unordered_map< std::string, std::shared_ptr< DdsObject > > | index |
| uint64_t | nextId {1} |
| std::vector< std::string > | order |
| uint64_t | revision {1} |
In-memory DDS scene graph.
Maintains two parallel collections for O(1) direct access and O(n) sequential traversal:
order – vector of object IDs in insertion order.index – unordered_map from ID → shared_ptr<DdsObject>.Deletion is soft: objects are marked deleted so stable IDs are preserved. Call compact() to physically remove soft-deleted entries.
Thread safety: the caller (camera_api, ucs_api, dds_api, …) is responsible for holding gMutex before calling any DdsScene method.
|
default |
|
default |
|
delete |
Assigns an auto-generated ID to obj and appends it to the scene.
Appends an object that already has its id field set (used during deserialization to restore the original ID strings).
Updates nextId if the id's numeric value exceeds the current counter.
| void bgi::DdsScene::clearAll | ( | ) |
Clears ALL objects (cameras, UCS, drawing objects).
| void bgi::DdsScene::clearDrawingObjects | ( | ) |
Clears all drawing-primitive objects (type not Camera, Ucs, WorldExtentsObj).
Camera and UCS objects remain in the scene.
| void bgi::DdsScene::compact | ( | ) |
Physically removes soft-deleted entries from order and index.
| int bgi::DdsScene::count | ( | ) | const |
Returns the number of non-deleted objects in the scene.
| int bgi::DdsScene::countDrawing | ( | ) | const |
Returns the number of non-deleted drawing-primitive objects only.
| std::shared_ptr< DdsObject > bgi::DdsScene::findById | ( | const std::string & | id | ) | const |
Returns the object with the given id, or nullptr if not found / deleted.
| std::shared_ptr< DdsObject > bgi::DdsScene::findByLabel | ( | const std::string & | label | ) | const |
Returns the first non-deleted object whose label equals label, or nullptr if none found.
| std::string bgi::DdsScene::findIdByLabel | ( | const std::string & | label | ) | const |
Returns the ID of the first non-deleted object with the given label, or "".
|
inline |
Calls fn(DdsObject&) for every non-deleted object in insertion order.
|
inline |
Calls fn(DdsObject&) for non-deleted drawing-primitive objects only.
|
inline |
Calls fn(DdsObject&) for top-level render roots only.
Any object referenced as a child/operand of Transform / SetUnion / SetIntersection / SetDifference is skipped here and is expected to render through its owning composite node instead of as an independent root.
| std::string bgi::DdsScene::idAt | ( | int | index | ) | const |
Returns the insertion-order ID at position index (0-based).
Skips soft-deleted entries. Returns "" if out of range.
| bool bgi::DdsScene::remove | ( | const std::string & | id | ) |
Soft-deletes the object with the given id.
Returns true on success.
| std::unordered_map<std::string, std::shared_ptr<DdsObject> > bgi::DdsScene::index |
| uint64_t bgi::DdsScene::nextId {1} |
| std::vector<std::string> bgi::DdsScene::order |
| uint64_t bgi::DdsScene::revision {1} |