Alphabetical Class Index   Class Hierarchy   Compound Members   File Members   File List  

BOpcodeHandler.h

Go to the documentation of this file.
00001 //
00002 // Copyright (c) 2000 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 
00013 // $Id: afeca7d366cf18efbe4bd48ff605450a5b0aa092 $
00014 
00015 //
00016 
00017 #ifndef BOPCODE_HANDLER
00018 #define BOPCODE_HANDLER
00019 
00020 #ifndef BBINFILETK_TOOLKIT
00021     #include "BStreamFileToolkit.h"
00022 #endif
00023 
00024 #ifndef POINTER_SIZED_INT
00025 #if defined(WIN64) || defined(_M_X64) || defined(_WIN64)
00026 #   define POINTER_SIZED_INT __int64
00027 #   define POINTER_SIZED_UINT unsigned __int64
00028 #else
00029 #   define POINTER_SIZED_INT long
00030 #   define POINTER_SIZED_UINT unsigned long
00031 #endif
00032 #endif
00033 
00034 
00036 
00039 
00040 
00060 class BBINFILETK_API2 BBaseOpcodeHandler
00061 #ifdef HPS_CORE_BUILD
00062     : public CMO
00063 #else
00064     : public BControlledMemoryObject
00065 #endif
00066 {
00067     protected:
00068         int             m_stage;        
00069         int             m_progress;     
00070         unsigned char   m_opcode;       
00071         unsigned char   m_general_flags;
00072         bool            m_needs_tag;    
00073 
00074         int             m_debug_length;   
00075         int             m_debug_allocated;
00076         char *          m_debug_string;   
00078         char *          m_ascii_buffer;
00079         int             m_ascii_size;
00080         int             m_ascii_length;
00081 
00082         int             m_ascii_stage;
00083         int             m_ascii_progress;   
00084 
00085         unsigned char   m_byte;             
00086         unsigned short  m_unsigned_short;   
00087         int             m_int;              
00088         char            m_char;             
00089 
00090     public:
00096         BBaseOpcodeHandler (int op)
00097             : m_stage (0), m_progress (0), m_opcode ((unsigned char)op), m_general_flags(0), m_needs_tag (false),
00098               m_debug_length (0), m_debug_allocated (0), m_debug_string (0),
00099 
00100               m_ascii_buffer (0), m_ascii_size (0), m_ascii_length (0), m_ascii_stage (0), m_ascii_progress(0),
00101               m_byte(0), m_unsigned_short(0), m_int(0), m_char('\0')
00102             {}
00103         virtual ~BBaseOpcodeHandler ();
00104 
00112         virtual TK_Status   Read (BStreamFileToolkit & tk) = 0;
00113 
00121         virtual TK_Status   Write (BStreamFileToolkit & tk) = 0;
00122 
00130         virtual TK_Status   Execute (BStreamFileToolkit & tk);
00131 
00141         virtual TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant = 0);
00142 
00152         virtual TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special);
00153 
00159         virtual void        Reset ();
00160     
00165         virtual bool        Match_Instance (BStreamFileToolkit const & tk, Recorded_Instance * instance);
00166 
00167 
00169         unsigned char       Opcode () const { return m_opcode; }
00170 
00172         unsigned char       General_Flags () const { return m_general_flags; }
00173 
00175         void                Set_General_Flags (int f) { m_general_flags = (unsigned char)f; }
00176 
00181         int                 Pass (BStreamFileToolkit & tk) const { return tk.pass(); }
00182 
00187         TK_Status           Tag (BStreamFileToolkit & tk, int variant= -1) const   { return tk.tag(variant); }
00188 
00192         bool                Tagging (BStreamFileToolkit & tk) const {
00193                                 return m_needs_tag || tk.GetWriteFlags(TK_Force_Tags) != 0;
00194                             }
00195 
00199         void                SetNeedsTag (bool n)        { m_needs_tag = n; }
00200 
00204         bool                NeedsTag () const       { return m_needs_tag; }
00205 
00212         virtual TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const {
00213                                 *handler = 0;
00214                                 return tk.Error();
00215                             }
00216 
00222         virtual bool   NeedsContext (BStreamFileToolkit & tk) const { (void)tk; return false; }
00223 
00228         void            SetLoggingString (char const * segment);
00229 
00234         void            SetLoggingString (int length);
00235 
00239         char const *    GetLoggingString () const                           { return m_debug_string; }
00244         char *          GetLoggingString ()                     { return m_debug_string; }
00245 
00249         void            LogDebug (BStreamFileToolkit & tk, char const * string = 0);
00250 
00251     protected:
00252         // various means of pulling data from the toolkit buffer
00253         // Note: format conversion is safe to do in output buffer
00254 
00256         TK_Status   GetData (BStreamFileToolkit & tk, char * b, int n)          { return tk.read (b, n); }
00257 
00259         TK_Status   GetData (BStreamFileToolkit & tk, short * s, int n) {
00260                         TK_Status   status;
00261                         if ((status = GetData (tk, (char *)s, n * (int)sizeof (short))) == TK_Normal)
00262                             fix (s, n);
00263                         return status;
00264                     }
00265 
00267         TK_Status   GetData (BStreamFileToolkit & tk, int * i,   int n) {
00268                         TK_Status   status;
00269                         if ((status = GetData (tk, (char *)i, n * (int)sizeof (int))) == TK_Normal)
00270                             fix (i, n);
00271                         return status;
00272                     }
00273 
00275         TK_Status   GetData (BStreamFileToolkit & tk, float * f, int n) {
00276                         TK_Status   status;
00277                         if ((status = GetData (tk, (char *)f, n * (int)sizeof (float))) == TK_Normal)
00278                             fix_in (f, n);
00279                         return status;
00280                     }
00281 
00283         TK_Status   GetData (BStreamFileToolkit & tk, double * d, int n) {
00284                         TK_Status   status;
00285                         if ((status = GetData (tk, (char *)d, n * (int)sizeof (double))) == TK_Normal)
00286                             fix_in (d, n);
00287                         return status;
00288                     }
00289 
00291         TK_Status   GetData (BStreamFileToolkit & tk, unsigned char * b, int n)     { return GetData (tk, (char *)b,  n); }
00292 
00294         TK_Status   GetData (BStreamFileToolkit & tk, unsigned short * s, int n)    { return GetData (tk, (short *)s, n); }
00295 
00297         TK_Status   GetData (BStreamFileToolkit & tk, unsigned int * i, int n)      { return GetData (tk, (int *)i,   n); }
00298 
00300         TK_Status   GetData (BStreamFileToolkit & tk, char & c)                     { return GetData (tk, &c, 1); }
00301 
00303         TK_Status   GetData (BStreamFileToolkit & tk, short & s)                    { return GetData (tk, &s, 1); }
00304 
00306         TK_Status   GetData (BStreamFileToolkit & tk, int & i)                      { return GetData (tk, &i, 1); }
00307 
00309         TK_Status   GetData (BStreamFileToolkit & tk, unsigned char & b)            { return GetData (tk, &b, 1); }
00310 
00312         TK_Status   GetData (BStreamFileToolkit & tk, unsigned short & s)           { return GetData (tk, &s, 1); }
00313 
00315         TK_Status   GetData (BStreamFileToolkit & tk, unsigned int & i)             { return GetData (tk, &i, 1); }
00316 
00318         TK_Status   GetData (BStreamFileToolkit & tk, float & f)                    { return GetData (tk, &f, 1); }
00319 
00321         TK_Status   GetData (BStreamFileToolkit & tk, double & d)                   { return GetData (tk, &d, 1); }
00322 
00323 
00325         TK_Status   GetGeneral (BStreamFileToolkit & tk) {
00326                         TK_Status       status = TK_Normal;
00327 
00328                         if (tk.GetVersion() >= 1975 &&
00329                             (status = GetData (tk, m_general_flags)) != TK_Normal)
00330                             return status;
00331 
00332                         return status;
00333                     }
00334 
00335 
00336 
00337 
00339         TK_Status   LookatData (BStreamFileToolkit & tk, unsigned char & b)             { return tk.lookat ((char &)b); }
00340 
00341         // various means of putting data into the toolkit buffer
00342         // Note: format conversion is NOT safe in input buffer -- use temps
00343 
00345         TK_Status   PutData (BStreamFileToolkit & tk, char const * b, int n)          { return tk.write (b, n); }
00346 
00348         TK_Status   PutData (BStreamFileToolkit & tk, short const * s, int n) {
00349                         #ifdef STREAM_BIGENDIAN
00350                             short *     buffer;
00351                             short *     tmp;
00352                             TK_Status   status;
00353                             int         i;
00354                             BSTREAM_ALLOC_ARRAY(buffer, n, short);
00355                             tmp = buffer;
00356                             for (i=0; i<n; ++i)
00357                                 *tmp++ = flip (*s++);
00358                             status = PutData (tk, (char const *)buffer, n * (int)sizeof (short));
00359                             BSTREAM_FREE_ARRAY(buffer, n, short);
00360                             if (status != TK_Normal)
00361                                 return status;
00362                             return TK_Normal;
00363                         #else
00364                             return PutData (tk, (char const *)s, n * (int)sizeof (short));
00365                         #endif
00366                     }
00367 
00369         TK_Status   PutData (BStreamFileToolkit & tk, int const * i, int n) {
00370                         #ifdef STREAM_BIGENDIAN
00371                             int *       buffer;
00372                             int *       tmp;
00373                             TK_Status   status;
00374                             int         j;
00375                             BSTREAM_ALLOC_ARRAY(buffer, n, int);
00376                             tmp = buffer;
00377                             for (j=0; j<n; ++j)
00378                                 *tmp++ = flip (*i++);
00379                             status = PutData (tk, (char const *)buffer, n * (int)sizeof (int));
00380                             BSTREAM_FREE_ARRAY(buffer, n, int);
00381                             if (status != TK_Normal)
00382                                 return status;
00383                             return TK_Normal;
00384                         #else
00385                             return PutData (tk, (char const *)i, n * (int)sizeof (int));
00386                         #endif
00387                     }
00388 
00390         TK_Status   PutData (BStreamFileToolkit & tk, float const * f, int n) {
00391                         #if defined(NON_IEEE) || defined(STREAM_BIGENDIAN)
00392                             float *     buffer;
00393                             float *     tmp;
00394                             TK_Status   status;
00395                             int         i;
00396                             BSTREAM_ALLOC_ARRAY(buffer, n, float);
00397                             tmp = buffer;
00398                             for (i=0; i<n; ++i) {
00399                                 *tmp = *f++;
00400                                 fix_out (tmp++, 1);
00401                             }
00402                             status = PutData (tk, (char const *)buffer, n * (int)sizeof (float));
00403                             BSTREAM_FREE_ARRAY(buffer, n, float);
00404                             if (status != TK_Normal)
00405                                 return status;
00406                             return TK_Normal;
00407                         #else
00408                             return PutData (tk, (char const *)f, n * (int)sizeof (float));
00409                         #endif
00410                     }
00411 
00413         TK_Status   PutData (BStreamFileToolkit & tk, double const * d, int n) {
00414                         #if defined(NON_IEEE) || defined(STREAM_BIGENDIAN)
00415                             double *     buffer;
00416                             double *     tmp;
00417                             TK_Status   status;
00418                             int         i;
00419                             BSTREAM_ALLOC_ARRAY(buffer, n, double);
00420                             tmp = buffer;
00421                             for (i=0; i<n; ++i) {
00422                                 *tmp = *d++;
00423                                 fix_out (tmp++, 1);
00424                             }
00425                             status = PutData (tk, (char const *)buffer, n * (int)sizeof (double));
00426                             BSTREAM_FREE_ARRAY(buffer, n, double);
00427                             if (status != TK_Normal)
00428                                 return status;
00429                             return TK_Normal;
00430                         #else
00431                             return PutData (tk, (char const *)d, n * (int)sizeof (double));
00432                         #endif
00433                     }
00434 
00436         TK_Status   PutData (BStreamFileToolkit & tk, unsigned char const * b, int n)   { return PutData (tk, (char const *)b,  n); }
00437 
00439         TK_Status   PutData (BStreamFileToolkit & tk, unsigned short const * s, int n)  { return PutData (tk, (short const *)s, n); }
00440             
00442         TK_Status   PutData (BStreamFileToolkit & tk, unsigned int const * i, int n)    { return PutData (tk, (int const *)i,   n); }
00443 
00445         TK_Status   PutData (BStreamFileToolkit & tk, char const & c)                   { return PutData (tk, &c, 1); }
00446 
00448         TK_Status   PutData (BStreamFileToolkit & tk, short const & s)                  { return PutData (tk, &s, 1); }
00449 
00451         TK_Status   PutData (BStreamFileToolkit & tk, int const & i)                    { return PutData (tk, &i, 1); }
00452 
00454         TK_Status   PutData (BStreamFileToolkit & tk, unsigned char const & b)          { return PutData (tk, &b, 1); }
00455 
00457         TK_Status   PutData (BStreamFileToolkit & tk, unsigned short const & s)         { return PutData (tk, &s, 1); }
00458 
00460         TK_Status   PutData (BStreamFileToolkit & tk, unsigned int const & i)           { return PutData (tk, &i, 1); }
00461         
00463         TK_Status   PutData (BStreamFileToolkit & tk, float const & f)                  { return PutData (tk, &f, 1); }
00464 
00466         TK_Status   PutData (BStreamFileToolkit & tk, double const & d)                 { return PutData (tk, &d, 1); }
00467 
00469         TK_Status   PutOpcode (BStreamFileToolkit & tk, int adjust = 1) {
00470                         TK_Status       status;
00471                         unsigned int    sequence;
00472 
00473                         if ((status = PutData (tk, Opcode ())) != TK_Normal)
00474                             return status;
00475 
00476                         tk.adjust_written (adjust);
00477 
00478                         sequence = tk.NextOpcodeSequence();
00479                         if (tk.GetLogging())
00480                             log_opcode (tk, sequence, Opcode());
00481 
00482                         return status;
00483                     }
00484 
00486         TK_Status   PutGeneral (BStreamFileToolkit & tk) {
00487                         TK_Status       status = TK_Normal;
00488 
00489                         if (tk.GetTargetVersion() >= 1975 &&
00490                             (status = PutData (tk, General_Flags ())) != TK_Normal)
00491                             return status;
00492 
00493                         return status;
00494                     }
00495 
00496 
00497 
00498         /* note -- fix for int types will work during read OR write phase, but floats need separate routines for native->IEEE and IEEE->native
00499         */
00501         short       flip (short s) {
00502                         return (short)(((s >> 8) & 0x00FF) | (s << 8));
00503                     }
00505         int         flip (int i) {
00506                         return ((i >> 24) & 0x000000FF) | ((i >> 8) & 0x0000FF00) |
00507                                ((i <<  8) & 0x00FF0000) |  (i << 24);
00508                     }
00509 
00510 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00511   #ifndef UNREFERENCED
00512     #define UNREFERENCED(x) (void)(x)
00513   #endif
00514 #endif 
00515 
00517         void        fix (int * i, int n) {
00518                         #ifdef STREAM_BIGENDIAN
00519                         while (n--){
00520                                 *i = flip (*i);
00521                                 i++;
00522                         }
00523                         #else
00524                         UNREFERENCED(i);
00525                         UNREFERENCED(n);
00526                         #endif
00527                     }
00529         void        fix (short * s, int n) {
00530                         #ifdef STREAM_BIGENDIAN
00531                             while (n--){
00532                                 *s = flip (*s);
00533                                 s++;
00534                                 }
00535                         #else
00536                             UNREFERENCED(s);
00537                             UNREFERENCED(n);
00538                         #endif
00539                     }
00540 
00542         void        fix_in (float * f, int n) {
00543                         #ifdef NON_IEEE
00544                             // need to re-interpret from IEEE to native format
00545                         #endif
00546 
00547                         #ifdef STREAM_BIGENDIAN
00548                             int * i = (int *) f;
00549                             while (n--) {
00550                                 *i = flip (*i);
00551                                 i++;
00552                             }
00553                         #else
00554                             UNREFERENCED(f);
00555                             UNREFERENCED(n);
00556                         #endif
00557                     }
00559         void        fix_in (double * d, int n) {
00560                         #ifdef NON_IEEE
00561                             // need to re-interpret from IEEE to native format
00562                         #endif
00563 
00564                         #ifdef STREAM_BIGENDIAN
00565                             while (n--) {
00566                                 flip (i++);
00567                             }
00568                         #else
00569                             UNREFERENCED(d);
00570                             UNREFERENCED(n);
00571                         #endif
00572                     }
00574         void        fix_out (float * f, int n) {
00575                         #ifdef NON_IEEE
00576                             // need to re-interpret from native format to IEEE
00577                         #endif
00578 
00579                         #ifdef STREAM_BIGENDIAN
00580                             int * i = (int*) f;
00581                             while (n--) {
00582                                 *i = flip (*i);
00583                                 i++;
00584                             }
00585                         #else
00586                             UNREFERENCED(f);
00587                             UNREFERENCED(n);
00588                         #endif
00589                     }
00591         void        fix_out (double * d, int n) {
00592                         #ifdef NON_IEEE
00593                             // need to re-interpret from native format to IEEE
00594                         #endif
00595 
00596                         #ifdef STREAM_BIGENDIAN
00597                             while (n--) {
00598                                 flip (d++);
00599                             }
00600                         #else
00601                             UNREFERENCED(d);
00602                             UNREFERENCED(n);
00603                         #endif
00604                     }
00605 
00607         void        log_opcode (BStreamFileToolkit & tk, unsigned int sequence, unsigned char opcode);
00608 
00609 
00610         /* common conversions
00611            these two are for converting between floats [0.0,1.0] and unsigned chars [0,255]
00612         */
00614         void        floats_to_bytes (float const * in, unsigned char * out, int count) const {
00615                         while (count-- > 0)
00616                             *out++ = char (*in++ * 255.999f);
00617                     }
00619         void        bytes_to_floats (unsigned char const * in, float * out, int count) const {
00620                         while (count-- > 0)
00621                             *out++ = float (*in++) * (1.0f/255.0f);
00622                     }
00623 
00624         // access to toolkit utility functions
00626         void        add_segment (BStreamFileToolkit & tk, ID_Key key)           { tk.add_segment (key); }
00628         ID_Key      remove_segment (BStreamFileToolkit & tk)                    { return tk.remove_segment(); }
00630         void        set_last_key (BStreamFileToolkit & tk, ID_Key key)          { tk.set_last_key (key); }
00632         ID_Key      last_key (BStreamFileToolkit & tk) const {
00633                         if (tk.m_last_keys_used == 1) 
00634                             return tk.m_last_keys[0];
00635                         else 
00636                             return -1; 
00637                     } 
00639         void        adjust_written (BStreamFileToolkit & tk, int count)         { tk.adjust_written (count); }
00641         void        increase_nesting (BStreamFileToolkit & tk, int amount=1)        { tk.increase_nesting (amount); }
00643         void        decrease_nesting (BStreamFileToolkit & tk, int amount=1)        { tk.decrease_nesting (amount); }
00644 
00648         void        Revisit (BStreamFileToolkit & tk, float priority=0.0f, int variant=0) const  { tk.revisit (Opcode(), priority, variant); }
00649 
00653         BBaseOpcodeHandler *        Opcode_Handler (BStreamFileToolkit & tk, unsigned char op) const
00654                                         { return tk.opcode_handler (op); }
00655 
00657         void        Record_Instance (BStreamFileToolkit & tk, ID_Key key, int variant,
00658                                      int val1, int val2, int val3) const {
00659                         tk.record_instance (key, variant, this, val1, val2, val3);
00660                     }
00662         bool        Find_Instance (BStreamFileToolkit & tk, int val1, int val2, int val3) {
00663                         return tk.find_instance (this, val1, val2, val3);
00664                     }
00665 
00667         void        Remember_Item (BStreamFileToolkit & tk, ID_Key key) const  { tk.remember_item(key); }
00669         bool        Find_Item (BStreamFileToolkit & tk, ID_Key key) const      { return tk.find_item(key); }
00670 
00672         bool        validate_count (int count, int limit = 1<<24) const { return 0 <= count && count <= limit; }
00673 
00677     static float read_float (char const *cp, char const ** newcpp = 0);
00679     static float read_float (char const *cp, char ** newcpp)
00680                     { return read_float (cp, (char const **)newcpp); }
00682     static char * write_float (char * buffer, double f);
00683 
00684 
00685 
00687         TK_Status   SkipNewlineAndTabs(BStreamFileToolkit & tk, unsigned int* readSize=0);
00689         TK_Status   ReadAsciiLine(BStreamFileToolkit & tk, unsigned int* readSize=0);
00691         TK_Status   ReadAsciiWord(BStreamFileToolkit & tk, unsigned int* readSize=0);
00693         TK_Status   ReadEndOpcode(BStreamFileToolkit & tk);
00695         bool        RemoveAngularBrackets(char* string);
00697         bool        RemoveQuotes(char* string);
00699         TK_Status   Read_Referenced_Segment(BStreamFileToolkit & tk, int &i_progress);
00700 
00701         //TK_Status   GetAsciiData(BStreamFileToolkit & tk, float * rFloats,    unsigned int n);
00702 
00704         TK_Status   GetAsciiData(BStreamFileToolkit & tk, int * rInts,      unsigned int n);
00705         //TK_Status   GetAsciiData(BStreamFileToolkit & tk, short * rShorts,    unsigned int n);
00706 
00708         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned char& value);
00710         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, char& value);
00712         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned short& value);
00714         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, short& value);
00716         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, int& value);
00718         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, float& value);
00720         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, float * rFloats, unsigned int n);
00722         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, char * m_string, unsigned int n);
00724         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned char * m_string, unsigned int n);
00726         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, int * rInts,     unsigned int n);
00728         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, short * rShorts, unsigned int n);
00730         TK_Status   GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned short * rShorts, unsigned int n);
00732         TK_Status   GetAsciiHex(BStreamFileToolkit & tk,  const char * tag, unsigned char &value);
00734         TK_Status   GetAsciiHex(BStreamFileToolkit & tk,  const char * tag, int &value);
00736         TK_Status   GetAsciiHex(BStreamFileToolkit & tk,  const char * tag, char &value);
00738         TK_Status   GetAsciiHex(BStreamFileToolkit & tk,  const char * tag, unsigned short &value);
00740         TK_Status   GetAsciiImageData(BStreamFileToolkit & tk, const char * tag, unsigned char * rValues, unsigned int n);
00741 
00743         TK_Status   PutAsciiOpcode (BStreamFileToolkit & tk, int adjust = 1, bool is_end = false, bool want_newline = true);
00744     //  TK_Status   PutAsciiOpcode (BStreamFileToolkit & tk, int adjust = 1);
00745 
00747         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, char const * b, int n);
00749         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, short const * s, int n);
00751         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, int const * i, int n);
00753         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, float const * f, int n);
00755         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned char const * b, int n);
00757         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned short const * s, int n);
00759         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned int const * i, int n);
00761         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, char const & c);
00763         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, short const & s);
00765         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, int const & i);
00767         TK_Status   PutAsciiFlag (BStreamFileToolkit & tk, char const *tag, int const & i);
00769         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned char const & b);
00771         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned short const & s);
00773         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned int const & i);
00775         TK_Status   PutAsciiData (BStreamFileToolkit & tk, char const *tag, float const & f);
00777         TK_Status   PutAsciiMask (BStreamFileToolkit & tk,char const *tag, int const & i);
00779         TK_Status   PutAsciiHex (BStreamFileToolkit & tk, char const *tag, int const & i);
00781         TK_Status   PutStartXMLTag (BStreamFileToolkit & tk, char const *tag);
00783         TK_Status   PutEndXMLTag (BStreamFileToolkit & tk, char const *tag);
00784 };
00785 
00787 #define IMPLEMENT_CLONE(class_name)                                                                         \
00788             TK_Status class_name::Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **newhandler) const {  \
00789                 *newhandler = BSTREAM_NEW(class_name);                                                              \
00790                 if (*newhandler != null)                                                                    \
00791                     return TK_Normal;                                                                       \
00792                 else                                                                                        \
00793                     return tk.Error ("memory allocation in" #class_name "::clone failed");                  \
00794             }                                                                                              //
00796 #define IMPLEMENT_CLONE_OPCODE(class_name)                                                                  \
00797             TK_Status class_name::Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **newhandler) const {  \
00798                 *newhandler = BSTREAM_NEW(class_name)(Opcode());                                                    \
00799                 if (*newhandler != null)                                                                    \
00800                     return TK_Normal;                                                                       \
00801                 else                                                                                        \
00802                     return tk.Error ("memory allocation in" #class_name "::clone failed");                  \
00803 }                                                                                                          //
00804 
00805 
00806 
00808 
00816 // Additions need to be reflected in the 'opcode_string' table in BOpcodeHandler.cpp
00817 enum TKE_Object_Types {
00818     TKE_Termination                 = '\x00',       
00819     TKE_Pause                       = '\x01',       
00820 
00821     TKE_Comment                     = ';',          
00822 
00823     TKE_Font                        = 'f',          
00824     TKE_Texture                     = 't',          
00825     TKE_Material                    = '\x02',       
00826 
00827     TKE_Open_Segment                = '(',          
00828     TKE_Close_Segment               = ')',          
00829     TKE_Reopen_Segment              = 's',          
00830     TKE_Include_Segment             = '<',          
00831     TKE_Style_Segment               = '{',          
00832     TKE_Named_Style                 = 'y',          
00833 
00834     TKE_Geometry_Attributes         = ':',          
00835     TKE_Renumber_Key_Global         = 'K',          
00836     TKE_Renumber_Key_Local          = 'k',          
00837     TKE_Priority                    = '0',          
00838     TKE_Tag                         = 'q',          
00839 
00840     TKE_Bounding                    = 'b',          
00841     TKE_Bounding_Info               = 'B',          
00842     TKE_Callback                    = '\x07',       
00843     TKE_Camera                      = '>',          
00844     TKE_Conditional_Action          = '\'',         
00845     TKE_Conditions                  = '?',          
00846     TKE_Color                       = '"',          
00847     TKE_Color_By_Index              = '\x08',       
00848     TKE_Color_By_Index_16           = '\x09',       
00849     TKE_Color_By_FIndex             = '\x0A',       
00850     TKE_Color_RGB                   = '~',          
00851     TKE_Color_By_Value              = '\x0B',       
00852     TKE_Color_Map                   = '\x0C',       
00853     TKE_Edge_Pattern                = '\x0D',       
00854     TKE_Edge_Weight                 = '\x0E',       
00855     TKE_Face_Pattern                = 'P',          
00856     TKE_Geometry_Options            = '\x17',       
00857     TKE_Handedness                  = 'h',          
00858     TKE_Heuristics                  = 'H',          
00859     TKE_Line_Pattern                = '-',          
00860     TKE_Line_Weight                 = '=',          
00861     TKE_Marker_Size                 = '+',          
00862     TKE_Marker_Symbol               = '@',          
00863     TKE_Modelling_Matrix            = '%',          
00864     TKE_LOD                         = '\x19',       
00865     TKE_Rendering_Options           = 'R',          
00866     TKE_Selectability               = '!',          
00867     TKE_Text_Alignment              = '*',          
00868     TKE_Text_Font                   = 'F',          
00869     TKE_Text_Path                   = '|',          
00870     TKE_Text_Spacing                = ' ',          
00871     TKE_Texture_Matrix              = '$',          
00872     TKE_Unicode_Options             = '\x16',       
00873     TKE_User_Index                  = 'n',          
00874     TKE_User_Index_Data             = 'm',          
00875     TKE_User_Options                = 'U',          
00876     TKE_User_Value                  = 'v',          
00877     TKE_Visibility                  = 'V',          
00878     TKE_Window                      = 'W',          
00879     TKE_Window_Frame                = '#',          
00880     TKE_Window_Pattern              = 'p',          
00881     TKE_Glyph_Definition            = 'j',          
00882     TKE_Line_Style                  = 'J',          
00883     TKE_Named_Style_Def             = 'u',          
00884 
00885     TKE_Area_Light                  = 'a',          
00886     TKE_Circle                      = 'C',          
00887     TKE_Circular_Arc                = 'c',          
00888     TKE_Circular_Chord              = '\\',         
00889     TKE_Circular_Wedge              = 'w',          
00890     TKE_Cutting_Plane               = '/',          
00891     TKE_Cylinder                    = 'Y',          
00892     TKE_Distant_Light               = 'd',          
00893     TKE_Ellipse                     = 'E',          
00894     TKE_Elliptical_Arc              = 'e',          
00895     TKE_Grid                        = 'g',          
00896     TKE_Image                       = 'i',          
00897     TKE_Infinite_Line               = '`',          
00898     TKE_Infinite_Ray                = '\x11',       
00899     TKE_Line                        = 'l',          
00900     TKE_Local_Light                 = '.',          
00901     TKE_Marker                      = 'X',          
00902     TKE_Mesh                        = 'M',          
00903     TKE_NURBS_Curve                 = 'N',          
00904     TKE_NURBS_Surface               = 'A',          
00905     TKE_PolyCylinder                = 'Q',          
00906     TKE_Polygon                     = 'G',          
00907     TKE_Polyline                    = 'L',          
00908     TKE_PolyPolyline                = '\x10',       
00909     TKE_Reference                   = 'r',          
00910     TKE_Shell                       = 'S',          
00911     TKE_Sphere                      = '\x1a',       
00912     TKE_Spot_Light                  = '^',          
00913     TKE_Text                        = 'T',          
00914     TKE_Text_With_Encoding          = 'x',          
00915 
00916     TKE_Start_User_Data             = '[',          
00917     TKE_Stop_User_Data              = ']',          
00918     TKE_XML                         = '\x18',       
00919     TKE_External_Reference          = '\x12',       
00920     TKE_External_Reference_Unicode  = '\x13',       
00921     TKE_URL                         = '\x15',       
00922 
00923     TKE_Start_Compression           = 'Z',          
00924     TKE_Stop_Compression            = 'z',          
00925 
00926     TKE_Repeat_Object               = '&',          
00927     TKE_View                        = '}',          
00928     TKE_Clip_Rectangle              = 'o',          
00929     TKE_Clip_Region                 = 'O',          
00930     TKE_Complex_Clip_Region         = '\x0F',       
00931 
00932     TKE_File_Info                   = 'I',          
00933     TKE_Dictionary                  = 'D',          
00934     TKE_Dictionary_Locater          = '_',          
00935     TKE_Thumbnail                   = '\x14',       
00936     TKE_Delete_Object               = '\x7F',       
00937 
00938     TKE_Tag_Implicit                = TKE_Tag,      
00939     TKE_Streaming_Mode              = ',',          
00940 
00941     TKE_First_User_Opcode           = '\xA0',       
00942     TKE_Last_User_Opcode            = '\xEF',       
00943     TKE_HW3D_Image                  = 0xE0,
00945     TKE_Pseudo_Handler              = '\xFE',       
00946     TKE_Extended_Code               = '\xFF'        
00947 };
00948 
00949 
00951 
00952 
00958 class BBINFILETK_API TK_Default : public BBaseOpcodeHandler {
00959     
00960     protected:
00961         char *      m_opcode_buffer;
00962         int         m_buffer_count;
00963 
00964     public:
00966         TK_Default () : BBaseOpcodeHandler (TKE_Pseudo_Handler) {m_opcode_buffer = 0, m_buffer_count = 0;}
00967 
00968         TK_Status   Read (BStreamFileToolkit & tk);
00969         
00970         TK_Status   Write (BStreamFileToolkit & tk);
00971 
00972 
00973         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
00974         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
00975 
00976 };
00977 
00983 class BBINFILETK_API TK_Unavailable : public BBaseOpcodeHandler {
00984     public:
00986         TK_Unavailable (char opcode) : BBaseOpcodeHandler (opcode) {}
00987 
00988         TK_Status   Read (BStreamFileToolkit & tk);
00989         TK_Status   Write (BStreamFileToolkit & tk);
00990 };
00991 
00994 
01000 class BBINFILETK_API TK_Header : public BBaseOpcodeHandler {
01001     protected:
01003         BBaseOpcodeHandler *    m_current_object;
01004 
01005     public:
01007         TK_Header () : BBaseOpcodeHandler (TKE_Pseudo_Handler), m_current_object (0) {}
01008         ~TK_Header();
01009 
01010         TK_Status   Read (BStreamFileToolkit & tk);
01011         TK_Status   Write (BStreamFileToolkit & tk);
01012 
01013 
01014         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01015         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01016 
01017 
01018         void        Reset ();
01019 };
01020 
01021 
01023 
01029 class BBINFILETK_API TK_File_Info : public BBaseOpcodeHandler {
01030     protected:
01032         int             m_flags;
01033 
01034     public:
01036         TK_File_Info () : BBaseOpcodeHandler (TKE_File_Info), m_flags (0) {}
01037 
01038         
01039         TK_Status   Read (BStreamFileToolkit & tk);
01040         TK_Status   Write (BStreamFileToolkit & tk);
01041         TK_Status   Execute (BStreamFileToolkit & tk);
01042         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant);
01043         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
01044                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
01045 
01046 
01047         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01048         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01049 
01050 
01052         void            SetFlags (int f)                        { m_flags = f;      }
01054         int             GetFlags ()                         { return m_flags;   }
01055 };
01056 
01057 
01059 
01067 class BBINFILETK_API TK_Comment : public BBaseOpcodeHandler {
01068     protected:
01070         int             m_length;
01072         int             m_allocated;
01074         char *          m_comment;
01075         
01077         void    set_comment (char const * comment);
01079         void    set_comment (int length);
01080 
01081     public:
01083         TK_Comment (char const * comment = 0);
01084         ~TK_Comment();
01085 
01086         TK_Status   Read (BStreamFileToolkit & tk);
01087         TK_Status   Write (BStreamFileToolkit & tk);
01088         TK_Status   Execute (BStreamFileToolkit & tk);
01089 
01090         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01091         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01092         TK_Status   ExecuteAscii (BStreamFileToolkit & tk);
01095         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant) {
01096                         (void)tk; (void)key; (void)variant;
01097                         return TK_Normal;
01098                     }
01099         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
01100                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
01101         void        Reset ();
01102 
01107         void            SetComment (char const * comment)       { set_comment (comment); }
01112         void            SetComment (int length)                 { set_comment (length);  }
01116         char const *    GetComment () const                 { return m_comment; }
01121         char *          GetComment ()                       { return m_comment; }
01122 };
01123 
01124 
01126 
01134 class BBINFILETK_API TK_Terminator : public BBaseOpcodeHandler {
01135     public:
01137         TK_Terminator (char opcode, bool is_file_terminator = true) : BBaseOpcodeHandler (opcode), 
01138                                                                     m_terminate_file(is_file_terminator) {}
01139 
01140         TK_Status   Read (BStreamFileToolkit & tk);
01141         TK_Status   Write (BStreamFileToolkit & tk);
01142         TK_Status   Execute (BStreamFileToolkit & tk);
01143 
01144 
01145         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01146         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01147 
01148     protected:
01150         // meant to terminate the file or something else (viz. LOD collection)
01151         bool        m_terminate_file;
01152 };
01153 
01154 
01156 
01163 class BBINFILETK_API TK_Compression : public BBaseOpcodeHandler {
01164     public:
01166         TK_Compression (char opcode) : BBaseOpcodeHandler (opcode) {}
01167 
01168         TK_Status   Read (BStreamFileToolkit & tk);
01169         TK_Status   Write (BStreamFileToolkit & tk);
01170 
01171         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01172         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01173         TK_Status   Execute (BStreamFileToolkit & tk);
01174         TK_Status   ExecuteAscii (BStreamFileToolkit & tk);
01175         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant);
01176         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
01177                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
01178 };
01179 
01181 
01185 enum TKO_Geometry_Bits {
01186     // first byte is common/shared items, plus flag for extended bits
01187     TKO_Geo_Face            = 0x00000001,   
01188     TKO_Geo_Edge            = 0x00000002,   
01189     TKO_Geo_Line            = 0x00000004,   
01190     TKO_Geo_Marker          = 0x00000008,   
01191     TKO_Geo_Text            = 0x00000010,   
01192     TKO_Geo_Window          = 0x00000020,   
01193     TKO_Geo_Image           = 0x00000040,   
01194 
01195     TKO_Geo_Extended        = 0x00000080,   
01196     TKO_Geo_Extended_Mask   = 0xFFFFFF00,   
01197     TKO_Geo_Extended_Shift  = 8,            
01198 
01199     // extras for color
01200     TKO_Geo_Ambient_Up      = 0x00000100,   
01201     TKO_Geo_Light           = 0x00000200,   
01202     TKO_Geo_Face_Contrast   = 0x00000400,   
01203     TKO_Geo_Window_Contrast = 0x00000800,   
01204     TKO_Geo_Front           = 0x00001000,   
01205     TKO_Geo_Back            = 0x00002000,   
01206     TKO_Geo_Vertex          = 0x00004000,   
01207     TKO_Geo_Geom_Colors     = 0x0000701F,   
01208     TKO_Geo_Every_Colors    = 0x000073BF,   
01209 
01210     TKO_Geo_Extended_Colors = 0x00008000,   
01211     TKO_Geo_Extended_Colors_Mask
01212                             = 0xFFFF0000,   
01213     TKO_Geo_Extended_Colors_Shift
01214                             = 16,           
01215 
01216     TKO_Geo_Edge_Contrast   = 0x00010000,   
01217     TKO_Geo_Line_Contrast   = 0x00020000,   
01218     TKO_Geo_Marker_Contrast = 0x00040000,   
01219     TKO_Geo_Vertex_Contrast = 0x00080000,   
01220     TKO_Geo_Cut_Edge        = 0x00100000,   
01221     TKO_Geo_Simple_Reflection=0x00200000,   
01222     TKO_Geo_Cut_Face        = 0x00400000,   
01223 
01224     TKO_Geo_Extended2       = 0x00800000,   
01225     TKO_Geo_Extended2_Mask  = 0xFF000000,   
01226     TKO_Geo_Extended2_Shift = 24,           
01227 
01228     TKO_Geo_Text_Contrast   = 0x01000000,   
01229     TKO_Geo_Ambient_Down    = 0x02000000,   
01230     TKO_Geo_Cut_Face_Contrast
01231                             = 0x04000000,   
01232     TKO_Geo_Ambient         = 0x02000100,   
01233     TKO_Geo_All_Colors      = 0x077F7F7F,   
01234 
01235     //extras for selectability
01236     TKO_Geo_String_Cursor   = 0x00000100,   
01237 //  TKO_Geo_Light           = 0x00000200,   //!< extra item for selectability; refer to ::HC_Set_Selectability for a description
01238 //  TKO_Geo_Vertex          = 0x00004000,   //!< extra item for selectability; refer to ::HC_Set_Selectability for a description
01239     TKO_Geo_Isoline         = 0x00000080,   
01240     TKO_Geo_Geom_Selects    = 0x0000435F,   
01241     TKO_Geo_All_Selects     = 0x000043FF,   
01242 
01243     // extras for visibility
01244 //  TKO_Geo_String_Cursor   = 0x00000100,   //!< extra item for visibility; refer to ::HC_Set_Visibility for a description
01245     TKO_Geo_Face_Lighting   = 0x00000200,   
01246     TKO_Geo_Edge_Lighting   = 0x00000400,   
01247     TKO_Geo_Marker_Lighting = 0x00000800,   
01248     TKO_Geo_Light_Visibles  = 0x00000E00,   
01249 
01250     TKO_Geo_Silhouette_Edge = 0x00001000,   
01251     TKO_Geo_Perimeter_Edge  = 0x00002000,   
01252     TKO_Geo_Mesh_Quad       = 0x00004000,   
01253     TKO_Geo_Hard_Edge       = 0x00008000,   
01254     TKO_Geo_Cutting_Plane   = 0x00010000,   
01255     TKO_Geo_Shadow_Emit     = 0x00020000,   
01256     TKO_Geo_Shadow_Cast     = 0x00040000,   
01257     TKO_Geo_Shadow_Receive  = 0x00080000,   
01258     TKO_Geo_Shadow_Visibles = 0x000E0000,   
01259 //  TKO_Geo_Cut_Edge        = 0x00100000,   //!< extra item for visibility; refer to ::HC_Set_Visibility for a description
01260     TKO_Geo_Vertex_Vis      = 0x00200000,   
01261 //  TKO_Geo_Cut_Face        = 0x00400000,   //!< extra item for visibility; refer to ::HC_Set_Visibility for a description
01262     TKO_Geo_Cut_Geometry    = 0x00500000,   
01263 
01264     TKO_Geo_Adjacent_Edge   = 0x01000000,   
01265     TKO_Geo_NonCulled_Edge  = 0x02000000,   
01266     TKO_Geo_Edge_Visibles   = 0x0300F002,   
01267 
01268 
01269     TKO_Geo_Geom_Visibles   = 0x0301FFFF,   
01270 
01271 
01272 
01273     TKO_Geo_All_Visibles    = 0x037FFF7F    
01274 };
01275 
01276 
01280 enum TKO_Color_Channels {
01281     TKO_Channel_Diffuse         = 0, 
01282     TKO_Channel_Specular        = 1, 
01283     TKO_Channel_Mirror          = 2, 
01284     TKO_Channel_Transmission    = 3, 
01285     TKO_Channel_Emission        = 4, 
01286     TKO_Channel_Gloss           = 5, 
01287     TKO_Channel_Index           = 6, 
01288     TKO_Channel_Extended        = 7, 
01289     TKO_Channel_Environment     = 8, 
01290     TKO_Channel_Bump            = 9, 
01291 
01292     TKO_Channel_Count           = 10,
01293 
01294     TKO_Channel_Extended_Mask   = 0xFF00,   
01295     TKO_Channel_Extended_Shift  = 8         
01296 };
01297 
01298 
01300 
01304 enum TKO_Attribute_Lock_Bits {
01305     TKO_Lock_Callback                   = 0x00000001,  
01306     TKO_Lock_Camera                     = 0x00000002,  
01307     TKO_Lock_Color                      = 0x00000004,  
01308     TKO_Lock_Color_Map                  = 0x00000008,  
01309     TKO_Lock_Driver                     = 0x00000010,  
01310     TKO_Lock_Driver_Options             = 0x00000020,  
01311     TKO_Lock_Edge_Pattern               = 0x00000040,  
01312     TKO_Lock_Edge_Weight                = 0x00000080,  
01313     TKO_Lock_Face_Pattern               = 0x00000100,  
01314     TKO_Lock_Handedness                 = 0x00000200,  
01315     TKO_Lock_Heuristics                 = 0x00000400,  
01316     TKO_Lock_Line_Pattern               = 0x00000800,  
01317     TKO_Lock_Line_Weight                = 0x00001000,  
01318     TKO_Lock_Marker_Size                = 0x00002000,  
01319     TKO_Lock_Marker_Symbol              = 0x00004000,  
01320     TKO_Lock_Metafile                   = 0x00008000,  
01321     TKO_Lock_Modelling_Matrix           = 0x00010000,  
01322     TKO_Lock_Rendering_Options          = 0x00020000,  
01323     TKO_Lock_Selectability              = 0x00040000,  
01324     TKO_Lock_Styles                     = 0x00080000,  
01325     TKO_Lock_Text_Alignment             = 0x00100000,  
01326     TKO_Lock_Text_Font                  = 0x00200000,  
01327     TKO_Lock_Text_Path                  = 0x00400000,  
01328     TKO_Lock_Text_Spacing               = 0x00800000,  
01329     TKO_Lock_User_Options               = 0x01000000,  
01330     TKO_Lock_User_Value                 = 0x02000000,  
01331     TKO_Lock_Texture_Matrix             = 0x04000000,  
01332     TKO_Lock_Visibility                 = 0x08000000,  
01333     TKO_Lock_Window                     = 0x10000000,  
01334     TKO_Lock_Window_Frame               = 0x20000000,  
01335     TKO_Lock_Window_Pattern             = 0x40000000,  
01336     TKO_Lock_All                        = 0x7FFFFFFF   
01337 
01338 };
01339 
01343 enum TKO_Color_Channel_Lock_Bits {
01344     TKO_Lock_Channel_Diffuse        = 0x0001,   
01345     TKO_Lock_Channel_Specular       = 0x0002,   
01346     TKO_Lock_Channel_Mirror         = 0x0004,   
01347     TKO_Lock_Channel_Transmission   = 0x0008,   
01348     TKO_Lock_Channel_Emission       = 0x0010,   
01349     TKO_Lock_Channel_Gloss          = 0x0020,   
01350     TKO_Lock_Channel_Index          = 0x0040,   
01351     TKO_Lock_Channel_Environment    = 0x0080,   
01352     TKO_Lock_Channel_Bump           = 0x0100,   
01353     TKO_Lock_Channel_ALL            = 0x01FF    
01354 };
01355 
01356 
01357 // this should be based off a "data handling" interface class broken out from BBaseOpcodeHandler
01358 class BBINFILETK_API Lock_Masks : public BBaseOpcodeHandler {
01359     public:
01360         int             mask;                           
01361         int             value;                          
01362         int             color_mask;                     
01363         int             color_value;                    
01364         short           color_face_mask;                
01365         short           color_face_value;               
01366         short           color_edge_mask;                
01367         short           color_edge_value;               
01368         short           color_line_mask;                
01369         short           color_line_value;               
01370         short           color_marker_mask;              
01371         short           color_marker_value;             
01372         short           color_text_mask;                
01373         short           color_text_value;               
01374         short           color_window_mask;              
01375         short           color_window_value;             
01376         short           color_face_contrast_mask;       
01377         short           color_face_contrast_value;      
01378         short           color_window_contrast_mask;     
01379         short           color_window_contrast_value;    
01380         short           color_back_mask;                
01381         short           color_back_value;               
01382         short           color_vertex_mask;              
01383         short           color_vertex_value;             
01384         short           color_edge_contrast_mask;       
01385         short           color_edge_contrast_value;      
01386         short           color_line_contrast_mask;       
01387         short           color_line_contrast_value;      
01388         short           color_marker_contrast_mask;     
01389         short           color_marker_contrast_value;    
01390         short           color_vertex_contrast_mask;     
01391         short           color_vertex_contrast_value;    
01392         short           color_text_contrast_mask;       
01393         short           color_text_contrast_value;      
01394         short           color_simple_reflection_mask;   
01395         short           color_simple_reflection_value;  
01396         short           color_cut_face_mask;            
01397         short           color_cut_face_value;           
01398         short           color_cut_edge_mask;            
01399         short           color_cut_edge_value;           
01400         int             visibility_mask;                
01401         int             visibility_value;               
01402 
01403 
01404         Lock_Masks () : BBaseOpcodeHandler (0) {}
01405         TK_Status   Read (BStreamFileToolkit &)     { return TK_Error; }
01406         TK_Status   Write (BStreamFileToolkit &)    { return TK_Error; }
01407 
01408         TK_Status   Read (BStreamFileToolkit & tk, bool mask_only);
01409         TK_Status   Write (BStreamFileToolkit & tk, bool mask_only);
01410 
01411         void    init() {
01412             mask = value = 0;
01413             color_mask = color_value = 0;
01414             color_face_mask = color_face_value = 
01415             color_edge_mask = color_edge_value = 
01416             color_line_mask = color_line_value = 
01417             color_marker_mask = color_marker_value = 
01418             color_text_mask = color_text_value = 
01419             color_window_mask = color_window_value = 
01420             color_face_contrast_mask = color_face_contrast_value = 
01421             color_window_contrast_mask = color_window_contrast_value = 
01422             color_back_mask = color_back_value = 
01423             color_vertex_mask = color_vertex_value = 
01424             color_edge_contrast_mask = color_edge_contrast_value = 
01425             color_line_contrast_mask = color_line_contrast_value = 
01426             color_marker_contrast_mask = color_marker_contrast_value = 
01427             color_vertex_contrast_mask = color_vertex_contrast_value = 
01428             color_text_contrast_mask = color_text_contrast_value = 0;
01429             color_simple_reflection_mask = color_simple_reflection_value = 0;
01430             color_cut_face_mask = color_cut_face_value = 0;
01431             color_cut_edge_mask = color_cut_edge_value = 0;
01432             visibility_mask = visibility_value = 0;
01433         }
01434 
01435         void    set_color() {
01436             color_mask = color_value = TKO_Geo_All_Colors;
01437             color_face_mask = color_face_value = 
01438             color_edge_mask = color_edge_value = 
01439             color_line_mask = color_line_value = 
01440             color_marker_mask = color_marker_value = 
01441             color_text_mask = color_text_value = 
01442             color_window_mask = color_window_value = 
01443             color_face_contrast_mask = color_face_contrast_value = 
01444             color_window_contrast_mask = color_window_contrast_value = 
01445             color_back_mask = color_back_value = 
01446             color_vertex_mask = color_vertex_value = 
01447             color_edge_contrast_mask = color_edge_contrast_value = 
01448             color_line_contrast_mask = color_line_contrast_value = 
01449             color_marker_contrast_mask = color_marker_contrast_value = 
01450             color_vertex_contrast_mask = color_vertex_contrast_value = 
01451             color_text_contrast_mask = color_text_contrast_value = 
01452             color_simple_reflection_mask = color_simple_reflection_value = 
01453             color_cut_face_mask = color_cut_face_value = 
01454             color_cut_edge_mask = color_cut_edge_value = 
01455                 TKO_Lock_Channel_ALL;
01456         }
01457 };
01458 
01460 
01462 
01472 class BBINFILETK_API TK_Open_Segment : public BBaseOpcodeHandler {
01473     protected:
01474         int             m_length;   
01475         int             m_allocated;
01476         char *          m_string;   
01478 
01479         void    set_segment (char const * segment);
01481         void    set_segment (int length);
01482 
01483     public:
01485         TK_Open_Segment () : BBaseOpcodeHandler (TKE_Open_Segment), m_length (0), m_allocated (0), m_string (0) {}
01486         ~TK_Open_Segment();
01487 
01488         TK_Status   Read (BStreamFileToolkit & tk);
01489         TK_Status   Write (BStreamFileToolkit & tk);
01490         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01491 
01492         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01493         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01494         void        Reset ();
01495 
01500         void            SetSegment (char const * segment)       { set_segment (segment); }
01501 
01506         void            SetSegment (int length)                 { set_segment (length); }
01507 
01511         char const *    GetSegment () const                 { return m_string; }
01516         char *          GetSegment ()                       { return m_string; }
01517 
01518 };
01519 
01520 
01522 
01531 class BBINFILETK_API TK_Close_Segment : public BBaseOpcodeHandler {
01532     public:
01534         TK_Close_Segment () : BBaseOpcodeHandler (TKE_Close_Segment) {}
01535 
01536         TK_Status   Read (BStreamFileToolkit & tk);
01537         TK_Status   Write (BStreamFileToolkit & tk);
01538         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01539 
01540         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01541         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01542 };
01543 
01544 
01545 
01547 
01559 class BBINFILETK_API TK_Reopen_Segment : public BBaseOpcodeHandler {
01560     protected:
01561         int             m_index;   
01563     public:
01565         TK_Reopen_Segment () : BBaseOpcodeHandler (TKE_Reopen_Segment), m_index (-1) {}
01566 
01567         TK_Status   Read (BStreamFileToolkit & tk);
01568         TK_Status   Write (BStreamFileToolkit & tk);
01569         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01570 
01571         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01572         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01573 
01575         void         SetIndex (int i)            { m_index = i;      }
01577         int          GetIndex () const       { return m_index;   }
01578 };
01579 
01580 
01582 
01590 class BBINFILETK_API TK_Referenced_Segment : public BBaseOpcodeHandler {
01591     protected:
01592         int             m_length;               
01593         int             m_allocated;            
01594         char *          m_string;               
01595         int             m_cond_length;          
01596         int             m_cond_allocated;       
01597         char *          m_condition;            
01599         ID_Key          m_key;                  
01600         ID_Key          m_renumbered_key;       
01601         unsigned char   m_renumbered_scope;     
01602         BBaseOpcodeHandler *     m_referee;     
01603         bool            m_follow;               
01604         Lock_Masks      m_filter;               
01605 
01606         void    set_segment (char const * segment);   
01607         void    set_segment (int length);             
01608 
01609     public:
01611         TK_Referenced_Segment (unsigned char opcode);
01612         ~TK_Referenced_Segment();
01613 
01614         TK_Status   Read (BStreamFileToolkit & tk);
01615         TK_Status   Write (BStreamFileToolkit & tk);
01616         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01617 
01618         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01619         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01620         void        Reset ();
01621 
01626         void            SetSegment (char const * segment)       { set_segment (segment); }
01631         void            SetSegment (int length)                 { set_segment (length); }
01635         char const *    GetSegment () const                 { return m_string; }
01640         char *          GetSegment ()                       { return m_string; }
01641 
01642 
01647         void            SetCondition (char const * condition);
01652         void            SetCondition (int length);
01656         char const *    GetCondition () const                 { return m_condition; }
01661         char *          GetCondition ()                       { return m_condition; }
01662 
01663 
01665         void            SetFollow (bool f)                      { m_follow = f;     }
01667         bool            GetFollow ()                        { return m_follow;  }
01668 
01669 };
01670 
01671 
01673 
01681 class BBINFILETK_API TK_Reference : public BBaseOpcodeHandler {
01682     protected:
01683         int             m_index;                
01684         int             m_cond_length;          
01685         int             m_cond_allocated;       
01686         char *          m_condition;            
01688         ID_Key          m_this_key;             
01689         ID_Key          m_key;                  
01690         BBaseOpcodeHandler *     m_referee;     
01691         bool            m_follow;               
01692 
01693     public:
01695         TK_Reference ();
01696         ~TK_Reference();
01697 
01698         TK_Status   Read (BStreamFileToolkit & tk);
01699         TK_Status   Write (BStreamFileToolkit & tk);
01700         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01701 
01702         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01703         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01704         void        Reset ();
01705 
01707         void            SetIndex (int index)                   { m_index = index;   }
01709         ID_Key          GetIndex ()                        { return m_index;    }
01710 
01715         void            SetCondition (char const * condition);
01720         void            SetCondition (int length);
01724         char const *    GetCondition () const                 { return m_condition; }
01729         char *          GetCondition ()                       { return m_condition; }
01730 
01731 
01733         void            SetFollow (bool f)                      { m_follow = f;     }
01735         bool            GetFollow ()                        { return m_follow;  }
01736 };
01737 
01738 
01742 enum Instance_Options {
01743     Instance_By_Tristrip    = 0x01  
01744 };
01745 
01746 
01748 
01756 class BBINFILETK_API TK_Instance : public BBaseOpcodeHandler {
01757     protected:
01758         int             m_from_index;   
01759         int             m_from_variant; 
01760         int             m_to_index;     
01761         int             m_to_variant;   
01762         int             m_options;      
01763         float           m_matrix[16];   
01764 
01765     public:
01767         TK_Instance (int from_index=0, int from_variant=0, int to_index=0, int to_variant=0,
01768                      int options=0, float const * xform=0);  
01769 
01770         TK_Status   Read (BStreamFileToolkit & tk);
01771         TK_Status   Write (BStreamFileToolkit & tk);
01772         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01773 
01774         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01775         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01776 
01777         void        Reset ();
01778 };
01779 
01781 
01784 class BBINFILETK_API TK_Delete_Object : public BBaseOpcodeHandler {
01785     protected:
01786         int             m_index;   
01787 
01788     public:
01790         TK_Delete_Object () : BBaseOpcodeHandler (TKE_Delete_Object), m_index (-1) {}
01791 
01792         TK_Status   Read (BStreamFileToolkit & tk);
01793         TK_Status   Write (BStreamFileToolkit & tk);
01794         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01795 
01796         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01797         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01798 
01800         void        SetIndex (int i)                        { m_index = i;      }
01802         int         GetIndex ()                             { return m_index;   }
01803 };
01804 
01805 
01807 
01808 
01810 
01813 class BBINFILETK_API TK_LOD : public BBaseOpcodeHandler {
01814     protected:
01815         int *m_num_primitives;              
01816         BBaseOpcodeHandler ***m_primitives; 
01817         int m_highest_level;                
01818         int m_levels_allocated;             
01819         int m_substage;                     
01820         struct vlist_s *m_current_working;  
01821         int m_current_level;            
01822 
01823         TK_Status   ReadOneList (BStreamFileToolkit & tk);  
01824 
01825     public:
01827         TK_LOD () : BBaseOpcodeHandler (TKE_LOD) {
01828             m_num_primitives = 0;
01829             m_primitives = 0;
01830             m_highest_level = 0;
01831             m_levels_allocated = 0;
01832             m_substage = 0;
01833             m_current_working = 0;
01834             m_current_level = 0;
01835         }
01836         ~TK_LOD();
01837 
01838         TK_Status   Read (BStreamFileToolkit & tk);
01839         TK_Status   Write (BStreamFileToolkit & tk);
01840         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01841 
01842         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01843         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01844 
01845         void        Reset ();
01846 };
01848 #define TKLOD_ESCAPE 255
01849 
01850 
01852 
01854 
01859 class BBINFILETK_API TK_Geometry_Attributes : public BBaseOpcodeHandler {
01860     protected:
01861 
01862     public:
01864         TK_Geometry_Attributes () : BBaseOpcodeHandler (TKE_Geometry_Attributes) {}
01865 
01866         TK_Status   Read (BStreamFileToolkit & tk);
01867         TK_Status   Write (BStreamFileToolkit & tk);
01868 
01869         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01870         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01871         TK_Status   Execute (BStreamFileToolkit & tk);
01872 };
01873 
01875 
01885 class BBINFILETK_API TK_Renumber : public BBaseOpcodeHandler {
01886     protected:
01887         ID_Key          m_key; 
01888 
01889     public:
01893         TK_Renumber (unsigned char opcode, ID_Key key = 0) : BBaseOpcodeHandler (opcode), m_key (key) {}  
01894 
01895         TK_Status   Read (BStreamFileToolkit & tk);
01896         TK_Status   Write (BStreamFileToolkit & tk);
01897         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
01898 
01899         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01900         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01901 
01902         void            SetKey (ID_Key k)           { m_key = k;    }
01904         ID_Key          GetKey () const         { return m_key; }
01905 };
01906 
01907 
01909 
01914 class BBINFILETK_API TK_Tag : public BBaseOpcodeHandler {
01915     protected:
01916 
01917     public:
01919         TK_Tag (unsigned char opcode = TKE_Tag) : BBaseOpcodeHandler (opcode) {}
01920 
01921         TK_Status   Read (BStreamFileToolkit & tk);
01922         TK_Status   Write (BStreamFileToolkit & tk);
01923 
01924         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01925         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01926 
01927         TK_Status   Execute (BStreamFileToolkit & tk);
01928         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant=0);
01929         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
01930                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
01931 };
01932 
01934 
01941 // Note: unlike most opcode handlers, this one does not contain its own data, it is primarily a
01942 // wrapper around the key <-> index translation table in the toolkit.
01943 class BBINFILETK_API TK_Dictionary : public BBaseOpcodeHandler {
01944     protected:
01945         unsigned char   m_format;       
01946         int             m_placeholder;      
01947         unsigned char   m_present;      
01948         int             m_number_of_items;  
01949 
01950         Internal_Translator::Index_Key_Pair * m_item; 
01951 
01952     public:
01954         TK_Dictionary () : BBaseOpcodeHandler (TKE_Dictionary), m_format (0) {}
01955 
01956         TK_Status   Read (BStreamFileToolkit & tk);
01957         TK_Status   Write (BStreamFileToolkit & tk);
01958 
01959         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01960         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01961 
01962         TK_Status   Execute (BStreamFileToolkit & tk);
01963         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant=0);
01964         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
01965                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
01966         void        Reset ();
01967 };
01968 
01969 
01971 
01978 class BBINFILETK_API TK_Dictionary_Locater : public BBaseOpcodeHandler {
01979     protected:
01980         int             m_size;         
01981         int             m_offset;       
01982 
01983     public:
01985         TK_Dictionary_Locater () : BBaseOpcodeHandler (TKE_Dictionary_Locater), m_offset (0) {}
01986 
01987         TK_Status   Read (BStreamFileToolkit & tk);
01988         TK_Status   Write (BStreamFileToolkit & tk);
01989 
01990         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
01991         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
01992 
01993         TK_Status   Execute (BStreamFileToolkit & tk);
01994         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant=0);
01995         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
01996                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
01997         void        Reset ();
01998 
02000     void        SetSize (int size)              { m_size = size; }
02002     int         GetSize () const                { return m_size;   }
02004     void        SetOffset (int offset)          { m_offset = offset; }
02006     int         GetOffset () const              { return m_offset;   }
02007 };
02008 
02009 
02011 
02012 
02014 
02019 class BBINFILETK_API TK_Color : public BBaseOpcodeHandler {
02020     protected:
02021         int             m_mask;     
02022         short           m_channels; 
02023 
02027         class BBINFILETK_API channel {
02028             public:
02029                 float   m_rgb[3];      
02030                 char *  m_name;        
02031 
02032                 channel() : m_name (0) {}
02033                 ~channel() { Reset(); }
02034                 void    Reset () {
02035                     if (m_name)
02036                         BSTREAM_FREE_ARRAY(m_name, (int)(strlen(m_name) + 1), char);
02037                     m_name = 0;
02038                 }   
02039         };
02040 
02041         channel         m_diffuse;      
02042         channel         m_specular;     
02043         channel         m_mirror;       
02044         channel         m_transmission; 
02045         channel         m_emission;     
02046         channel         m_environment;  
02047         channel         m_bump;         
02048         float           m_gloss;        
02049         float           m_index;        
02050         int             m_substage;     
02051 
02053         void    set_channel_rgb (channel & c, float r, float g, float b, int which_channel = -1) {
02054                     c.m_rgb[0] = r;     c.m_rgb[1] = g;     c.m_rgb[2] = b;
02055                     if (which_channel != -1) {
02056                         m_channels |= (1 << which_channel);
02057                         if (which_channel > TKO_Channel_Extended)
02058                         m_channels |= (1 << TKO_Channel_Extended);
02059                     }
02060                 }
02062         void    set_channel_name (channel & c, char const * name, int which_channel = -1);
02064         void    set_channel_name (channel & c, int length, int which_channel = -1);
02065 
02066     public:
02067         TK_Color ();
02068         ~TK_Color ();
02069 
02070         TK_Status   Read (BStreamFileToolkit & tk);
02071         TK_Status   Write (BStreamFileToolkit & tk);
02072         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02073 
02074         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02075         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02076 
02077         void        Reset ();
02078 
02080         void            SetGeometry (int m) {
02081                             m_mask = m & TKO_Geo_All_Colors;
02082                             if ((m & TKO_Geo_Extended_Mask) != 0) {
02083                                 m_mask |= TKO_Geo_Extended;
02084                                 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) {
02085                                     m_mask |= TKO_Geo_Extended_Colors;
02086                                     if ((m & TKO_Geo_Extended2_Mask) != 0)
02087                                         m_mask |= TKO_Geo_Extended2;
02088                                 }
02089                             }
02090                         }
02092         int             GetGeometry () const                        { return m_mask;                        }
02094         void            SetChannels (int c) {
02095                             m_channels = (short)c;
02096                             if ((c & (((unsigned int)~0) << (TKO_Channel_Extended_Shift))) != 0)
02097                                 m_channels |= (1 << TKO_Channel_Extended);
02098                         }
02100         int             GetChannels () const                        { return (int)m_channels;               }
02101 
02103         void            SetDiffuse (float r, float g, float b)          { set_channel_rgb (m_diffuse, r, g, b, TKO_Channel_Diffuse); }
02105         void            SetDiffuse (float const * rgb)                  { SetDiffuse (rgb[0], rgb[1], rgb[2]);  }
02107         void            SetDiffuseName (char const * name)              { set_channel_name (m_diffuse, name, TKO_Channel_Diffuse);   }
02109         void            SetDiffuseName (int length)                     { set_channel_name (m_diffuse, length, TKO_Channel_Diffuse); }
02111         float const *   GetDiffuse () const                         { return m_diffuse.m_rgb;               }
02113         char const *    GetDiffuseName () const                     { return m_diffuse.m_name;              }
02115         char *          GetDiffuseName ()                           { return m_diffuse.m_name;              }
02116 
02118         void            SetSpecular (float r, float g, float b)         { set_channel_rgb (m_specular, r, g, b, TKO_Channel_Specular);}
02120         void            SetSpecular (float const * rgb)                 { SetSpecular (rgb[0], rgb[1], rgb[2]); }
02122         void            SetSpecularName (char const * name)             { set_channel_name (m_specular, name, TKO_Channel_Specular);  }
02124         void            SetSpecularName (int length)                    { set_channel_name (m_specular, length, TKO_Channel_Specular);}
02126         float const *   GetSpecular () const                        { return m_specular.m_rgb;              }
02128         char const *    GetSpecularName () const                    { return m_specular.m_name;             }
02130         char *          GetSpecularName ()                          { return m_specular.m_name;             }
02131 
02133         void            SetMirror (float r, float g, float b)           { set_channel_rgb (m_mirror, r, g, b, TKO_Channel_Mirror);  }
02135         void            SetMirror (float const * rgb)                   { SetMirror (rgb[0], rgb[1], rgb[2]);   }
02137         void            SetMirrorName (char const * name)               { set_channel_name (m_mirror, name, TKO_Channel_Mirror);    }
02139         void            SetMirrorName (int length)                      { set_channel_name (m_mirror, length, TKO_Channel_Mirror);  }
02141         float const *   GetMirror () const                          { return m_mirror.m_rgb;                }
02143         char const *    GetMirrorName () const                      { return m_mirror.m_name;               }
02145         char *          GetMirrorName ()                            { return m_mirror.m_name;               }
02146 
02148         void            SetTransmission (float r, float g, float b)       { set_channel_rgb (m_transmission, r, g, b, TKO_Channel_Transmission); }
02150         void            SetTransmission (float const * rgb)               { SetTransmission (rgb[0], rgb[1], rgb[2]);  }
02152         void            SetTransmissionName (char const * name)           { set_channel_name (m_transmission, name, TKO_Channel_Transmission);   }
02154         void            SetTransmissionName (int length)                  { set_channel_name (m_transmission, length, TKO_Channel_Transmission); }
02156         float const *   GetTransmission () const                      { return m_transmission.m_rgb;               }
02158         char const *    GetTransmissionName () const                  { return m_transmission.m_name;              }
02160         char *          GetTransmissionName ()                        { return m_transmission.m_name;              }
02161 
02163         void            SetEmission (float r, float g, float b)         { set_channel_rgb (m_emission, r, g, b, TKO_Channel_Emission);}
02165         void            SetEmission (float const * rgb)                 { SetEmission (rgb[0], rgb[1], rgb[2]); }
02167         void            SetEmissionName (char const * name)             { set_channel_name (m_emission, name, TKO_Channel_Emission);  }
02169         void            SetEmissionName (int length)                    { set_channel_name (m_emission, length, TKO_Channel_Emission);}
02171         float const *   GetEmission () const                        { return m_emission.m_rgb;              }
02173         char const *    GetEmissionName () const                    { return m_emission.m_name;             }
02175         char *          GetEmissionName ()                          { return m_emission.m_name;             }
02176 
02178         void            SetEnvironmentName (char const * name)          { set_channel_name (m_environment, name, TKO_Channel_Environment);   }
02180         void            SetEnvironmentName (int length)                 { set_channel_name (m_environment, length, TKO_Channel_Environment); }
02182         char const *    GetEnvironmentName () const                 { return m_environment.m_name;              }
02184         char *          GetEnvironmentName ()                       { return m_environment.m_name;              }
02185 
02187         void            SetBumpName (char const * name)                 { set_channel_name (m_bump, name, TKO_Channel_Bump);      }
02189         void            SetBumpName (int length)                        { set_channel_name (m_bump, length, TKO_Channel_Bump);    }
02191         char const *    GetBumpName () const                        { return m_bump.m_name;                 }
02193         char *          GetBumpName ()                              { return m_bump.m_name;                 }
02194 
02196         void            SetGloss (float g)                              { m_gloss = g; m_channels |= (1<<TKO_Channel_Gloss); }
02198         float           GetGloss () const                           { return m_gloss;                       }
02200         void            SetIndex (float i)                              { m_index = i; m_channels |= (1<<TKO_Channel_Index); }
02202         float           GetIndex () const                           { return m_index;                       }
02203 };
02204 
02205 
02207 
02212 class BBINFILETK_API TK_Color_RGB : public BBaseOpcodeHandler {
02213     protected:
02214         int             m_mask;     
02215         float           m_rgb[3];   
02216 
02217     public:
02219         TK_Color_RGB () : BBaseOpcodeHandler (TKE_Color_RGB), m_mask (0) {}
02220 
02221         TK_Status   Read (BStreamFileToolkit & tk);
02222         TK_Status   Write (BStreamFileToolkit & tk);
02223         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02224 
02225         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02226         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02227 
02232         void            SetGeometry (int m) {
02233                             m_mask = m & TKO_Geo_All_Colors;
02234                             if ((m & TKO_Geo_Extended_Mask) != 0) {
02235                                 m_mask |= TKO_Geo_Extended;
02236                                 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) {
02237                                     m_mask |= TKO_Geo_Extended_Colors;
02238                                     if ((m & TKO_Geo_Extended2_Mask) != 0)
02239                                         m_mask |= TKO_Geo_Extended2;
02240                                 }
02241                             }
02242                         }
02247         int             GetGeometry () const                    { return m_mask;                        }
02248 
02250         void            SetRGB (float r, float g, float b)          { m_rgb[0] = r; m_rgb[1] = g; m_rgb[2] = b; }
02252         void            SetRGB (float const * rgb)                  { SetRGB (rgb[0], rgb[1], rgb[2]);          }
02254         float const *   GetRGB () const                         { return m_rgb;                             }
02255 };
02256 
02257 
02259 
02264 class BBINFILETK_API TK_Color_By_Value : public BBaseOpcodeHandler {
02265     protected:
02266         int             m_mask;         
02267         float           m_value[3];     
02268         char            m_space;        
02269 
02270     public:
02272         TK_Color_By_Value () : BBaseOpcodeHandler (TKE_Color_By_Value), m_mask (0) {}
02273 
02274         TK_Status   Read (BStreamFileToolkit & tk);
02275         TK_Status   Write (BStreamFileToolkit & tk);
02276         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02277 
02278         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02279         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02280 
02285         void            SetGeometry (int m) {
02286                             m_mask = m & TKO_Geo_All_Colors;
02287                             if ((m & TKO_Geo_Extended_Mask) != 0) {
02288                                 m_mask |= TKO_Geo_Extended;
02289                                 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) {
02290                                     m_mask |= TKO_Geo_Extended_Colors;
02291                                     if ((m & TKO_Geo_Extended2_Mask) != 0)
02292                                         m_mask |= TKO_Geo_Extended2;
02293                                 }
02294                             }
02295                         }
02300         int             GetGeometry () const                { return m_mask;                                }
02301 
02303         void            SetSpace (int s)                        { m_space = (char)s;                            }
02305         int             GetSpace () const                   { return (int)m_space;                          }
02306 
02308         void            SetValue (float a, float b, float c) {
02309                                 m_value[0] = a;     m_value[1] = b;     m_value[2] = c;
02310                             }
02312         void            SetValue (float const * triple)         { SetValue (triple[0], triple[1], triple[2]);   }
02314         float const *   GetValue () const                   { return m_value;                               }
02315 };
02316 
02317 
02319 
02325 class BBINFILETK_API TK_Color_By_Index : public BBaseOpcodeHandler {
02326     protected:
02327         int             m_mask;     
02328         int             m_index;    
02329 
02330     public:
02332         TK_Color_By_Index (unsigned char opcode) : BBaseOpcodeHandler (opcode), m_mask (0), m_index (-1) {}
02333 
02334         TK_Status   Read (BStreamFileToolkit & tk);
02335         TK_Status   Write (BStreamFileToolkit & tk);
02336         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02337 
02338         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02339         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02340 
02345         void            SetGeometry (int m) {
02346                             m_mask = m & TKO_Geo_All_Colors;
02347                             if ((m & TKO_Geo_Extended_Mask) != 0) {
02348                                 m_mask |= TKO_Geo_Extended;
02349                                 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) {
02350                                     m_mask |= TKO_Geo_Extended_Colors;
02351                                     if ((m & TKO_Geo_Extended2_Mask) != 0)
02352                                         m_mask |= TKO_Geo_Extended2;
02353                                 }
02354                             }
02355                         }
02360         int             GetGeometry () const    { return m_mask;    }
02361 
02363         void            SetIndex (int i)            { m_index = i;      }
02365         int             GetIndex () const       { return m_index;   }
02366 };
02367 
02369 
02374 class BBINFILETK_API TK_Color_By_FIndex : public BBaseOpcodeHandler {
02375     protected:
02376         int             m_mask;     
02377         float           m_index;    
02378 
02379     public:
02381         TK_Color_By_FIndex () : BBaseOpcodeHandler (TKE_Color_By_FIndex), m_mask (0), m_index (-1.0f) {}
02382 
02383         TK_Status   Read (BStreamFileToolkit & tk);
02384         TK_Status   Write (BStreamFileToolkit & tk);
02385         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02386 
02387         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02388         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02389 
02394         void            SetGeometry (int m) {
02395                             m_mask = m & TKO_Geo_All_Colors;
02396                             if ((m & TKO_Geo_Extended_Mask) != 0) {
02397                                 m_mask |= TKO_Geo_Extended;
02398                                 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) {
02399                                     m_mask |= TKO_Geo_Extended_Colors;
02400                                     if ((m & TKO_Geo_Extended2_Mask) != 0)
02401                                         m_mask |= TKO_Geo_Extended2;
02402                                 }
02403                             }
02404                         }
02409         int             GetGeometry () const    { return m_mask;    }
02410 
02412         void            SetIndex (float val)        { m_index = val;      }
02414         float           GetIndex () const       { return m_index;   }
02415 };
02416 
02420 enum TKO_Map_Format {
02421     TKO_Map_RGB_Values,     
02422     TKO_Map_String          
02423 };
02424 
02427 
02432 class BBINFILETK_API TK_Color_Map : public BBaseOpcodeHandler {
02433     protected:
02434         int             m_length;           
02435         int             m_values_length;    
02436         float *         m_values;           
02437         int             m_string_length;    
02438         char *          m_string;           
02439         unsigned char   m_format;           
02440 
02442         void    set_values (int length, float const * values = 0);
02443 
02444     public:
02446         TK_Color_Map ()
02447             : BBaseOpcodeHandler (TKE_Color_Map), m_length (0), m_values_length (0), m_values (0), m_string_length (0), m_string (0), m_format (TKO_Map_RGB_Values) {}
02448         ~TK_Color_Map();
02449 
02450         TK_Status   Read (BStreamFileToolkit & tk);
02451         TK_Status   Write (BStreamFileToolkit & tk);
02452         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02453 
02454         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02455         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02456 
02457         void        Reset ();
02458 
02460         void            SetFormat (int f)                                       { m_format = (unsigned char)f;  }
02462         int             GetFormat () const                                  { return (int)m_format;         }
02463 
02468         void            SetValues (int count, float const * values = 0)         { set_values (count, values);   }
02470         float const *   GetValues () const                                  { return m_values;              }
02472         float *         GetValues ()                                        { return m_values;              }
02474         int             GetLength () const                                  { return m_length;              }
02475 
02480         void            SetString (char const * string);
02485         void            SetString (int length);
02489         char const *    GetString () const                 { return m_string; }
02494         char *          GetString ()                       { return m_string; }
02495 };
02496 
02498 
02501 
02507 class BBINFILETK_API TK_Callback : public BBaseOpcodeHandler {
02508     protected:
02509         int                     m_length;       
02510         char *                  m_string;       
02513         void    set_callback (char const * callback);  
02514 
02515         void    set_callback (int length);           
02516 
02517     public:
02519         TK_Callback () : BBaseOpcodeHandler (TKE_Callback), m_length (0), m_string (0) {}
02520         ~TK_Callback();
02521 
02522         TK_Status   Read (BStreamFileToolkit & tk);
02523         TK_Status   Write (BStreamFileToolkit & tk);
02524         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
02525 
02526         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02527         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02528 
02529         void        Reset ();
02530 
02532         void            SetCallback (char const * callback)         { set_callback (callback);  }
02534         void            SetCallback (int length)                    { set_callback (length);    }
02536         char const *    GetCallback () const                    { return m_string;          }
02538         char *          GetCallback ()                          { return m_string;          }
02539 };
02540 
02542 
02543 
02551 enum TKO_Rendering_Option_Bits {
02552     TKO_Interp_Texture_Faces            = 0x00000001,   
02553     TKO_Interp_Texture_Edges            = 0x00000002,   
02554     TKO_Interp_Texture_Markers          = 0x00000004,   
02555     TKO_Interp_Texture                  = 0x00000007,   
02556 
02557     TKO_Interp_Color_Faces              = 0x00000008,   
02558     TKO_Interp_Color_Edges              = 0x00000010,   
02559     TKO_Interp_Color_Markers            = 0x00000020,   
02560     TKO_Interp_Color                    = 0x00000038,   
02561 
02562     TKO_Interp_Index_Faces              = 0x00000040,   
02563     TKO_Interp_Index_Edges              = 0x00000080,   
02564     TKO_Interp_Index_FE                 = 0x000000C0,   
02565 
02566     TKO_Interp_Lighting_Faces_Gouraud   = 0x00000100,   
02567     TKO_Interp_Lighting_Faces_Phong     = 0x00000200,   
02568     TKO_Interp_Lighting_Edges_Gouraud   = 0x00000400,   
02569     TKO_Interp_Lighting_Edges_Phong     = 0x00000800,   
02570     TKO_Interp_Lighting_Faces           = 0x00000300,   
02571     TKO_Interp_Lighting_Edges           = 0x00000C00,   
02572     TKO_Interp_Lighting_Gouraud         = 0x00000500,   
02573     TKO_Interp_Lighting_Phong           = 0x00000A00,   
02574     TKO_Interp_Lighting                 = 0x00000F00,   
02575 
02576     TKO_Rendo_HSR_Algorithm             = 0x00001000,   
02577     TKO_Rendo_THSR_Algorithm            = 0x00002000,   
02578     TKO_Rendo_Any_HSR                   = 0x00003000,   
02579 
02580     TKO_Rendo_Local_Viewer              = 0x00004000,   
02581     TKO_Rendo_Perspective_Correction    = 0x00008000,   
02582     TKO_Rendo_Display_Lists             = 0x00010000,   
02583 
02584     TKO_Rendo_Debug                     = 0x00020000,   
02585 
02586     TKO_Rendo_Technology                = 0x00040000,   
02587     TKO_Rendo_Quantization              = 0x00080000,   
02588     TKO_Rendo_TQ                        = 0x000C0000,   
02589 
02590     TKO_Rendo_Attribute_Lock            = 0x00100000,   
02591 
02592     TKO_Rendo_Face_Displacement         = 0x00200000,   
02593     TKO_Rendo_Fog                       = 0x00400000,   
02594 
02595     TKO_Rendo_Buffer_Options            = 0x00800000,   
02596     TKO_Rendo_Hidden_Line_Options       = 0x01000000,   
02597 
02598     TKO_Rendo_LOD                       = 0x02000000,   
02599     TKO_Rendo_LOD_Options               = 0x04000000,   
02600 
02601     TKO_Rendo_NURBS_Curve_Options       = 0x08000000,   
02602     TKO_Rendo_NURBS_Surface_Options     = 0x10000000,   
02603     TKO_Rendo_NURBS_Options             = 0x18000000,   
02604 
02605     TKO_Rendo_Stereo                    = 0x20000000,   
02606     TKO_Rendo_Stereo_Separation         = 0x40000000,   
02607 
02608 // hpux doesn't like the high bit set as part of the enumerated type
02609     //TKO_Rendo_Extended              = 0x80000000,
02610 #ifndef SWIG
02611 #define TKO_Rendo_Extended                  0x80000000   
02612 #else
02613     TKO_Rendo_Extended                  = 0x8000000,
02614 #endif
02615 
02616     // extended settings
02617     TKO_Rendo_Tessellation              = 0x00000001,  
02618     TKO_Rendo_Transparency_Style        = 0x00000002,  
02619     TKO_Rendo_Transparency_Hardware     = 0x00000004,  
02620     TKO_Rendo_Cut_Geometry              = 0x00000008,  
02621     TKO_Rendo_Depth_Range               = 0x00000010,  
02622     TKO_Rendo_Mask_Transform            = 0x00000020,  
02623     TKO_Rendo_Image_Scale               = 0x00000040,  
02624     TKO_Rendo_Local_Cutting_Planes      = 0x00000080,  
02625     TKO_Rendo_Simple_Shadow             = 0x00000100,  
02626     TKO_Rendo_Geometry_Options          = 0x00000200,  
02627     TKO_Rendo_Image_Tint                = 0x00000400,  
02628     TKO_Interp_Index_Face_Isolines      = 0x00000800,  
02629     TKO_Rendo_Force_Grayscale           = 0x00001000,  
02630     TKO_Rendo_Transparency_Options      = 0x00002000,  
02631     TKO_Rendo_General_Displacement      = 0x00004000,  
02632     TKO_Rendo_Join_Cutoff_Angle         = 0x00008000,  
02633     TKO_Rendo_Screen_Range              = 0x00010000,  
02634     TKO_Rendo_Stereo_Distance           = 0x00020000,  
02635     TKO_Rendo_Shadow_Map                = 0x00040000,  
02636     TKO_Rendo_Simple_Reflection         = 0x00080000,  
02637     TKO_Rendo_Ambient_Up_Vector         = 0x00100000,  
02638     TKO_Rendo_Gooch_Color_Range         = 0x00200000,  
02639     TKO_Rendo_Gooch_Diffuse_Weight      = 0x00400000,  
02640     TKO_Rendo_Antialias                 = 0x00800000,  
02641     TKO_Interp_Index_Markers            = 0x01000000,  
02642     TKO_Rendo_Gooch_Color_Map           = 0x02000000,  
02643     TKO_Interp_Lighting_Faces_Gooch     = 0x04000000,   
02644     TKO_Interp_Lighting_Edges_Gooch     = 0x08000000,   
02645     TKO_Interp_Lighting_Gooch           = 0x0C000000,   
02646     TKO_Rendo_Transparency_Depth_Writing= 0x10000000,  
02647     TKO_Rendo_Vertex_Decimation         = 0x20000000,  
02648     TKO_Rendo_Vertex_Displacement       = 0x40000000,  
02649 
02650 #ifndef SWIG
02651 #define TKO_Rendo_Extended2                 0x80000000   
02652 #else
02653     TKO_Rendo_Extended2                 = 0x8000000,
02654 #endif
02655 
02656     // more extended settings
02657     TKO_Rendo_Forced_Lock               = 0x00000001,  
02658     TKO_Rendo_Frame_Buffer_Effects      = 0x00000002,  
02659     TKO_Rendo_Scaled_Displacement       = 0x00000004,  
02660     TKO_Rendo_Contour_Options           = 0x00000008,  
02661     TKO_Rendo_Isoline_Options           = 0x00000010,  
02662     TKO_Rendo_Diffuse_Texture_Tint      = 0x00000020,  
02663     TKO_Rendo_Diffuse_Color_Tint        = 0x00000040,  
02664     TKO_Rendo_Edge_Join_Cutoff_Angle    = 0x00000080,  
02665     TKO_Rendo_Bump_Mapping_Parallax     = 0x00000100,  
02666     TKO_Rendo_Randomize_Vertices        = 0x00000200,  
02667 
02668     // type for specific fields
02669     TKO_HSR_Hardware                    = 0,    
02670     TKO_HSR_SZB                         = 1,    
02671     TKO_HSR_Painters                    = 2,    
02672     TKO_HSR_Z_Sort_Only                 = 3,    
02673     TKO_HSR_Priority                    = 4,    
02674     TKO_HSR_Spider_Web                  = 5,    
02675     TKO_HSR_Hidden_Line                 = 6,    
02676     TKO_HSR_None                        = 7,    
02677     TKO_HSR_Fast_Hidden_Line            = 8,    
02678     TKO_HSR_Depth_Peeling               = 9,    
02679     TKO_HSR_Mask                        = 0x0F, 
02680     TKO_THSR_Mask                       = 0xF0, 
02681 
02682     TKO_Transparency_None               = 0x0000,   
02683     TKO_Transparency_Blending           = 0x0001,   
02684     TKO_Transparency_Screen_Door        = 0x0002,   
02685     TKO_Transparency_Style_Mask         = 0x000F,   
02686     TKO_Transparency_Peeling_Layers     = 0x0010,   
02687     TKO_Transparency_Peeling_Min_Area   = 0x0020,   
02688     TKO_Transparency_Extended           = 0x0080,   
02689     TKO_Transparency_Extended_Mask      = 0xFF00,   
02690     TKO_Transparency_Extended_Shift     = 8,        
02691     TKO_Transparency_ZSort_Fast         = 0x0100,   
02692     TKO_Transparency_ZSort_Nice         = 0x0200,   
02693 
02694 
02695     TKO_Cut_Geometry_Level                  = 0x01,   
02696     TKO_Cut_Geometry_Tolerance              = 0x02,   
02697     TKO_Cut_Geometry_Match_Color            = 0x04,   
02698     TKO_Cut_Geometry_Level_Entity           = 0,   
02699     TKO_Cut_Geometry_Level_Segment          = 1,   
02700     TKO_Cut_Geometry_Level_Segment_Tree     = 2,   
02701     TKO_Cut_Geometry_Match_Color_Off        = 0,   
02702     TKO_Cut_Geometry_Match_Color_Current    = 1,   
02703     TKO_Cut_Geometry_Match_Color_First      = 2,   
02704     TKO_Cut_Geometry_Match_Color_Last       = 3,   
02705 
02706     TKO_Display_List_Level_Entity           = 0,   
02707     TKO_Display_List_Level_Segment          = 1,   
02708     TKO_Display_List_Level_Segment_Tree     = 2,   
02709 
02710     TKO_Simple_Shadow_On                = 0x0001,   
02711     TKO_Simple_Shadow_Off               = 0x0002,   
02712     TKO_Simple_Shadow_Plane             = 0x0004,   
02713     TKO_Simple_Shadow_Light_Direction   = 0x0008,   
02714     TKO_Simple_Shadow_Color             = 0x0010,   
02715     TKO_Simple_Shadow_Resolution        = 0x0020,   
02716     TKO_Simple_Shadow_Blur              = 0x0040,   
02717     TKO_Simple_Shadow_Extended          = 0x0080,   // internal use, indicates presence of extended bits
02718     TKO_Simple_Shadow_Extended_Mask     = 0xFF00,   // internal use, indicates bits which require TKO_Simple_Shadow_Extended
02719     TKO_Simple_Shadow_Extended_Shift    = 8,        // internal use, shift of extended section
02720     TKO_Simple_Shadow_Auto              = 0x0100,   
02721     TKO_Simple_Shadow_Opacity           = 0x0200,   
02722     TKO_Simple_Shadow_Ignore_Transparency=0x0400,   
02723     TKO_Simple_Shadow_Use_Transparency  = 0x0800,   
02724     TKO_Simple_Shadow_Extended2         = 0x8000,   // reserved for future expansion
02725 
02726     TKO_Shadow_Map_On                   = 0x0001,   
02727     TKO_Shadow_Map_Off                  = 0x0002,   
02728     TKO_Shadow_Map_Resolution           = 0x0004,   
02729     TKO_Shadow_Map_Samples              = 0x0008,   
02730     TKO_Shadow_Map_Jitter_On            = 0x0010,   
02731     TKO_Shadow_Map_Jitter_Off           = 0x0020,   
02732     TKO_Shadow_Map_Extended             = 0x0080,   // indicates presence of extended bits
02733     TKO_Shadow_Map_View_Depedent_On     = 0x0100,   
02734     TKO_Shadow_Map_View_Depedent_Off    = 0x0200,   
02735     TKO_Shadow_Map_Extended_Mask        = 0xFF00,   // mask of bits requiring extended
02736     TKO_Shadow_Map_Extended2            = 0x8000,   // reserved for future expansion
02737 
02738     TKO_Simple_Reflection_On            = 0x0001,   
02739     TKO_Simple_Reflection_Off           = 0x0002,   
02740     TKO_Simple_Reflection_Plane         = 0x0004,   
02741     TKO_Simple_Reflection_Opacity       = 0x0008,   
02742     TKO_Simple_Reflection_Fading_On     = 0x0010,   
02743     TKO_Simple_Reflection_Fading_Off    = 0x0020,   
02744     TKO_Simple_Reflection_Blur          = 0x0040,   
02745     TKO_Simple_Reflection_Extended      = 0x0080,   
02746     TKO_Simple_Reflection_Extended_Mask = 0xFF00,   
02747     TKO_Simple_Reflection_Extended_Shift= 8,        
02748     TKO_Simple_Reflection_Attenuation   = 0x0100,   
02749     TKO_Simple_Reflection_Visibility    = 0x0200,   
02750     TKO_Simple_Reflection_Extended2     = 0x8000,   // reserved for future expansion
02751 
02752     TKO_Mask_None                       = 0x0000,   
02753     TKO_Mask_Camera_Rotation            = 0x0001,   
02754     TKO_Mask_Camera_Scale               = 0x0002,   
02755     TKO_Mask_Camera_Translation         = 0x0004,   
02756     TKO_Mask_Camera_Perspective         = 0x0008,   
02757     TKO_Mask_Model_Rotation             = 0x0010,   
02758     TKO_Mask_Model_Scale                = 0x0020,   
02759     TKO_Mask_Model_Translation          = 0x0040,   
02760     TKO_Mask_Camera                     = 0x000F,   
02761     TKO_Mask_Model                      = 0x0070,   
02762     TKO_Mask_All                        = 0x007F,   
02763     TKO_Mask_Extended                   = 0x0080,   
02764     TKO_Mask_Extended_Mask              = 0xFF00,   
02765     TKO_Mask_Extended_Shift             = 8,        
02766     TKO_Mask_Camera_Offset              = 0x0100,   
02767     TKO_Mask_Model_Offset               = 0x0200,   
02768 
02769     TKO_Technology_Standard             = 0x01,             
02770     TKO_Technology_Soft_Frame_Buffer    = 0x02,             
02771     TKO_Technology_Radiosity            = 0x04,             
02772     TKO_Technology_Ray_Trace            = 0x08,             
02773     TKO_Technology_Mask                 = 0x0F,             
02774 
02775     TKO_Quantization_Threshold          = 0x10,             
02776     TKO_Quantization_Dither             = 0x20,             
02777     TKO_Quantization_Error_Diffusion    = 0x40,             
02778     TKO_Quantization_Mask               = 0xF0,             
02779 
02780     TKO_Buffer_Size_Limit               = 0x01,             
02781     TKO_Buffer_Retention                = 0x02,             
02782     TKO_Buffer_Color_Depth_Match        = 0x04,             
02783     TKO_Buffer_Color_Depth_Full         = 0x08,             
02784 
02785     TKO_Antialias_Screen_On             = 0x01,             
02786     TKO_Antialias_Lines_On              = 0x02,             
02787     TKO_Antialias_Text_On               = 0x04,             
02788     TKO_Antialias_All_On                = 0x07,             
02789     TKO_Antialias_Screen_Off            = 0x10,             
02790     TKO_Antialias_Lines_Off             = 0x20,             
02791     TKO_Antialias_Text_Off              = 0x40,             
02792     TKO_Antialias_All_Off               = 0x70,             
02793 
02794     TKO_Hidden_Line_Visibility_On           = 0x00000001,   
02795     TKO_Hidden_Line_Visibility_Off          = 0x00000002,   
02796     TKO_Hidden_Line_Pattern                 = 0x00000004,   
02797     TKO_Hidden_Line_Face_Displacement       = 0x00000008,   
02798     TKO_Hidden_Line_Dim_Factor              = 0x00000010,   
02799     TKO_Hidden_Line_Render_Faces_On         = 0x00000020,   
02800     TKO_Hidden_Line_Render_Faces_Off        = 0x00000040,   
02801     TKO_Hidden_Line_Extended                = 0x00000080,   
02802     TKO_Hidden_Line_Extended_Mask           = 0xFFFFFF00,   
02803     TKO_Hidden_Line_Extended_Shift          = 8,            
02804     TKO_Hidden_Line_Silhouette_Cleanup_On   = 0x00000100,   
02805     TKO_Hidden_Line_Silhouette_Cleanup_Off  = 0x00000200,   
02806     TKO_Hidden_Line_Extended2               = 0x00008000,   
02807     TKO_Hidden_Line_Extended2_Mask          = 0xFFFF0000,   
02808     TKO_Hidden_Line_Extended2_Shift         = 16,           
02809     TKO_Hidden_Line_Color                   = 0x00010000,   
02810     TKO_Hidden_Line_Weight                  = 0x00020000,   
02811     TKO_Hidden_Line_Image_Outline_On        = 0x00040000,   
02812     TKO_Hidden_Line_Image_Outline_Off       = 0x00080000,   
02813     TKO_Hidden_Line_HSR_Algorithm           = 0x00100000,   
02814     TKO_Hidden_Line_Render_Text_On          = 0x00200000,   
02815     TKO_Hidden_Line_Render_Text_Off         = 0x00400000,   
02816     TKO_Hidden_Line_Transparency_Cutoff     = 0x00800000,   
02817     TKO_Hidden_Line_Remove_Duplicates_On    = 0x01000000,   
02818     TKO_Hidden_Line_Remove_Duplicates_Off   = 0x02000000,   
02819 
02820     TKO_Contour_Face_Visibility_On      = 0x0001,   
02821     TKO_Contour_Face_Visibility_Off     = 0x0002,   
02822     TKO_Contour_Isoline_Visibility_On   = 0x0004,   
02823     TKO_Contour_Isoline_Visibility_Off  = 0x0008,   
02824     TKO_Contour_Visibility_Mask         = 0x000F,   
02825     TKO_Contour_Value_Adjustment        = 0x0010,   
02826 
02827     TKO_Contour_Adjustment_None         = 0,    
02828     TKO_Contour_Adjustment_Normalized   = 1,    
02829     TKO_Contour_Adjustment_Explicit     = 2,    
02830 
02831     TKO_Isoline_Positions       = 0x0001,   
02832     TKO_Isoline_Colors          = 0x0002,   
02833     TKO_Isoline_Patterns        = 0x0004,   
02834     TKO_Isoline_Weights         = 0x0008,   
02835     TKO_Isoline_Lighting_On     = 0x0010,   
02836     TKO_Isoline_Lighting_Off    = 0x0020,   
02837 
02838     TKO_Isoline_Positions_Default   = 0,    
02839     TKO_Isoline_Positions_Repeat    = 1,    
02840     TKO_Isoline_Positions_Explicit  = 2,    
02841 
02842     TKO_Tint_On         = 0x0001,   
02843     TKO_Tint_Off        = 0x0002,   
02844     TKO_Tint_Range      = 0x0004,   
02845     TKO_Tint_Color      = 0x0008,   
02846     TKO_Tint_Effect     = 0x0010,   
02847 
02848     TKO_Tint_Effect_Grayscale       = 1,    
02849     TKO_Tint_Effect_Modulate        = 2,    
02850     TKO_Tint_Effect_Modulate_Gray   = 3,    
02851     TKO_Tint_Effect_Tone            = 4,    
02852 
02853     TKO_LOD_Conserve_Memory             = 0x00000001,       
02854     TKO_LOD_Screen_Space                = 0x00000002,       
02855     TKO_LOD_Physical                    = 0x00000004,       
02856     TKO_LOD_Tolerance_FRU               = 0x00000008,       
02857     TKO_LOD_Tolerance_ORU               = 0x00000010,       
02858     TKO_LOD_Preprocess                  = 0x00000020,       
02859     TKO_LOD_Bounding_Current            = 0x00000040,       
02860     TKO_LOD_Bounding_Explicit           = 0x00000080,       
02861     TKO_LOD_Ratio                       = 0x00000100,       
02862     TKO_LOD_Threshold                   = 0x00000200,       
02863     TKO_LOD_Min_Triangle_Count          = 0x00000400,       
02864     TKO_LOD_Clamp                       = 0x00000800,       
02865     TKO_LOD_Num_Levels                  = 0x00001000,       
02866     TKO_LOD_Max_Degree                  = 0x00002000,       
02867     TKO_LOD_Tolerance                   = 0x00004000,       
02868     TKO_LOD_Usefulness_Heuristic        = 0x00008000,       
02869     TKO_LOD_Calculation_Cutoff          = 0x00010000,       
02870     TKO_LOD_Fallback                    = 0x00020000,       
02871     TKO_LOD_Collapse_Vertices           = 0x00040000,       
02872     TKO_LOD_Algorithm                   = 0x00080000,       
02873     TKO_LOD_Mode_Segment                = 0x00100000,       
02874 
02875     TKO_LOD_Threshold_Tris_Per_Pix_Sq   = 1,    
02876     TKO_LOD_Threshold_Tris_Per_CM_Sq    = 2,    
02877     TKO_LOD_Threshold_Percent_Area      = 3,    
02878     TKO_LOD_Threshold_Distance          = 4,    
02879 
02880     TKO_LOD_Algorithm_Fast              = 1,    
02881     TKO_LOD_Algorithm_Nice              = 2,    
02882 
02883     TKO_LOD_Heur_Is_Diagonal            = 0x00,    
02884     TKO_LOD_Heur_Is_Per_Triangle        = 0x01,    
02885     TKO_LOD_Heur_Is_Ratio               = 0x02,    
02886     TKO_LOD_Heur_Is_Volume              = 0x04,    
02887     TKO_LOD_Heur_Triangle_Size          = 0x08,    
02888 
02889     TKO_LOD_Heur_Diag                   = 0,    
02890     TKO_LOD_Heur_Tri_Diag               = 1,    
02891     TKO_LOD_Heur_Diag_Ratio             = 2,    
02892     TKO_LOD_Heur_Tri_Diag_Ratio         = 3,    
02893     TKO_LOD_Heur_Vol                    = 4,    
02894     TKO_LOD_Heur_Tri_Vol                = 5,    
02895     TKO_LOD_Heur_Vol_Ratio              = 6,    
02896     TKO_LOD_Heur_Tri_Vol_Ratio          = 7,    
02897 
02898     TKO_LOD_Fallback_None               = 0,    
02899     TKO_LOD_Fallback_Bounding           = 1,    
02900     TKO_LOD_Fallback_Coarsest           = 2,    
02901     TKO_LOD_Fallback_Coarsest_None      = 3,    
02902     TKO_LOD_Fallback_Coarsest_Bounding  = 4,    
02903     TKO_LOD_Fallback_Bounding_None      = 5,    
02904 
02905     TKO_NURBS_Curve_Budget              = 0x0001,    
02906     TKO_NURBS_Curve_Continued_Budget    = 0x0002,    
02907     TKO_NURBS_Curve_View_Dependent      = 0x0004,    
02908     TKO_NURBS_Curve_Max_Deviation       = 0x0008,    
02909     TKO_NURBS_Surface_Budget            = 0x0010,    
02910     TKO_NURBS_Surface_Trim_Budget       = 0x0020,    
02911     TKO_NURBS_Surface_Max_Facet_Width   = 0x0040,    
02912     TKO_NURBS_Curve_Max_Angle           = 0x1000,    
02913     TKO_NURBS_Curve_Max_Length          = 0x2000,    
02914 
02915     TKO_NURBS_Extended                  = 0x0080,   
02916     TKO_NURBS_Extended_Mask             = 0xFF00,   
02917     TKO_NURBS_Extended_Shift            = 8,        
02918 
02919     TKO_NURBS_Surface_Max_Facet_Angle   = 0x0100,    
02920     TKO_NURBS_Surface_Max_Facet_Deviation
02921                                         = 0x0200,    
02922     TKO_NURBS_Surface_Max_Trim_Curve_Deviation
02923                                         = 0x0400,    
02924 
02925     TKO_NURBS_Curve_Mask                = 0xF00F,    
02926     TKO_NURBS_Surface_Mask              = 0x0FF0,    
02927 
02928     TKO_Tessellation_Cylinder           = 0x01,   
02929     TKO_Tessellation_Sphere             = 0x02,   
02930 
02931     TKO_Geometry_Options_Dihedral       = 0x01,   
02932     TKO_Geometry_Options_Reverse_PolyCylinder_Radii     = 0x02,   
02933     TKO_Geometry_Options_No_Reverse_PolyCylinder_Radii  = 0x04,   
02934     TKO_Geometry_Options_Reverse_PolyCylinder_Colors    = 0x08,   
02935     TKO_Geometry_Options_No_Reverse_PolyCylinder_Colors = 0x10    
02936 };
02937 
02938 
02939 #if 0
02940 class BBINFILETK_API TK_Radiosity_RayTrace_Options : public BBaseOpcodeHandler {
02941     protected:
02942 
02943     public:
02944         TK_Radiosity_RayTrace_Options () : BBaseOpcodeHandler (TKE_Radiosity_RayTrace_Options) {}
02945         ~TK_Radiosity_RayTrace_Options () {}
02946 
02947         TK_Status   Read (BStreamFileToolkit & tk);
02948         TK_Status   Write (BStreamFileToolkit & tk);
02949 
02950         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02951         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02952 };
02953 #endif
02954 
02955 
02957 
02963 class BBINFILETK_API TK_Rendering_Options : public BBaseOpcodeHandler {
02964     protected:
02965         int             m_mask[3];  
02966         int             m_value[3]; 
02967 
02968         unsigned char   m_hsr;      
02969         unsigned char   m_tq;       
02970         int             m_debug;                
02971         int             m_face_displacement;    
02972         int             m_vertex_displacement;    
02973 
02974         float           m_fog_limits[2];        
02975 
02976         Lock_Masks      m_lock;                 
02977         Lock_Masks      m_forced;               
02978 
02979         unsigned char   m_buffer_options_mask;  
02980         unsigned char   m_buffer_options_value; 
02981         int             m_buffer_size_limit;    
02982 
02983         int             m_hlr_options;          
02984         float           m_hlr_dim_factor;       
02985         float           m_hlr_face_displacement;
02986         float           m_hlr_transparency_cutoff;
02987         int             m_hlr_line_pattern;     
02988         float           m_hlr_color[3];     
02989         float           m_hlr_weight;       
02990         unsigned char   m_hlr_weight_units; 
02991         unsigned char   m_hlr_hsr_algorithm;    
02992 
02993         unsigned short  m_contour_options;          
02994         unsigned short  m_isoline_options;          
02995         char            m_contour_value_adjustment; 
02996         float           m_contour_value_scale;      
02997         float           m_contour_value_translate;  
02998         char            m_isoline_position_type;    
02999         int             m_isoline_position_count;   
03000         float *         m_isoline_positions;        
03001         int             m_isoline_color_count;      
03002         float *         m_isoline_colors;           
03003         int             m_isoline_pattern_count;    
03004         char **         m_isoline_patterns;         
03005         int             m_isoline_weight_count;     
03006         float *         m_isoline_weights_value;    
03007         unsigned char * m_isoline_weights_unit;     
03008 
03009         unsigned short  m_tint_options;         
03010         float           m_tint_color[3];        
03011         float           m_tint_range[2];        
03012         char            m_tint_effect;          
03013 
03014         int             m_lod_options_mask;     
03015         int             m_lod_options_value;    
03016         char            m_lod_algorithm;        
03017         char            m_num_ratios;           
03018         float           m_ratio[8];             
03019         char            m_num_thresholds;       
03020         float           m_threshold[8];         
03021         char            m_threshold_type;       
03022         int             m_min_triangle_count;   
03023         unsigned char   m_clamp;                
03024         unsigned char   m_num_levels;           
03025         int             m_max_degree;           
03026         float           m_tolerance;            
03027         float           m_bounding[6];          
03028         char            m_num_cutoffs;          
03029         float           m_cutoff[8];            
03030         unsigned char   m_heuristic;            
03031         unsigned char   m_fallback;             
03032 
03033         int             m_nurbs_options_mask;   
03034         int             m_nurbs_options_value;  
03035         int             m_curve_budget;         
03036         int             m_curve_continued_budget;
03037         int             m_surface_budget;       
03038         int             m_surface_trim_budget;  
03039         float           m_surface_max_trim_curve_deviation;
03040         float           m_surface_max_facet_angle;
03041         float           m_surface_max_facet_deviation;
03042         float           m_surface_max_facet_width;
03043         float           m_curve_max_angle;          
03044         float           m_curve_max_deviation;      
03045         float           m_curve_max_length;         
03046 
03047         float           m_stereo_separation;        
03048         float           m_stereo_distance;          
03049 
03050         unsigned char   m_tessellations;            
03051         char            m_num_cylinder;             
03052         char            m_cylinder[8];              
03053         char            m_num_sphere;               
03054         char            m_sphere[8];                
03055 
03056         float           m_gooch_color_range[2];     
03057         float           m_gooch_diffuse_weight;     
03058         char *          m_gooch_color_map_segment;          
03059         int             m_gooch_color_map_segment_length;   
03060         unsigned short  m_transparency_options;     
03061 
03062         unsigned char   m_cut_geometry;             
03063         unsigned char   m_cut_geometry_level;       
03064         unsigned char   m_cut_geometry_match;       
03065         float           m_cut_geometry_tolerance;   
03066 
03067         unsigned short  m_simple_shadow;            
03068         unsigned char   m_simple_shadow_blur;       
03069         unsigned short  m_simple_shadow_resolution; 
03070         float           m_simple_shadow_plane[4];   
03071         float           m_simple_shadow_light[3];   
03072         float           m_simple_shadow_color[3];   
03073         float           m_simple_shadow_opacity;
03074 
03075         unsigned short  m_shadow_map;               
03076         unsigned short  m_shadow_map_resolution;    
03077         unsigned char   m_shadow_map_samples;       
03078 
03079         unsigned short  m_simple_reflection;        
03080         float           m_simple_reflection_plane[4]; 
03081         float           m_simple_reflection_opacity;
03082         int             m_simple_reflection_blur;   
03083         float           m_simple_reflection_hither; 
03084         float           m_simple_reflection_yon;    
03085         int             m_simple_reflection_visibility_mask; 
03086         int             m_simple_reflection_visibility_value;
03087 
03088         float           m_depth_range[2];       
03089         float           m_screen_range[4];      
03090         float           m_ambient_up_vector[3]; 
03091         float           m_image_scale[2];       
03092         unsigned short  m_mask_transform;       
03093 
03094         unsigned char   m_geometry_options;     
03095         float           m_dihedral;             
03096 
03097         float           m_image_tint_color[3];   
03098         float           m_texture_tint_color[3];   
03099         unsigned char   m_depth_peeling_layers;  
03100         float           m_depth_peeling_min_area;
03101 
03102         int             m_general_displacement;    
03103         int             m_join_cutoff_angle;    
03104         int             m_edge_join_cutoff_angle;    
03105         float           m_vertex_decimation;    
03106         unsigned char   m_display_list_level;    
03107         unsigned char   m_antialias;
03108 
03109         int             m_extra;
03110 
03111 #if 0
03112         TK_Radiosity_RayTrace_Options   *m_rrt; 
03113 #endif
03114 
03115     public:
03117         TK_Rendering_Options ();
03118         ~TK_Rendering_Options ();
03119 
03120         TK_Status   Read (BStreamFileToolkit & tk);
03121         TK_Status   Write (BStreamFileToolkit & tk);
03122         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
03123 
03124         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
03125         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
03126 
03127         void        Reset ();
03128 
03130         void            SetMask (int m0, int m1=0, int m2=0) {
03131                             m_mask[0] = m0;
03132                             m_mask[1] = m1;
03133                             m_mask[2] = m2;
03134                             if (m2 != 0)
03135                                 m_mask[1] |= TKO_Rendo_Extended;
03136                             if (m1 != 0)
03137                                 m_mask[0] |= TKO_Rendo_Extended;
03138                         }
03140         int             GetMask (int index=0) const         { return m_mask[index];             }
03141 
03143         void            SetValue (int v0, int v1=0, int v2=0)         { m_value[0] = v0; m_value[1] = v1; m_value[2] = v2; }
03145         int             GetValue (int index=0) const        { return m_value[index];            }
03146 
03148         void            SetHSR (int h)                  { m_hsr &= 0xF0; m_hsr |= (unsigned char)h & 0x0F;  }
03150         int             GetHSR () const             { return (int)(m_hsr & 0x0F);                       }
03151 
03153         void            SetTransparentHSR (int t)       { m_hsr &= 0x0F; m_hsr |= (unsigned char)t << 4;    }
03155         int             GetTransparentHSR () const  { return (int)(m_hsr >> 4);                         }
03156 
03158         void            SetTransparentStyle (int s)       { m_transparency_options = (unsigned short)s;      }
03160         int             GetTransparentStyle () const  { return (int)m_transparency_options;             }
03161 
03163         void            SetTechnology (int t)           { m_tq &= 0xF0; m_tq |= (unsigned char)t & 0x0F;    }
03165         int             GetTechnology () const      { return (int)(m_tq & 0x0F);                        }
03166 
03168         void            SetQuantization (int q)         { m_tq &= 0x0F; m_tq |= (unsigned char)q << 4;      }
03170         int             GetQuantization () const    { return (int)(m_tq >> 4);                          }
03171 
03173         void            SetDebug (int d)                { m_debug = d;                                      }
03175         int             GetDebug () const           { return m_debug;                                   }
03176 
03178         void            SetFaceDisplacement (int d)         { m_face_displacement = d;                      }
03180         int             GetFaceDisplacement () const    { return m_face_displacement;                   }
03181 
03183         void            SetVertexDisplacement (int d)         { m_vertex_displacement = d;                      }
03185         int             GetVertexDisplacement () const    { return m_vertex_displacement;                   }
03186 
03188         void            SetGeneralDisplacement (int d)         { m_general_displacement = d;                      }
03190         int             GetGeneralDisplacement () const    { return m_general_displacement;                   }
03191 
03193         void            SetJoinCutoffAngle (int d)         { m_join_cutoff_angle = d;                       }
03195         int             GetJoinCutoffAngle () const    { return m_join_cutoff_angle;                    }
03196 
03198         void            SetFogLimits (float n, float f)         { m_fog_limits[0] = n; m_fog_limits[1] = f; }
03200         void            SetFogLimits (float const * l)          { SetFogLimits (l[0], l[1]);                }
03202         float const *   GetFogLimits () const               { return m_fog_limits;                      }
03203 
03204 
03206         void            SetLockMask (int m)                     { m_lock.mask = m;                  }
03208         int             GetLockMask () const                { return m_lock.mask;               }
03209 
03211         void            SetLockValue (int v)                    { m_lock.value = v;                 }
03213         int             GetLockValue () const               { return m_lock.value;              }
03214 
03219         void            SetVisibilityLockMask (int m)           { m_lock.visibility_mask = m;       }
03224         int             GetVisibilityLockMask () const      { return m_lock.visibility_mask;    }
03225 
03230         void            SetVisibilityLockValue (int v)          { m_lock.visibility_value = v;      }
03235         int             GetVisibilityLockValue () const     { return m_lock.visibility_value;   }
03236 
03237 
03242         void            SetColorLockMask (int m)           { m_lock.color_mask = m;       }
03247         int             GetColorLockMask () const      { return m_lock.color_mask;    }
03248 
03253         void            SetColorLockValue (int v)          { m_lock.color_value = v;      }
03258         int             GetColorLockValue () const     { return m_lock.color_value;   }
03259 
03260 
03265         void            SetColorFaceLockMask (int m)                { m_lock.color_face_mask = (short)m;     }
03270         int             GetColorFaceLockMask () const           { return m_lock.color_face_mask;         }
03271 
03276         void            SetColorFaceLockValue (int v)               { m_lock.color_face_value = (short)v;    }
03281         int             GetColorFaceLockValue () const          { return m_lock.color_face_value;        }
03282 
03283 
03288         void            SetColorEdgeLockMask (int m)                { m_lock.color_edge_mask = (short)m;     }
03293         int             GetColorEdgeLockMask () const           { return m_lock.color_edge_mask;         }
03294 
03299         void            SetColorEdgeLockValue (int v)               { m_lock.color_edge_value = (short)v;    }
03304         int             GetColorEdgeLockValue () const          { return m_lock.color_edge_value;        }
03305 
03306 
03311         void            SetColorLineLockMask (int m)                { m_lock.color_line_mask = (short)m;     }
03316         int             GetColorLineLockMask () const           { return m_lock.color_line_mask;         }
03317 
03322         void            SetColorLineLockValue (int v)               { m_lock.color_line_value = (short)v;    }
03327         int             GetColorLineLockValue () const          { return m_lock.color_line_value;        }
03328 
03329 
03334         void            SetColorMarkerLockMask (int m)                { m_lock.color_marker_mask = (short)m;     }
03339         int             GetColorMarkerLockMask () const           { return m_lock.color_marker_mask;         }
03340 
03345         void            SetColorMarkerLockValue (int v)               { m_lock.color_marker_value = (short)v;    }
03350         int             GetColorMarkerLockValue () const          { return m_lock.color_marker_value;        }
03351 
03352 
03357         void            SetColorTextLockMask (int m)                { m_lock.color_text_mask = (short)m;     }
03362         int             GetColorTextLockMask () const           { return m_lock.color_text_mask;         }
03363 
03368         void            SetColorTextLockValue (int v)               { m_lock.color_text_value = (short)v;    }
03373         int             GetColorTextLockValue () const          { return m_lock.color_text_value;        }
03374 
03375 
03380         void            SetColorWindowLockMask (int m)                { m_lock.color_window_mask = (short)m;     }
03385         int             GetColorWindowLockMask () const           { return m_lock.color_window_mask;         }
03386 
03391         void            SetColorWindowLockValue (int v)               { m_lock.color_window_value = (short)v;    }
03396         int             GetColorWindowLockValue () const          { return m_lock.color_window_value;        }
03397 
03398 
03403         void            SetColorFaceContrastLockMask (int m)                { m_lock.color_face_contrast_mask = (short)m;     }
03408         int             GetColorFaceContrastLockMask () const           { return m_lock.color_face_contrast_mask;         }
03409 
03414         void            SetColorFaceContrastLockValue (int v)               { m_lock.color_face_contrast_value = (short)v;    }
03419         int             GetColorFaceContrastLockValue () const          { return m_lock.color_face_contrast_value;        }
03420 
03421 
03426         void            SetColorWindowContrastLockMask (int m)                { m_lock.color_window_contrast_mask = (short)m;     }
03431         int             GetColorWindowContrastLockMask () const           { return m_lock.color_window_contrast_mask;         }
03432 
03437         void            SetColorWindowContrastLockValue (int v)               { m_lock.color_window_contrast_value = (short)v;    }
03442         int             GetColorWindowContrastLockValue () const          { return m_lock.color_window_contrast_value;        }
03443 
03444 
03449         void            SetColorBackLockMask (int m)                { m_lock.color_back_mask = (short)m;     }
03454         int             GetColorBackLockMask () const           { return m_lock.color_back_mask;         }
03455 
03460         void            SetColorBackLockValue (int v)               { m_lock.color_back_value = (short)v;    }
03465         int             GetColorBackLockValue () const          { return m_lock.color_back_value;        }
03466 
03467 
03472         void            SetColorVertexLockMask (int m)                { m_lock.color_vertex_mask = (short)m;     }
03477         int             GetColorVertexLockMask () const           { return m_lock.color_vertex_mask;         }
03478 
03483         void            SetColorVertexLockValue (int v)               { m_lock.color_vertex_value = (short)v;    }
03488         int             GetColorVertexLockValue () const          { return m_lock.color_vertex_value;        }
03489 
03490 
03495         void            SetColorEdgeContrastLockMask (int m)                { m_lock.color_edge_contrast_mask = (short)m;     }
03500         int             GetColorEdgeContrastLockMask () const           { return m_lock.color_edge_contrast_mask;         }
03501 
03506         void            SetColorEdgeContrastLockValue (int v)               { m_lock.color_edge_contrast_value = (short)v;    }
03511         int             GetColorEdgeContrastLockValue () const          { return m_lock.color_edge_contrast_value;        }
03512 
03513 
03518         void            SetColorLineContrastLockMask (int m)                { m_lock.color_line_contrast_mask = (short)m;     }
03523         int             GetColorLineContrastLockMask () const           { return m_lock.color_line_contrast_mask;         }
03524 
03529         void            SetColorLineContrastLockValue (int v)               { m_lock.color_line_contrast_value = (short)v;    }
03534         int             GetColorLineContrastLockValue () const          { return m_lock.color_line_contrast_value;        }
03535 
03536 
03541         void            SetColorMarkerContrastLockMask (int m)                { m_lock.color_marker_contrast_mask = (short)m;     }
03546         int             GetColorMarkerContrastLockMask () const           { return m_lock.color_marker_contrast_mask;         }
03547 
03552         void            SetColorMarkerContrastLockValue (int v)               { m_lock.color_marker_contrast_value = (short)v;    }
03557         int             GetColorMarkerContrastLockValue () const          { return m_lock.color_marker_contrast_value;        }
03558 
03559 
03564         void            SetColorVertexContrastLockMask (int m)                { m_lock.color_vertex_contrast_mask = (short)m;     }
03569         int             GetColorVertexContrastLockMask () const           { return m_lock.color_vertex_contrast_mask;         }
03570 
03575         void            SetColorVertexContrastLockValue (int v)               { m_lock.color_vertex_contrast_value = (short)v;    }
03580         int             GetColorVertexContrastLockValue () const          { return m_lock.color_vertex_contrast_value;        }
03581 
03582 
03587         void            SetColorTextContrastLockMask (int m)                { m_lock.color_text_contrast_mask = (short)m;     }
03592         int             GetColorTextContrastLockMask () const           { return m_lock.color_text_contrast_mask;         }
03593 
03598         void            SetColorTextContrastLockValue (int v)               { m_lock.color_text_contrast_value = (short)v;    }
03603         int             GetColorTextContrastLockValue () const          { return m_lock.color_text_contrast_value;        }
03604 
03605 
03606 
03607 
03609         void            SetForcedLockMask (int m)                     { m_forced.mask = m;                  }
03611         int             GetForcedLockMask () const                { return m_forced.mask;               }
03612 
03614         void            SetForcedLockValue (int v)                    { m_forced.value = v;                 }
03616         int             GetForcedLockValue () const               { return m_forced.value;              }
03617 
03622         void            SetVisibilityForcedLockMask (int m)           { m_forced.visibility_mask = m;       }
03627         int             GetVisibilityForcedLockMask () const      { return m_forced.visibility_mask;    }
03628 
03633         void            SetVisibilityForcedLockValue (int v)          { m_forced.visibility_value = v;      }
03638         int             GetVisibilityForcedLockValue () const     { return m_forced.visibility_value;   }
03639 
03640 
03645         void            SetColorForcedLockMask (int m)           { m_forced.color_mask = m;       }
03650         int             GetColorForcedLockMask () const      { return m_forced.color_mask;    }
03651 
03656         void            SetColorForcedLockValue (int v)          { m_forced.color_value = v;      }
03661         int             GetColorForcedLockValue () const     { return m_forced.color_value;   }
03662 
03663 
03668         void            SetColorFaceForcedLockMask (int m)                { m_forced.color_face_mask = (short)m;     }
03673         int             GetColorFaceForcedLockMask () const           { return m_forced.color_face_mask;         }
03674 
03679         void            SetColorFaceForcedLockValue (int v)               { m_forced.color_face_value = (short)v;    }
03684         int             GetColorFaceForcedLockValue () const          { return m_forced.color_face_value;        }
03685 
03686 
03691         void            SetColorEdgeForcedLockMask (int m)                { m_forced.color_edge_mask = (short)m;     }
03696         int             GetColorEdgeForcedLockMask () const           { return m_forced.color_edge_mask;         }
03697 
03702         void            SetColorEdgeForcedLockValue (int v)               { m_forced.color_edge_value = (short)v;    }
03707         int             GetColorEdgeForcedLockValue () const          { return m_forced.color_edge_value;        }
03708 
03709 
03714         void            SetColorLineForcedLockMask (int m)                { m_forced.color_line_mask = (short)m;     }
03719         int             GetColorLineForcedLockMask () const           { return m_forced.color_line_mask;         }
03720 
03725         void            SetColorLineForcedLockValue (int v)               { m_forced.color_line_value = (short)v;    }
03730         int             GetColorLineForcedLockValue () const          { return m_forced.color_line_value;        }
03731 
03732 
03737         void            SetColorMarkerForcedLockMask (int m)                { m_forced.color_marker_mask = (short)m;     }
03742         int             GetColorMarkerForcedLockMask () const           { return m_forced.color_marker_mask;         }
03743 
03748         void            SetColorMarkerForcedLockValue (int v)               { m_forced.color_marker_value = (short)v;    }
03753         int             GetColorMarkerForcedLockValue () const          { return m_forced.color_marker_value;        }
03754 
03755 
03760         void            SetColorTextForcedLockMask (int m)                { m_forced.color_text_mask = (short)m;     }
03765         int             GetColorTextForcedLockMask () const           { return m_forced.color_text_mask;         }
03766 
03771         void            SetColorTextForcedLockValue (int v)               { m_forced.color_text_value = (short)v;    }
03776         int             GetColorTextForcedLockValue () const          { return m_forced.color_text_value;        }
03777 
03778 
03783         void            SetColorWindowForcedLockMask (int m)                { m_forced.color_window_mask = (short)m;     }
03788         int             GetColorWindowForcedLockMask () const           { return m_forced.color_window_mask;         }
03789 
03794         void            SetColorWindowForcedLockValue (int v)               { m_forced.color_window_value = (short)v;    }
03799         int             GetColorWindowForcedLockValue () const          { return m_forced.color_window_value;        }
03800 
03801 
03806         void            SetColorFaceContrastForcedLockMask (int m)                { m_forced.color_face_contrast_mask = (short)m;     }
03811         int             GetColorFaceContrastForcedLockMask () const           { return m_forced.color_face_contrast_mask;         }
03812 
03817         void            SetColorFaceContrastForcedLockValue (int v)               { m_forced.color_face_contrast_value = (short)v;    }
03822         int             GetColorFaceContrastForcedLockValue () const          { return m_forced.color_face_contrast_value;        }
03823 
03824 
03829         void            SetColorWindowContrastForcedLockMask (int m)                { m_forced.color_window_contrast_mask = (short)m;     }
03834         int             GetColorWindowContrastForcedLockMask () const           { return m_forced.color_window_contrast_mask;         }
03835 
03840         void            SetColorWindowContrastForcedLockValue (int v)               { m_forced.color_window_contrast_value = (short)v;    }
03845         int             GetColorWindowContrastForcedLockValue () const          { return m_forced.color_window_contrast_value;        }
03846 
03847 
03852         void            SetColorBackForcedLockMask (int m)                { m_forced.color_back_mask = (short)m;     }
03857         int             GetColorBackForcedLockMask () const           { return m_forced.color_back_mask;         }
03858 
03863         void            SetColorBackForcedLockValue (int v)               { m_forced.color_back_value = (short)v;    }
03868         int             GetColorBackForcedLockValue () const          { return m_forced.color_back_value;        }
03869 
03870 
03875         void            SetColorVertexForcedLockMask (int m)                { m_forced.color_vertex_mask = (short)m;     }
03880         int             GetColorVertexForcedLockMask () const           { return m_forced.color_vertex_mask;         }
03881 
03886         void            SetColorVertexForcedLockValue (int v)               { m_forced.color_vertex_value = (short)v;    }
03891         int             GetColorVertexForcedLockValue () const          { return m_forced.color_vertex_value;        }
03892 
03893 
03898         void            SetColorEdgeContrastForcedLockMask (int m)                { m_forced.color_edge_contrast_mask = (short)m;     }
03903         int             GetColorEdgeContrastForcedLockMask () const           { return m_forced.color_edge_contrast_mask;         }
03904 
03909         void            SetColorEdgeContrastForcedLockValue (int v)               { m_forced.color_edge_contrast_value = (short)v;    }
03914         int             GetColorEdgeContrastForcedLockValue () const          { return m_forced.color_edge_contrast_value;        }
03915 
03916 
03921         void            SetColorLineContrastForcedLockMask (int m)                { m_forced.color_line_contrast_mask = (short)m;     }
03926         int             GetColorLineContrastForcedLockMask () const           { return m_forced.color_line_contrast_mask;         }
03927 
03932         void            SetColorLineContrastForcedLockValue (int v)               { m_forced.color_line_contrast_value = (short)v;    }
03937         int             GetColorLineContrastForcedLockValue () const          { return m_forced.color_line_contrast_value;        }
03938 
03939 
03944         void            SetColorMarkerContrastForcedLockMask (int m)                { m_forced.color_marker_contrast_mask = (short)m;     }
03949         int             GetColorMarkerContrastForcedLockMask () const           { return m_forced.color_marker_contrast_mask;         }
03950 
03955         void            SetColorMarkerContrastForcedLockValue (int v)               { m_forced.color_marker_contrast_value = (short)v;    }
03960         int             GetColorMarkerContrastForcedLockValue () const          { return m_forced.color_marker_contrast_value;        }
03961 
03962 
03967         void            SetColorVertexContrastForcedLockMask (int m)                { m_forced.color_vertex_contrast_mask = (short)m;     }
03972         int             GetColorVertexContrastForcedLockMask () const           { return m_forced.color_vertex_contrast_mask;         }
03973 
03978         void            SetColorVertexContrastForcedLockValue (int v)               { m_forced.color_vertex_contrast_value = (short)v;    }
03983         int             GetColorVertexContrastForcedLockValue () const          { return m_forced.color_vertex_contrast_value;        }
03984 
03985 
03990         void            SetColorTextContrastForcedLockMask (int m)                { m_forced.color_text_contrast_mask = (short)m;     }
03995         int             GetColorTextContrastForcedLockMask () const           { return m_forced.color_text_contrast_mask;         }
03996 
04001         void            SetColorTextContrastForcedLockValue (int v)               { m_forced.color_text_contrast_value = (short)v;    }
04006         int             GetColorTextContrastForcedLockValue () const          { return m_forced.color_text_contrast_value;        }
04007 
04008 
04009 
04010 
04012         void            SetBufferOptionsMask (int v)            { m_buffer_options_mask = (unsigned char)v;        }
04014         int             GetBufferOptionsMask () const       { return m_buffer_options_mask;     }
04016         void            SetBufferOptionsValue (int v)           { m_buffer_options_value = (unsigned char) v; }
04018         int             GetBufferOptionsValue () const      { return m_buffer_options_value;    }
04020         void            SetBufferSizeLimit (int l)              { m_buffer_size_limit = l;          }
04022         int             GetBufferSizeLimit () const         { return m_buffer_size_limit;       }
04023 
04024 
04026         void            SetStereoSeparation (float s)           { m_stereo_separation = s;          }
04028         float           GetStereoSeparation () const        { return m_stereo_separation;       }
04030         void            SetStereoDistance (float d)           { m_stereo_distance = d;          }
04032         float           GetStereoDistance () const        { return m_stereo_distance;       }
04033 
04034 
04036         void            SetHlrOptions (int o) {
04037                             m_hlr_options = o;
04038                             if ((o & TKO_Hidden_Line_Extended_Mask) != 0) {
04039                                 m_hlr_options |= TKO_Hidden_Line_Extended;
04040                             if ((o & TKO_Hidden_Line_Extended2_Mask) != 0)
04041                                 m_hlr_options |= TKO_Hidden_Line_Extended2;
04042                         }
04043             }
04045         int             GetHlrOptions () const              { return m_hlr_options;             }
04047         void            SetHlrDimFactor (float d)               { m_hlr_dim_factor = d;             }
04049         float           GetHlrDimFactor () const            { return m_hlr_dim_factor;          }
04051         void            SetHlrFaceDisplacement (float d)        { m_hlr_face_displacement = d;      }
04053         float           GetHlrFaceDisplacement () const     { return m_hlr_face_displacement;   }
04055         void            SetHlrLinePattern (int p)               { m_hlr_line_pattern = p;           }
04057         int             GetHlrLinePattern () const          { return m_hlr_line_pattern;        }
04059         void            SetHlrFaceSortingAlgorithm (int a)       { m_hlr_hsr_algorithm = (unsigned char)a;  }
04061         float           GetHlrFaceSortingAlgorithm () const { return m_hlr_hsr_algorithm;           }
04062 
04063 
04065         void            SetNURBSOptionsMask (int m) {
04066                             m_nurbs_options_mask = m;
04067                             if ((m & TKO_NURBS_Extended_Mask) != 0)
04068                                 m_nurbs_options_mask |= TKO_NURBS_Extended;
04069                         }
04071         int             GetNURBSOptionsMask () const        { return m_nurbs_options_mask;     }
04073         void            SetNURBSOptionsValue (int v)            { m_nurbs_options_value = v;       }
04075         int             GetNURBSOptionsValue () const       { return m_nurbs_options_value;    }
04077         void            SetNURBSCurveBudget (int b)             { m_curve_budget = b;               }
04079         int             GetNURBSCurveBudget () const        { return m_curve_budget;            }
04081         void            SetNURBSCurveContinuedBudget (int b)        { m_curve_continued_budget = b;     }
04083         int             GetNURBSCurveContinuedBudget () const   { return m_curve_continued_budget;  }
04085         void            SetNURBSSurfaceBudget (int b)           { m_surface_budget = b;               }
04087         int             GetNURBSSurfaceBudget () const      { return m_surface_budget;            }
04089         void            SetNURBSSurfaceTrimBudget (int b)       { m_surface_trim_budget = b;        }
04091         int             GetNURBSSurfaceTrimBudget () const  { return m_surface_trim_budget;     }
04092 
04093 
04095         void            SetLodOptionsMask (int v)               { m_lod_options_mask = v;           }
04097         int             GetLodOptionsMask () const          { return m_lod_options_mask;        }
04099         void            SetLodOptionsValue (int v)              { m_lod_options_value = v;          }
04101         int             GetLodOptionsValue () const         { return m_lod_options_value;       }
04103         void            SetLodAlgorithm (int v)                 { m_lod_algorithm = (char)v;        }
04105         int             GetLodAlgorithm () const            { return m_lod_algorithm;           }
04107         void            SetLodMinimumTriangleCount (int v)          { m_min_triangle_count = v;     }
04109         int             GetLodMinimumTriangleCount () const     { return m_min_triangle_count;  }
04111         void            SetLodNumLevels (int v)                 { m_num_levels = (unsigned char)v;  }
04113         int             GetLodNumLevels () const            { return m_num_levels;              }
04115         void            SetLodClamp (int v)                     { m_clamp = (unsigned char)v;       }
04117         int             GetLodClamp () const                { return m_clamp;                   }
04119         void            SetLodMaxDegree (int v)                 { m_max_degree = v;                 }
04121         int             GetLodMaxDegree () const            { return m_max_degree;              }
04123         void            SetLodTolerance (float v)               { m_tolerance = v;                  }
04125         float           GetLodTolerance () const            { return m_tolerance;               }
04127         void            SetLodFallback (int v)                  { m_fallback = (char)v;             }
04129         int             GetLodFallback () const             { return m_fallback;                }
04130 
04132         void            SetLodBounding (float x1, float y1, float z1, float x2, float y2, float z2) {
04133                             m_bounding[0] = x1;  m_bounding[1] = y1;  m_bounding[2] = z1;
04134                             m_bounding[3] = x2;  m_bounding[4] = y2;  m_bounding[5] = z2;
04135                         }
04137         void            SetLodBounding (float const * s, float const * e) {
04138                             SetLodBounding (s[0], s[1], s[2],  e[0], e[1], e[2]);
04139                         }
04141         void            SetLodBounding (float const * p)        { SetLodBounding (&p[0], &p[3]);    }
04143         float const *   GetLodBounding () const             { return m_bounding;                }
04144 
04146         void            SetLodRatio (float r)                   { m_num_ratios = 1; m_ratio[0] = r; }
04148         void            SetLodRatios (int c, float const * r = 0) {
04149                             m_num_ratios = (char)c;
04150                             if (r != 0) {
04151                                 int i;
04152                                 for (i=0; i<c; ++i)
04153                                     m_ratio[i] = r[i];
04154                             }
04155                         }
04157         int             GetLodNumRatios () const            { return m_num_ratios;              }
04159         float const *   GetLodRatios () const               { return m_ratio;                   }
04161         float *         GetLodRatios ()                     { return m_ratio;                   }
04162 
04164         void            SetLodThresholdType (int v)             { m_threshold_type = (char)v; }
04166         int             GetLodThresholdType () const        { return m_threshold_type; }
04168         void            SetLodThreshold (float r)                   { m_num_thresholds = 1; m_threshold[0] = r;    }
04170         void            SetLodThresholds (int c, float const * r = 0) {
04171                             m_num_thresholds = (char)c;
04172                             if (r != 0) {
04173                                 int i;
04174                                 for (i=0; i<c; ++i)
04175                                     m_threshold[i] = r[i];
04176                             }
04177                         }
04179         int             GetLodNumThresholds () const            { return m_num_thresholds;              }
04181         float const *   GetLodThresholds () const               { return m_threshold;                  }
04183         float *         GetLodThresholds ()                     { return m_threshold;                  }
04184 
04186         void            SetLodCutoff (float r)                   { m_num_cutoffs = 1; m_cutoff[0] = r;    }
04188         void            SetLodCutoffs (int c, float const * r = 0) {
04189                             m_num_cutoffs = (char)c;
04190                             if (r != 0) {
04191                                 int i;
04192                                 for (i=0; i<c; ++i)
04193                                     m_cutoff[i] = r[i];
04194                             }
04195                         }
04197         int             GetLodNumCutoffs () const           { return m_num_cutoffs;             }
04199         float const *   GetLodCutoffs () const              { return m_cutoff;                  }
04201         float *         GetLodCutoffs ()                    { return m_cutoff;                  }
04202 
04203 
04205         void            SetTessellationMask (int m)             { m_tessellations = (unsigned char)m;          }
04207         int             GetTessellationMask () const        { return m_tessellations;       }
04209         void            SetCylinderTessellation (int n)          { m_num_cylinder = (char)1; m_cylinder[0] = (char)n;    }
04211         void            SetCylinderTessellations (int c, char const * n = 0) {
04212                             m_num_cylinder = (char)c;
04213                             if (n != 0) {
04214                                 int i;
04215                                 for (i=0; i<c; ++i)
04216                                     m_cylinder[i] = n[i];
04217                             }
04218                         }
04220         int             GetNumCylinderTessellations () const { return m_num_cylinder;           }
04222         char const *    GetCylinderTessellations () const    { return m_cylinder;               }
04224         char *          GetCylinderTessellations ()          { return m_cylinder;               }
04226         void            SetSphereTessellation (int n)          { m_num_sphere = (char)1; m_sphere[0] = (char)n;    }
04228         void            SetSphereTessellations (int c, char const * n = 0) {
04229                             m_num_sphere = (char)c;
04230                             if (n != 0) {
04231                                 int i;
04232                                 for (i=0; i<c; ++i)
04233                                     m_sphere[i] = n[i];
04234                             }
04235                         }
04237         int             GetNumSphereTessellations () const  { return m_num_sphere;           }
04239         char const *    GetSphereTessellations () const     { return m_sphere;               }
04241         char *          GetSphereTessellations ()           { return m_sphere;               }
04242 
04244         void            SetGeometryOptionsMask (int m)          { m_geometry_options = (unsigned char)m;    }
04246         int             GetGeometryOptionsMask () const         { return m_geometry_options;    }
04247 
04249         void            SetHardEdgeAngle (int m)            { m_dihedral = (unsigned char)m;    }
04251         float           GetHardEdgeAngle () const           { return m_dihedral;    }
04252 
04254         void            SetMaskTransform (int m)            { m_mask_transform = (unsigned short)m;  }
04256         int             GetMaskTransform () const           { return (int)m_mask_transform;         }
04257 
04258 
04260         void            SetCutGeometry (int m)              { m_cut_geometry = (unsigned char)m;  }
04262         int             GetCutGeometry () const             { return (int)m_cut_geometry;         }
04263 
04265         void            SetCutGeometryLevel (int m)         { m_cut_geometry_level = (unsigned char)m;  }
04267         int             GetCutGeometryLevel () const        { return (int)m_cut_geometry_level;         }
04268 
04270         void            SetCutGeometryColorMatch (int m)        { m_cut_geometry_match = (unsigned char)m;  }
04272         int             GetCutGeometryColorMatch () const       { return (int)m_cut_geometry_match;         }
04273 
04275         void            SetCutGeometryTolerance (float m)           { m_cut_geometry_tolerance = m; }
04277         float           GetCutGeometryTolerance () const            { return m_cut_geometry_tolerance;  }
04278 
04279 
04281         void            SetDisplayListLevel (int m)         { m_display_list_level = (unsigned char)m;  }
04283         int             GetDisplayListLevel () const        { return (int)m_display_list_level;         }
04284 
04286         void            SetSimpleShadow (int m) {
04287                             m_simple_shadow = (unsigned short)m;
04288                             if ((m & TKO_Simple_Shadow_Extended_Mask) != 0)
04289                                 m_simple_shadow |= TKO_Simple_Shadow_Extended;
04290                         }
04292         int             GetSimpleShadow () const            { return (int)m_simple_shadow;         }
04293 
04295         void            SetSimpleShadowBlur (int m)             { m_simple_shadow_blur = (unsigned char)m;  }
04297         int             GetSimpleShadowBlur () const            { return (int)m_simple_shadow_blur;         }
04298 
04300         void            SetSimpleShadowResolution (int m)           { m_simple_shadow_resolution = (unsigned short)m;  }
04302         int             GetSimpleShadowResolution () const          { return (int)m_simple_shadow_resolution;         }
04303 
04305         void            SetSimpleShadowLight (float x, float y, float z) {
04306                             m_simple_shadow_light[0] = x;
04307                             m_simple_shadow_light[1] = y;
04308                             m_simple_shadow_light[2] = z;
04309                         }
04311         void            SetSimpleShadowLight (float const * l)          { SetSimpleShadowLight (l[0], l[1], l[2]); }
04313         float const *   getSimpleShadowLight () const               { return m_simple_shadow_light; }
04314 
04316         void            SetSimpleShadowPlane (float a, float b, float c, float d) {
04317                             m_simple_shadow_plane[0] = a;
04318                             m_simple_shadow_plane[1] = b;
04319                             m_simple_shadow_plane[2] = c;
04320                             m_simple_shadow_plane[3] = d;
04321                         }
04323         void            SetSimpleShadowPlane (float const * p)          { SetSimpleShadowPlane (p[0], p[1], p[2], p[3]); }
04325         float const *   GetSimpleShadowPlane () const               { return m_simple_shadow_plane; }
04326 
04328         void            SetSimpleShadowColor (float r, float g, float b)
04329                 { m_simple_shadow_color[0] = r; m_simple_shadow_color[1] = g; m_simple_shadow_color[2] = b; }
04331         void            SetSimpleShadowColor (float const * rgb)            { SetSimpleShadowColor (rgb[0], rgb[1], rgb[2]);    }
04333         float const *   GetSimpleShadowColor () const                   { return m_simple_shadow_color;     }
04334 
04336         void            SetSimpleShadowOpacity (float o)        { m_simple_shadow_opacity = o;      }
04338         float           GetSimpleShadowOpacity () const         { return m_simple_shadow_opacity;   }
04339 
04340   
04342         void            SetShadowMap (int m)            { m_shadow_map = (unsigned char)m;  }
04344         int             GetShadowMap () const           { return (int)m_shadow_map;         }
04345 
04347         void            SetShadowMapResolution (int m)          { m_shadow_map_resolution = (unsigned short)m;  }
04349         int             GetShadowMapResolution () const         { return (int)m_shadow_map_resolution;         }
04350 
04352         void            SetShadowMapSamples (int m)             { m_shadow_map_samples = (unsigned char)m;  }
04354         int             GetShadowMapSamples () const            { return (int)m_shadow_map_samples;         }
04355 
04356 
04358         void            SetSimpleReflection (int m)             { m_simple_reflection = (unsigned short)m;  }
04360         int             GetSimpleReflection () const            { return (int)m_simple_reflection;          }
04361 
04363         void            SetSimpleReflectionPlane (float a, float b, float c, float d) {
04364                             m_simple_reflection_plane[0] = a;
04365                             m_simple_reflection_plane[1] = b;
04366                             m_simple_reflection_plane[2] = c;
04367                             m_simple_reflection_plane[3] = d;
04368                         }
04370         void            SetSimpleReflectionPlane (float const * p)          { SetSimpleReflectionPlane (p[0], p[1], p[2], p[3]); }
04372         float const *   GetSimpleReflectionPlane () const               { return m_simple_reflection_plane; }
04373 
04375         void            SetSimpleReflectionOpacity (float o)        { m_simple_reflection_opacity = o;      }
04377         float           GetSimpleReflectionOpacity () const         { return m_simple_reflection_opacity;   }
04378 
04380         void            SetSimpleReflectionVisibilityMask (int m)           { m_simple_reflection_visibility_mask = m;  }
04382         int             GetSimpleReflectionVisibilityValue () const         { return m_simple_reflection_visibility_value;          }
04383 
04384 
04386         void            SetDepthRange (float n, float f)         { m_depth_range[0] = n; m_depth_range[1] = f; }
04388         void            SetDepthRange (float const * l)          { SetDepthRange (l[0], l[1]);                }
04390         float const *   GetDepthRange () const               { return m_depth_range;                      }
04391 
04392 
04394         void            SetScreenRange (float l, float r, float b, float t)
04395                             { m_screen_range[0] = l; m_screen_range[1] = r; m_screen_range[2] = b; m_screen_range[3] = t; }
04397         void            SetScreenRange (float const * l)          { SetScreenRange (l[0], l[1], l[2], l[3]);    }
04399         float const *   GetScreenRange () const               { return m_screen_range;                      }
04400 
04404         void            SetAmbientUpVector (float x, float y, float z)
04405                             { m_ambient_up_vector[0] = x; m_ambient_up_vector[1] = y; m_ambient_up_vector[2] = z; }
04407         void            SetAmbientUpVector (float const * v)        { SetAmbientUpVector (v[0], v[1], v[2]); }
04409         float const *   GetAmbientUpVector () const               { return m_ambient_up_vector; }
04410 
04412         void            SetImageScale (float x, float y)         { m_image_scale[0] = x; m_image_scale[1] = y; }
04414         void            SetImageScale (float const * s)          { SetImageScale (s[0], s[1]);                }
04416         float const *   GetImageScale () const               { return m_image_scale;                      }
04417 
04418 
04420         void            SetImageTintColor (float r, float g, float b)
04421                             { m_image_tint_color[0] = r; m_image_tint_color[1] = g; m_image_tint_color[2] = b; }
04423         void            SetImageTintColor (float const * rgb)           { SetImageTintColor (rgb[0], rgb[1], rgb[2]);   }
04425         float const *   GetImageTintColor () const                   { return m_image_tint_color;     }
04426 
04428         void            SetDiffuseTextureTintColor (float r, float g, float b)
04429                             { m_texture_tint_color[0] = r; m_texture_tint_color[1] = g; m_texture_tint_color[2] = b; }
04431         void            SetDiffuseTextureTintColor (float const * rgb)       { SetDiffuseTextureTintColor (rgb[0], rgb[1], rgb[2]); }
04433         float const *   GetDiffuseTextureTintColor () const                   { return m_texture_tint_color;     }
04434 
04436         void            SetAntiAlias (int m)            { m_antialias = (unsigned char)m;   }
04438         int             GetAntiAlias () const           { return (int)m_antialias;          }
04439 
04441         void            SetVertexDecimation (float f)           { m_vertex_decimation = f;  }
04443         float           GetVertexDecimation () const            { return m_vertex_decimation;           }
04444 };
04445 
04447 
04451 enum TKO_Heuristic_Bits {
04452     TKO_Heuristic_Hidden_Surfaces           = 0x00000001,  
04453     TKO_Heuristic_Backplane_Cull            = 0x00000002,  
04454     TKO_Heuristic_Polygon_Handedness        = 0x00000004,  
04455     TKO_Heuristic_Quick_Moves               = 0x00000008,  
04456     TKO_Heuristic_Partial_Erase             = 0x00000010,  
04457     TKO_Heuristic_Memory_Purge              = 0x00000020,  
04458     TKO_Heuristic_Related_Select_Limit      = 0x00000040,  
04459     TKO_Heuristic_Internal_Shell_Limit      = 0x00000080,  
04460     TKO_Heuristic_Clipping                  = 0x00000100,  
04461     TKO_Heuristic_Transformations           = 0x00000200,  
04462     TKO_Heuristic_Intersecting_Polygons     = 0x00000400,  
04463     TKO_Heuristic_Polygon_Crossings         = 0x00000800,  
04464     TKO_Heuristic_Concave_Polygons          = 0x00001000,  
04465     TKO_Heuristic_Incremental_Updates       = 0x00002000,  
04466     TKO_Heuristic_Selection_Sorting         = 0x00004000,  
04467 
04468     TKO_Heuristic_Extended                  = 0x00008000,  
04469     TKO_Heuristic_Extended_Mask             = 0xFFFF0000,  
04470     TKO_Heuristic_Extended_Shift            = 16,           
04471 
04472     TKO_Heuristic_Culling                   = 0x00010000,  
04473     TKO_Heuristic_Exclude_Bounding          = 0x00020000,  
04474     TKO_Heuristic_Detail_Selection          = 0x00040000,  
04475     TKO_Heuristic_Ordered_Drawing           = 0x00080000,  
04476     TKO_Heuristic_Ordered_Unit              = 0x00100000,  
04477     TKO_Heuristic_Ordered_Weights           = 0x00200000,  
04478     TKO_Heuristic_Internal_Polyline_Limit   = 0x00400000,  
04479     TKO_Heuristic_Ordered_Grid              = 0x00800000,  
04480 
04481     TKO_Heuristic_Selection_Level           = 0x01000000,  
04482     TKO_Heuristic_Static                    = 0x02000000,  
04483     TKO_Heuristic_Force_Defer               = 0x04000000,  
04484     TKO_Heuristic_Model_Type                = 0x08000000,  
04485 
04486     TKO_Heuristic_Internal_Select_Limit = TKO_Heuristic_Internal_Shell_Limit | TKO_Heuristic_Internal_Polyline_Limit,  
04487     TKO_Heuristic_Extras                = TKO_Heuristic_Polygon_Handedness | TKO_Heuristic_Quick_Moves,  
04488 
04489     TKO_Heur_Extra_Left_Handed_Polys    = 0x01,         
04490     TKO_Heur_Extra_Quick_Move_Spriting  = 0x02,         
04491 
04492     TKO_Heur_View_Frustum_Culling       = 0x00000001,           
04493     TKO_Heur_Obscuration_Culling        = 0x00000002,           
04494     TKO_Heur_Extent_Culling             = 0x00000004,           
04495     TKO_Heur_View_Frustum_Culling_Off   = 0x00000010,           
04496     TKO_Heur_Obscuration_Culling_Off    = 0x00000020,           
04497     TKO_Heur_Extent_Culling_Off         = 0x00000040,           
04498     TKO_Heur_Culling_Extended           = 0x00000080,           
04499     TKO_Heur_Culling_Extended_Mask      = 0xFFFFFF00,           
04500     TKO_Heur_Culling_Extended_Shift     = 8,                
04501     TKO_Heur_Obscuration_Use_Octree     = 0x00000100,           
04502     TKO_Heur_Maximum_Extent_Mode        = 0x00000200,           
04503     TKO_Heur_Vector_Culling             = 0x00000400,           
04504     TKO_Heur_Vector_Tolerance           = 0x00000800,           
04505     TKO_Heur_Vector_Culling_Off         = 0x00001000,           
04506     TKO_Heur_Vector_Tolerance_Off       = 0x00002000,           
04507     TKO_Heur_Hard_Extent_Culling        = 0x00004000,           
04508     TKO_Heur_Culling_Extended2          = 0x00008000,           
04509     TKO_Heur_Culling_Extended2_Mask     = 0xFFFF0000,       
04510     TKO_Heur_Culling_Extended2_Shift    = 16,               
04511     TKO_Heur_Maximum_Extent_Level       = 0x00010000,           
04512     TKO_Heur_Hard_Extent_Culling_Off    = 0x00020000,           
04513     TKO_Heur_Extent_Culling_Detail_On   = 0x00040000,           
04514     TKO_Heur_Extent_Culling_Detail_Off  = 0x00080000,           
04515 
04516 
04517     TKO_Heur_Max_Extent_Mode_None       = 0,                
04518     TKO_Heur_Max_Extent_Mode_Dot        = 1,                
04519     TKO_Heur_Max_Extent_Mode_Bounding   = 2,                
04520     TKO_Heur_Max_Extent_Mode_Defer      = 3,                
04521 
04522     TKO_Heur_Max_Extent_Level_None      = 0x00,             
04523     TKO_Heur_Max_Extent_Level_Segment   = 0x01,             
04524     TKO_Heur_Max_Extent_Level_Geometry  = 0x02,             
04525     TKO_Heur_Max_Extent_Level_Primitive = 0x04,             
04526     TKO_Heur_Max_Extent_Level_All       = 0x07,             
04527 
04528     TKO_Heur_Order_World_Volume     = 0,                
04529     TKO_Heur_Order_Screen_Extent    = 1,                
04530     TKO_Heur_Order_Distance         = 2,                
04531     TKO_Heur_Order_Divergence       = 3,                
04532     TKO_Heur_Order_Density          = 4,                
04533     TKO_Heur_Order_Priority         = 5,                
04534     TKO_Heur_Order_Count            = 6,                
04535 
04536     TKO_Heur_Selection_Level_Entity       = 0,   
04537     TKO_Heur_Selection_Level_Segment      = 1,   
04538     TKO_Heur_Selection_Level_Segment_Tree = 2,   
04539 
04540     TKO_Heur_Model_Type_Default         = 0,   
04541     TKO_Heur_Model_Type_LMV             = 1   
04542 };
04543 
04544 
04545 
04547 
04553 class BBINFILETK_API TK_Heuristics : public BBaseOpcodeHandler {
04554     protected:
04555         int             m_mask;                 
04556         int             m_value;                
04557 
04558         int             m_related;              
04559         int             m_internal_shell;       
04560         int             m_internal_polyline;    
04561 
04562         unsigned char   m_extras;               
04563         int             m_culling;              
04564         int             m_pixel_threshold;      
04565         int             m_maximum_extent;       
04566         int             m_maximum_extent_mode;  
04567         char            m_maximum_extent_level; 
04568         int             m_hard_extent;          
04569         int             m_force_defer;          
04570         float           m_vector[3];            
04571         float           m_vector_tolerance;     
04572 
04573         unsigned char   m_ordered_weights_mask;
04574         float           m_ordered_weights[TKO_Heur_Order_Count];
04575         unsigned char   m_selection_level;
04576         unsigned char   m_model_type;
04577 
04578     public:
04580         TK_Heuristics () : BBaseOpcodeHandler (TKE_Heuristics),
04581                                   m_mask (0), m_value (0), m_culling(0), m_pixel_threshold (0), m_maximum_extent (0), m_maximum_extent_mode(0) {}
04582         ~TK_Heuristics ();
04583 
04584         TK_Status   Read (BStreamFileToolkit & tk);
04585         TK_Status   Write (BStreamFileToolkit & tk);
04586         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04587 
04588         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04589         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04590 
04592         void            SetMask (int m) {
04593                             m_mask = m;
04594                             if ((m & TKO_Heuristic_Extended_Mask) != 0)
04595                                 m_mask |= TKO_Heuristic_Extended;
04596                         }
04598         int             GetMask () const            { return m_mask;    }
04599 
04601         void            SetValue (int v)                { m_value = v;      }
04603         int             GetValue () const           { return m_value;   }
04604 
04606         void            SetRelatedSelectionLimit (int r)        { m_related = r;      }
04608         int             GetRelatedSelectionLimit () const   { return m_related;   }
04609 
04611         void            SetInternalSelectionLimit (int i)       { m_internal_shell = m_internal_polyline = i;     }
04613         int             GetInternalSelectionLimit () const  { return m_internal_shell;  }
04614 
04616         void            SetInternalShellSelectionLimit (int i)       { m_internal_shell = i;     }
04618         int             GetInternalShellSelectionLimit () const  { return m_internal_shell;  }
04619 
04621         void            SetInternalPolylineSelectionLimit (int i)       { m_internal_polyline = i;     }
04623         int             GetInternalPolylineSelectionLimit () const  { return m_internal_polyline;  }
04624 
04626         void            SetExtras (int e)               { m_extras = (unsigned char)e;  }
04628         int             GetExtras () const          { return (int)m_extras;         }
04629 
04631         void            SetCulling (int c)              { m_culling = (unsigned short)c; }
04633         int             GetCulling () const         { return (int)m_culling;        }
04635         void            SetPixelThreshold (int c)              { m_pixel_threshold = c;     }
04637         int             GetPixelThreshold () const         { return m_pixel_threshold;  }
04639         void            SetMaximumExtent (int c)               { m_maximum_extent = c;      }
04641         int             GetMaximumExtent () const          { return m_maximum_extent;   }
04643         int             GetMaximumExtentMode () const          { return m_maximum_extent_mode; }
04645         void            SetMaximumExtentMode (int c)               { m_maximum_extent_mode = c;     }
04647         int             GetMaximumExtentLevel () const         { return m_maximum_extent_level; }
04649         void            SetMaximumExtentLevel (int c)               { m_maximum_extent_level = (unsigned char)c;        }
04651         void            SetHardExtent (int c)               { m_hard_extent = c;        }
04653         int             GetHardExtent () const          { return m_hard_extent; }
04655         float const *   GetVector () const                          { return m_vector; }
04657         void            SetVector (float x, float y, float z) {
04658                             m_vector[0] = x;
04659                             m_vector[1] = y;
04660                             m_vector[2] = z;
04661                         }
04663         void            SetVector (float const * v)                 { SetVector(v[0], v[1], v[2]); }
04665         float           GetVectorTolerance () const                 { return m_vector_tolerance; }
04667         void            SetVectorTolerance (float tol)              { m_vector_tolerance = tol; }
04668 
04670         void            SetOrderedWeightsMask (int c)          { m_ordered_weights_mask = (unsigned char)c; }
04672         int             GetOrderedWeightsMask () const     { return (int)m_ordered_weights_mask;        }
04673 
04675         void            SetOrderedWeight (int index, float weight) {
04676                             m_ordered_weights[index] = weight;
04677                             m_ordered_weights_mask |= 1<<index;
04678                         }
04680         float           GetOrderedWeight (int index) const          { return m_ordered_weights[index];  }
04682         float const *   GetOrderedWeights () const                  { return m_ordered_weights;         }
04684         float *         GetOrderedWeights ()                        { return m_ordered_weights;         }
04685 
04687         void            SetSelectionLevel (int l)              { m_selection_level = (unsigned char)l; }
04689         int             GetSelectionLevel () const         { return (int)m_selection_level;        }
04690 
04692         void            SetForceDefer (int l)              { m_force_defer = l; }
04694         int             GetForceDefer () const         { return m_force_defer;        }
04695 
04696 };
04697 
04699 
04703 enum TKO_Geometry_Options {
04704     TKO_Geometry_Options_Orientation        = 0x0001,  
04705     TKO_Geometry_Options_Camera_Relative    = 0x0002   
04706 };
04707 
04708 
04710 
04716 class BBINFILETK_API TK_Geometry_Options : public BBaseOpcodeHandler {
04717     protected:
04718         unsigned short  m_mask;                 
04719         unsigned short  m_value;                
04720 
04721         char            m_orientation_count;    
04722         float           m_orientation[6];       
04723 
04724     public:
04726         TK_Geometry_Options () : BBaseOpcodeHandler (TKE_Geometry_Options),
04727                                   m_mask (0), m_value (0), m_orientation_count (0) {}
04728         ~TK_Geometry_Options ();
04729 
04730         TK_Status   Read (BStreamFileToolkit & tk);
04731         TK_Status   Write (BStreamFileToolkit & tk);
04732         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04733 
04734         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04735         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04736 
04738         void            SetMask (int m)       { m_mask = (unsigned short)m; }
04740         int             GetMask () const            { return (int)m_mask;    }
04741 
04743         void            SetOrientation (int count, float const * o) {
04744                                 if (count != 3 && count != 6)
04745                                     return;
04746                                 m_orientation_count = (unsigned char)count;
04747                                 while (count-- > 0)
04748                                     m_orientation[count] = o[count];
04749                             }
04751         int             GetOrientationCount () const { return (int) m_orientation_count; }
04753         float const *   GetOrientation () const { return m_orientation; }
04754 };
04755 
04758 
04763 class BBINFILETK_API TK_Visibility : public BBaseOpcodeHandler {
04764     protected:
04765         int             m_mask;     
04766         int             m_value;    
04767 
04768     public:
04770         TK_Visibility (void)
04771             : BBaseOpcodeHandler (TKE_Visibility), m_mask (0), m_value (0) {}
04772 
04773         TK_Status   Read (BStreamFileToolkit & tk);
04774         TK_Status   Write (BStreamFileToolkit & tk);
04775         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04776 
04777         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04778         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04779 
04783         void            SetGeometry (int m) {
04784                             m_mask = m & TKO_Geo_All_Visibles;
04785                             if ((m & TKO_Geo_Extended_Mask) != 0) {
04786                                 m_mask |= TKO_Geo_Extended;
04787                                 if ((m & TKO_Geo_Extended2_Mask) != 0)
04788                                     m_mask |= TKO_Geo_Extended2;
04789                             }
04790                         }
04795         int             GetGeometry () const        { return m_mask;    }
04796 
04801         void            SetValue (int m)                { m_value = m;       }
04806         int             GetValue () const           { return m_value;    }
04807 };
04808 
04811 
04818 class BBINFILETK_API TK_Selectability : public BBaseOpcodeHandler {
04819     protected:
04820         int             m_mask;         
04821         int             m_down;         
04822         int             m_up;           
04823         int             m_move_down;    
04824         int             m_move_up;      
04825         int             m_invisible;    
04826 
04827     public:
04829         TK_Selectability (void)
04830             : BBaseOpcodeHandler (TKE_Selectability),
04831             m_mask (0), m_down (0), m_up (0), m_move_down (0), m_move_up (0), m_invisible (0) {}
04832 
04833         TK_Status   Read (BStreamFileToolkit & tk);
04834         TK_Status   Write (BStreamFileToolkit & tk);
04835         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04836 
04837         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04838         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04839 
04843         void            SetGeometry (int m) {
04844                             m_mask = m & TKO_Geo_All_Selects;
04845                             if ((m & TKO_Geo_Extended_Mask) != 0)
04846                                 m_mask |= TKO_Geo_Extended;
04847                         }
04852         int             GetGeometry () const        { return m_mask;        }
04853 
04858         void            SetDown (int m)                 { m_down = m;           }
04863         int             GetDown () const            { return m_down;        }
04864 
04869         void            SetUp (int m)                   { m_up = m;             }
04874         int             GetUp () const              { return m_up;          }
04875 
04880         void            SetMoveDown (int m)             { m_move_down = m;      }
04885         int             GetMoveDown () const        { return m_move_down;   }
04886 
04891         void            SetMoveUp (int m)               { m_move_up = m;        }
04896         int             GetMoveUp () const          { return m_move_up;     }
04897 
04902         void            SetWhenInvisible (int m)        { m_invisible = m;      }
04907         int             GetWhenInvisible () const   { return m_invisible;   }
04908 };
04909 
04911 
04917 class BBINFILETK_API TK_Matrix : public BBaseOpcodeHandler {
04918     protected:
04919         float           m_matrix[16];  
04920         double          m_dmatrix[16];  
04921 
04922     public:
04924         TK_Matrix (unsigned char opcode)
04925             : BBaseOpcodeHandler (opcode) {}
04926 
04927         TK_Status   Read (BStreamFileToolkit & tk);
04928         TK_Status   Write (BStreamFileToolkit & tk);
04929         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04930 
04931         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04932         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04933 
04935         void            SetMatrix (float const * m) {
04936                             int i;  for (i=0; i<16; i++) m_matrix[i] = m[i];
04937                         }
04939         void            SetDMatrix (double const * m) {
04940                             int i;  for (i=0; i<16; i++) m_dmatrix[i] = m[i];
04941                         }
04943         float const *   GetMatrix () const              { return m_matrix;  }
04945         float *         GetMatrix ()                    { return m_matrix;  }
04947         double const *  GetDMatrix () const             { return m_dmatrix;  }
04949         double *        GetDMatrix ()                   { return m_dmatrix;  }
04950 };
04951 
04952 
04956 enum TKO_Enumerations {
04957     TKO_Line_Pattern_Solid      = 0,  
04958     TKO_Line_Pattern_Dash_Dot   = 1,  
04959     TKO_Line_Pattern_Dashed     = 2,  
04960     TKO_Line_Pattern_Dotted     = 3,  
04961     TKO_Line_Pattern_Dash_2Dot  = 4,  
04962     TKO_Line_Pattern_Dash_3Dot  = 5,  
04963     TKO_Line_Pattern_Long_Dash  = 6,  
04964     TKO_Line_Pattern_Center     = 7,  
04965     TKO_Line_Pattern_Phantom    = 8,  
04966     TKO_Line_Pattern_Find_Dots  = 9,  
04967 
04968     TKO_Fill_Pattern_Hash       = 0,  
04969     TKO_Fill_Pattern_Vertical   = 1,  
04970     TKO_Fill_Pattern_Horizontal = 2,  
04971     TKO_Fill_Pattern_Right      = 3,  
04972     TKO_Fill_Pattern_Left       = 4,  
04973     TKO_Fill_Pattern_Diamond    = 5,  
04974     TKO_Fill_Pattern_Dots       = 6,  
04975     TKO_Fill_Pattern_Boxes      = 7,  
04976     TKO_Fill_Pattern_Solid      = 8,  
04977     TKO_Fill_Pattern_Clear      = 9,  
04978     TKO_Fill_Pattern_Gradient_N = 10,  
04979     TKO_Fill_Pattern_Gradient_NE= 11,  
04980     TKO_Fill_Pattern_Gradient_E = 12,  
04981     TKO_Fill_Pattern_Gradient_SE= 13,  
04982     TKO_Fill_Pattern_Gradient_S = 14,  
04983     TKO_Fill_Pattern_Gradient_SW= 15,  
04984     TKO_Fill_Pattern_Gradient_W = 16,  
04985     TKO_Fill_Pattern_Gradient_NW= 17,  
04986     TKO_Fill_Pattern_Blend  = 18,  
04987     TKO_Fill_Pattern_Invisible  = 19,  
04988 
04989     TKO_Marker_Circle                       = 0,  
04990     TKO_Marker_Circle_Dot                   = 1,  
04991     TKO_Marker_Circle_Plus                  = 2,  
04992     TKO_Marker_Circle_X                     = 3,  
04993     TKO_Marker_Circle_Circle                = 4,  
04994     TKO_Marker_Circle_Filled                = 5,  
04995     TKO_Marker_Dot                          = 6,  
04996     TKO_Marker_Plus                         = 7,  
04997     TKO_Marker_X                            = 8,  
04998     TKO_Marker_Star                         = 9,  
04999     TKO_Marker_Box                          = 10,  
05000     TKO_Marker_Box_Dot                      = 11,  
05001     TKO_Marker_Box_X                        = 12,  
05002     TKO_Marker_Box_Filled                   = 13,  
05003     TKO_Marker_Diamond                      = 14,  
05004     TKO_Marker_Diamond_Dot                  = 15,  
05005     TKO_Marker_Diamond_Plus                 = 16,  
05006     TKO_Marker_Diamond_Filled               = 17,  
05007     TKO_Marker_Triangle_Up                  = 18,  
05008     TKO_Marker_Triangle_Up_Vertex           = 19,  
05009     TKO_Marker_Triangle_Up_Dot              = 20,  
05010     TKO_Marker_Triangle_Up_Filled           = 21,  
05011     TKO_Marker_Triangle_Up_Filled_Vertex    = 22,  
05012     TKO_Marker_Triangle_Down                = 23,  
05013     TKO_Marker_Triangle_Down_Vertex         = 24,  
05014     TKO_Marker_Triangle_Down_Dot            = 25,  
05015     TKO_Marker_Triangle_Down_Filled         = 26,  
05016     TKO_Marker_Triangle_Down_Filled_Vertex  = 27,  
05017     TKO_Marker_Triangle_Right               = 28,  
05018     TKO_Marker_Triangle_Right_Vertex        = 29,  
05019     TKO_Marker_Triangle_Right_Dot           = 30,  
05020     TKO_Marker_Triangle_Right_Filled        = 31,  
05021     TKO_Marker_Triangle_Right_Filled_Vertex = 32,  
05022     TKO_Marker_Triangle_Left                = 33,  
05023     TKO_Marker_Triangle_Left_Vertex         = 34,  
05024     TKO_Marker_Triangle_Left_Dot            = 35,  
05025     TKO_Marker_Triangle_Left_Filled         = 36,  
05026     TKO_Marker_Triangle_Left_Filled_Vertex  = 37,  
05027     TKO_Marker_Hash                         = 38,  
05028     TKO_Marker_Wide_Plus                    = 39,  
05029     TKO_Marker_Open_Arrow                   = 40,  
05030     TKO_Marker_Closed_Arrow                 = 41,  
05031     TKO_Marker_Vertical_Bar                 = 42,  
05032     TKO_Marker_Half_Arrow_Left              = 43,  
05033     TKO_Marker_Half_Arrow_Right             = 44,  
05034     TKO_Marker_Wide_Arrow                   = 45,  
05035     TKO_Marker_Double_Arrow                 = 46,  
05036     TKO_Marker_Y                            = 47,  
05037     TKO_Marker_Z                            = 48,  
05038 
05039     // alignment format change in 17.80.
05040 
05041     // old alignment enum choices in lower nibble
05042     TKO_Text_Alignment_Lower_Left       = 0,  
05043     TKO_Text_Alignment_Upper_Left       = 1,  
05044     TKO_Text_Alignment_Middle_Left      = 2,  
05045     TKO_Text_Alignment_Lower_Right      = 3,  
05046     TKO_Text_Alignment_Upper_Right      = 4,  
05047     TKO_Text_Alignment_Middle_Right     = 5,  
05048     TKO_Text_Alignment_Lower_Center     = 6,  
05049     TKO_Text_Alignment_Upper_Center     = 7,  
05050     TKO_Text_Alignment_Middle_Center    = 8,  
05051     TKO_Text_Alignment_Insertion_Left   = 9,  
05052     TKO_Text_Alignment_Insertion_Right  = 10, 
05053     TKO_Text_Alignment_Insertion_Center = 11, 
05054     TKO_Text_Alignment_Insertion        = 9,  
05055     // and justification in higher nibble
05056     TKO_Text_Justification_Unspecified  = 0,  
05057     TKO_Text_Justification_Left         = 1,  
05058     TKO_Text_Justification_Center       = 2,  
05059     TKO_Text_Justification_Right        = 3,  
05060 
05061     // new format defines bits for "building" alignment setting
05062     TKO_Text_Alignment_Center           = 0x00,
05063     TKO_Text_Alignment_Left             = 0x01,
05064     TKO_Text_Alignment_Right            = 0x02,
05065     TKO_Text_Alignment_Bottom           = 0x04,
05066     TKO_Text_Alignment_Top              = 0x08,
05067     TKO_Text_Alignment_Point            = 0x10,
05068     // can't have left & right, or bottom & top, so all bits is good as an "unset" placeholder
05069     TKO_Text_Alignment_Unspecified      = 0x1F,
05070     // and uses same justification but shifted a bit higher
05071     TKO_Text_Justification_Mask         = 0x60,  
05072     TKO_Text_Justification_Shift        = 5,  
05073     // and the high bit will be set
05074     TKO_Text_Alignment_New_Format       = 0x80,
05075 
05076 
05077 
05078     TKO_Window_Frame_Off    = 0,  
05079     TKO_Window_Frame_On     = 1,  
05080 
05081     TKO_Handedness_Left     = 0,  
05082     TKO_Handedness_Right    = 1  
05083 };
05084 
05090 class BBINFILETK_API TK_Enumerated : public BBaseOpcodeHandler {
05091     protected:
05092         char            m_index;    
05093 
05094     public:
05096         TK_Enumerated (unsigned char opcode)
05097             : BBaseOpcodeHandler (opcode), m_index (0) {}
05098 
05099         TK_Status   Read (BStreamFileToolkit & tk);
05100         TK_Status   Write (BStreamFileToolkit & tk);
05101         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05102 
05103         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05104         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05105 
05106         void            SetIndex (int i)        { m_index = (char)i;   }
05108         int             GetIndex () const   { return (int)m_index;  }
05109 };
05110 
05114 enum TKO_Generic_Size_Units {
05115     TKO_Generic_Size_Object,        
05116     TKO_Generic_Size_Screen,        
05117     TKO_Generic_Size_Window,        
05118     TKO_Generic_Size_Points,        
05119     TKO_Generic_Size_Pixels,        
05120     TKO_Generic_Size_Percent,       
05121     TKO_Generic_Size_World,         
05122 
05123     TKO_Generic_Size_Unspecified    
05124 };
05125 // NOTE: any changes to this need to be reflected in generic_units_table in parse.cpp & HOpcodeHandler.cpp
05126 
05127 
05133 class BBINFILETK_API TK_Size : public BBaseOpcodeHandler {
05134     protected:
05135         float           m_value;  
05136         unsigned char   m_units;  
05137 
05138     public:
05140         TK_Size (unsigned char opcode)
05141             : BBaseOpcodeHandler (opcode), m_value (0.0f), m_units (TKO_Generic_Size_Unspecified) {}
05142 
05143         TK_Status   Read (BStreamFileToolkit & tk);
05144         TK_Status   Write (BStreamFileToolkit & tk);
05145         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05146 
05147         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05148         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05149 
05151         void            SetSize (float value, int units = TKO_Generic_Size_Unspecified) {
05152                             m_value = (value > 0.0f) ? value : 0.0f;
05153                             m_units = (m_value > 0.0f) ? (unsigned char) units : (unsigned char) TKO_Generic_Size_Unspecified;
05154                         }
05156         float           GetSize () const    { return m_value;  }
05158         int             GetUnits () const   { return m_units;  }
05159 };
05160 
05165 class BBINFILETK_API TK_Linear_Pattern : public BBaseOpcodeHandler {
05166     protected:
05167         unsigned short  m_pattern;  
05168 
05169     public:
05171         TK_Linear_Pattern (unsigned char opcode)
05172             : BBaseOpcodeHandler (opcode), m_pattern (0) {}
05173 
05174         TK_Status   Read (BStreamFileToolkit & tk);
05175         TK_Status   Write (BStreamFileToolkit & tk);
05176         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05177 
05178         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05179         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05180 
05182         void            SetPattern (int p)          { m_pattern = (unsigned short)p;    }
05184         int             GetPattern () const     { return (int)m_pattern;            }
05185 };
05186 
05192 class BBINFILETK_API TK_Named : public BBaseOpcodeHandler {
05193     protected:
05194         int     m_name_length;  
05195         char *  m_name;         
05196         int     m_index;        
05197 
05198     public:
05200         TK_Named (unsigned char opcode)
05201             : BBaseOpcodeHandler (opcode), m_name_length (0), m_name (0), m_index (0) {}
05202         ~TK_Named();
05203 
05204         TK_Status   Read (BStreamFileToolkit & tk);
05205         TK_Status   Write (BStreamFileToolkit & tk);
05206         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05207 
05208         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05209         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05210 
05211         void        Reset ();
05212 
05214         void            SetName (char const * name);
05216         void            SetName (int length);
05218         char const *    GetName () const            { return m_name;        }
05220         char *          GetName ()                  { return m_name;        }
05221 
05223         void            SetIndex (int i)        { Reset(); m_index = i;   }
05225         int             GetIndex () const   { return (int)m_index;      }
05226 };
05227 
05228 
05229 
05236 class BBINFILETK_API TK_Streaming : public BBaseOpcodeHandler {
05237     protected:
05238         bool            m_flag;  
05239 
05240     public:
05242         TK_Streaming () : BBaseOpcodeHandler (TKE_Streaming_Mode) {}
05243 
05244         TK_Status   Read (BStreamFileToolkit & tk);
05245         TK_Status   Write (BStreamFileToolkit & tk);
05246         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05247 
05248         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05249         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05250 
05251         void        SetStreaming (bool s)       { m_flag = s;       }
05253         bool        GetStreaming () const   { return m_flag;    }
05254 };
05255 
05258 
05264 class BBINFILETK_API TK_Conditions : public BBaseOpcodeHandler {
05265     protected:
05266         int                     m_length;       
05267         char *                  m_string;       
05269     public:
05271         TK_Conditions () : BBaseOpcodeHandler (TKE_Conditions), m_length (0), m_string (0) {}
05272         ~TK_Conditions();
05273 
05274         TK_Status   Read (BStreamFileToolkit & tk);
05275         TK_Status   Write (BStreamFileToolkit & tk);
05276         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05277 
05278         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05279         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05280 
05281         void        Reset ();
05282 
05284         void            SetConditions (char const * options);
05286         void            SetConditions (int length);
05288         char const *    GetConditions () const                 { return m_string;          }
05290         char *          GetConditions ()                       { return m_string;          }
05292         int             GetLength()                         { return m_length;          }
05293 };
05294 
05295 
05299 enum TKO_Actions {
05300     TKO_Action_Type_Prune_Segment   = 1,    
05301 
05302     TKO_Action_Option_Segment_Tree  = 0x0001    
05303 };
05304 
05305 
05308 
05313 class BBINFILETK_API TK_Conditional_Action : public BBaseOpcodeHandler {
05314     protected:
05315         short                   m_type;         
05316         short                   m_options;      
05317         int                     m_length;       
05318         char *                  m_string;       
05320     public:
05322         TK_Conditional_Action () : BBaseOpcodeHandler (TKE_Conditional_Action), m_length (0), m_string (0) {}
05323         ~TK_Conditional_Action();
05324 
05325         TK_Status   Read (BStreamFileToolkit & tk);
05326         TK_Status   Write (BStreamFileToolkit & tk);
05327         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05328 
05329         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05330         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05331 
05332         void        Reset ();
05333 
05335         void            SetCondition (char const * options);
05337         void            SetCondition (int length);
05339         char const *    GetCondition () const                 { return m_string;          }
05341         char *          GetCondition ()                       { return m_string;          }
05343         int             GetLength()                         { return m_length;          }
05344 
05346         void            SetAction (int at)          { m_type = (short)at; }
05348         int             GetAction () const          { return (int)m_type; }
05350         void            SetOptions (int at)         { m_options = (short)at; }
05352         int             GetOptions () const         { return (int)m_options; }
05353 };
05354 
05357 
05363 class BBINFILETK_API TK_User_Options : public BBaseOpcodeHandler {
05364     protected:
05365         int                     m_length;       
05366         char *                  m_string;       
05367         BBaseOpcodeHandler *    m_indices;      
05368         BBaseOpcodeHandler *    m_unicode;      
05369         BBaseOpcodeHandler *    m_index_data;   
05371         void    set_options (char const * options);       
05372         void    set_options (int length);                 
05373 
05374     public:
05376         TK_User_Options () : BBaseOpcodeHandler (TKE_User_Options), m_length (0), m_string (0),
05377                              m_indices (0), m_unicode (0), m_index_data(0) {}
05378         ~TK_User_Options();
05379 
05380         TK_Status   Read (BStreamFileToolkit & tk);
05381         TK_Status   Write (BStreamFileToolkit & tk);
05382         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05383 
05384         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05385         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05386 
05387         void        Reset ();
05388 
05390         void            SetOptions (char const * options)       { set_options (options);    }
05392         void            SetOptions (int length)                 { set_options (length);     }
05394         char const *    GetOptions () const                 { return m_string;          }
05396         char *          GetOptions ()                       { return m_string;          }
05398         int             GetLength()                         { return m_length;          }
05399 };
05400 
05403 
05409 class BBINFILETK_API TK_Unicode_Options : public BBaseOpcodeHandler {
05410     protected:
05411         int                     m_length;       
05412         unsigned short *        m_string;       
05414     public:
05416         TK_Unicode_Options () : BBaseOpcodeHandler (TKE_Unicode_Options), m_length (0), m_string (0) {}
05417         ~TK_Unicode_Options();
05418 
05419         TK_Status   Read (BStreamFileToolkit & tk);
05420         TK_Status   Write (BStreamFileToolkit & tk);
05421         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05422 
05423         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05424         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05425 
05426         void        Reset ();
05427 
05429         void                    SetOptions (unsigned short const * options);
05431         void                    SetOptions (int length);
05433         unsigned short const *  GetOptions () const                 { return m_string;          }
05435         unsigned short *        GetOptions ()                       { return m_string;          }
05437         int                     GetLength()                         { return m_length;          }
05438 };
05439 
05441 
05447 class BBINFILETK_API TK_User_Index : public BBaseOpcodeHandler {
05448     protected:
05449         int             m_count;            
05450         int *           m_indices;          
05451         HLONG *          m_values;           
05452         int             m_current_value;        
05453         void    set_indices (int count, int const * indices, POINTER_SIZED_INT const * values);  
05454         void    set_indices (int count);                                            
05455 
05456     public:
05458         TK_User_Index ()
05459             : BBaseOpcodeHandler (TKE_User_Index), m_count (0), m_indices (0), m_values (0), m_current_value(0) {}
05460         ~TK_User_Index();
05461 
05462         TK_Status   Read (BStreamFileToolkit & tk);
05463         TK_Status   Write (BStreamFileToolkit & tk);
05464         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05465 
05466         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05467         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05468 
05469         void        Reset ();
05470 
05472         void            SetIndices (int count, int const * indices, POINTER_SIZED_INT const * values)
05473                                                         { set_indices (count, indices, values); }
05475         void            SetIndices (int count)          { set_indices (count);                  }
05477         int             GetCount () const           { return m_count;                       }
05479         int const *     GetIndices () const         { return m_indices;                     }
05481         int *           GetIndices ()               { return m_indices;                     }
05483         HLONG const *    GetValues () const          { return m_values;                      }
05485         HLONG *          GetValues ()                { return m_values;                      }
05486 };
05487 
05489 
05495 class BBINFILETK_API TK_User_Index_Data : public BBaseOpcodeHandler {
05496 protected:
05497     int             m_count;            
05498     int *           m_indices;          
05499     void **         m_values;           
05500     int *           m_sizes;
05501 
05502     int             m_current_value;        
05503     void    set_indices (int count, int const indices[], void const * values[], int const sizes[]);  
05504     void    set_indices (int count);                                            
05505     void        FreeMem ();
05506 
05507 public:
05509     TK_User_Index_Data ()
05510         : BBaseOpcodeHandler (TKE_User_Index_Data), m_count (0), m_indices (0), m_values (0), m_sizes(0), m_current_value(0) {}
05511     ~TK_User_Index_Data();
05512 
05513     TK_Status   Read (BStreamFileToolkit & tk);
05514     TK_Status   Write (BStreamFileToolkit & tk);
05515     TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05516 
05517     void        Reset ();
05518 
05520     void            SetIndices (int count, int const indices[], void const * values[], int const sizes[]) {
05521         set_indices (count, indices, values, sizes); 
05522     }
05523 
05525     void            SetIndices (int count)          { set_indices (count);}
05526 
05528     int             GetCount () const           { return m_count;}
05529 
05531     int const *     GetIndices () const         { return m_indices;}
05532 
05534     int *           GetIndices ()               { return m_indices;}
05535 
05537     void ** const   GetValues () const          { return m_values;}
05538 
05540     void ** const    GetValues ()                { return m_values;}
05541 
05543     int const *    GetSizes () const          { return m_sizes;}
05544 
05546     int *          GetSizes ()                { return m_sizes;}
05547 };
05548 
05549 
05551 
05556 class BBINFILETK_API TK_User_Value : public BBaseOpcodeHandler {
05557     protected:
05558         HLONG            m_value;  
05559 
05560     public:
05562         TK_User_Value ()
05563             : BBaseOpcodeHandler (TKE_User_Value), m_value (0) {}
05564 
05565         TK_Status   Read (BStreamFileToolkit & tk);
05566         TK_Status   Write (BStreamFileToolkit & tk);
05567         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05568 
05569         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05570         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05571 
05573         void            SetValue (HLONG v)           { m_value = v;      }
05575         HLONG            GetValue () const       { return m_value;   }
05576 };
05577 
05581 enum TKO_Camera_Projection {
05582     TKO_Camera_Perspective_Bit  = 0x01,  
05583     TKO_Camera_Stretched_Bit    = 0x02,  
05584     TKO_Camera_Projection_Mask  = 0x03,  
05585 
05586     TKO_Camera_Orthographic     = 0x00,  
05587     TKO_Camera_Perspective      = 0x01,  
05588     TKO_Camera_Stretched        = 0x02,  
05589 
05590     TKO_Camera_Oblique_Y        = 0x04,  
05591     TKO_Camera_Oblique_X        = 0x08,  
05592     TKO_Camera_Oblique_Mask     = 0x0C,  
05593 
05594     TKO_Camera_Near_Limit       = 0x10,  
05595 
05596     TKO_Camera_Thumbnail        = 0x80   
05597 };
05598 
05600 
05605 class BBINFILETK_API2 TK_Camera : public BBaseOpcodeHandler {
05606     protected:
05610         float           m_settings[14];
05612         double          m_dsettings[14];
05614         float           m_details[3];
05615         unsigned char   m_projection;   
05616         int             m_length;       
05617         char *          m_name;         
05620         void    set_name (char const * name);   
05621     
05622         void    set_name (int length);      
05623 
05624     public:
05626         TK_Camera (unsigned char opcode = TKE_Camera)
05627             : BBaseOpcodeHandler (opcode), m_length (0), m_name (0) {
05628                 int i;
05629                 int count = (int)(sizeof(m_settings) / sizeof(m_settings[0]));
05630                 for (i = 0; i < count; i++) {
05631                     m_settings[i] = 0;
05632                     m_dsettings[i] = 0;
05633                 }
05634         }
05635         ~TK_Camera();
05636 
05637         TK_Status   Read (BStreamFileToolkit & tk);
05638         TK_Status   Write (BStreamFileToolkit & tk);
05639         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05640 
05641         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05642         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05643 
05645         void            SetPosition (float x, float y, float z)
05646                                         { m_settings[0] = x;  m_settings[1] = y;  m_settings[2] = z;        }
05648         void            SetPosition (float const * p)       { SetPosition (p[0], p[1], p[2]);               }
05650         float const *   GetPosition () const                { return &m_settings[0];                        }
05652         void            GetPosition (float * p) const       { memcpy(p, GetPosition(), 3*sizeof(float));    }
05653 
05655         void            SetDPosition (double x, double y, double z)
05656                                         { m_dsettings[0] = x;  m_dsettings[1] = y;  m_dsettings[2] = z;    }
05658         void            SetDPosition (double const * p)     { SetDPosition (p[0], p[1], p[2]);              }
05660         double const *  GetDPosition () const               { return &m_dsettings[0];                       }
05662         void            GetDPosition (double * p) const     { memcpy(p, GetDPosition(), 3*sizeof(double));  }
05663 
05665         void            SetTarget (float x, float y, float z)
05666                                         { m_settings[3] = x;  m_settings[4] = y;  m_settings[5] = z;    }
05668         void            SetTarget (float const * t)         { SetTarget (t[0], t[1], t[2]);             }
05670         float const *   GetTarget () const                  { return &m_settings[3];                    }
05672         void            GetTarget (float * t) const         { memcpy(t, GetTarget(), 3*sizeof(float));  }
05673 
05675         void            SetDTarget (double x, double y, double z)
05676                                         { m_dsettings[3] = x;  m_dsettings[4] = y;  m_dsettings[5] = z;     }
05678         void            SetDTarget (double const * t)       { SetDTarget (t[0], t[1], t[2]);                }
05680         double const *  GetDTarget () const             { return &m_dsettings[3];                       }
05682         void            GetDTarget (double * t) const       { memcpy(t, GetDTarget(), 3*sizeof(double));    }
05683 
05685         void            SetUpVector (float x, float y, float z)
05686                                         { m_settings[6] = x;  m_settings[7] = y;  m_settings[8] = z;    }
05688         void            SetUpVector (float const * u)       { SetUpVector (u[0], u[1], u[2]);           }
05690         float const *   GetUpVector () const                { return &m_settings[6];                    }
05692         void            GetUpVector (float * u) const       { memcpy(u,GetUpVector(),3*sizeof(float));  }
05693 
05695         void            SetDUpVector (double x, double y, double z)
05696                                         { m_dsettings[6] = x;  m_dsettings[7] = y;  m_dsettings[8] = z;     }
05698         void            SetDUpVector (double const * u)     { SetDUpVector (u[0], u[1], u[2]);              }
05700         double const *  GetDUpVector () const               { return &m_dsettings[6];                       }
05702         void            GetDUpVector (double * u) const     { memcpy(u, GetDUpVector(), 3*sizeof(double));  }
05703 
05705         void            SetField (float w, float h)         { m_settings[9] = w;  m_settings[10] = h;   }
05707         void             SetField (float const * f)         { SetField (f[0], f[1]);                    }
05709         float const *   GetField () const                   { return &m_settings[9];                    }
05711         void            GetField (float *f) const           { memcpy(f,GetField(),2*sizeof(float));     }
05712 
05714         void            SetDField (double w, double h)      { m_dsettings[9] = w;  m_dsettings[10] = h; }
05716         void            SetDField (double const * f)        { SetDField (f[0], f[1]);                   }
05718         double const *  GetDField () const                  { return &m_dsettings[9];                   }
05720         void            GetDField (double * f) const        { memcpy(f, GetDField(), 2*sizeof(double)); }
05721 
05722 
05724         void            SetOblique (float h, float v)       { m_details[0] = h;  m_details[1] = v;
05725                                                               m_projection &= ~TKO_Camera_Oblique_Mask;
05726                                                               if (h != 0.0f) m_projection |= TKO_Camera_Oblique_Y;
05727                                                               if (v != 0.0f) m_projection |= TKO_Camera_Oblique_Mask;
05728                                                             }
05730         void            SetOblique (float const * o)        { SetOblique (o[0], o[1]);                  }
05732         float const *   GetOblique () const                 { return m_details;                         }
05734         void            GetOblique (float * o) const        { memcpy(o, GetOblique(), 2*sizeof(float)); }
05735 
05737         void            SetNearLimit (float l)              { m_details[2] = l;
05738                                                               m_projection &= ~TKO_Camera_Near_Limit;
05739                                                               if (l != 0.0f) m_projection |= TKO_Camera_Near_Limit;
05740                                                             }
05742         float           GetNearLimit () const               { return m_details[2];      }
05743 
05744 
05746         void            SetProjection (int p)               { m_projection = (char)p;   }
05748         int             GetProjection () const              { return (int)m_projection; }
05749 
05750 
05752         void            SetView (char const * name)         { set_name (name);          }
05754         void            SetView (int length)                { set_name (length);        }
05756         char const *    GetView () const                    { return m_name;            }
05758         char *          GetView ()                          { return m_name;            }
05759 };
05760 
05762 
05767 class BBINFILETK_API TK_Window : public BBaseOpcodeHandler {
05768     protected:
05769         float           m_window[4];  
05770 
05771     public:
05773         TK_Window ()
05774             : BBaseOpcodeHandler (TKE_Window) {}
05775 
05776         TK_Status   Read (BStreamFileToolkit & tk);
05777         TK_Status   Write (BStreamFileToolkit & tk);
05778         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05779 
05780         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05781         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05782 
05784         void            SetWindow (float l, float r, float b, float t)
05785                                 { m_window[0] = l;  m_window[1] = r;  m_window[2] = b;  m_window[3] = t;    }
05787         void            SetWindow (float const * w)            { SetWindow (w[0], w[1], w[2], w[3]);        }
05789         float const *   GetWindow () const                 { return m_window;                           }
05790 };
05791 
05792 
05797 enum TKO_Font_Options {
05798     TKO_Font_Names              = 0x00000001,   
05799     TKO_Font_Size               = 0x00000002,   
05800     TKO_Font_Size_Tolerance     = 0x00000004,   
05801     TKO_Font_Transforms         = 0x00000008,   
05802     TKO_Font_Rotation           = 0x00000010,   
05803     TKO_Font_Slant              = 0x00000020,   
05804     TKO_Font_Width_Scale        = 0x00000040,   
05805     TKO_Font_Extended           = 0x00000080,   
05806     TKO_Font_Extended_Mask      = 0xFFFFFF00,   //   internal use, indicates bits which require TKO_Font_Extended
05807     TKO_Font_Extended_Shift     = 8,            //   internal use, indicatesshift of extended section
05808     TKO_Font_Extra_Space        = 0x00000100,   
05809     TKO_Font_Line_Spacing       = 0x00000200,   
05810     TKO_Font_Outline            = 0x00000400,   
05811     TKO_Font_Underline          = 0x00000800,   
05812     TKO_Font_Strikethrough      = 0x00001000,   
05813     TKO_Font_Overline           = 0x00002000,   
05814     TKO_Font_Uniform_Spacing    = 0x00004000,   
05815     TKO_Font_Extended2          = 0x00008000,   
05816     TKO_Font_Extended2_Mask     = 0xFFFF0000,   
05817     TKO_Font_Extended2_Shift    = 16,           
05818     TKO_Font_Greeking_Limit     = 0x00010000,   
05819     TKO_Font_Fill_Edges         = 0x00020000,   
05820     TKO_Font_Bold               = 0x00040000,   
05821     TKO_Font_Italic             = 0x00080000,   
05822     TKO_Font_Renderer           = 0x00100000,   
05823     TKO_Font_Greeking_Mode      = 0x00200000,   
05824     TKO_Font_Preference         = 0x00400000,   
05825     TKO_Font_Layout             = 0x00800000    
05826 };
05827 
05828 
05829 
05833 enum TKO_Font_Layout {
05834     TKO_Font_Layout_Default = 0, 
05835     TKO_Font_Layout_Unicode = 1  
05836 };
05837 
05838 
05839 #define TKO_Font_Size_Units TKO_Generic_Size_Units
05840 #define TKO_Font_Size_Object TKO_Generic_Size_Object
05841 #define TKO_Font_Size_Screen TKO_Generic_Size_Screen
05842 #define TKO_Font_Size_Window TKO_Generic_Size_Window
05843 #define TKO_Font_Size_Points TKO_Generic_Size_Points
05844 #define TKO_Font_Size_Pixels TKO_Generic_Size_Pixels
05845 #define TKO_Font_Size_Percent TKO_Generic_Size_Percent
05846 #define TKO_Font_Size_World TKO_Generic_Size_World
05847 
05848 
05854 enum TKO_Font_Transforms {
05855     TKO_Font_Transform_Position_Only = 0,  
05856     TKO_Font_Transform_Full = 1            
05857 };
05858 
05859 
05863 enum TKO_Font_Renderers {
05864     TKO_Font_Renderer_Undefined = -1,   
05865     TKO_Font_Renderer_Default   = 0,    
05866     TKO_Font_Renderer_Driver    = 1,    
05867     TKO_Font_Renderer_Truetype  = 2,    
05868     TKO_Font_Renderer_Defined   = 3     
05869 };
05870 
05874 enum TKO_Font_Preferences {
05875     TKO_Font_Preference_Undefined = -1, 
05876     TKO_Font_Preference_Default   = 0,  
05877     TKO_Font_Preference_Bitmap    = 1,  
05878     TKO_Font_Preference_Outline   = 2,  
05879     TKO_Font_Preference_Exterior  = 3  
05880 };
05881 
05885 enum TKO_Font_Greeking_Modes {
05886     TKO_Font_Greeking_Mode_None  = 0, 
05887     TKO_Font_Greeking_Mode_Lines = 1, 
05888     TKO_Font_Greeking_Mode_Box   = 2  
05889 };
05890 
05892 
05899 class BBINFILETK_API TK_Text_Font : public BBaseOpcodeHandler {
05900     protected:
05901         int             m_mask;  
05902         int             m_value;  
05903         int             m_names_length; 
05904         char *          m_names;        
05905         float           m_size;         
05906         float           m_tolerance;    
05907         float           m_rotation;     
05908         float           m_slant;        
05909         float           m_width_scale;  
05910         float           m_extra_space;  
05911         float           m_line_spacing; 
05912         float           m_greeking_limit;
05913         float           m_renderer_cutoff;
05914         float           m_preference_cutoff;
05915         int             m_renderers[2];   
05916         int             m_preferences[2];   
05917         unsigned char   m_size_units;   
05918         unsigned char   m_tolerance_units;
05919         unsigned char   m_space_units;  
05920         unsigned char   m_greeking_units;  
05921         unsigned char   m_greeking_mode;   
05922         unsigned char   m_transforms;   
05923         unsigned char   m_renderer_cutoff_units;  
05924         unsigned char   m_preference_cutoff_units;  
05925         unsigned char   m_layout; 
05926 
05927         void    set_names (int length);           
05928         void    set_names (char const * names);   
05929 
05930     public:
05932         TK_Text_Font ()
05933             : BBaseOpcodeHandler (TKE_Text_Font), m_names_length (0), m_names (0) {}
05934         ~TK_Text_Font ();
05935 
05936         TK_Status   Read (BStreamFileToolkit & tk);
05937         TK_Status   Write (BStreamFileToolkit & tk);
05938         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05939 
05940         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05941         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05942 
05943         void        Reset ();
05944 
05946         void            SetMask (int m) {
05947                             m_mask = m;
05948                             if ((m & TKO_Font_Extended2_Mask) != 0)
05949                                 m_mask |= TKO_Font_Extended2;
05950                             if ((m & TKO_Font_Extended_Mask) != 0)
05951                                 m_mask |= TKO_Font_Extended;
05952                         }
05954         int             GetMask () const                    { return m_mask;        }
05955 
05957         void            SetValue (int v)                        { m_value = v;          }
05959         int             GetValue () const                   { return m_value;       }
05960 
05962         void            SetNames (char const * names)           { set_names (names);    }
05964         void            SetNames (int length)                   { set_names (length);   }
05966         char const *    GetNames () const                   { return m_names;       }
05968         char *          GetNames ()                         { return m_names;       }
05969 
05971         void            SetSize (float s)                       { m_size = s;                           }
05973         float           GetSize () const                    { return m_size;                        }
05974 
05976         void            SetSizeUnits (int u)                    { m_size_units = (unsigned char)u;      }
05978         int             GetSizeUnits () const               { return (int)m_size_units;             }
05979 
05981         void            SetTolerance (float t)                  { m_tolerance = t;                      }
05983         float           GetTolerance () const               { return m_tolerance;                   }
05984 
05986         void            SetToleranceUnits (int u)               { m_tolerance_units = (unsigned char)u; }
05988         int             GetToleranceUnits () const          { return (int)m_tolerance_units;        }
05989 
05991         void            SetRotation (float r)                   { m_rotation = r;                       }
05993         float           GetRotation () const                { return m_rotation;                    }
05994 
05996         void            SetSlant (float s)                      { m_slant = s;                          }
05998         float           GetSlant () const                   { return m_slant;                       }
05999 
06001         void            SetWidthScale (float s)                 { m_width_scale = s;                    }
06003         float           GetWidthScale () const              { return m_width_scale;                 }
06004 
06006         void            SetExtraSpace (float s)                 { m_extra_space = s;                    }
06008         float           GetExtraSpace () const              { return m_extra_space;                 }
06009 
06011         void            SetExtraSpaceUnits (int u)              { m_space_units = (unsigned char)u;     }
06013         int             GetExtraSpaceUnits () const         { return (int)m_space_units;            }
06014 
06016         void            SetLineSpacing (float s)                { m_line_spacing = s;                   }
06018         float           GetLineSpacing () const             { return m_line_spacing;                }
06019 
06021         void            SetTransforms (int t)                   { m_transforms = (unsigned char)t;      }
06023         int             GetTransforms () const              { return (int)m_transforms;             }
06024 
06026         void            SetGreekingLimit (float s)                 { m_greeking_limit = s;                    }
06028         float           GetGreekingLimit () const              { return m_greeking_limit;                 }
06029 
06031         void            SetGreekingLimitUnits (int u)              { m_greeking_units = (unsigned char)u;     }
06033         int             GetGreekingLimitUnits () const         { return (int)m_greeking_units;            }
06034 
06036         void            SetGreekingMode (int m)              { m_greeking_mode = (unsigned char)m;     }
06038         int             GetGreekingMode () const         { return (int)m_greeking_mode;            }
06039 
06040 
06042         void            SetRenderer (int r)                   { m_renderers[0] = m_renderers[1] = r;    }
06044         int             GetRenderer () const              { return m_renderers[0];                  }
06045 
06047         void            SetRenderers (int r1, int r2)         { m_renderers[0] = r1; m_renderers[1] = r2;   }
06049         int const *      GetRenderers () const            { return m_renderers;                         }
06050 
06052         void            SetRendererCutoff (float s)           { m_renderer_cutoff = s;                    }
06054         float           GetRendererCutoff () const        { return m_renderer_cutoff;                 }
06055 
06057         void            SetRendererCutoffUnits (int u)              { m_renderer_cutoff_units = (unsigned char)u;     }
06059         int             GetRendererCutoffUnits () const         { return (int)m_renderer_cutoff_units;            }
06060 
06061 
06063         void            SetPreference (int r)                   { m_preferences[0] = m_preferences[1] = r;    }
06065         int             GetPreference () const              { return m_preferences[0];                  }
06066 
06068         void            SetPreferences (int r1, int r2)         { m_preferences[0] = r1; m_preferences[1] = r2; }
06070         int const *      GetPreferences () const            { return m_preferences;                         }
06071 
06073         void            SetPreferenceCutoff (float s)           { m_preference_cutoff = s;                    }
06075         float           GetPreferenceCutoff () const        { return m_preference_cutoff;                 }
06076 
06078         void            SetPreferenceCutoffUnits (int u)              { m_preference_cutoff_units = (unsigned char)u;     }
06080         int             GetPreferenceCutoffUnits () const         { return (int)m_preference_cutoff_units;            }
06081 
06083         void            SetLayout (int l) {m_layout = (unsigned char)l;}
06085         int             GetLayout () const {return (int)m_layout;}
06086 };
06087 
06089 
06091 
06103 enum TKO_Bounding_Type_Options {
06104     TKO_Bounding_Type_Cuboid    = 0,    
06105     TKO_Bounding_Type_Sphere    = 1     
06106 };
06107 
06108 
06109 
06111 
06122 class BBINFILETK_API2 TK_Bounding : public BBaseOpcodeHandler {
06123     protected:
06124         double          m_dvalues[6];       
06125         float           m_values[6];        
06126         char            m_type;             
06127         bool            m_is_valid;         
06128     public:
06130         TK_Bounding (unsigned char opcode)
06131             : BBaseOpcodeHandler (opcode) {}
06133         TK_Bounding (unsigned char opcode, float * min, float * max)
06134             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) {
06135                 m_values[0] = min[0]; m_values[1] = min[1]; m_values[2] = min[2];
06136                 m_values[3] = max[0]; m_values[4] = max[1]; m_values[5] = max[2];
06137             }
06139         TK_Bounding (unsigned char opcode, float * center, float radius)
06140             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) {
06141                 m_values[0] = center[0]; m_values[1] = center[1]; m_values[2] = center[2];
06142                 m_values[3] = radius;
06143             }
06145         TK_Bounding (unsigned char opcode, double * min, double * max)
06146             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) {
06147                 m_dvalues[0] = min[0]; m_dvalues[1] = min[1]; m_dvalues[2] = min[2];
06148                 m_dvalues[3] = max[0]; m_dvalues[4] = max[1]; m_dvalues[5] = max[2];
06149                 Set_General_Flags (TK_Double_Precision);
06150             }
06152         TK_Bounding (unsigned char opcode, double * center, double radius)
06153             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) {
06154                 m_dvalues[0] = center[0]; m_dvalues[1] = center[1]; m_dvalues[2] = center[2];
06155                 m_dvalues[3] = radius;
06156                 Set_General_Flags (TK_Double_Precision);
06157             }
06158 
06159         TK_Status   Read (BStreamFileToolkit & tk);
06160         TK_Status   Write (BStreamFileToolkit & tk);
06161         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06162 
06163         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06164         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06165 };
06166 
06168 
06172 enum TKO_Light_Options {
06173     TKO_Light_Camera_Relative = 0x1
06174 };
06175 
06176 
06178 
06180 
06186 class BBINFILETK_API TK_Point : public BBaseOpcodeHandler {
06187     protected:
06188         float           m_point[3];     
06189         double          m_dpoint[3];    
06190         char            m_options;      
06191 
06192     public:
06194         TK_Point (unsigned char opcode)
06195             : BBaseOpcodeHandler (opcode) {
06196             m_point[0] = m_point[1] = m_point[2] = 0; 
06197             m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 
06198             m_options = 0; 
06199         };
06200 
06201         TK_Status   Read (BStreamFileToolkit & tk);
06202         TK_Status   Write (BStreamFileToolkit & tk);
06203         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06204 
06205         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06206         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06207 
06208         void        Reset(void) { 
06209                         m_point[0] = m_point[1] = m_point[2] = 0; 
06210                         m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 
06211                         m_options = 0; 
06212                         BBaseOpcodeHandler::Reset(); 
06213                     };
06214 
06215 
06216 
06218         void            SetPoint (float x, float y, float z)    { m_point[0] = x; m_point[1] = y; m_point[2] = z; }
06220         void            SetPoint (float const * p)              { SetPoint (p[0], p[1], p[2]);  }
06222         float const *   GetPoint () const                       { return m_point;               }
06223 
06225         void             SetDPoint (double x, double y, double z)   { m_dpoint[0] = x; m_dpoint[1] = y; m_dpoint[2] = z; }
06227         void             SetDPoint (double const * p)               { SetDPoint (p[0], p[1], p[2]);  }
06229         double const *  GetDPoint () const                          { return m_dpoint;               }
06230 
06232         void    SetOptions (int o)          { m_options = (char)o;      }
06234         int     GetOptions () const         { return (int)m_options;    }
06235 
06236 };
06237 
06238 
06239 
06241 
06246 class BBINFILETK_API TK_Line : public BBaseOpcodeHandler {
06247     protected:
06249         float           m_points[6];    
06251         double          m_dpoints[6];    
06252 
06253     public:
06255         TK_Line (unsigned char opcode = TKE_Line)
06256             : BBaseOpcodeHandler (opcode) {}
06257 
06258         TK_Status   Read (BStreamFileToolkit & tk);
06259         TK_Status   Write (BStreamFileToolkit & tk);
06260         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06261 
06262         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06263         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06264 
06266         void            SetPoints (float x1, float y1, float z1, float x2, float y2, float z2) {
06267                                 m_points[0] = x1;  m_points[1] = y1;  m_points[2] = z1;
06268                                 m_points[3] = x2;  m_points[4] = y2;  m_points[5] = z2;
06269                             }
06271         void            SetPoints (float const * s, float const * e) {
06272                                 SetPoints (s[0], s[1], s[2],  e[0], e[1], e[2]);
06273                             }
06275         void            SetPoints (float const * p)             { SetPoints (&p[0], &p[3]); }
06277         float const *   GetPoints () const                      { return m_points;          }
06278 
06280         void            SetDPoints (double x1, double y1, double z1, double x2, double y2, double z2) {
06281                                 m_dpoints[0] = x1;  m_dpoints[1] = y1;  m_dpoints[2] = z1;
06282                                 m_dpoints[3] = x2;  m_dpoints[4] = y2;  m_dpoints[5] = z2;
06283                             }
06285         void            SetDPoints (double const * s, double const * e) {
06286                                 SetDPoints (s[0], s[1], s[2],  e[0], e[1], e[2]);
06287                             }
06289         void            SetDPoints (double const * p)           { SetDPoints (&p[0], &p[3]); }
06291         double const *  GetDPoints () const                     { return m_dpoints;          }
06292 
06293 };
06294 
06295 
06296 
06298 
06305 class BBINFILETK_API TK_Polypoint : public BBaseOpcodeHandler {
06306     protected:
06307         int             m_count;    
06308         int             m_allocated;
06309         float *         m_points;   
06310         double *        m_dpoints;   
06313         void    set_points (int count, float const * points = 0)            { SetPoints (count, points); }      
06314     public:
06318         TK_Polypoint (unsigned char opcode)
06319             : BBaseOpcodeHandler (opcode), m_count (0), m_allocated (0), m_points (0), m_dpoints (0) {}
06320         ~TK_Polypoint();
06321 
06322         TK_Status   Read (BStreamFileToolkit & tk);
06323         TK_Status   Write (BStreamFileToolkit & tk);
06324         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06325 
06326         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06327         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06328 
06329         void        Reset ();
06330 
06333         void            SetPoints (int count, float const * points = 0);
06335         float const *   GetPoints () const                                  { return m_points;              }
06337         float *         GetPoints ()                                        { return m_points;              }
06338 
06341         void            SetDPoints (int count, double const * points = 0);
06343         double const *  GetDPoints () const                                 { return m_dpoints;              }
06345         double *        GetDPoints ()                                       { return m_dpoints;              }
06346 
06348         int             GetCount () const                                   { return m_count;               }
06349 
06350 };
06351 
06352 
06353 
06354 
06355 #define NC_HAS_WEIGHTS 0x01     
06356 #define NC_HAS_KNOTS   0x02     
06357 #define NC_HAS_START   0x04     
06358 #define NC_HAS_END     0x08     
06359 
06361 
06366 class BBINFILETK_API TK_NURBS_Curve : public BBaseOpcodeHandler {
06367     protected:
06368         unsigned char m_optionals;  
06369         unsigned char m_degree;     
06370         int m_control_point_count;  
06371         int m_knot_count_implicit;  
06372         float *m_control_points;    
06373         double *m_dcontrol_points;  
06374         float *m_weights;           
06375         float *m_knots;             
06376         float m_start;              
06377         float m_end;                
06379 
06380         void    set_curve (int degree, int control_count, float const * points = 0,
06381                            float const * weights = 0, float const * knots = 0,
06382                            float start = 0.0f, float end = 1.0f);
06383     public:
06384         TK_NURBS_Curve();
06385         ~TK_NURBS_Curve();
06386 
06387         TK_Status   Read (BStreamFileToolkit & tk);
06388         TK_Status   Write (BStreamFileToolkit & tk);
06389         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06390 
06391         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06392         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06393 
06394         void        Reset ();
06395 
06397         void            SetCurve (int degree, int control_count, float const * points = 0,
06398                                   float const * weights = 0, float const * knots = 0,
06399                                   float start = 0.0f, float end = 1.0f) {
06400                             set_curve (degree, control_count, points, weights, knots, start, end);
06401                         }
06402         void            SetDCurve (int degree, int control_count, double const * points = 0,
06403                                   float const * weights = 0, float const * knots = 0,
06404                                   float start = 0.0f, float end = 1.0f);
06405 
06406         float const *   GetPoints () const          { return m_control_points;          } 
06407         float *         GetPoints ()                { return m_control_points;          } 
06408         double const *  GetDPoints () const         { return m_dcontrol_points;          } 
06409         double *        GetDPoints ()               { return m_dcontrol_points;          } 
06411         int             GetDegree () const          { return m_degree;                  } 
06412         int             GetCount () const           { return m_control_point_count;     } 
06413         float const *   GetWeights () const         { return m_weights;                 } 
06414         float *         GetWeights ()               { return m_weights;                 } 
06415         float const *   GetKnots () const           { return m_knots;                   } 
06416         float *         GetKnots ()                 { return m_knots;                   } 
06418         void            SetStart (float s)              { m_start = s;                      } 
06419         float           GetStart () const           { return m_start;                   } 
06420         void            SetEnd (float e)                { m_end = e;                        } 
06421         float           GetEnd () const             { return m_end;                     } 
06423         void            SetOptions (int o)              { m_optionals = (unsigned char)o;   } 
06424         int             GetOptions () const         { return m_optionals;               } 
06426 };
06427 
06428 
06429 
06430 
06431 
06432 #define NS_HAS_WEIGHTS 0x01   
06433 #define NS_HAS_KNOTS   0x02   
06434 #define NS_HAS_TRIMS   0x04   
06435 
06436 #define NS_TRIM_END         0       
06437 #define NS_TRIM_POLY        1       
06438 #define NS_TRIM_CURVE       2       
06439 #define NS_TRIM_COLLECTION  3       
06440 #define NS_TRIM_LAST_KNOWN_TYPE 3   
06441 
06442 #define NS_TRIM_KEEP        0x01 
06443 #define NS_TRIM_HAS_WEIGHTS 0x02 
06444 #define NS_TRIM_HAS_KNOTS   0x04 
06445 
06447 
06453 class BBINFILETK_API HT_NURBS_Trim : public BBaseOpcodeHandler  {
06454     friend class TK_NURBS_Surface;
06455     protected:
06456         //first 5 are relevant to polys and curves
06457         int             m_substage;             
06458         HT_NURBS_Trim * m_next;                 
06459         unsigned char   m_type;                 
06460         int             m_count;                
06461         float *         m_points;               
06462         //next 6 are specific to curves
06463         unsigned char   m_degree;               
06464         unsigned char   m_options;              
06465         float *         m_weights;              
06466         float *         m_knots;                
06467         float           m_start_u;              
06468         float           m_end_u;                
06469         HT_NURBS_Trim * m_list;                 
06470         HT_NURBS_Trim * m_current_trim;         
06472         HT_NURBS_Trim();
06473         TK_Status read_collection(BStreamFileToolkit & tk);  
06474         TK_Status write_collection(BStreamFileToolkit & tk); 
06477     public:
06478         ~HT_NURBS_Trim();
06479         void    SetPoly (int count, float const * points = 0);    
06480         void    SetCurve (int degree, int control_count, float const * points = 0, 
06481                           float const * weights = 0, float const * knots = 0, float start_u = 0, float end_u = 1); 
06482         void    SetCollection ();                                 
06483         void    SetOptions (int o)       { m_options = (unsigned char)o; }             
06484         void    SetList (HT_NURBS_Trim *node)       { m_list = node; }  
06485         void    SetNext (HT_NURBS_Trim *next) { m_next = next; }        
06487         TK_Status   Read (BStreamFileToolkit & tk);
06488         TK_Status   Write (BStreamFileToolkit & tk);
06489 
06490         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06491         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06492         
06493         TK_Status   read_collection_ascii(BStreamFileToolkit & tk);
06494         TK_Status   write_collection_ascii(BStreamFileToolkit & tk);
06495 
06497         HT_NURBS_Trim * GetNext (void)              { return m_next;    } 
06499         int             GetType () const        { return m_type;    } 
06501         int             GetCount () const       { return m_count;   } 
06503         float const *   GetPoints () const      { return m_points;  } 
06505         float *         GetPoints ()            { return m_points;  } 
06507         int             GetDegree () const      { return m_degree;  } 
06509         int             GetOptions () const     { return m_options; } 
06511         float const *   GetWeights () const     { return m_weights; } 
06513         float *         GetWeights ()           { return m_weights; } 
06515         float const *   GetKnots () const       { return m_knots;   } 
06517         float *         GetKnots ()             { return m_knots;   } 
06519         HT_NURBS_Trim const *GetList () const   { return m_list;    } 
06521         HT_NURBS_Trim *GetList ()               { return m_list;    } 
06522     
06523 };
06524 
06526 
06531 class BBINFILETK_API TK_NURBS_Surface : public BBaseOpcodeHandler {
06532     protected:
06533         unsigned char   m_optionals;        
06534         unsigned char   m_degree[2];        
06535         int             m_size[2];          
06536         float *         m_control_points;   
06537         double *        m_dcontrol_points;  
06538         float *         m_weights;          
06539         float *         m_u_knots;          
06540         float *         m_v_knots;          
06542         HT_NURBS_Trim * m_trims;            
06543         HT_NURBS_Trim * m_current_trim;     
06546     public:
06547         TK_NURBS_Surface();
06548         ~TK_NURBS_Surface();
06549 
06550         TK_Status   Read (BStreamFileToolkit & tk);   
06551         TK_Status   Write (BStreamFileToolkit & tk);  
06552         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06553 
06554         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06555         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06556 
06557         void        Reset (); 
06559         void            SetSurface (int u_degree, int v_degree,  int u_size, int v_size,
06560                                     float const * points = 0,    float const * weights = 0,
06561                                     float const * u_knots = 0,   float const * v_knots = 0);  
06562         void            SetDSurface (int u_degree, int v_degree,  int u_size, int v_size,
06563                                     double const * points = 0,   float const * weights = 0,
06564                                     float const * u_knots = 0,   float const * v_knots = 0);  
06567         float const *   GetPoints () const          { return m_control_points;          }
06569         float *         GetPoints ()                { return m_control_points;          }
06571         double const *  GetDPoints () const         { return m_dcontrol_points;         }
06573         double *        GetDPoints ()               { return m_dcontrol_points;         }
06574 
06576         int             GetUDegree () const         { return m_degree[0];               } 
06578         int             GetVDegree () const         { return m_degree[1];               } 
06580         int             GetUSize () const           { return m_size[0];                 } 
06582         int             GetVSize () const           { return m_size[1];                 } 
06584         float const *   GetWeights () const         { return m_weights;                 } 
06586         float *         GetWeights ()               { return m_weights;                 } 
06588         float const *   GetUKnots () const          { return m_u_knots;                 } 
06590         float *         GetUKnots ()                { return m_u_knots;                 } 
06592         float const *   GetVKnots () const          { return m_v_knots;                 } 
06594         float *         GetVKnots ()                { return m_v_knots;                 } 
06595 
06597         void            SetOptions (int o)              { m_optionals = (unsigned char)o;   } 
06599         int             GetOptions () const         { return m_optionals;               } 
06600 
06602         HT_NURBS_Trim * NewTrim (int type = NS_TRIM_END);                                 
06604         HT_NURBS_Trim * GetTrims ()                 { return m_trims;                   }
06605 
06606 
06607 };
06608 
06610 
06615 class BBINFILETK_API TK_Area_Light : public BBaseOpcodeHandler {
06616     protected:
06617         int             m_count;    
06618         float *         m_points;   
06619         double *        m_dpoints;  
06620         char            m_options;  
06621 
06623         void    set_points (int count, float const * points = 0);
06624 
06625     public:
06627         TK_Area_Light ()
06628             : BBaseOpcodeHandler (TKE_Area_Light), m_count (0), m_points (0), m_dpoints (0), m_options (0) {}
06629         ~TK_Area_Light();
06630 
06631         TK_Status   Read (BStreamFileToolkit & tk);
06632         TK_Status   Write (BStreamFileToolkit & tk);
06633         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06634 
06635         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06636         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06637 
06638         void        Reset ();
06639 
06644         void            SetPoints (int count, float const * points = 0)     { set_points (count, points);   }
06646         float const *   GetPoints () const                                  { return m_points;              }
06648         float *         GetPoints ()                                        { return m_points;              }
06649 
06654         void            SetDPoints (int count, double const * points = 0) ;
06656         double const *  GetDPoints () const                                 { return m_dpoints;             }
06658         double *        GetDPoints ()                                       { return m_dpoints;             }
06659 
06661         int             GetCount () const                                   { return m_count;               }
06662 
06664         void            SetOptions (int o)                                      { m_options = (char)o;          }
06666         int             GetOptions () const                                 { return (int)m_options;        }
06667 };
06668 
06669 
06673 enum TKO_Spot_Light_Options {
06674     TKO_Spot_Outer_Degrees      = 0x01,  
06675     TKO_Spot_Outer_Field        = 0x02,  
06676 
06677     TKO_Spot_Inner_Degrees      = 0x04,  
06678     TKO_Spot_Inner_Field        = 0x08,  
06679     TKO_Spot_Inner_Percent      = 0x0C,  
06680 
06681     TKO_Spot_Outer_Mask         = 0x03,  
06682     TKO_Spot_Inner_Mask         = 0x0C,  
06683 
06684     TKO_Spot_Camera_Relative    = 0x10,  
06685 
06686     TKO_Spot_Concentration      = 0x20  
06687 };
06688 
06689 
06691 
06696 class BBINFILETK_API TK_Spot_Light : public BBaseOpcodeHandler {
06697     protected:
06698         float           m_position[3];      
06699         float           m_target[3];        
06700         double          m_dposition[3];      
06701         double          m_dtarget[3];        
06702         float           m_outer;            
06703         float           m_inner;            
06704         float           m_concentration;    
06705         char            m_options;          
06706 
06707     public:
06709         TK_Spot_Light ()
06710             : BBaseOpcodeHandler (TKE_Spot_Light), m_options (0) {}
06711 
06712         TK_Status   Read (BStreamFileToolkit & tk);
06713         TK_Status   Write (BStreamFileToolkit & tk);
06714         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06715 
06716         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06717         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06718 
06720         void            SetPosition (float x, float y, float z)
06721                                         { m_position[0] = x; m_position[1] = y; m_position[2] = z;      }
06723         void            SetPosition (float const * p)       { SetPosition (p[0], p[1], p[2]);   }
06725         float const *   GetPosition () const                { return m_position;                }
06726 
06728         void            SetDPosition (double x, double y, double z)
06729                                         { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z;   }
06731         void            SetDPosition (double const * p)     { SetDPosition (p[0], p[1], p[2]);  }
06733         double const *  GetDPosition () const               { return m_dposition;               }
06734 
06736         void            SetTarget (float x, float y, float z)
06737                                         { m_target[0] = x; m_target[1] = y; m_target[2] = z;    }
06739         void            SetTarget (float const * t)         { SetTarget (t[0], t[1], t[2]);     }
06741         float const *   GetTarget () const                  { return m_target;                  }
06742 
06744         void            SetDTarget (double x, double y, double z)
06745                                         { m_dtarget[0] = x; m_dtarget[1] = y; m_dtarget[2] = z; }
06747         void            SetDTarget (double const * t)       { SetDTarget (t[0], t[1], t[2]);    }
06749         double const *  GetDTarget () const                 { return m_dtarget;                 }
06750 
06752         void            SetOuter (float o)                  { m_outer = o;      }
06754         float           GetOuter () const                   { return m_outer;   }
06755 
06757         void            SetInner (float i)                  { m_inner = i;      }
06759         float           GetInner () const                   { return m_inner;   }
06760 
06762         void            SetConcentration (float c)          { m_concentration = c;      }
06764         float           GetConcentration () const           { return m_concentration;   }
06765 
06767         void            SetOptions (int o)                  { m_options = (char)o;      }
06769         int             GetOptions () const                 { return (int)m_options;    }
06770 };
06771 
06772 
06774 
06779 class BBINFILETK_API TK_Cutting_Plane : public BBaseOpcodeHandler {
06780     protected:
06781         float *         m_planes;       
06782         double *        m_dplanes;      
06783         int             m_count;        
06784 
06785     public:
06787         TK_Cutting_Plane ()
06788             : BBaseOpcodeHandler (TKE_Cutting_Plane), m_planes (0), m_dplanes (0), m_count (0) {}
06789         ~TK_Cutting_Plane ();
06790 
06791         TK_Status   Read (BStreamFileToolkit & tk);
06792         TK_Status   Write (BStreamFileToolkit & tk);
06793         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06794 
06795         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06796         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06797 
06798         void        Reset ();
06799 
06801         void            SetPlanes (int count, float const * p=0);
06803         void            SetDPlanes (int count, double const * p=0);
06804 
06806         void            SetPlane (float a, float b, float c, float d)
06807                                     { SetPlanes(1);
06808                                         m_planes[0] = a;  m_planes[1] = b;  m_planes[2] = c;  m_planes[3] = d;      }
06810         void            SetDPlane (double a, double b, double c, double d)
06811                                     { SetDPlanes(1);
06812                                         m_dplanes[0] = a;  m_dplanes[1] = b;  m_dplanes[2] = c;  m_dplanes[3] = d;  }
06813 
06815         void            SetPlane (float const * p)              { SetPlanes (1, p);    }
06817         void            SetDPlane (double const * p)            { SetDPlanes (1, p);    }
06818 
06820         float const *   GetPlane () const                       { return m_planes;  }
06822         double const *  GetDPlane () const                      { return m_dplanes; }
06823 
06825         float const *   GetPlanes () const                      { return m_planes;  }
06827         double const *  GetDPlanes () const                     { return m_dplanes; }
06828 
06830         int             GetCount () const                       { return m_count;   }
06831 };
06832 
06833 
06837 enum TKO_Circular_Options {
06838     TKO_Circular_Center     = 0x01  
06839 };
06840 
06842 
06849 class BBINFILETK_API TK_Circle : public BBaseOpcodeHandler {
06850     protected:
06851         float           m_points[9];     
06852         float           m_center[3];    
06853         double          m_dpoints[9];     
06854         double          m_dcenter[3];    
06855         unsigned char   m_flags;        
06858     public:
06860         TK_Circle (unsigned char opcode)
06861             : BBaseOpcodeHandler (opcode), m_flags (0) {}
06862 
06863         TK_Status   Read (BStreamFileToolkit & tk);
06864         TK_Status   Write (BStreamFileToolkit & tk);
06865         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06866 
06867         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06868         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06869 
06870         void        Reset ();
06871 
06873         void            SetStart (float x, float y, float z) {
06874                             m_points[0] = x;    m_points[1] = y;    m_points[2] = z;
06875                         }
06877         void            SetStart (float const * s) {
06878                             SetStart (s[0], s[1], s[2]);
06879                         }
06881         void            SetMiddle (float x, float y, float z) {
06882                             m_points[3] = x;    m_points[4] = y;    m_points[5] = z;
06883                         }
06885         void            SetMiddle (float const * m) {
06886                             SetMiddle (m[0], m[1], m[2]);
06887                         }
06889         void            SetEnd (float x, float y, float z) {
06890                             m_points[6] = x;    m_points[7] = y;    m_points[8] = z;
06891                         }
06893         void            SetEnd (float const * e) {
06894                             SetEnd (e[0], e[1], e[2]);
06895                         }
06897         void            SetCenter (float x, float y, float z) {
06898                             m_center[0] = x;    m_center[1] = y;    m_center[2] = z;
06899                             m_flags = TKO_Circular_Center;
06900                         }
06902         void            SetCenter (float const * c) {
06903                             if (c) SetCenter (c[0], c[1], c[2]);
06904                             else m_flags = 0;
06905                         }
06907         void            SetPoints (float const * s, float const * m, float const * e,
06908                                    float const * c = 0) {
06909                             SetStart (s); SetMiddle (m); SetEnd (e); SetCenter (c);
06910                         }
06911 
06913         float const *   GetStart () const   { return &m_points[0];  }
06915         float const *   GetMiddle () const  { return &m_points[3];  }
06917         float const *   GetEnd () const     { return &m_points[6];  }
06919         float const *   GetCenter () const  { return (m_flags & TKO_Circular_Center) ? m_center : 0;    }
06920 
06922         void            SetDStart (double x, double y, double z) {
06923                             m_dpoints[0] = x;   m_dpoints[1] = y;   m_dpoints[2] = z;
06924                         }
06926         void            SetDStart (double const * s) {
06927                             SetDStart (s[0], s[1], s[2]);
06928                         }
06930         void            SetDMiddle (double x, double y, double z) {
06931                             m_dpoints[3] = x;   m_dpoints[4] = y;   m_dpoints[5] = z;
06932                         }
06934         void            SetDMiddle (double const * m) {
06935                             SetDMiddle (m[0], m[1], m[2]);
06936                         }
06938         void            SetDEnd (double x, double y, double z) {
06939                             m_dpoints[6] = x;   m_dpoints[7] = y;   m_dpoints[8] = z;
06940                         }
06942         void            SetDEnd (double const * e) {
06943                             SetDEnd (e[0], e[1], e[2]);
06944                         }
06946         void            SetDCenter (double x, double y, double z) {
06947                             m_dcenter[0] = x;   m_dcenter[1] = y;   m_dcenter[2] = z;
06948                             m_flags = TKO_Circular_Center;
06949                         }
06951         void            SetDCenter (double const * c) {
06952                             if (c) SetDCenter (c[0], c[1], c[2]);
06953                             else m_flags = 0;
06954                         }
06956         void            SetDPoints (double const * s, double const * m, double const * e,
06957                                     double const * c = 0) {
06958                             SetDStart (s); SetDMiddle (m); SetDEnd (e); SetDCenter (c);
06959                         }
06960 
06962         double const *  GetDStart () const  { return &m_dpoints[0]; }
06964         double const *  GetDMiddle () const { return &m_dpoints[3]; }
06966         double const *  GetDEnd () const    { return &m_dpoints[6]; }
06968         double const *  GetDCenter () const { return (m_flags & TKO_Circular_Center) ? m_dcenter : 0;   }
06969 };
06970 
06971 
06973 
06980 class BBINFILETK_API TK_Ellipse : public BBaseOpcodeHandler {
06981     protected:
06982         float           m_points[9];    
06983         double          m_dpoints[9];    
06984         float           m_limits[2];    
06986     public:
06988         TK_Ellipse (unsigned char opcode)
06989             : BBaseOpcodeHandler (opcode) {}
06990 
06991         TK_Status   Read (BStreamFileToolkit & tk);
06992         TK_Status   Write (BStreamFileToolkit & tk);
06993         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06994 
06995         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06996         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06997 
06999         void            SetCenter (float x, float y, float z) {
07000                             m_points[0] = x;    m_points[1] = y;    m_points[2] = z;
07001                         }
07003         void            SetCenter (float const * s)     { SetCenter (s[0], s[1], s[2]); }
07005         float const *   GetCenter () const              { return &m_points[0];          }
07006 
07008         void            SetMajor (float x, float y, float z) {
07009                             m_points[3] = x;    m_points[4] = y;    m_points[5] = z;
07010                         }
07012         void            SetMajor (float const * m)     { SetMajor (m[0], m[1], m[2]);   }
07014         float const *   GetMajor () const            { return &m_points[3];             }
07015 
07017         void            SetMinor (float x, float y, float z) {
07018                             m_points[6] = x;    m_points[7] = y;    m_points[8] = z;
07019                         }
07021         void            SetMinor (float const * m)      { SetMinor (m[0], m[1], m[2]);  }
07023         float const *   GetMinor () const               { return &m_points[6];          }
07024 
07025 
07027         void            SetDCenter (double x, double y, double z) {
07028                             m_dpoints[0] = x;   m_dpoints[1] = y;   m_dpoints[2] = z;
07029                         }
07031         void            SetDCenter (double const * s)   { SetDCenter (s[0], s[1], s[2]);}
07033         double const *  GetDCenter () const             { return &m_dpoints[0];         }
07034 
07036         void            SetDMajor (double x, double y, double z) {
07037                             m_dpoints[3] = x;   m_dpoints[4] = y;   m_dpoints[5] = z;
07038                         }
07040         void            SetDMajor (double const * m)    { SetDMajor (m[0], m[1], m[2]); }
07042         double const *  GetDMajor () const              { return &m_dpoints[3];         }
07043 
07045         void            SetDMinor (double x, double y, double z) {
07046                             m_dpoints[6] = x;   m_dpoints[7] = y;   m_dpoints[8] = z;
07047                         }
07049         void            SetDMinor (double const * m)    { SetDMinor (m[0], m[1], m[2]); }
07051         double const *  GetDMinor () const              { return &m_dpoints[6];         }
07052 
07054         void            SetLimits (float s, float e) {
07055                             m_limits[0] = s;    m_limits[1] = e;
07056                         }
07058         float const *   GetLimits () const              { return m_limits;              }
07059 };
07060 
07061 
07063 
07070 class BBINFILETK_API TK_Sphere : public BBaseOpcodeHandler {
07071     protected:
07072         unsigned char   m_flags;        
07073         float           m_center[3];    
07074         float           m_radius;       
07075         float           m_axis[3];      
07076         float           m_ortho[3];     
07077         double          m_dcenter[3];    
07078         double          m_dradius;       
07079         double          m_daxis[3];      
07080         double          m_dortho[3];     
07082     public:
07084         TK_Sphere ()
07085             : BBaseOpcodeHandler (TKE_Sphere) { Reset(); }
07086 
07087         TK_Status   Read (BStreamFileToolkit & tk);
07088         TK_Status   Write (BStreamFileToolkit & tk);
07089         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07090 
07091         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07092         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07093 
07094         void        Reset ();
07095 
07097         void            SetCenter (float x, float y, float z) {
07098                             m_center[0] = x;    m_center[1] = y;    m_center[2] = z;
07099                         }
07101         void            SetCenter (float const * s)     { SetCenter (s[0], s[1], s[2]); }
07103         float const *   GetCenter () const              { return m_center;              }
07104 
07105 
07107         void            SetRadius (float r)             { m_radius = r;                 }
07109         float           GetRadius () const              { return m_radius;              }
07110 
07112         void            SetAxis (float x, float y, float z) {
07113                             m_axis[0] = x;  m_axis[1] = y;  m_axis[2] = z;
07114                             if (x != 0.0f || y != 1.0f || z != 0.0f)
07115                                 m_flags &= ~TKSPH_NULL_AXIS;
07116                         }
07118         void            SetAxis (float const * s)       { SetAxis (s[0], s[1], s[2]);   }
07120         float const *   GetAxis () const                { return m_axis;                }
07121 
07123         void            SetOrtho (float x, float y, float z) {
07124                             m_ortho[0] = x; m_ortho[1] = y; m_ortho[2] = z;
07125                             if (x != 1.0f || y != 0.0f || z != 0.0f)
07126                                 m_flags &= ~TKSPH_NULL_AXIS;
07127                         }
07129         void            SetOrtho (float const * s)      { SetOrtho (s[0], s[1], s[2]);  }
07131         float const *   GetOrtho () const               { return m_ortho;               }
07132 
07133 
07135         void            SetDCenter (double x, double y, double z) {
07136                             m_dcenter[0] = x;   m_dcenter[1] = y;   m_dcenter[2] = z;
07137                         }
07139         void            SetDCenter (double const * s)   { SetDCenter (s[0], s[1], s[2]);}
07141         double const *  GetDCenter () const             { return m_dcenter;             }
07142 
07143 
07145         void            SetDRadius (double r)           { m_dradius = r;                }
07147         double          GetDRadius () const             { return m_dradius;             }
07148 
07150         void            SetDAxis (double x, double y, double z) {
07151                             m_daxis[0] = x; m_daxis[1] = y; m_daxis[2] = z;
07152                             if (x != 0.0f || y != 1.0f || z != 0.0f)
07153                                 m_flags &= ~TKSPH_NULL_AXIS;
07154                         }
07156         void            SetDAxis (double const * s)     { SetDAxis (s[0], s[1], s[2]);  }
07158         double const *  GetDAxis () const               { return m_daxis;               }
07159 
07161         void            SetDOrtho (double x, double y, double z) {
07162                             m_dortho[0] = x;    m_dortho[1] = y;    m_dortho[2] = z;
07163                             if (x != 1.0f || y != 0.0f || z != 0.0f)
07164                                 m_flags &= ~TKSPH_NULL_AXIS;
07165                         }
07167         void            SetDOrtho (double const * s)    { SetDOrtho (s[0], s[1], s[2]); }
07169         double const *  GetDOrtho () const              { return m_dortho;              }
07170 
07171 
07175         enum Flags {
07176             TKSPH_NONE      = 0x0,   
07177             TKSPH_NULL_AXIS = 0x1    
07178         };
07179 
07180 };
07181 
07182 
07184 
07191 class BBINFILETK_API TK_Cylinder : public BBaseOpcodeHandler {
07192     protected:
07193         float           m_axis[6];      
07194         float           m_radius;       
07195         double          m_daxis[6];      
07196         double          m_dradius;       
07197         unsigned char   m_flags;        
07199     public:
07201         TK_Cylinder ()
07202             : BBaseOpcodeHandler (TKE_Cylinder) {}
07203 
07204         TK_Status   Read (BStreamFileToolkit & tk);
07205         TK_Status   Write (BStreamFileToolkit & tk);
07206         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07207 
07208         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07209         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07210 
07212         void            SetAxis (float x1, float y1, float z1, float x2, float y2, float z2) {
07213                             m_axis[0] = x1;     m_axis[1] = y1;     m_axis[2] = z1;
07214                             m_axis[3] = x2;     m_axis[4] = y2;     m_axis[5] = z2;
07215                         }
07217         void            SetAxis (float const * s, float const * e)      { SetAxis (s[0], s[1], s[2], e[0], e[1], e[2]); }
07219         void            SetAxis (float const * a)                       { SetAxis (&a[0], &a[3]);   }
07221         float const *   GetAxis () const        { return m_axis;        }
07223         float const *   GetStart () const       { return &m_axis[0];    }
07225         float const *   GetEnd () const         { return &m_axis[3];    }
07226 
07228         void            SetRadius (float r)     { m_radius = r;     }
07230         float           GetRadius () const      { return m_radius;  }
07231 
07232 
07234         void            SetDAxis (double x1, double y1, double z1, double x2, double y2, double z2) {
07235                             m_daxis[0] = x1;    m_daxis[1] = y1;    m_daxis[2] = z1;
07236                             m_daxis[3] = x2;    m_daxis[4] = y2;    m_daxis[5] = z2;
07237                         }
07239         void            SetDAxis (double const * s, double const * e)   { SetDAxis (s[0], s[1], s[2], e[0], e[1], e[2]);    }
07241         void            SetDAxis (double const * a)                     { SetDAxis (&a[0], &a[3]);  }
07243         double const *  GetDAxis () const       { return m_daxis;       }
07245         double const *  GetDStart () const      { return &m_daxis[0];   }
07247         double const *  GetDEnd () const        { return &m_daxis[3];   }
07248 
07250         void            SetDRadius (double r)   { m_dradius = r;        }
07252         double          GetDRadius () const     { return m_dradius; }
07253 
07254 
07256         void            SetCaps (int f)         { m_flags = (unsigned char)f;   }
07258         int             GetCaps () const        { return m_flags;               }
07259 
07263         enum Capping_Options {
07264             TKCYL_NONE   = 0,  
07265             TKCYL_FIRST  = 1,  
07266             TKCYL_SECOND = 2,  
07267             TKCYL_BOTH   = 3   
07268         };
07269 
07270 };
07271 
07272 
07274 
07281 #include "BPolyhedron.h"
07282 
07283 class BBINFILETK_API TK_PolyCylinder : public TK_Polyhedron {
07284     protected:
07285         int             m_count;        
07286         float *         m_points;       
07287         double *        m_dpoints;       
07288         int             m_radius_count; 
07289         float *         m_radii;        
07290         double *        m_dradii;        
07291         unsigned char   m_flags;        
07292         float           m_normals[6];   
07294     public:
07296         TK_PolyCylinder ()
07297             : TK_Polyhedron (TKE_PolyCylinder), m_count (0), m_points (0), m_dpoints (0),
07298             m_radius_count (0), m_radii (0), m_dradii (0) {}
07299         ~TK_PolyCylinder();
07300 
07301         TK_Status   Read (BStreamFileToolkit & tk);
07302         TK_Status   Write (BStreamFileToolkit & tk);
07303         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07304 
07305         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07306         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07307 
07308         void        Reset ();
07309 
07313         enum Capping_Options {
07314             TKCYL_NORMAL_FIRST  = 0x04,  
07315             TKCYL_NORMAL_SECOND = 0x08,  
07316             TKCYL_OPTIONALS     = 0x10   
07317         };
07318 
07323         void            SetPoints (int count, float const * points = 0);
07325         float const *   GetPoints () const              { return m_points;          }
07327         float *         GetPoints ()                    { return m_points;          }
07328 
07333         void            SetRadii (int count, float const * radii = 0);
07335         void            SetRadius (float radius)        { SetRadii (1, &radius);    }
07337         float const *   GetRadii () const               { return m_radii;           }
07339         float *         GetRadii ()                     { return m_radii;           }
07340 
07341 
07346         void            SetDPoints (int count, double const * points = 0);
07348         double const *  GetDPoints () const             { return m_dpoints;         }
07350         double *        GetDPoints ()                   { return m_dpoints;         }
07351 
07356         void            SetDRadii (int count, double const * radii = 0);
07358         void            SetDRadius (double radius)      { SetDRadii (1, &radius);   }
07360         double const *  GetDRadii () const              { return m_dradii;          }
07362         double *        GetDRadii ()                    { return m_dradii;          }
07363 
07364 
07366         int             GetCount () const               { return m_count;           }
07368         int             GetRadiusCount () const         { return m_radius_count;    }
07369 
07370 
07371 
07372 
07374         void            SetCaps (int f)                 { m_flags &= ~0x03; m_flags |= f;   }
07376         int             GetCaps () const                { return m_flags & 0x03;            }
07377 
07379         void            SetEndNormal (int index, float const * normal = 0) {
07380                             int     mask = 0x40 << index;
07381                             if (normal == 0)
07382                                 m_flags &= ~mask;
07383                             else {
07384                                 m_flags |= mask;
07385                                 m_normals[3*index+0] = normal[0];
07386                                 m_normals[3*index+1] = normal[1];
07387                                 m_normals[3*index+2] = normal[2];
07388                             }
07389                         }
07391         float const *   GetEndNormal (int index) const      {
07392                             int     mask = 0x40 << index;
07393                             if (m_flags & mask)
07394                                 return &m_normals[3*index];
07395                             else
07396                                 return 0;
07397                         }
07398 };
07399 
07400 
07402 
07408 class BBINFILETK_API TK_Grid : public BBaseOpcodeHandler {
07409     protected:
07410         char            m_type;      
07411         float           m_points[9]; 
07412         double          m_dpoints[9]; 
07413         int             m_counts[2]; 
07415     public:
07417         TK_Grid ()
07418             : BBaseOpcodeHandler (TKE_Grid) {}
07419 
07420         TK_Status   Read (BStreamFileToolkit & tk);
07421         TK_Status   Write (BStreamFileToolkit & tk);
07422         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07423 
07424         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07425         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07426 
07428         void            SetOrigin (float x, float y, float z) {
07429                             m_points[0] = x;    m_points[1] = y;    m_points[2] = z;
07430                         }
07432         void            SetOrigin (float const * o)     { SetOrigin (o[0], o[1], o[2]); }
07434         float const *   GetOrigin () const              { return &m_points[0];          }
07436         float *         GetOrigin ()                    { return &m_points[0];          }
07437 
07439         void            SetRef1 (float x, float y, float z) {
07440                             m_points[3] = x;    m_points[4] = y;    m_points[5] = z;
07441                         }
07443         void            SetRef1 (float const * r)       { SetRef1 (r[0], r[1], r[2]);   }
07445         float const *   GetRef1 () const                { return &m_points[3];          }
07447         float *         GetRef1 ()                      { return &m_points[3];          }
07448 
07450         void            SetRef2 (float x, float y, float z) {
07451                             m_points[6] = x;    m_points[7] = y;    m_points[8] = z;
07452                         }
07454         void            SetRef2 (float const * r)       { SetRef2 (r[0], r[1], r[2]);   }
07456         float const *   GetRef2 () const                { return &m_points[6];          }
07458         float *         GetRef2 ()                      { return &m_points[6];          }
07459 
07460 
07462         void            SetDOrigin (double x, double y, double z) {
07463                             m_dpoints[0] = x;   m_dpoints[1] = y;   m_dpoints[2] = z;
07464                         }
07466         void            SetDOrigin (double const * o)   { SetDOrigin (o[0], o[1], o[2]);}
07468         double const *  GetDOrigin () const             { return &m_dpoints[0];         }
07470         double *        GetDOrigin ()                   { return &m_dpoints[0];         }
07471 
07473         void            SetDRef1 (double x, double y, double z) {
07474                             m_dpoints[3] = x;   m_dpoints[4] = y;   m_dpoints[5] = z;
07475                         }
07477         void            SetDRef1 (double const * r)     { SetDRef1 (r[0], r[1], r[2]);  }
07479         double const *  GetDRef1 () const               { return &m_dpoints[3];         }
07481         double *        GetDRef1 ()                     { return &m_dpoints[3];         }
07482 
07484         void            SetDRef2 (double x, double y, double z) {
07485                             m_dpoints[6] = x;   m_dpoints[7] = y;   m_dpoints[8] = z;
07486                         }
07488         void            SetDRef2 (double const * r)     { SetDRef2 (r[0], r[1], r[2]);  }
07490         double const *  GetDRef2 () const               { return &m_dpoints[6];         }
07492         double *        GetDRef2 ()                     { return &m_dpoints[6];         }
07493 
07494 
07496         void            SetCounts (int c1, int c2) {
07497                             m_counts[0] = c1;   m_counts[1] = c2;
07498                         }
07500         int const *     GetCounts () const              { return m_counts;              }
07502         int *           GetCounts ()                    { return m_counts;              }
07503 
07505         void            SetType (int t)                 { m_type = (char)t;             }
07507         int             GetType () const                { return (int)m_type;           }
07508 };
07509 
07511 
07515 enum TKO_Text_Encodings {
07516     TKO_Enc_ISO_Latin_One,  
07517     TKO_Enc_ISO_Latin,      
07518     TKO_Enc_JEC,            
07519     TKO_Enc_EUC,            
07520     TKO_Enc_Raw_16,         
07521     TKO_Enc_Unicode,        
07522     TKO_Enc_Unicode32,      
07523     TKO_Enc_UTF8,           
07524     TKO_Enc_UTF16,          
07525     TKO_Enc_UTF32,          
07526     TKO_Enc_WCS             
07527 };
07528 
07532 enum TKO_Text_Options {
07533     TKO_Text_Option_Region                  = 0x01, 
07534     TKO_Text_Option_Character_Attributes    = 0x02  
07535 };
07536 
07540 enum TKO_Text_Region_Options {
07541     TKO_Text_Region_Window      = 0x01, 
07542     TKO_Text_Region_Relative    = 0x02, 
07543     TKO_Text_Region_Adjusted    = 0x04, 
07544     TKO_Text_Region_Center      = 0x08, 
07545     TKO_Text_Region_Top         = 0x10, 
07546     TKO_Text_Region_HFit        = 0x20, 
07547     TKO_Text_Region_VFit        = 0x40, 
07548     TKO_Text_Region_Fitting     = 0x60, 
07549     TKO_Text_Region_Extended    = 0x80  
07550 };
07551 
07555 enum TKO_Text_Region_Fit_Options {
07556     TKO_Text_Region_Fit_None    = 0,    
07557     TKO_Text_Region_Fit_Spacing = 1,    
07558     TKO_Text_Region_Fit_Size    = 2     
07559 };
07560 
07561 
07565 enum TKO_Character_Attributes {
07566     TKO_Character_Name              = 0x0001,  
07567     TKO_Character_Size              = 0x0002,  
07568     TKO_Character_Vertical_Offset   = 0x0004,  
07569     TKO_Character_Omitted           = 0x0008,  
07570     TKO_Character_Invisible         = 0x0010,  
07571     TKO_Character_Slant             = 0x0020,  
07572     TKO_Character_Width_Scale       = 0x0040,  
07573     TKO_Character_Rotation          = 0x0080,  
07574     TKO_Character_Rotation_Fixed    = 0x0100,
07575     TKO_Character_Horizontal_Offset = 0x0200,  
07576     TKO_Character_Color             = 0x0400,  
07577     TKO_Character_Extended          = 0x8000   
07578 };
07579 
07581 struct TK_Character_Attribute {
07582     char *              name;                   
07583 
07584     float               color[3];               
07585     float               size;                   
07586     float               vertical_offset;        
07587     float               horizontal_offset;      
07588     float               slant;                  
07589     float               rotation;               
07590     float               width_scale;            
07591 
07592     unsigned short      mask;                   
07593     unsigned short      value;                  
07594 
07595     unsigned char       size_units;             
07596     unsigned char       vertical_offset_units;  
07597     unsigned char       horizontal_offset_units;    
07598 };
07599 
07600 
07602 
07608 class BBINFILETK_API TK_Text : public BBaseOpcodeHandler {
07609     protected:
07610         float           m_position[3];  
07611         double          m_dposition[3];  
07612         int             m_length;       
07613         int             m_allocated;    
07614         char *          m_string;       
07615         unsigned char   m_encoding;     
07616         unsigned char   m_options;      
07617         unsigned char   m_region_options;
07618         unsigned char   m_region_fit;   
07619         unsigned char   m_region_count; 
07620         float           m_region[4*3];  
07621         int             m_count;        
07622         TK_Character_Attribute  *m_character_attributes;    
07623         int             m_substage;     
07624         int             m_tmp;          
07626         void    set_string (char const * string);     
07627         void    set_string (int length);              
07628 
07629     public:
07631         TK_Text (unsigned char opcode);
07632         ~TK_Text();
07633 
07634         TK_Status   Read (BStreamFileToolkit & tk);
07635         TK_Status   Write (BStreamFileToolkit & tk);
07636         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07637 
07638         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07639         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07640 
07641         void        Reset ();
07642 
07644         void            SetString (char const * string)         { set_string (string);  }
07646         void            SetString (unsigned short const * string);
07648         void            SetString (unsigned int const * string);
07650         void            SetString (int length)                  { set_string (length);  }
07652         char const *    GetString () const                  { return m_string;      }
07654         char *          GetString ()                        { return m_string;      }
07655 
07657         void            SetPosition (float x, float y, float z)
07658                                         {   m_position[0] = x;  m_position[1] = y;  m_position[2] = z;  }
07660         void            SetPosition (float const * p)           { SetPosition (p[0], p[1], p[2]);       }
07662         float const *   GetPosition () const                    { return &m_position[0];                }
07663 
07665         void            SetDPosition (double x, double y, double z)
07666                                         {   m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; }
07668         void            SetDPosition (double const * p)         { SetDPosition (p[0], p[1], p[2]);      }
07670         double const *   GetDPosition () const                  { return &m_dposition[0];               }
07671 
07673         void            SetEncoding (int e)                     { m_encoding = (unsigned char)e;        }
07675         int             GetEncoding () const                    { return (int)m_encoding;               }
07676 
07678         void            SetTextRegion (int c, float const * p, int o=0, int f=0);
07680         int             GetTextRegionCount () const         { return (int)m_region_count;   }
07682         float const *   GetTextRegionPoints () const        { return m_region;              }
07684         int             GetTextRegionOptions () const       { return (int)m_region_options; }
07686         int             GetTextRegionFitting () const       { return (int)m_region_fit;     }
07687 };
07688 
07690 
07692 
07698 enum TKO_Font_Type {
07699     TKO_Font_HOOPS_Stroked      // data represents a HOOPS stroked font definition
07700 };
07701 
07702 
07704 
07710 class BBINFILETK_API TK_Font : public BBaseOpcodeHandler {
07711     protected:
07712         char *          m_name;         
07713         char *          m_lookup;       
07714         char *          m_bytes;        
07715         int             m_name_length;  
07716         int             m_lookup_length;
07717         int             m_length;       
07718         unsigned char   m_type;         
07719         unsigned char   m_encoding;     
07721 
07722         void    set_bytes (int size, char const * bytes = 0);
07724         void    set_name (char const * string);
07726         void    set_name (int length);
07728         void    set_lookup (char const * string);
07730         void    set_lookup (int length);
07731 
07732     public:
07734         TK_Font () : BBaseOpcodeHandler (TKE_Font),
07735             m_name (0), m_lookup (0), m_bytes (0), m_name_length (0), m_lookup_length (0), m_length (0),
07736             m_type (0), m_encoding (0) {}
07737         ~TK_Font();
07738 
07739         TK_Status   Read (BStreamFileToolkit & tk);
07740         TK_Status   Write (BStreamFileToolkit & tk);
07741         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07742 
07743         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07744         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07745 
07746         void        Reset ();
07747 
07748 
07750         void            SetType (int t)                                     { m_type = (unsigned char)t;}
07752         int             GetType () const                                { return (int)m_type;       }
07753 
07758         void            SetBytes (int size, char const * bytes = 0)         { set_bytes (size, bytes);  }
07760         int             GetBytesCount () const                          { return m_length;          }
07762         char const *    GetBytes () const                               { return m_bytes;           }
07764         char *          GetBytes ()                                     { return m_bytes;           }
07765 
07767         void            SetName (char const * string)                       { set_name (string);        }
07769         void            SetName (int length)                                { set_name (length);        }
07771         char const *    GetName () const                                { return m_name;            }
07773         char *          GetName ()                                      { return m_name;            }
07774 
07776         void            SetLookup (char const * string)                     { set_lookup (string);      }
07778         void            SetLookup (int length)                              { set_lookup (length);      }
07780         char const *    GetLookup () const                              { return m_lookup;          }
07782         char *          GetLookup ()                                    { return m_lookup;          }
07783 
07785         void            SetEncoding (int e)                             { m_encoding = (unsigned char)e;}
07787         int             GetEncoding () const                        { return (int)m_encoding;       }
07788 };
07789 
07791 
07795 enum TKO_Image_Formats {
07796     TKO_Image_Mapped    = 0,         
07797     TKO_Image_Mapped_16 = 1,         
07798     TKO_Image_RGB       = 2,         
07799     TKO_Image_RGBA      = 3,         
07800     TKO_Image_BGRA      = 4,         
07801     TKO_Image_DEPTH     = 5,         
07802     TKO_Image_LUMINANCE8 = 6,         
07803     TKO_Image_JPEG      = 7,         
07804     TKO_Image_DXT1      = 8,         
07805     TKO_Image_DXT3      = 9,         
07806     TKO_Image_DXT5      = 10,        
07807     TKO_Image_TARGA     = 11,        
07808     TKO_Image_PNG       = 12,        
07809     TKO_Image_Format_Mask   = 0x0F,  
07810 
07811     TKO_Image_Explicit_Size = 0x10,         
07812     TKO_Image_Local_Texture = 0x20,         
07813     TKO_Image_Is_Named      = 0x80,         
07814 
07815     TKO_Image_Compression_Quality = 0x00000100,         
07816     TKO_Image_Discard       = 0x00000200,         
07817     TKO_Image_Options_Mask  = 0xFFFFFFF0,         
07818 
07819     TKO_Image_Invalid       = 0xFF          
07820 };
07821 
07822 
07824 extern const int TK_Image_Bytes_Per_Pixel[];
07825 
07829 enum TKO_Compression {
07830     TKO_Compression_None  = 0,  
07831     TKO_Compression_RLE   = 1,  
07832     TKO_Compression_JPEG  = 2,  
07833     TKO_Compression_DXT   = 3,  
07834     TKO_Compression_TARGA = 4,  
07835     TKO_Compression_PNG   = 5,  
07836     TKO_Compression_Reference = 99  
07837 };
07838 
07839 #ifndef DOXYGEN_SHOULD_SKIP_THIS
07840 
07841 class BBINFILETK_API2 TK_Image_Data_Buffer {
07842     protected:
07843         unsigned char *                 m_buffer;   
07844         unsigned int                    m_allocated;    
07845         unsigned int                    m_used;     
07846 
07847     public:
07849         TK_Image_Data_Buffer() : m_buffer (0),  m_allocated (0), m_used (0) {}
07850         ~TK_Image_Data_Buffer();
07851 
07852         void    Resize (unsigned int size);
07853         void    Expand (unsigned int size)              { Resize (Size() + size);   }
07854         void    Reset ();
07855 
07856         unsigned int const &     Size () const      { return m_allocated;   }
07857         unsigned int const &     Used () const      { return m_used;        }
07858         unsigned int       &     Used ()            { return m_used;        }
07859         unsigned char const *    Buffer () const    { return m_buffer;      }
07860         unsigned char *          Buffer ()          { return m_buffer;      }
07861 };
07862 
07863 
07864 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
07865 
07866 
07868 
07874 class BBINFILETK_API2 TK_Image : public BBaseOpcodeHandler {
07875     protected:
07876         char *                  m_bytes;        
07877         char *                  m_name;         
07878         char *                  m_reference;    
07879         float                   m_position[3];  
07880         double                  m_dposition[3];  
07881         int                     m_size[2];      
07882         int                     m_data_size;      
07883         int                     m_name_length;  
07884         int                     m_reference_length; 
07885         unsigned char           m_format;       
07886         unsigned int            m_options;      
07887         unsigned char           m_compression;  
07888         unsigned char           m_bytes_format; 
07889         float                   m_explicit_size[2]; 
07890         unsigned char           m_explicit_units[2];    
07891         TK_Image_Data_Buffer    m_work_area[2];    
07892         float                   m_compression_quality;  
07894         bool                    m_jpeg_native;  
07896 
07897         void    set_data (int size, char const * bytes = 0, unsigned char data_format = TKO_Compression_None);
07899         void    set_name (char const * string);
07901         void    set_name (int length);
07902 
07904         TK_Status compress_image (BStreamFileToolkit & tk, int active_work_area = 0);
07906         TK_Status decompress_image (BStreamFileToolkit & tk, int active_work_area = 0);
07908         TK_Status read_jpeg_header ();
07909 
07910     public:
07912         TK_Image ();
07913         ~TK_Image();
07914 
07915         TK_Status   Read (BStreamFileToolkit & tk);
07916         TK_Status   Write (BStreamFileToolkit & tk);
07917         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07918 
07919         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07920         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07921         TK_Status   compress_image_ascii (BStreamFileToolkit & tk);
07922 
07923 
07924         void        Reset ();
07925 
07930         void            SetBytes (int size, char const * bytes = 0,
07931                                   unsigned char data_format = TKO_Compression_None)
07932                                                                             { set_data (size, bytes, data_format);  }
07934         char const *    GetBytes () const                               { return m_bytes;           }
07936         char *          GetBytes ()                                     { return m_bytes;           }
07937 
07939         void            SetName (char const * string)                       { set_name (string);        }
07941         void            SetName (int length)                                { set_name (length);        }
07943         char const *    GetName () const                                { return m_name;            }
07945         char *          GetName ()                                      { return m_name;            }
07946 
07948         void            SetReference (char const * string);
07950         void            SetReference (int length);
07952         char const *    GetReference () const                           { return m_reference;       }
07954         char *          GetReference ()                                 { return m_reference;       }
07955 
07957         void            SetPosition (float x, float y, float z)
07958                                         {   m_position[0] = x;  m_position[1] = y;  m_position[2] = z;  }
07960         void            SetPosition (float const * p)       { SetPosition (p[0], p[1], p[2]);           }
07962         float const *   GetPosition () const                { return &m_position[0];                    }
07963 
07965         void            SetDPosition (double x, double y, double z)
07966                                         {   m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; }
07968         void            SetDPosition (double const * p)     { SetDPosition (p[0], p[1], p[2]);          }
07970         double const *  GetDPosition () const               { return &m_dposition[0];                   }
07971 
07973         void            SetSize (int w, int h)                  { m_size[0] = w; m_size[1] = h;         }
07975         void            SetSize (int const * s)                 { m_size[0] = s[0]; m_size[1] = s[1];   }
07977         int const *     GetSize () const                    { return m_size;                        }
07978 
07980         void            SetFormat (int f)                       { m_format = (unsigned char)(f & TKO_Image_Format_Mask);    }
07982         int             GetFormat () const                  { return (int)m_format;         }
07983 
07985         void            SetOptions (int f)                       { m_options = (unsigned char)(f & TKO_Image_Options_Mask); }
07987         int             GetOptions () const                  { return (int)m_options;       }
07988 
07990         void            SetCompression (int c)                  { m_compression = (unsigned char)c;     }
07992         int             GetCompression () const             { return (int)m_compression;            }
07993 };
07994 
07995 
07997 
07998 
08002 enum TKO_Texture_Option_Bits {
08003     TKO_Texture_Param_Source        = 0x00000001,   
08004     TKO_Texture_Tiling              = 0x00000002,   
08005     TKO_Texture_Interpolation       = 0x00000004,   
08006     TKO_Texture_Decimation          = 0x00000008,   
08007     TKO_Texture_Red_Mapping         = 0x00000010,   
08008     TKO_Texture_Green_Mapping       = 0x00000020,   
08009     TKO_Texture_Blue_Mapping        = 0x00000040,   
08010     TKO_Texture_Alpha_Mapping       = 0x00000080,   
08011     TKO_Texture_Param_Function      = 0x00000100,   
08012     TKO_Texture_Layout              = 0x00000200,   
08013     TKO_Texture_Transform           = 0x00000400,   
08014     TKO_Texture_Value_Scale         = 0x00000800,   
08015     TKO_Texture_Caching             = 0x00001000,   
08016     TKO_Texture_DownSample          = 0x00002000,   
08017     TKO_Texture_No_DownSample       = 0x00004000,   
08018     TKO_Texture_Extended            = 0x00008000,   
08019     TKO_Texture_Extended_Mask       = 0xFFFF0000,   //   internal use, indicates bit which require TKO_Texture_Extended
08020     TKO_Texture_Extended_Shift      = 16,           //   internal use, indicates shift of extended section
08021     TKO_Texture_Decal               = 0x00010000,   
08022     TKO_Texture_Modulate            = 0x00020000,   
08023     TKO_Texture_Param_Offset        = 0x00040000,   
08024     TKO_Texture_Transform_Override  = 0x00080000,   
08025     TKO_Texture_Shader              = 0x00100000,   
08026     TKO_Texture_Shader_Multitexture = 0x00200000,   
08027     TKO_Texture_Camera              = 0x00400000,   
08028     TKO_Texture_Source_Dimensions   = 0x00800000,   
08029     TKO_Texture_Geometry_Shader     = 0x01000000    
08030 };
08031 
08035 enum TKO_Texture_Param_Sources {
08036     TKO_Texture_Param_Source_U,   
08037     TKO_Texture_Param_Source_UV,   
08038     TKO_Texture_Param_Source_UVW,   
08039     TKO_Texture_Param_Source_Object,   
08040     TKO_Texture_Param_Source_World,   
08041     TKO_Texture_Param_Source_Surface_Normal,   
08042     TKO_Texture_Param_Source_Reflection_Vector,   
08043     TKO_Texture_Param_Source_Natural_UV,   
08044     TKO_Texture_Param_Source_Local_Pixels,   
08045     TKO_Texture_Param_Source_Outer_Pixels,   
08046     TKO_Texture_Param_Source_Local_Window,   
08047     TKO_Texture_Param_Source_Outer_Window,   
08048     TKO_Texture_Param_Source_Transmission_Vector,   
08049     TKO_Texture_Param_Source_Sphere_Map,   
08050     TKO_Texture_Param_Source_Cylinder_Map,  
08051     TKO_Texture_Param_Source_Physical_Reflection_Vector   
08052 };
08053 
08054 
08058 enum TKO_Texture_Param_Functions {
08059     TKO_Texture_Param_Function_None,   
08060     TKO_Texture_Param_Function_Sphere,   
08061     TKO_Texture_Param_Function_Cylinder,   
08062     TKO_Texture_Param_Function_Box   
08063 };
08064 
08065 
08069 enum TKO_Texture_Layouts {
08070     TKO_Texture_Layout_Rectilinear,   
08071     TKO_Texture_Layout_Spherical,   
08072     TKO_Texture_Layout_Hemispherical,   
08073     TKO_Texture_Layout_Cubic_Faces,   
08074     TKO_Texture_Layout_Unknown   
08075 };
08076 
08080 enum TKO_Texture_Tilings {
08081     TKO_Texture_Tiling_None,   
08082     TKO_Texture_Tiling_Clamp,   
08083     TKO_Texture_Tiling_Repeat,   
08084     TKO_Texture_Tiling_Mirror,   
08085     TKO_Texture_Tiling_Drop    
08086 };
08087 
08088 
08092 enum TKO_Texture_Filters {
08093     TKO_Texture_Filter_None,   
08094     TKO_Texture_Filter_Bilinear,   
08095     TKO_Texture_Filter_Trilinear,   
08096     TKO_Texture_Filter_MipMap,   
08097     TKO_Texture_Filter_Summed_Areas,   
08098     TKO_Texture_Filter_Gaussian,   
08099     TKO_Texture_Filter_Stochastic,   
08100     TKO_Texture_Filter_Anisotropic  
08101 };
08102 
08103 
08107 enum TKO_Texture_Channel_Mappings {
08108     TKO_Texture_Channel_Mapping_Red,   
08109     TKO_Texture_Channel_Mapping_Green,   
08110     TKO_Texture_Channel_Mapping_Blue,   
08111     TKO_Texture_Channel_Mapping_Alpha,   
08112     TKO_Texture_Channel_Mapping_Zero,   
08113     TKO_Texture_Channel_Mapping_One,   
08114     TKO_Texture_Channel_Mapping_Luminance,   
08115     TKO_Texture_Channel_Mapping_None   
08116 };
08117 
08118 
08122 enum TKO_Texture_Application_Modes {
08123     TKO_Texture_Modulate_Set    = 0x01,     
08124     TKO_Texture_Decal_Set   = 0x02      
08125 };
08126 
08127 
08129 
08135 class BBINFILETK_API2 TK_Texture : public BBaseOpcodeHandler {
08136     protected:
08137         char *          m_name;             
08138         char *          m_shader_source;    
08139         char *          m_image;            
08140         char *          m_camera;            
08141         int             m_name_length;      
08142         int             m_shader_source_length;  
08143         int             m_image_length;     
08144         int             m_camera_length;      
08145         int             m_flags;            
08146         int             m_substage;         
08148         char            m_param_source;     
08149         char            m_interpolation;    
08150         char            m_decimation;       
08151         char            m_red_mapping;      
08152         char            m_green_mapping;    
08153         char            m_blue_mapping;     
08154         char            m_alpha_mapping;    
08155         char            m_param_function;   
08156         char            m_layout;           
08157         char            m_tiling;           
08158         float           m_value_scale[2];   
08159         int             m_source_dimensions[3]; 
08160         char *          m_transform;        
08161         char            m_apply_mode;       
08162         char            m_param_offset;     
08164         void    set_name (int length);                    
08165         void    set_name (char const * name);             
08166         void    set_image (int length);                   
08167         void    set_image (char const * image);           
08168         void    set_transform (int length);               
08169         void    set_transform (char const * transform);   
08170 
08171     public:
08173         TK_Texture () : BBaseOpcodeHandler (TKE_Texture),
08174             m_name (0), m_shader_source(0), m_image (0), m_camera (0),
08175             m_name_length (0), m_shader_source_length(0), m_image_length (0), m_camera_length (0),
08176             m_transform (0) {
08177                 Reset();
08178             }
08179         ~TK_Texture();
08180 
08181         TK_Status   Read (BStreamFileToolkit & tk);
08182         TK_Status   Write (BStreamFileToolkit & tk);
08183         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08184 
08185         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08186         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08187 
08188         void        Reset ();
08189 
08191         void            SetName (char const * name)                 { set_name (name);              }
08193         void            SetName (int length)                        { set_name (length);            }
08195         char const *    GetName () const                        { return m_name;                }
08197         char *          GetName ()                              { return m_name;                }
08198 
08200         void            SetShaderSource (char const * shader_source);
08202         void            SetShaderSource (int length);
08204         char const *    GetShaderSource () const                            { return m_shader_source;                }
08206         char *          GetShaderSource ()                                  { return m_shader_source;                }
08207 
08209         void            SetImage (char const * image)               { set_image (image);            }
08211         void            SetImage (int length)                       { set_image (length);           }
08213         char const *    GetImage () const                       { return m_image;               }
08215         char *          GetImage ()                             { return m_image;               }
08216 
08218         void            SetCamera (char const * camera);
08220         void            SetCamera (int length);
08222         char const *    GetCamera () const                       { return m_camera;               }
08224         char *          GetCamera ()                             { return m_camera;               }
08225 
08227         void            SetFlags (int f) {
08228                             m_flags = f;
08229                             if ((f & TKO_Texture_Extended_Mask) != 0)
08230                                 m_flags |= TKO_Texture_Extended;
08231                         }
08233         int             GetFlags () const                       { return m_flags;           }
08234 
08236         void            SetParameterSource (int p)                  { m_param_source = (char)p;     }
08238         int             GetParameterSource () const             { return (int)m_param_source;   }
08239 
08241         void            SetInterpolation (int p)                    { m_interpolation = (char)p;    }
08243         int             GetInterpolation () const               { return (int)m_interpolation;  }
08244 
08246         void            SetDecimation (int p)                       { m_decimation = (char)p;       }
08248         int             GetDecimation () const                  { return (int)m_decimation;     }
08249 
08251         void            SetRedMapping (int p)                       { m_red_mapping = (char)p;      }
08253         int             GetRedMapping () const                  { return (int)m_red_mapping;    }
08254 
08256         void            SetGreenMapping (int p)                     { m_green_mapping = (char)p;    }
08258         int             GetGreenMapping () const                { return (int)m_green_mapping;  }
08259 
08261         void            SetBlueMapping (int p)                      { m_blue_mapping = (char)p;     }
08263         int             GetBlueMapping () const                 { return (int)m_blue_mapping;   }
08264 
08266         void            SetAlphaMapping (int p)                     { m_alpha_mapping = (char)p;    }
08268         int             GetAlphaMapping () const                { return (int)m_alpha_mapping;  }
08269 
08271         void            SetParameterFunction (int p)                { m_param_function = (char)p;   }
08273         int             GetParameterFunction () const           { return (int)m_param_function; }
08274 
08276         void            SetLayout (int p)                           { m_layout = (char)p;           }
08278         int             GetLayout () const                      { return (int)m_layout;         }
08279 
08281         void            SetTiling (int p)                           { m_tiling = (char)p;           }
08283         int             GetTiling () const                      { return (int)m_tiling;         }
08284 
08286         void            SetValueScale (float v1, float v2)          { m_value_scale[0] = v1; m_value_scale[1] = v2; }
08288         float const *   GetValueScale () const                  { return m_value_scale;         }
08289 
08291         void            SetApplicationMode (int p)                  { m_apply_mode = (char)p;       }
08293         int             GetApplicationMode () const             { return (int)m_apply_mode;         }
08294 
08296         void            SetParameterOffset (int p)                  { m_param_offset = (char)p;     }
08298         int             GetParameterOffset () const             { return (int)m_param_offset;   }
08299 
08304         void            SetTransform (char const * transform)       { set_transform (transform);    }
08309         void            SetTransform (int length)                   { set_transform (length);       }
08311         char const *    GetTransform () const                   { return m_transform;           }
08313         char *          GetTransform ()                         { return m_transform;           }
08314 };
08315 
08316 
08320 enum TKO_Thumbnail_Formats {
08321     TKO_Thumbnail_RGB       = 0,         
08322     TKO_Thumbnail_RGBA      = 1,         
08323 
08324     TKO_Thumbnail_Invalid   = 0xFF       
08325 };
08326 
08328 
08334 class BBINFILETK_API2 TK_Thumbnail : public BBaseOpcodeHandler {
08335     protected:
08336         unsigned char *         m_bytes;        
08337         int                     m_allocated;    
08338         int                     m_size[2];      
08339         unsigned char           m_format;       
08341     public:
08343     TK_Thumbnail() : BBaseOpcodeHandler (TKE_Thumbnail), m_bytes (0), m_allocated (0), m_format (TKO_Thumbnail_Invalid) {}
08344         ~TK_Thumbnail();
08345 
08346         TK_Status   Read (BStreamFileToolkit & tk);
08347         TK_Status   Write (BStreamFileToolkit & tk);
08348         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08349 
08350         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08351         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08352 
08353         TK_Status   Execute (BStreamFileToolkit & tk);
08354         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant);
08355         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
08356                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
08357         void        Reset ();
08358 
08363         void            SetBytes (int size, unsigned char const * bytes = 0);
08365         unsigned char const *    GetBytes () const                   { return m_bytes;          }
08367         unsigned char *          GetBytes ()                         { return m_bytes;          }
08368 
08370         void            SetSize (int w, int h)                  { m_size[0] = w; m_size[1] = h;     }
08372         void            SetSize (int const * s)                 { m_size[0] = s[0]; m_size[1] = s[1];   }
08374         int const *     GetSize () const                    { return m_size;            }
08375 
08377         void            SetFormat (int f)                       { m_format = (unsigned char)f;      }
08379         int             GetFormat () const                  { return (int)m_format;         }
08380 };
08381 
08382 
08384 
08386 
08391 class BBINFILETK_API2 TK_Glyph_Definition : public BBaseOpcodeHandler {
08392     protected:
08393         int             m_name_length;      
08394         int             m_size;         
08395         char *          m_name;             
08396         char *          m_data;         
08398     public:
08400         TK_Glyph_Definition () : BBaseOpcodeHandler (TKE_Glyph_Definition),
08401             m_name_length (0), m_size (0),
08402             m_name (0), m_data (0) {}
08403         ~TK_Glyph_Definition();
08404 
08405         TK_Status   Read (BStreamFileToolkit & tk);
08406         TK_Status   Write (BStreamFileToolkit & tk);
08407         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08408 
08409         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08410         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08411 
08412         void        Reset ();
08413 
08415         void            SetName (char const * name);
08417         void            SetName (int length);
08419         char const *    GetName () const            { return m_name;    }
08421         char *          GetName ()                  { return m_name;    }
08422 
08424         void            SetDefinition (int size, char const * data = 0);
08426         int     GetDefinitionSize () const      { return m_size;    }
08428         char const *    GetDefinition () const      { return m_data;    }
08430         char *          GetDefinition ()            { return m_data;    }
08431 };
08432 
08433 
08435 
08440 class BBINFILETK_API2 TK_Named_Style_Def : public BBaseOpcodeHandler {
08441     protected:
08442         int             m_name_length;      
08443         char *          m_name;             
08445         int             m_segment_length;   
08446         char *          m_segment;          
08448         int             m_cond_length;          
08449         int             m_cond_allocated;       
08450         char *          m_condition;            
08452         ID_Key          m_key;                  
08453         BBaseOpcodeHandler *     m_referee;     
08454         bool            m_follow;               
08455 
08456     public:
08458         TK_Named_Style_Def () : BBaseOpcodeHandler (TKE_Named_Style_Def),
08459             m_name_length (0), m_name (0),
08460             m_segment_length (0), m_segment (0) , 
08461             m_cond_length (0), m_cond_allocated (0), m_condition (0),
08462             m_key(-1), m_referee(0), m_follow(true) {}
08463         ~TK_Named_Style_Def();
08464 
08465         TK_Status   Read (BStreamFileToolkit & tk);
08466         TK_Status   Write (BStreamFileToolkit & tk);
08467         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08468 
08469         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08470         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08471 
08472         void        Reset ();
08473 
08475         void            SetName (char const * name);
08477         void            SetName (int length);
08479         char const *    GetName () const            { return m_name;    }
08481         char *          GetName ()                  { return m_name;    }
08482 
08487         void            SetSegment (char const * segment);
08492         void            SetSegment (int length);
08496         char const *    GetSegment () const                 { return m_segment; }
08501         char *          GetSegment ()                       { return m_segment; }
08502 };
08503 
08505 
08510 class BBINFILETK_API2 TK_Line_Style : public BBaseOpcodeHandler {
08511     protected:
08512         int             m_name_length;      
08513         int             m_definition_length;
08514         char *          m_name;             
08515         char *          m_definition;       
08517     public:
08519         TK_Line_Style () : BBaseOpcodeHandler (TKE_Line_Style),
08520             m_name_length (0), m_definition_length (0),
08521             m_name (0), m_definition (0) {}
08522         ~TK_Line_Style();
08523 
08524         TK_Status   Read (BStreamFileToolkit & tk);
08525         TK_Status   Write (BStreamFileToolkit & tk);
08526         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08527 
08528         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08529         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08530 
08531         void        Reset ();
08532 
08534         void            SetName (char const * name);
08536         void            SetName (int length);
08538         char const *    GetName () const            { return m_name;        }
08540         char *          GetName ()                  { return m_name;        }
08541 
08543         void            SetDefinition (char const * def);
08545         void            SetDefinition (int length);
08547         char const *    GetDefinition () const  { return m_definition;  }
08549         char *          GetDefinition ()        { return m_definition;  }
08550 };
08551 
08553 
08555 
08560 class BBINFILETK_API TK_Clip_Rectangle : public BBaseOpcodeHandler {
08561     protected:
08562         char            m_options;  
08563         float           m_rect[4];  
08565     public:
08567         TK_Clip_Rectangle ()
08568             : BBaseOpcodeHandler (TKE_Clip_Rectangle), m_options (0) {}
08569 
08570         TK_Status   Read (BStreamFileToolkit & tk);
08571         TK_Status   Write (BStreamFileToolkit & tk);
08572         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08573 
08574         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08575         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08576 
08577         void        Reset ();
08578 
08580         void            SetRectangle (float left, float right, float bottom, float top)
08581                             { m_rect[0] = left;  m_rect[1] = right;  m_rect[2] = bottom;  m_rect[3] = top; }
08583         void            SetRectangle (float const * rect)
08584                             { SetRectangle (rect[0], rect[1], rect[2], rect[3]); }
08586         float const *   GetRectangle () const       { return m_rect;            }
08587 
08589         void            SetOptions (int o)              { m_options = (char)o;      }
08591         int             GetOptions () const         { return (int)m_options;    }
08592 };
08593 
08595 
08599 enum TKO_Clip_Region_Options {
08600     TKO_Clip_Region_World_Space = 0x01,    
08601     TKO_Clip_Region_Window_Space = 0x02,   
08602     TKO_Clip_Region_Object_Space = 0x10,   
08603     TKO_Clip_Region_Clip = 0x04,           
08604     TKO_Clip_Region_Mask = 0x08            
08605 };
08606 
08608 
08613 class BBINFILETK_API TK_Clip_Region : public BBaseOpcodeHandler {
08614     protected:
08615         char            m_options;  
08616         int             m_count;    
08617         float *         m_points;   
08618         double *        m_dpoints;   
08620     public:
08622         TK_Clip_Region ()
08623             : BBaseOpcodeHandler (TKE_Clip_Region), m_options (0), m_count (0), m_points (0), m_dpoints (0) {}
08624         ~TK_Clip_Region();
08625 
08626         TK_Status   Read (BStreamFileToolkit & tk);
08627         TK_Status   Write (BStreamFileToolkit & tk);
08628         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08629 
08630         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08631         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08632 
08633         void        Reset ();
08634 
08639         void            SetPoints (int count, float const * points = 0);
08641         float const *   GetPoints () const          { return m_points;          }
08643         float *         GetPoints ()                { return m_points;          }
08644 
08649         void            SetDPoints (int count, double const * points = 0);
08651         double const *  GetDPoints () const         { return m_dpoints;         }
08653         double *        GetDPoints ()               { return m_dpoints;         }
08654 
08655 
08657         int             GetCount () const           { return m_count;           }
08658 
08659 
08661         void            SetOptions (int o)          { m_options = (char)o;      }
08663         int             GetOptions () const         { return (int)m_options;    }
08664 };
08665 
08666 
08668 
08670 
08686 class BBINFILETK_API2 TK_User_Data : public BBaseOpcodeHandler {
08687     protected:
08688         int             m_size;  
08689         unsigned char *          m_data;  
08690         int             m_buffer_size;   
08692 
08693         void    set_data (int size, unsigned char const * bytes = 0);  
08694 
08695     public:
08697         TK_User_Data ()
08698             : BBaseOpcodeHandler (TKE_Start_User_Data), m_size (0), m_data (0), m_buffer_size(0) {}
08699         ~TK_User_Data();
08700 
08701         TK_Status   Read (BStreamFileToolkit & tk);
08702         TK_Status   Write (BStreamFileToolkit & tk);
08703         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08704 
08705         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08706         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08707 
08708         TK_Status   Execute (BStreamFileToolkit & tk);
08709         void        Reset ();
08710 
08715         void            SetUserData (int size, unsigned char const * bytes = 0)          { set_data (size, bytes);   }
08717         unsigned char const *    GetUserData () const                                { return m_data;            }
08719         unsigned char *          GetUserData ()                                      { return m_data;            }
08721         int             GetSize () const                                    { return m_size;            }
08722 
08724         void            Resize (int size);  
08725 
08727         void            SetSize (int size);
08728 };
08729 
08730 
08732 
08734 
08746 class BBINFILETK_API2 TK_Material : public BBaseOpcodeHandler {
08747     protected:
08748         int                     m_total_size; 
08749 
08752         struct vlist_s *m_data;             
08753 
08754     public:
08756         TK_Material () : BBaseOpcodeHandler (TKE_Material), m_total_size(0), m_data(0) {}
08757         ~TK_Material();
08758 
08759         TK_Status   Read (BStreamFileToolkit & tk);
08760         TK_Status   Write (BStreamFileToolkit & tk);
08761         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08762         void        Reset ();
08763 
08764         TK_Status   PushUserData (char const *buffer, int buffer_size, bool tally_total_size = true);       
08765         TK_Status   GetBlock (char const **ptr, int *buffer_size);      
08766 };
08767 
08769 
08774 class BBINFILETK_API TK_XML : public BBaseOpcodeHandler {
08775     protected:
08776         int             m_size;  
08777         char *          m_data;  
08779     public:
08781         TK_XML (): BBaseOpcodeHandler (TKE_XML), m_size (0), m_data (0) {}
08782         ~TK_XML();
08783 
08784         TK_Status   Read (BStreamFileToolkit & tk);
08785         TK_Status   Write (BStreamFileToolkit & tk);
08786         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08787 
08788         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08789         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08790 
08791         TK_Status   Execute (BStreamFileToolkit & tk);
08792         void        Reset ();
08793 
08798         void            SetXML (int size, char const * data = 0);
08802         void            AppendXML (int size, char const * data = 0);
08804         char const *    GetXML () const                     { return m_data;            }
08806         char *          GetXML ()                           { return m_data;            }
08808         int             GetSize () const                    { return m_size;            }
08809 };
08810 
08811 
08812 
08814 
08820 class BBINFILETK_API TK_URL : public BBaseOpcodeHandler {
08821     protected:
08822         int             m_length;       
08823         int             m_allocated;    
08824         char *          m_string;       
08826     public:
08828         TK_URL () : BBaseOpcodeHandler (TKE_URL),
08829                                     m_length (0), m_allocated (0), m_string (0) {}
08830         ~TK_URL();
08831 
08832         TK_Status   Read (BStreamFileToolkit & tk);
08833         TK_Status   Write (BStreamFileToolkit & tk);
08834         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08835 
08836         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08837         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08838 
08839         void        Reset ();
08840 
08842         void            SetString (char const * string);
08844         void            SetString (int length);
08846         char const *    GetString () const                  { return m_string;      }
08848         char *          GetString ()                        { return m_string;      }
08849 };
08850 
08851 
08853 
08859 class BBINFILETK_API TK_External_Reference : public BBaseOpcodeHandler {
08860     protected:
08861         int             m_length;       
08862         int             m_allocated;    
08863         char *          m_string;       
08865     public:
08866         TK_External_Reference () : BBaseOpcodeHandler (TKE_External_Reference),
08867                                     m_length (0), m_allocated (0), m_string (0) {}
08868         ~TK_External_Reference();
08869 
08870         TK_Status   Read (BStreamFileToolkit & tk);
08871         TK_Status   Write (BStreamFileToolkit & tk);
08872         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08873 
08874         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08875         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08876 
08877         TK_Status   Execute (BStreamFileToolkit & tk);
08878         void        Reset ();
08879 
08881         void            SetString (char const * string);
08883         void            SetString (int length);
08885         char const *    GetString () const                  { return m_string;      }
08887         char *          GetString ()                        { return m_string;      }
08888 };
08889 
08890 
08892 
08898 class BBINFILETK_API TK_External_Reference_Unicode : public BBaseOpcodeHandler {
08899     protected:
08900         int             m_length;       
08901         int             m_allocated;    
08902         wchar_t *       m_string;       
08904     public:
08905         TK_External_Reference_Unicode () : BBaseOpcodeHandler (TKE_External_Reference_Unicode),
08906                                     m_length (0), m_allocated (0), m_string (0) {}
08907         ~TK_External_Reference_Unicode();
08908 
08909         TK_Status   Read (BStreamFileToolkit & tk);
08910         TK_Status   Write (BStreamFileToolkit & tk);
08911         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08912 
08913         TK_Status   Execute (BStreamFileToolkit & tk);
08914         void        Reset ();
08915 
08917         void            SetString (__wchar_t const * string);
08918 #ifdef _MSC_VER
08919         void            SetString (unsigned short const * string);
08920 #endif
08921 
08922         void            SetString (int length);
08924         wchar_t const *    GetString () const                  { return m_string;      }
08926         wchar_t *          GetString ()                        { return m_string;      }
08927 };
08928 
08929 
08930 #endif //BOPCODE_HANDLER
08931