#ifndef jbt_cache_h #define jbt_cache_h #include <jgl/jgl.h> class jbt_blobtree; class jbt_cache { public: jbt_cache( jbt_blobtree* ); virtual ~jbt_cache(); void restore(); const jVec3& queryPoint() const { return qp; } private: jVec3 qp; jFlt fv; // field value jNorm3 N; // normal vector jVec3 G; // gradient vector jVec2 uvc; // texture coordinate jULng cached; jbt_blobtree* tree; struct child { child( jbt_cache* _c, child* _n ) : c(_c), n(_n) {} ~child() { if(c) delete c; if(n) delete n; } void restore() { if(n) c->restore(); } jbt_cache* c; child* n; } * children; }; #endif