diff --git a/panda/src/lerp/config_lerp.cxx b/panda/src/lerp/config_lerp.cxx index 3414027aa7..b353aa58f0 100644 --- a/panda/src/lerp/config_lerp.cxx +++ b/panda/src/lerp/config_lerp.cxx @@ -26,6 +26,17 @@ ConfigureFn(config_lerp) { SimpleLerpFunctor::init_type(); SimpleLerpFunctor::init_type(); SimpleLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); + SimpleQueryLerpFunctor::init_type(); MultiLerpFunctor::init_type(); LerpBlendType::init_type(); diff --git a/panda/src/lerp/lerpfunctor.h b/panda/src/lerp/lerpfunctor.h index d14ca45cbc..3031af68f9 100644 --- a/panda/src/lerp/lerpfunctor.h +++ b/panda/src/lerp/lerpfunctor.h @@ -84,6 +84,49 @@ private: template TypeHandle SimpleLerpFunctor::_type_handle; +template +class SimpleQueryLerpFunctor : public SimpleLerpFunctor { +private: + value _save; +protected: + /* + SimpleQueryLerpFunctor(const SimpleQueryLerpFucntor& c); + */ +public: + SimpleQueryLerpFunctor(value start, value end) + : SimpleLerpFunctor(start, end) {} + virtual ~SimpleQueryLerpFunctor(void); + SimpleQueryLerpFunctor& operator=(const SimpleQueryLerpFunctor&); + virtual void operator()(float); +PUBLISHED: + value get_value(void); + + static TypeHandle get_class_type(void) { + return _type_handle; + } +public: + static void init_type(void) { + SimpleLerpFunctor::init_type(); + ostringstream os; + os << "SimpleQueryLerpFunctor<" << get_type_handle(value).get_name() + << ">"; + register_type(_type_handle, os.str(), + SimpleLerpFunctor::get_class_type()); + } + virtual TypeHandle get_type(void) const { + return get_class_type(); + } + virtual TypeHandle force_init_type(void) { + init_type(); + return get_class_type(); + } +private: + static TypeHandle _type_handle; +}; + +template +TypeHandle SimpleQueryLerpFunctor::_type_handle; + #include EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleLerpFunctor) @@ -98,6 +141,18 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleLerpFunctor) EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleLerpFunctor) EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, SimpleQueryLerpFunctor) + typedef SimpleLerpFunctor IntLerpFunctor; typedef SimpleLerpFunctor FloatLerpFunctor; typedef SimpleLerpFunctor LPoint2fLerpFunctor; @@ -110,6 +165,18 @@ typedef SimpleLerpFunctor LVector2fLerpFunctor; typedef SimpleLerpFunctor LVector3fLerpFunctor; typedef SimpleLerpFunctor LVector4fLerpFunctor; +typedef SimpleQueryLerpFunctor IntQueryLerpFunctor; +typedef SimpleQueryLerpFunctor FloatQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LPoint2fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LPoint3fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LPoint4fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LVecBase2fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LVecBase3fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LVecBase4fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LVector2fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LVector3fQueryLerpFunctor; +typedef SimpleQueryLerpFunctor LVector4fQueryLerpFunctor; + #include #include @@ -182,4 +249,32 @@ value SimpleLerpFunctor::interpolate(float t) { return ((t * _diff_cache) + _start); } +/* +template +SimpleQueryLerpFunctor::SimpleQueryLerpFunctor(const SimpleQueryLerpFunctor& c) : SimpleLerpFunctor(c), _save(c._save) {} +*/ + +template +SimpleQueryLerpFunctor::~SimpleQueryLerpFunctor(void) +{ +} + +template +SimpleQueryLerpFunctor& +SimpleQueryLerpFunctor::operator=(const SimpleQueryLerpFunctor& c) { + _save = c._save; + SimpleLerpFunctor::operator=(c); + return *this; +} + +template +void SimpleQueryLerpFunctor::operator()(float t) { + _save = interpolate(t); +} + +template +value SimpleQueryLerpFunctor::get_value(void) { + return _save; +} + #endif /* __LERPFUNCTOR_H__ */