feat: add removeNode function to StardustBridge for node deletion

This commit is contained in:
MayaTheShy
2025-11-08 16:00:11 -05:00
parent 9e955e7548
commit ba6ff968db
2 changed files with 16 additions and 0 deletions

View File

@@ -161,6 +161,16 @@ bool StardustBridge::updateNodeTransform(NodeId id, const glm::mat4& transform)
return true;
}
bool StardustBridge::removeNode(NodeId id) {
auto it = m_nodes.find(id);
if (it == m_nodes.end()) return false;
m_nodes.erase(it);
if (m_fnRemoveNode) {
(void)m_fnRemoveNode(id);
}
return true;
}
void StardustBridge::poll() {
if (!m_connected) return;
@@ -237,6 +247,7 @@ bool StardustBridge::loadBridge() {
m_fnShutdown = reinterpret_cast<fn_shutdown_t>(req("sdxr_shutdown"));
m_fnCreateNode = reinterpret_cast<fn_create_node_t>(req("sdxr_create_node"));
m_fnUpdateNode = reinterpret_cast<fn_update_node_t>(req("sdxr_update_node"));
m_fnRemoveNode = reinterpret_cast<fn_remove_node_t>(req("sdxr_remove_node"));
if (m_fnStart && m_fnPoll && m_fnCreateNode && m_fnUpdateNode) {
m_bridgeHandle = h;
std::cout << "[StardustBridge] Loaded Rust bridge: " << path << std::endl;