From c2ee1d49fb4ecaa049d7ea8f477a227a5232d817 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sat, 8 Nov 2025 20:40:13 -0500 Subject: [PATCH] feat: implement functions to set node model, texture, color, dimensions, and entity type --- src/StardustBridge.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/StardustBridge.cpp b/src/StardustBridge.cpp index 5e6df88..2de5f46 100644 --- a/src/StardustBridge.cpp +++ b/src/StardustBridge.cpp @@ -171,6 +171,51 @@ bool StardustBridge::removeNode(NodeId id) { return true; } +bool StardustBridge::setNodeModel(NodeId id, const std::string& modelUrl) { + auto it = m_nodes.find(id); + if (it == m_nodes.end()) return false; + if (m_fnSetModel) { + return m_fnSetModel(id, modelUrl.c_str()) == 0; + } + return true; +} + +bool StardustBridge::setNodeTexture(NodeId id, const std::string& textureUrl) { + auto it = m_nodes.find(id); + if (it == m_nodes.end()) return false; + if (m_fnSetTexture) { + return m_fnSetTexture(id, textureUrl.c_str()) == 0; + } + return true; +} + +bool StardustBridge::setNodeColor(NodeId id, const glm::vec3& color, float alpha) { + auto it = m_nodes.find(id); + if (it == m_nodes.end()) return false; + if (m_fnSetColor) { + return m_fnSetColor(id, color.r, color.g, color.b, alpha) == 0; + } + return true; +} + +bool StardustBridge::setNodeDimensions(NodeId id, const glm::vec3& dimensions) { + auto it = m_nodes.find(id); + if (it == m_nodes.end()) return false; + if (m_fnSetDimensions) { + return m_fnSetDimensions(id, dimensions.x, dimensions.y, dimensions.z) == 0; + } + return true; +} + +bool StardustBridge::setNodeEntityType(NodeId id, uint8_t entityType) { + auto it = m_nodes.find(id); + if (it == m_nodes.end()) return false; + if (m_fnSetEntityType) { + return m_fnSetEntityType(id, entityType) == 0; + } + return true; +} + void StardustBridge::poll() { if (!m_connected) return;