#pragma once #include #include #include #include namespace OpenVic { struct BuildingInstance; 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; using animation_map_t = deque_ordered_map; using model_map_t = deque_ordered_map; animation_map_t animation_cache; model_map_t model_cache; godot::Dictionary get_animation_dict(GFX::Actor::Animation const& animation); godot::Dictionary get_model_dict(GFX::Actor const& actor); template bool add_unit_dict( ordered_set*> const& units, godot::TypedArray& unit_array ); bool add_building_dict( BuildingInstance const& building, ProvinceInstance const& province, godot::TypedArray& building_array ); public: godot::TypedArray get_units(); godot::Dictionary get_cultural_gun_model(godot::String const& culture); godot::Dictionary get_cultural_helmet_model(godot::String const& culture); godot::Dictionary get_flag_model(bool floating); godot::TypedArray get_buildings(); }; }