Subversion Repositories spk

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef BOB_DOM_FRAME_INCLUDED
#define BOB_DOM_FRAME_INCLUDED

#include "bob_dom_base.h"

#define CUT_F_LINEAR          0x1
#define CUT_F_ROT             0x2
#define CUT_F_TARGETPOS       0x8
#define CUT_F_SAMEPOS         0x10
#define CUT_F_SAMEROT         0x20
#define CUT_F_SAMETARGET      0x40
#define CUT_F_BEZIER          0x80
#define CUT_F_SAMESCALE       0x100
#define CUT_F_COLOR           0x200
#define CUT_F_SAMECOLOR       0x400
#define CUT_F_FOV             0x800
#define CUT_F_SAMEFOV         0x1000
#define CUT_F_ABSROT          0x2000
#define CUT_F_POSTCBINFO      0x4000
#define CUT_F_ROTTCBINFO      0x8000
#define CUT_F_POSBEZINFO      0x10000
#define CUT_F_TPOSTCBINFO     0x20000
#define CUT_F_FAKEROTTCBINFO  0x40000

class bob_dom_frame : public bob_with_errors
{
        public:
                struct point3d
                {
                        int x,y,z;
                        
                        point3d() { x=0; y=0; z=0; }
                        
                        bool load(bob_dom_ibinaryfilestream& is);
                        bool toFile(bob_dom_otextfilestream& os);
                        bool toFile(bob_dom_obinaryfilestream& os);
                };

                struct angle_axis
                {
                        double angle, x, y, z;
                        
                        angle_axis() { angle=0; x=0; y=0; z=0; }
                        
                        bool load(bob_dom_ibinaryfilestream& is);
                        bool toFile(bob_dom_otextfilestream & os);
                        bool toFile(bob_dom_obinaryfilestream& os);
                };

                struct rgb
                {
                        double r, g, b;
                        
                        rgb() { r=0; g=0; b=0; }
                        
                        bool load(bob_dom_ibinaryfilestream& is);
                        bool toFile(bob_dom_otextfilestream & os);
                        bool toFile(bob_dom_obinaryfilestream& os);
                };

                struct tcb_info
                {
                        double tension, continuity, bias, easeFrom, easeTo;
                        
                        tcb_info() { tension=0; continuity=0; bias=0; easeFrom=0; easeTo=0; }
                        
                        bool load(bob_dom_ibinaryfilestream& is);
                        bool toFile(bob_dom_otextfilestream& os);
                        bool toFile(bob_dom_obinaryfilestream& os);
                };
        
        public:
                // don't include CUT_F_POSBEZINFO in the mask until it's known!
                static const int flagMask=CUT_F_LINEAR|CUT_F_ROT|CUT_F_TARGETPOS|CUT_F_SAMEPOS|CUT_F_SAMEROT|CUT_F_SAMETARGET|CUT_F_BEZIER|CUT_F_SAMESCALE|CUT_F_COLOR|CUT_F_SAMECOLOR|CUT_F_FOV|CUT_F_SAMEFOV|CUT_F_ABSROT|CUT_F_POSTCBINFO|CUT_F_ROTTCBINFO|CUT_F_TPOSTCBINFO|CUT_F_FAKEROTTCBINFO;
        
                int flags;
                point3d position;
                angle_axis *rotation;
                point3d *targetPos;
                double rollAngle;
                tcb_info *pos_tcb_info, *rot_tcb_info, *tpos_tcb_info;
                double fov;
                rgb *color;
                int length, index;
                
                bob_dom_frame() 
                { 
                        flags=0; 
                        rotation=0;
                        targetPos=0;
                        rollAngle=0;
                        color=0;
                        pos_tcb_info=0;
                        rot_tcb_info=0;
                        tpos_tcb_info=0;
                        fov=0;
                        length=0;
                        index=0;
                }
                
                ~bob_dom_frame() 
                { 
                        delete rotation; delete targetPos; delete pos_tcb_info; delete rot_tcb_info; delete tpos_tcb_info;
                        delete color;
                }
                
                int valueCount();
                
                bool toFile(bob_dom_obinaryfilestream& os);
                bool toFile(bob_dom_otextfilestream& os);
                
                bool load(bob_dom_ibinaryfilestream& is);
};

template <class Ty>
inline
Ty& operator << (Ty& os, bob_dom_frame& right)
{
        right.toFile(os);
        return os;
}

#endif // !defined(BOB_DOM_FRAME_INCLUDED)