libjbt

texturingnode.h

This is the verbatim text of the texturingnode.h include file.

#ifndef jbt_texturingnode_h
#define jbt_texturingnode_h

#include "ngnode.h"


class jbt_texturingnode : public jbt_ngnode
{
public:


    enum psurface { pCylinder=0, pSphere };


    jbt_texturingnode( psurface, int, jbt_blobtree* = 0 );


    jbt_texturingnode( jbt_blobtree* = 0 );

private:
    

    static const jFlt dt;

    struct trajstep
    {
        trajstep( jFlt _k, const jNorm3& _R, const jNorm3& _A, trajstep* _n )
                : k(_k), R(_R), A(_A), n(_n)
            {
                T = R*k + A*(1-k);
            }
        ~trajstep()
            { if(n) delete n; }
        jNorm3 R,A,T;
        jFlt k;
        trajstep* n;

        jVec3 step( const jVec3& p, jFlt dt ) const
            {
                return p+T*dt;
            }
    };

    void balance( const trajstep*, jVec3&, const jVec3& );

    bool precomp;
    
    psurface ps;
    jVec3 c;
    int axis;
    
    void beginQuery( const jVec3& );

    void uv( jVec2& );

    jNorm3 attract( const jVec3&, const trajstep* ) const;
    jVec3 trace( const jVec3& );

    void parametrize( const jVec3&, jVec2& ) const;

    jbt_blobtree::Type type() const { return jbtTexturingNode; }
};

#endif

JSP / libjbt v0.1 mtigges@cpsc.ucalgary.ca