Program Listing for File UpdateProxyScene.cc

Program Listing for File UpdateProxyScene.cc#

Return to documentation for file (doxygen_docs/GeneralKModels/UpdateProxyScene.cc)

#include "Karana/GeneralKModels/UpdateProxyScene.h"
#include "Karana/KCore/Allocator.h"

/**
 * @file
 * @brief UpdateProxyScene implementation.
 */

namespace Karana::Models {

    namespace kd = Karana::Dynamics;
    namespace ks = Karana::Scene;

    UpdateProxyScene::UpdateProxyScene(std::string_view name,
                                       const kc::ks_ptr<kd::ModelManager> &mm,
                                       const kc::ks_ptr<ks::ProxyScene> &scene)
        : KModel<UpdateProxyScene>(name, mm)
        , _scene(scene){};

    kc::ks_ptr<UpdateProxyScene> UpdateProxyScene::create(std::string_view name,
                                                          const kc::ks_ptr<kd::ModelManager> &mm,
                                                          const kc::ks_ptr<ks::ProxyScene> &scene) {
        kc::ks_ptr<UpdateProxyScene> ups = std::allocate_shared<UpdateProxyScene>(
            kc::Allocator<UpdateProxyScene>{}, name, mm, scene);
        mm->registerModel(ups);
        return ups;
    }

    void UpdateProxyScene::postHop(const km::Ktime &, const km::Vec &) { _scene->update(); }

    // Destructor included for MacOS builds. Must have a key-function out-of-line to avoid dulpicate
    // symbols.
    UpdateProxyScene::~UpdateProxyScene(){};

    const kc::ks_ptr<ks::ProxyScene> &UpdateProxyScene::getProxyScene() const { return _scene; }

} // namespace Karana::Models