#ifndef jbt_query_h #define jbt_query_h class jbt_object; class jbt_node; class jbt_query { struct child { child( jbt_query* _q ) : q(_q), n(0) {}; ~child() { if(n) delete n; } jbt_query* q; child* n; } * fc, * lc; friend class iter; public: jbt_query( const jVec3&, jbt_object* ); virtual ~jbt_query(); const jVec3& getPoint() const { return pt; } void setPoint( const jVec3& _pt ) { pt = _pt; } jFlt field(); const jNorm3& normal(); void addChild( jbt_object* ); class iter { public: iter( jbt_query* q ) : i(q->fc) {}; jbt_query* child() { return i ? i->q : 0; } void operator++() { i = i ? i->n : 0; } operator bool () { return i!=0; } private: jbt_query::child* i; }; private: jbt_query(); void buildKids(); jULng flgs; bool on( jULng f ) const { return flgs&fField; } bool off( jULng f ) const { return !on(f); } void setOn( jULng f ) { flgs |= f; } void setOff( jULng f ) { flgs = flgs&(~f); } static const jULng fField; static const jULng fNormal; static const jULng fTransform; jMat4 T; static const jULng fField; static const jULng fNormal; // Implicit surface data ... jNorm3 N; jFlt fv; jVec3 pt; jbt_object* obj; }; #endif jbt_query_h