Intial Commit of starworld

This commit is contained in:
MayaTheShy
2025-11-08 13:39:53 -05:00
commit 2fc3ecc876
3120 changed files with 34117 additions and 0 deletions

25
src/SceneSync.cpp Normal file
View File

@@ -0,0 +1,25 @@
#include "SceneSync.Hpp"
#include "OverteClient.hpp"
#include "StardustBridge.hpp"
#include <glm/gtc/matrix_transform.hpp>
std::unordered_map<std::uint64_t, std::uint64_t> SceneSync::s_entityNodeMap;
void SceneSync::update(StardustBridge& stardust, OverteClient& overte) {
// Pull only the entities that changed since the last call.
auto updated = overte.consumeUpdatedEntities();
for (const auto& e : updated) {
auto it = s_entityNodeMap.find(e.id);
if (it == s_entityNodeMap.end()) {
// Create a Stardust node the first time we see this entity.
auto nodeId = stardust.createNode(e.name, e.transform);
s_entityNodeMap.emplace(e.id, nodeId);
} else {
// Update existing node's transform.
stardust.updateNodeTransform(it->second, e.transform);
}
}
}