From 4b21057fdd906e2ea72c4a621cd33694aac1aea5 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 15 Nov 2024 14:52:08 +0100 Subject: [PATCH] Model loading --- NetworkSync.h | 2 ++ Roboid.cpp | 8 ++++++++ Roboid.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/NetworkSync.h b/NetworkSync.h index 4347d6c..786934e 100644 --- a/NetworkSync.h +++ b/NetworkSync.h @@ -85,6 +85,8 @@ public: virtual void SendText(const char *s); void SendInt(const int x); + virtual void Download(const char *url) {}; + protected: Roboid *roboid; NetworkPerception *networkPerception; diff --git a/Roboid.cpp b/Roboid.cpp index ec04aad..02a6f3c 100644 --- a/Roboid.cpp +++ b/Roboid.cpp @@ -130,3 +130,11 @@ void Passer::RoboidControl::Roboid::Release(Thing *child) { this->perception->AddTrackedObject(nullptr, Spherical16::zero, SwingTwist16::identity, child->type); } + +void Roboid::LoadModel(const char *url) { + this->modelUrl = url; + if (this->networkSync == nullptr) + return; + + this->networkSync->Download(url); +} \ No newline at end of file diff --git a/Roboid.h b/Roboid.h index c2cb2d8..7164170 100644 --- a/Roboid.h +++ b/Roboid.h @@ -70,6 +70,12 @@ public: nullptr; // thing to track the world origin to be able to transform // world coordinates into roboid or local coordinates // Perhaps this will move to perception at some point + + /// @brief Loads the model and adds the skeleton (if any) to the roboid + /// @param url The url of the model + /// @remark The only supported model format is .gltf + void LoadModel(const char *url); + private: unsigned long lastUpdateTimeMs = 0; };