#37 Renderer-dependant (interactive) nodes

Açık
caryoscelus tarafından 7 yıl önce kere açıldı · 1 yorum
caryoscelus 7 yıl önce olarak yorumlandı
Henüz bir içerik yok.
caryoscelus 7 yıl önce olarak yorumlandı
Sahibi

Implementation idea: store renderer pointer in Context. This would be really easy to implement.

The only question is then interface that will be used to retrieve information from renderer. The most intuitive thing to do would be to just call by node name. E.g. something like

class MousePosition : Node<Geom::Point> {
public:
    Geom::Point get(shared_ptr<Context> ctx) const override {
        if (auto r = ctx->get_renderer()) {
            return r->get_value<Geom::Point>("MousePosition");
        }
        return {}; // or throw instead
    }
};
Implementation idea: store renderer pointer in Context. This would be really easy to implement. The only question is then interface that will be used to retrieve information from renderer. The most intuitive thing to do would be to just call by node name. E.g. something like ```c++ class MousePosition : Node<Geom::Point> { public: Geom::Point get(shared_ptr<Context> ctx) const override { if (auto r = ctx->get_renderer()) { return r->get_value<Geom::Point>("MousePosition"); } return {}; // or throw instead } }; ```
Giriş yap bu konuşmaya katılmak için.
Yükleniyor...
İptal
Kaydet
Henüz bir içerik yok.