From ac1504f6fa981947bd9543d24325b3751236e925 Mon Sep 17 00:00:00 2001 From: hop311 Date: Tue, 7 May 2024 22:05:55 +0100 Subject: Generate army and navy models --- .../singletons/ModelSingleton.hpp | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 extension/src/openvic-extension/singletons/ModelSingleton.hpp (limited to 'extension/src/openvic-extension/singletons/ModelSingleton.hpp') diff --git a/extension/src/openvic-extension/singletons/ModelSingleton.hpp b/extension/src/openvic-extension/singletons/ModelSingleton.hpp new file mode 100644 index 0000000..9ec163e --- /dev/null +++ b/extension/src/openvic-extension/singletons/ModelSingleton.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include + +#include +#include + +namespace OpenVic { + class ModelSingleton : public godot::Object { + GDCLASS(ModelSingleton, godot::Object) + + static inline ModelSingleton* singleton = nullptr; + + protected: + static void _bind_methods(); + + public: + static ModelSingleton* get_singleton(); + + ModelSingleton(); + ~ModelSingleton(); + + private: + GFX::Actor const* get_actor(std::string_view name, bool error_on_fail = true) const; + GFX::Actor const* get_cultural_actor( + std::string_view culture, std::string_view name, std::string_view fallback_name + ) const; + + godot::Dictionary make_animation_dict(GFX::Actor::Animation const& animation) const; + godot::Dictionary make_model_dict(GFX::Actor const& actor) const; + + template T> + bool add_unit_dict(ordered_set const& units, godot::TypedArray& unit_array) const; + + public: + godot::TypedArray get_units() const; + godot::Dictionary get_cultural_gun_model(godot::String const& culture) const; + godot::Dictionary get_cultural_helmet_model(godot::String const& culture) const; + + godot::Dictionary get_flag_model(bool floating) const; + }; +} -- cgit v1.2.3-56-ga3b1