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: 8e8e7d7d6adc50bfd318cc472014974bb776cadd $
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             }                                                                                              //
00795 
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_Peeling_Buffer                  = 0,    
02683     TKO_Peeling_Pixel                   = 1,    
02684 
02685     TKO_Transparency_None               = 0x0000,   
02686     TKO_Transparency_Blending           = 0x0001,   
02687     TKO_Transparency_Screen_Door        = 0x0002,   
02688     TKO_Transparency_Style_Mask         = 0x000F,   
02689     TKO_Transparency_Peeling_Layers     = 0x0010,   
02690     TKO_Transparency_Peeling_Min_Area   = 0x0020,   
02691     TKO_Transparency_Peeling_Algorithm  = 0x0040,   
02692     TKO_Transparency_Extended           = 0x0080,   
02693     TKO_Transparency_Extended_Mask      = 0xFF00,   
02694     TKO_Transparency_Extended_Shift     = 8,        
02695     TKO_Transparency_ZSort_Fast         = 0x0100,   
02696     TKO_Transparency_ZSort_Nice         = 0x0200,   
02697 
02698 
02699     TKO_Cut_Geometry_Level                  = 0x01,   
02700     TKO_Cut_Geometry_Tolerance              = 0x02,   
02701     TKO_Cut_Geometry_Match_Color            = 0x04,   
02702     TKO_Cut_Geometry_Level_Entity           = 0,   
02703     TKO_Cut_Geometry_Level_Segment          = 1,   
02704     TKO_Cut_Geometry_Level_Segment_Tree     = 2,   
02705     TKO_Cut_Geometry_Match_Color_Off        = 0,   
02706     TKO_Cut_Geometry_Match_Color_Current    = 1,   
02707     TKO_Cut_Geometry_Match_Color_First      = 2,   
02708     TKO_Cut_Geometry_Match_Color_Last       = 3,   
02709 
02710     TKO_Display_List_Level_Entity           = 0,   
02711     TKO_Display_List_Level_Segment          = 1,   
02712     TKO_Display_List_Level_Segment_Tree     = 2,   
02713 
02714     TKO_Simple_Shadow_On                = 0x0001,   
02715     TKO_Simple_Shadow_Off               = 0x0002,   
02716     TKO_Simple_Shadow_Plane             = 0x0004,   
02717     TKO_Simple_Shadow_Light_Direction   = 0x0008,   
02718     TKO_Simple_Shadow_Color             = 0x0010,   
02719     TKO_Simple_Shadow_Resolution        = 0x0020,   
02720     TKO_Simple_Shadow_Blur              = 0x0040,   
02721     TKO_Simple_Shadow_Extended          = 0x0080,   // internal use, indicates presence of extended bits
02722     TKO_Simple_Shadow_Extended_Mask     = 0xFF00,   // internal use, indicates bits which require TKO_Simple_Shadow_Extended
02723     TKO_Simple_Shadow_Extended_Shift    = 8,        // internal use, shift of extended section
02724     TKO_Simple_Shadow_Auto              = 0x0100,   
02725     TKO_Simple_Shadow_Opacity           = 0x0200,   
02726     TKO_Simple_Shadow_Ignore_Transparency=0x0400,   
02727     TKO_Simple_Shadow_Use_Transparency  = 0x0800,   
02728     TKO_Simple_Shadow_Extended2         = 0x8000,   // reserved for future expansion
02729 
02730     TKO_Shadow_Map_On                   = 0x0001,   
02731     TKO_Shadow_Map_Off                  = 0x0002,   
02732     TKO_Shadow_Map_Resolution           = 0x0004,   
02733     TKO_Shadow_Map_Samples              = 0x0008,   
02734     TKO_Shadow_Map_Jitter_On            = 0x0010,   
02735     TKO_Shadow_Map_Jitter_Off           = 0x0020,   
02736     TKO_Shadow_Map_Extended             = 0x0080,   // indicates presence of extended bits
02737     TKO_Shadow_Map_View_Depedent_On     = 0x0100,   
02738     TKO_Shadow_Map_View_Depedent_Off    = 0x0200,   
02739     TKO_Shadow_Map_Extended_Mask        = 0xFF00,   // mask of bits requiring extended
02740     TKO_Shadow_Map_Extended2            = 0x8000,   // reserved for future expansion
02741 
02742     TKO_Simple_Reflection_On            = 0x0001,   
02743     TKO_Simple_Reflection_Off           = 0x0002,   
02744     TKO_Simple_Reflection_Plane         = 0x0004,   
02745     TKO_Simple_Reflection_Opacity       = 0x0008,   
02746     TKO_Simple_Reflection_Fading_On     = 0x0010,   
02747     TKO_Simple_Reflection_Fading_Off    = 0x0020,   
02748     TKO_Simple_Reflection_Blur          = 0x0040,   
02749     TKO_Simple_Reflection_Extended      = 0x0080,   
02750     TKO_Simple_Reflection_Extended_Mask = 0xFF00,   
02751     TKO_Simple_Reflection_Extended_Shift= 8,        
02752     TKO_Simple_Reflection_Attenuation   = 0x0100,   
02753     TKO_Simple_Reflection_Visibility    = 0x0200,   
02754     TKO_Simple_Reflection_Extended2     = 0x8000,   // reserved for future expansion
02755 
02756     TKO_Mask_None                       = 0x0000,   
02757     TKO_Mask_Camera_Rotation            = 0x0001,   
02758     TKO_Mask_Camera_Scale               = 0x0002,   
02759     TKO_Mask_Camera_Translation         = 0x0004,   
02760     TKO_Mask_Camera_Perspective         = 0x0008,   
02761     TKO_Mask_Model_Rotation             = 0x0010,   
02762     TKO_Mask_Model_Scale                = 0x0020,   
02763     TKO_Mask_Model_Translation          = 0x0040,   
02764     TKO_Mask_Camera                     = 0x000F,   
02765     TKO_Mask_Model                      = 0x0070,   
02766     TKO_Mask_All                        = 0x007F,   
02767     TKO_Mask_Extended                   = 0x0080,   
02768     TKO_Mask_Extended_Mask              = 0xFF00,   
02769     TKO_Mask_Extended_Shift             = 8,        
02770     TKO_Mask_Camera_Offset              = 0x0100,   
02771     TKO_Mask_Model_Offset               = 0x0200,   
02772 
02773     TKO_Technology_Standard             = 0x01,             
02774     TKO_Technology_Soft_Frame_Buffer    = 0x02,             
02775     TKO_Technology_Radiosity            = 0x04,             
02776     TKO_Technology_Ray_Trace            = 0x08,             
02777     TKO_Technology_Mask                 = 0x0F,             
02778 
02779     TKO_Quantization_Threshold          = 0x10,             
02780     TKO_Quantization_Dither             = 0x20,             
02781     TKO_Quantization_Error_Diffusion    = 0x40,             
02782     TKO_Quantization_Mask               = 0xF0,             
02783 
02784     TKO_Buffer_Size_Limit               = 0x01,             
02785     TKO_Buffer_Retention                = 0x02,             
02786     TKO_Buffer_Color_Depth_Match        = 0x04,             
02787     TKO_Buffer_Color_Depth_Full         = 0x08,             
02788 
02789     TKO_Antialias_Screen_On             = 0x01,             
02790     TKO_Antialias_Lines_On              = 0x02,             
02791     TKO_Antialias_Text_On               = 0x04,             
02792     TKO_Antialias_All_On                = 0x07,             
02793     TKO_Antialias_Screen_Off            = 0x10,             
02794     TKO_Antialias_Lines_Off             = 0x20,             
02795     TKO_Antialias_Text_Off              = 0x40,             
02796     TKO_Antialias_All_Off               = 0x70,             
02797 
02798     TKO_Hidden_Line_Visibility_On           = 0x00000001,   
02799     TKO_Hidden_Line_Visibility_Off          = 0x00000002,   
02800     TKO_Hidden_Line_Pattern                 = 0x00000004,   
02801     TKO_Hidden_Line_Face_Displacement       = 0x00000008,   
02802     TKO_Hidden_Line_Dim_Factor              = 0x00000010,   
02803     TKO_Hidden_Line_Render_Faces_On         = 0x00000020,   
02804     TKO_Hidden_Line_Render_Faces_Off        = 0x00000040,   
02805     TKO_Hidden_Line_Extended                = 0x00000080,   
02806     TKO_Hidden_Line_Extended_Mask           = 0xFFFFFF00,   
02807     TKO_Hidden_Line_Extended_Shift          = 8,            
02808     TKO_Hidden_Line_Silhouette_Cleanup_On   = 0x00000100,   
02809     TKO_Hidden_Line_Silhouette_Cleanup_Off  = 0x00000200,   
02810     TKO_Hidden_Line_Extended2               = 0x00008000,   
02811     TKO_Hidden_Line_Extended2_Mask          = 0xFFFF0000,   
02812     TKO_Hidden_Line_Extended2_Shift         = 16,           
02813     TKO_Hidden_Line_Color                   = 0x00010000,   
02814     TKO_Hidden_Line_Weight                  = 0x00020000,   
02815     TKO_Hidden_Line_Image_Outline_On        = 0x00040000,   
02816     TKO_Hidden_Line_Image_Outline_Off       = 0x00080000,   
02817     TKO_Hidden_Line_HSR_Algorithm           = 0x00100000,   
02818     TKO_Hidden_Line_Render_Text_On          = 0x00200000,   
02819     TKO_Hidden_Line_Render_Text_Off         = 0x00400000,   
02820     TKO_Hidden_Line_Transparency_Cutoff     = 0x00800000,   
02821     TKO_Hidden_Line_Remove_Duplicates_On    = 0x01000000,   
02822     TKO_Hidden_Line_Remove_Duplicates_Off   = 0x02000000,   
02823 
02824     TKO_Contour_Face_Visibility_On      = 0x0001,   
02825     TKO_Contour_Face_Visibility_Off     = 0x0002,   
02826     TKO_Contour_Isoline_Visibility_On   = 0x0004,   
02827     TKO_Contour_Isoline_Visibility_Off  = 0x0008,   
02828     TKO_Contour_Visibility_Mask         = 0x000F,   
02829     TKO_Contour_Value_Adjustment        = 0x0010,   
02830 
02831     TKO_Contour_Adjustment_None         = 0,    
02832     TKO_Contour_Adjustment_Normalized   = 1,    
02833     TKO_Contour_Adjustment_Explicit     = 2,    
02834 
02835     TKO_Isoline_Positions       = 0x0001,   
02836     TKO_Isoline_Colors          = 0x0002,   
02837     TKO_Isoline_Patterns        = 0x0004,   
02838     TKO_Isoline_Weights         = 0x0008,   
02839     TKO_Isoline_Lighting_On     = 0x0010,   
02840     TKO_Isoline_Lighting_Off    = 0x0020,   
02841 
02842     TKO_Isoline_Positions_Default   = 0,    
02843     TKO_Isoline_Positions_Repeat    = 1,    
02844     TKO_Isoline_Positions_Explicit  = 2,    
02845 
02846     TKO_Tint_On         = 0x0001,   
02847     TKO_Tint_Off        = 0x0002,   
02848     TKO_Tint_Range      = 0x0004,   
02849     TKO_Tint_Color      = 0x0008,   
02850     TKO_Tint_Effect     = 0x0010,   
02851 
02852     TKO_Tint_Effect_Grayscale       = 1,    
02853     TKO_Tint_Effect_Modulate        = 2,    
02854     TKO_Tint_Effect_Modulate_Gray   = 3,    
02855     TKO_Tint_Effect_Tone            = 4,    
02856 
02857     TKO_LOD_Conserve_Memory             = 0x00000001,       
02858     TKO_LOD_Screen_Space                = 0x00000002,       
02859     TKO_LOD_Physical                    = 0x00000004,       
02860     TKO_LOD_Tolerance_FRU               = 0x00000008,       
02861     TKO_LOD_Tolerance_ORU               = 0x00000010,       
02862     TKO_LOD_Preprocess                  = 0x00000020,       
02863     TKO_LOD_Bounding_Current            = 0x00000040,       
02864     TKO_LOD_Bounding_Explicit           = 0x00000080,       
02865     TKO_LOD_Ratio                       = 0x00000100,       
02866     TKO_LOD_Threshold                   = 0x00000200,       
02867     TKO_LOD_Min_Triangle_Count          = 0x00000400,       
02868     TKO_LOD_Clamp                       = 0x00000800,       
02869     TKO_LOD_Num_Levels                  = 0x00001000,       
02870     TKO_LOD_Max_Degree                  = 0x00002000,       
02871     TKO_LOD_Tolerance                   = 0x00004000,       
02872     TKO_LOD_Usefulness_Heuristic        = 0x00008000,       
02873     TKO_LOD_Calculation_Cutoff          = 0x00010000,       
02874     TKO_LOD_Fallback                    = 0x00020000,       
02875     TKO_LOD_Collapse_Vertices           = 0x00040000,       
02876     TKO_LOD_Algorithm                   = 0x00080000,       
02877     TKO_LOD_Mode_Segment                = 0x00100000,       
02878 
02879     TKO_LOD_Threshold_Tris_Per_Pix_Sq   = 1,    
02880     TKO_LOD_Threshold_Tris_Per_CM_Sq    = 2,    
02881     TKO_LOD_Threshold_Percent_Area      = 3,    
02882     TKO_LOD_Threshold_Distance          = 4,    
02883 
02884     TKO_LOD_Algorithm_Fast              = 1,    
02885     TKO_LOD_Algorithm_Nice              = 2,    
02886 
02887     TKO_LOD_Heur_Is_Diagonal            = 0x00,    
02888     TKO_LOD_Heur_Is_Per_Triangle        = 0x01,    
02889     TKO_LOD_Heur_Is_Ratio               = 0x02,    
02890     TKO_LOD_Heur_Is_Volume              = 0x04,    
02891     TKO_LOD_Heur_Triangle_Size          = 0x08,    
02892 
02893     TKO_LOD_Heur_Diag                   = 0,    
02894     TKO_LOD_Heur_Tri_Diag               = 1,    
02895     TKO_LOD_Heur_Diag_Ratio             = 2,    
02896     TKO_LOD_Heur_Tri_Diag_Ratio         = 3,    
02897     TKO_LOD_Heur_Vol                    = 4,    
02898     TKO_LOD_Heur_Tri_Vol                = 5,    
02899     TKO_LOD_Heur_Vol_Ratio              = 6,    
02900     TKO_LOD_Heur_Tri_Vol_Ratio          = 7,    
02901 
02902     TKO_LOD_Fallback_None               = 0,    
02903     TKO_LOD_Fallback_Bounding           = 1,    
02904     TKO_LOD_Fallback_Coarsest           = 2,    
02905     TKO_LOD_Fallback_Coarsest_None      = 3,    
02906     TKO_LOD_Fallback_Coarsest_Bounding  = 4,    
02907     TKO_LOD_Fallback_Bounding_None      = 5,    
02908 
02909     TKO_NURBS_Curve_Budget              = 0x0001,    
02910     TKO_NURBS_Curve_Continued_Budget    = 0x0002,    
02911     TKO_NURBS_Curve_View_Dependent      = 0x0004,    
02912     TKO_NURBS_Curve_Max_Deviation       = 0x0008,    
02913     TKO_NURBS_Surface_Budget            = 0x0010,    
02914     TKO_NURBS_Surface_Trim_Budget       = 0x0020,    
02915     TKO_NURBS_Surface_Max_Facet_Width   = 0x0040,    
02916     TKO_NURBS_Curve_Max_Angle           = 0x1000,    
02917     TKO_NURBS_Curve_Max_Length          = 0x2000,    
02918 
02919     TKO_NURBS_Extended                  = 0x0080,   
02920     TKO_NURBS_Extended_Mask             = 0xFF00,   
02921     TKO_NURBS_Extended_Shift            = 8,        
02922 
02923     TKO_NURBS_Surface_Max_Facet_Angle   = 0x0100,    
02924     TKO_NURBS_Surface_Max_Facet_Deviation
02925                                         = 0x0200,    
02926     TKO_NURBS_Surface_Max_Trim_Curve_Deviation
02927                                         = 0x0400,    
02928 
02929     TKO_NURBS_Curve_Mask                = 0xF00F,    
02930     TKO_NURBS_Surface_Mask              = 0x0FF0,    
02931 
02932     TKO_Tessellation_Cylinder           = 0x01,   
02933     TKO_Tessellation_Sphere             = 0x02,   
02934 
02935     TKO_Geometry_Options_Dihedral       = 0x01,   
02936     TKO_Geometry_Options_Reverse_PolyCylinder_Radii     = 0x02,   
02937     TKO_Geometry_Options_No_Reverse_PolyCylinder_Radii  = 0x04,   
02938     TKO_Geometry_Options_Reverse_PolyCylinder_Colors    = 0x08,   
02939     TKO_Geometry_Options_No_Reverse_PolyCylinder_Colors = 0x10    
02940 };
02941 
02942 
02943 #if 0
02944 class BBINFILETK_API TK_Radiosity_RayTrace_Options : public BBaseOpcodeHandler {
02945     protected:
02946 
02947     public:
02948         TK_Radiosity_RayTrace_Options () : BBaseOpcodeHandler (TKE_Radiosity_RayTrace_Options) {}
02949         ~TK_Radiosity_RayTrace_Options () {}
02950 
02951         TK_Status   Read (BStreamFileToolkit & tk);
02952         TK_Status   Write (BStreamFileToolkit & tk);
02953 
02954         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
02955         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
02956 };
02957 #endif
02958 
02959 
02961 
02967 class BBINFILETK_API TK_Rendering_Options : public BBaseOpcodeHandler {
02968     protected:
02969         int             m_mask[3];  
02970         int             m_value[3]; 
02971 
02972         unsigned char   m_hsr;      
02973         unsigned char   m_tq;       
02974         int             m_debug;                
02975         int             m_face_displacement;    
02976         int             m_vertex_displacement;    
02977 
02978         float           m_fog_limits[2];        
02979 
02980         Lock_Masks      m_lock;                 
02981         Lock_Masks      m_forced;               
02982 
02983         unsigned char   m_buffer_options_mask;  
02984         unsigned char   m_buffer_options_value; 
02985         int             m_buffer_size_limit;    
02986 
02987         int             m_hlr_options;          
02988         float           m_hlr_dim_factor;       
02989         float           m_hlr_face_displacement;
02990         float           m_hlr_transparency_cutoff;
02991         int             m_hlr_line_pattern;     
02992         float           m_hlr_color[3];     
02993         float           m_hlr_weight;       
02994         unsigned char   m_hlr_weight_units; 
02995         unsigned char   m_hlr_hsr_algorithm;    
02996 
02997         unsigned short  m_contour_options;          
02998         unsigned short  m_isoline_options;          
02999         char            m_contour_value_adjustment; 
03000         float           m_contour_value_scale;      
03001         float           m_contour_value_translate;  
03002         char            m_isoline_position_type;    
03003         int             m_isoline_position_count;   
03004         float *         m_isoline_positions;        
03005         int             m_isoline_color_count;      
03006         float *         m_isoline_colors;           
03007         int             m_isoline_pattern_count;    
03008         char **         m_isoline_patterns;         
03009         int             m_isoline_weight_count;     
03010         float *         m_isoline_weights_value;    
03011         unsigned char * m_isoline_weights_unit;     
03012 
03013         unsigned short  m_tint_options;         
03014         float           m_tint_color[3];        
03015         float           m_tint_range[2];        
03016         char            m_tint_effect;          
03017 
03018         int             m_lod_options_mask;     
03019         int             m_lod_options_value;    
03020         char            m_lod_algorithm;        
03021         char            m_num_ratios;           
03022         float           m_ratio[8];             
03023         char            m_num_thresholds;       
03024         float           m_threshold[8];         
03025         char            m_threshold_type;       
03026         int             m_min_triangle_count;   
03027         unsigned char   m_clamp;                
03028         unsigned char   m_num_levels;           
03029         int             m_max_degree;           
03030         float           m_tolerance;            
03031         float           m_bounding[6];          
03032         char            m_num_cutoffs;          
03033         float           m_cutoff[8];            
03034         unsigned char   m_heuristic;            
03035         unsigned char   m_fallback;             
03036 
03037         int             m_nurbs_options_mask;   
03038         int             m_nurbs_options_value;  
03039         int             m_curve_budget;         
03040         int             m_curve_continued_budget;
03041         int             m_surface_budget;       
03042         int             m_surface_trim_budget;  
03043         float           m_surface_max_trim_curve_deviation;
03044         float           m_surface_max_facet_angle;
03045         float           m_surface_max_facet_deviation;
03046         float           m_surface_max_facet_width;
03047         float           m_curve_max_angle;          
03048         float           m_curve_max_deviation;      
03049         float           m_curve_max_length;         
03050 
03051         float           m_stereo_separation;        
03052         float           m_stereo_distance;          
03053 
03054         unsigned char   m_tessellations;            
03055         char            m_num_cylinder;             
03056         char            m_cylinder[8];              
03057         char            m_num_sphere;               
03058         char            m_sphere[8];                
03059 
03060         float           m_gooch_color_range[2];     
03061         float           m_gooch_diffuse_weight;     
03062         char *          m_gooch_color_map_segment;          
03063         int             m_gooch_color_map_segment_length;   
03064         unsigned short  m_transparency_options;     
03065 
03066         unsigned char   m_cut_geometry;             
03067         unsigned char   m_cut_geometry_level;       
03068         unsigned char   m_cut_geometry_match;       
03069         float           m_cut_geometry_tolerance;   
03070 
03071         unsigned short  m_simple_shadow;            
03072         unsigned char   m_simple_shadow_blur;       
03073         unsigned short  m_simple_shadow_resolution; 
03074         float           m_simple_shadow_plane[4];   
03075         float           m_simple_shadow_light[3];   
03076         float           m_simple_shadow_color[3];   
03077         float           m_simple_shadow_opacity;
03078 
03079         unsigned short  m_shadow_map;               
03080         unsigned short  m_shadow_map_resolution;    
03081         unsigned char   m_shadow_map_samples;       
03082 
03083         unsigned short  m_simple_reflection;        
03084         float           m_simple_reflection_plane[4]; 
03085         float           m_simple_reflection_opacity;
03086         int             m_simple_reflection_blur;   
03087         float           m_simple_reflection_hither; 
03088         float           m_simple_reflection_yon;    
03089         int             m_simple_reflection_visibility_mask; 
03090         int             m_simple_reflection_visibility_value;
03091 
03092         float           m_depth_range[2];       
03093         float           m_screen_range[4];      
03094         float           m_ambient_up_vector[3]; 
03095         float           m_image_scale[2];       
03096         unsigned short  m_mask_transform;       
03097 
03098         unsigned char   m_geometry_options;     
03099         float           m_dihedral;             
03100 
03101         float           m_image_tint_color[3];   
03102         float           m_texture_tint_color[3];   
03103         unsigned char   m_depth_peeling_layers;  
03104         float           m_depth_peeling_min_area;
03105         unsigned char   m_depth_peeling_algorithm;  
03106 
03107         int             m_general_displacement;    
03108         int             m_join_cutoff_angle;    
03109         int             m_edge_join_cutoff_angle;    
03110         float           m_vertex_decimation;    
03111         unsigned char   m_display_list_level;    
03112         unsigned char   m_antialias;
03113 
03114         int             m_extra;
03115 
03116 #if 0
03117         TK_Radiosity_RayTrace_Options   *m_rrt; 
03118 #endif
03119 
03120     public:
03122         TK_Rendering_Options ();
03123         ~TK_Rendering_Options ();
03124 
03125         TK_Status   Read (BStreamFileToolkit & tk);
03126         TK_Status   Write (BStreamFileToolkit & tk);
03127         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
03128 
03129         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
03130         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
03131 
03132         void        Reset ();
03133 
03135         void            SetMask (int m0, int m1=0, int m2=0) {
03136                             m_mask[0] = m0;
03137                             m_mask[1] = m1;
03138                             m_mask[2] = m2;
03139                             if (m2 != 0)
03140                                 m_mask[1] |= TKO_Rendo_Extended;
03141                             if (m1 != 0)
03142                                 m_mask[0] |= TKO_Rendo_Extended;
03143                         }
03145         int             GetMask (int index=0) const         { return m_mask[index];             }
03146 
03148         void            SetValue (int v0, int v1=0, int v2=0)         { m_value[0] = v0; m_value[1] = v1; m_value[2] = v2; }
03150         int             GetValue (int index=0) const        { return m_value[index];            }
03151 
03153         void            SetHSR (int h)                  { m_hsr &= 0xF0; m_hsr |= (unsigned char)h & 0x0F;  }
03155         int             GetHSR () const             { return (int)(m_hsr & 0x0F);                       }
03156 
03158         void            SetTransparentHSR (int t)       { m_hsr &= 0x0F; m_hsr |= (unsigned char)t << 4;    }
03160         int             GetTransparentHSR () const  { return (int)(m_hsr >> 4);                         }
03161 
03163         void            SetTransparentStyle (int s)       { m_transparency_options = (unsigned short)s;      }
03165         int             GetTransparentStyle () const  { return (int)m_transparency_options;             }
03166 
03168         void            SetTechnology (int t)           { m_tq &= 0xF0; m_tq |= (unsigned char)t & 0x0F;    }
03170         int             GetTechnology () const      { return (int)(m_tq & 0x0F);                        }
03171 
03173         void            SetQuantization (int q)         { m_tq &= 0x0F; m_tq |= (unsigned char)q << 4;      }
03175         int             GetQuantization () const    { return (int)(m_tq >> 4);                          }
03176 
03178         void            SetDebug (int d)                { m_debug = d;                                      }
03180         int             GetDebug () const           { return m_debug;                                   }
03181 
03183         void            SetFaceDisplacement (int d)         { m_face_displacement = d;                      }
03185         int             GetFaceDisplacement () const    { return m_face_displacement;                   }
03186 
03188         void            SetVertexDisplacement (int d)         { m_vertex_displacement = d;                      }
03190         int             GetVertexDisplacement () const    { return m_vertex_displacement;                   }
03191 
03193         void            SetGeneralDisplacement (int d)         { m_general_displacement = d;                      }
03195         int             GetGeneralDisplacement () const    { return m_general_displacement;                   }
03196 
03198         void            SetJoinCutoffAngle (int d)         { m_join_cutoff_angle = d;                       }
03200         int             GetJoinCutoffAngle () const    { return m_join_cutoff_angle;                    }
03201 
03203         void            SetFogLimits (float n, float f)         { m_fog_limits[0] = n; m_fog_limits[1] = f; }
03205         void            SetFogLimits (float const * l)          { SetFogLimits (l[0], l[1]);                }
03207         float const *   GetFogLimits () const               { return m_fog_limits;                      }
03208 
03209 
03211         void            SetLockMask (int m)                     { m_lock.mask = m;                  }
03213         int             GetLockMask () const                { return m_lock.mask;               }
03214 
03216         void            SetLockValue (int v)                    { m_lock.value = v;                 }
03218         int             GetLockValue () const               { return m_lock.value;              }
03219 
03224         void            SetVisibilityLockMask (int m)           { m_lock.visibility_mask = m;       }
03229         int             GetVisibilityLockMask () const      { return m_lock.visibility_mask;    }
03230 
03235         void            SetVisibilityLockValue (int v)          { m_lock.visibility_value = v;      }
03240         int             GetVisibilityLockValue () const     { return m_lock.visibility_value;   }
03241 
03242 
03247         void            SetColorLockMask (int m)           { m_lock.color_mask = m;       }
03252         int             GetColorLockMask () const      { return m_lock.color_mask;    }
03253 
03258         void            SetColorLockValue (int v)          { m_lock.color_value = v;      }
03263         int             GetColorLockValue () const     { return m_lock.color_value;   }
03264 
03265 
03270         void            SetColorFaceLockMask (int m)                { m_lock.color_face_mask = (short)m;     }
03275         int             GetColorFaceLockMask () const           { return m_lock.color_face_mask;         }
03276 
03281         void            SetColorFaceLockValue (int v)               { m_lock.color_face_value = (short)v;    }
03286         int             GetColorFaceLockValue () const          { return m_lock.color_face_value;        }
03287 
03288 
03293         void            SetColorEdgeLockMask (int m)                { m_lock.color_edge_mask = (short)m;     }
03298         int             GetColorEdgeLockMask () const           { return m_lock.color_edge_mask;         }
03299 
03304         void            SetColorEdgeLockValue (int v)               { m_lock.color_edge_value = (short)v;    }
03309         int             GetColorEdgeLockValue () const          { return m_lock.color_edge_value;        }
03310 
03311 
03316         void            SetColorLineLockMask (int m)                { m_lock.color_line_mask = (short)m;     }
03321         int             GetColorLineLockMask () const           { return m_lock.color_line_mask;         }
03322 
03327         void            SetColorLineLockValue (int v)               { m_lock.color_line_value = (short)v;    }
03332         int             GetColorLineLockValue () const          { return m_lock.color_line_value;        }
03333 
03334 
03339         void            SetColorMarkerLockMask (int m)                { m_lock.color_marker_mask = (short)m;     }
03344         int             GetColorMarkerLockMask () const           { return m_lock.color_marker_mask;         }
03345 
03350         void            SetColorMarkerLockValue (int v)               { m_lock.color_marker_value = (short)v;    }
03355         int             GetColorMarkerLockValue () const          { return m_lock.color_marker_value;        }
03356 
03357 
03362         void            SetColorTextLockMask (int m)                { m_lock.color_text_mask = (short)m;     }
03367         int             GetColorTextLockMask () const           { return m_lock.color_text_mask;         }
03368 
03373         void            SetColorTextLockValue (int v)               { m_lock.color_text_value = (short)v;    }
03378         int             GetColorTextLockValue () const          { return m_lock.color_text_value;        }
03379 
03380 
03385         void            SetColorWindowLockMask (int m)                { m_lock.color_window_mask = (short)m;     }
03390         int             GetColorWindowLockMask () const           { return m_lock.color_window_mask;         }
03391 
03396         void            SetColorWindowLockValue (int v)               { m_lock.color_window_value = (short)v;    }
03401         int             GetColorWindowLockValue () const          { return m_lock.color_window_value;        }
03402 
03403 
03408         void            SetColorFaceContrastLockMask (int m)                { m_lock.color_face_contrast_mask = (short)m;     }
03413         int             GetColorFaceContrastLockMask () const           { return m_lock.color_face_contrast_mask;         }
03414 
03419         void            SetColorFaceContrastLockValue (int v)               { m_lock.color_face_contrast_value = (short)v;    }
03424         int             GetColorFaceContrastLockValue () const          { return m_lock.color_face_contrast_value;        }
03425 
03426 
03431         void            SetColorWindowContrastLockMask (int m)                { m_lock.color_window_contrast_mask = (short)m;     }
03436         int             GetColorWindowContrastLockMask () const           { return m_lock.color_window_contrast_mask;         }
03437 
03442         void            SetColorWindowContrastLockValue (int v)               { m_lock.color_window_contrast_value = (short)v;    }
03447         int             GetColorWindowContrastLockValue () const          { return m_lock.color_window_contrast_value;        }
03448 
03449 
03454         void            SetColorBackLockMask (int m)                { m_lock.color_back_mask = (short)m;     }
03459         int             GetColorBackLockMask () const           { return m_lock.color_back_mask;         }
03460 
03465         void            SetColorBackLockValue (int v)               { m_lock.color_back_value = (short)v;    }
03470         int             GetColorBackLockValue () const          { return m_lock.color_back_value;        }
03471 
03472 
03477         void            SetColorVertexLockMask (int m)                { m_lock.color_vertex_mask = (short)m;     }
03482         int             GetColorVertexLockMask () const           { return m_lock.color_vertex_mask;         }
03483 
03488         void            SetColorVertexLockValue (int v)               { m_lock.color_vertex_value = (short)v;    }
03493         int             GetColorVertexLockValue () const          { return m_lock.color_vertex_value;        }
03494 
03495 
03500         void            SetColorEdgeContrastLockMask (int m)                { m_lock.color_edge_contrast_mask = (short)m;     }
03505         int             GetColorEdgeContrastLockMask () const           { return m_lock.color_edge_contrast_mask;         }
03506 
03511         void            SetColorEdgeContrastLockValue (int v)               { m_lock.color_edge_contrast_value = (short)v;    }
03516         int             GetColorEdgeContrastLockValue () const          { return m_lock.color_edge_contrast_value;        }
03517 
03518 
03523         void            SetColorLineContrastLockMask (int m)                { m_lock.color_line_contrast_mask = (short)m;     }
03528         int             GetColorLineContrastLockMask () const           { return m_lock.color_line_contrast_mask;         }
03529 
03534         void            SetColorLineContrastLockValue (int v)               { m_lock.color_line_contrast_value = (short)v;    }
03539         int             GetColorLineContrastLockValue () const          { return m_lock.color_line_contrast_value;        }
03540 
03541 
03546         void            SetColorMarkerContrastLockMask (int m)                { m_lock.color_marker_contrast_mask = (short)m;     }
03551         int             GetColorMarkerContrastLockMask () const           { return m_lock.color_marker_contrast_mask;         }
03552 
03557         void            SetColorMarkerContrastLockValue (int v)               { m_lock.color_marker_contrast_value = (short)v;    }
03562         int             GetColorMarkerContrastLockValue () const          { return m_lock.color_marker_contrast_value;        }
03563 
03564 
03569         void            SetColorVertexContrastLockMask (int m)                { m_lock.color_vertex_contrast_mask = (short)m;     }
03574         int             GetColorVertexContrastLockMask () const           { return m_lock.color_vertex_contrast_mask;         }
03575 
03580         void            SetColorVertexContrastLockValue (int v)               { m_lock.color_vertex_contrast_value = (short)v;    }
03585         int             GetColorVertexContrastLockValue () const          { return m_lock.color_vertex_contrast_value;        }
03586 
03587 
03592         void            SetColorTextContrastLockMask (int m)                { m_lock.color_text_contrast_mask = (short)m;     }
03597         int             GetColorTextContrastLockMask () const           { return m_lock.color_text_contrast_mask;         }
03598 
03603         void            SetColorTextContrastLockValue (int v)               { m_lock.color_text_contrast_value = (short)v;    }
03608         int             GetColorTextContrastLockValue () const          { return m_lock.color_text_contrast_value;        }
03609 
03610 
03611 
03612 
03614         void            SetForcedLockMask (int m)                     { m_forced.mask = m;                  }
03616         int             GetForcedLockMask () const                { return m_forced.mask;               }
03617 
03619         void            SetForcedLockValue (int v)                    { m_forced.value = v;                 }
03621         int             GetForcedLockValue () const               { return m_forced.value;              }
03622 
03627         void            SetVisibilityForcedLockMask (int m)           { m_forced.visibility_mask = m;       }
03632         int             GetVisibilityForcedLockMask () const      { return m_forced.visibility_mask;    }
03633 
03638         void            SetVisibilityForcedLockValue (int v)          { m_forced.visibility_value = v;      }
03643         int             GetVisibilityForcedLockValue () const     { return m_forced.visibility_value;   }
03644 
03645 
03650         void            SetColorForcedLockMask (int m)           { m_forced.color_mask = m;       }
03655         int             GetColorForcedLockMask () const      { return m_forced.color_mask;    }
03656 
03661         void            SetColorForcedLockValue (int v)          { m_forced.color_value = v;      }
03666         int             GetColorForcedLockValue () const     { return m_forced.color_value;   }
03667 
03668 
03673         void            SetColorFaceForcedLockMask (int m)                { m_forced.color_face_mask = (short)m;     }
03678         int             GetColorFaceForcedLockMask () const           { return m_forced.color_face_mask;         }
03679 
03684         void            SetColorFaceForcedLockValue (int v)               { m_forced.color_face_value = (short)v;    }
03689         int             GetColorFaceForcedLockValue () const          { return m_forced.color_face_value;        }
03690 
03691 
03696         void            SetColorEdgeForcedLockMask (int m)                { m_forced.color_edge_mask = (short)m;     }
03701         int             GetColorEdgeForcedLockMask () const           { return m_forced.color_edge_mask;         }
03702 
03707         void            SetColorEdgeForcedLockValue (int v)               { m_forced.color_edge_value = (short)v;    }
03712         int             GetColorEdgeForcedLockValue () const          { return m_forced.color_edge_value;        }
03713 
03714 
03719         void            SetColorLineForcedLockMask (int m)                { m_forced.color_line_mask = (short)m;     }
03724         int             GetColorLineForcedLockMask () const           { return m_forced.color_line_mask;         }
03725 
03730         void            SetColorLineForcedLockValue (int v)               { m_forced.color_line_value = (short)v;    }
03735         int             GetColorLineForcedLockValue () const          { return m_forced.color_line_value;        }
03736 
03737 
03742         void            SetColorMarkerForcedLockMask (int m)                { m_forced.color_marker_mask = (short)m;     }
03747         int             GetColorMarkerForcedLockMask () const           { return m_forced.color_marker_mask;         }
03748 
03753         void            SetColorMarkerForcedLockValue (int v)               { m_forced.color_marker_value = (short)v;    }
03758         int             GetColorMarkerForcedLockValue () const          { return m_forced.color_marker_value;        }
03759 
03760 
03765         void            SetColorTextForcedLockMask (int m)                { m_forced.color_text_mask = (short)m;     }
03770         int             GetColorTextForcedLockMask () const           { return m_forced.color_text_mask;         }
03771 
03776         void            SetColorTextForcedLockValue (int v)               { m_forced.color_text_value = (short)v;    }
03781         int             GetColorTextForcedLockValue () const          { return m_forced.color_text_value;        }
03782 
03783 
03788         void            SetColorWindowForcedLockMask (int m)                { m_forced.color_window_mask = (short)m;     }
03793         int             GetColorWindowForcedLockMask () const           { return m_forced.color_window_mask;         }
03794 
03799         void            SetColorWindowForcedLockValue (int v)               { m_forced.color_window_value = (short)v;    }
03804         int             GetColorWindowForcedLockValue () const          { return m_forced.color_window_value;        }
03805 
03806 
03811         void            SetColorFaceContrastForcedLockMask (int m)                { m_forced.color_face_contrast_mask = (short)m;     }
03816         int             GetColorFaceContrastForcedLockMask () const           { return m_forced.color_face_contrast_mask;         }
03817 
03822         void            SetColorFaceContrastForcedLockValue (int v)               { m_forced.color_face_contrast_value = (short)v;    }
03827         int             GetColorFaceContrastForcedLockValue () const          { return m_forced.color_face_contrast_value;        }
03828 
03829 
03834         void            SetColorWindowContrastForcedLockMask (int m)                { m_forced.color_window_contrast_mask = (short)m;     }
03839         int             GetColorWindowContrastForcedLockMask () const           { return m_forced.color_window_contrast_mask;         }
03840 
03845         void            SetColorWindowContrastForcedLockValue (int v)               { m_forced.color_window_contrast_value = (short)v;    }
03850         int             GetColorWindowContrastForcedLockValue () const          { return m_forced.color_window_contrast_value;        }
03851 
03852 
03857         void            SetColorBackForcedLockMask (int m)                { m_forced.color_back_mask = (short)m;     }
03862         int             GetColorBackForcedLockMask () const           { return m_forced.color_back_mask;         }
03863 
03868         void            SetColorBackForcedLockValue (int v)               { m_forced.color_back_value = (short)v;    }
03873         int             GetColorBackForcedLockValue () const          { return m_forced.color_back_value;        }
03874 
03875 
03880         void            SetColorVertexForcedLockMask (int m)                { m_forced.color_vertex_mask = (short)m;     }
03885         int             GetColorVertexForcedLockMask () const           { return m_forced.color_vertex_mask;         }
03886 
03891         void            SetColorVertexForcedLockValue (int v)               { m_forced.color_vertex_value = (short)v;    }
03896         int             GetColorVertexForcedLockValue () const          { return m_forced.color_vertex_value;        }
03897 
03898 
03903         void            SetColorEdgeContrastForcedLockMask (int m)                { m_forced.color_edge_contrast_mask = (short)m;     }
03908         int             GetColorEdgeContrastForcedLockMask () const           { return m_forced.color_edge_contrast_mask;         }
03909 
03914         void            SetColorEdgeContrastForcedLockValue (int v)               { m_forced.color_edge_contrast_value = (short)v;    }
03919         int             GetColorEdgeContrastForcedLockValue () const          { return m_forced.color_edge_contrast_value;        }
03920 
03921 
03926         void            SetColorLineContrastForcedLockMask (int m)                { m_forced.color_line_contrast_mask = (short)m;     }
03931         int             GetColorLineContrastForcedLockMask () const           { return m_forced.color_line_contrast_mask;         }
03932 
03937         void            SetColorLineContrastForcedLockValue (int v)               { m_forced.color_line_contrast_value = (short)v;    }
03942         int             GetColorLineContrastForcedLockValue () const          { return m_forced.color_line_contrast_value;        }
03943 
03944 
03949         void            SetColorMarkerContrastForcedLockMask (int m)                { m_forced.color_marker_contrast_mask = (short)m;     }
03954         int             GetColorMarkerContrastForcedLockMask () const           { return m_forced.color_marker_contrast_mask;         }
03955 
03960         void            SetColorMarkerContrastForcedLockValue (int v)               { m_forced.color_marker_contrast_value = (short)v;    }
03965         int             GetColorMarkerContrastForcedLockValue () const          { return m_forced.color_marker_contrast_value;        }
03966 
03967 
03972         void            SetColorVertexContrastForcedLockMask (int m)                { m_forced.color_vertex_contrast_mask = (short)m;     }
03977         int             GetColorVertexContrastForcedLockMask () const           { return m_forced.color_vertex_contrast_mask;         }
03978 
03983         void            SetColorVertexContrastForcedLockValue (int v)               { m_forced.color_vertex_contrast_value = (short)v;    }
03988         int             GetColorVertexContrastForcedLockValue () const          { return m_forced.color_vertex_contrast_value;        }
03989 
03990 
03995         void            SetColorTextContrastForcedLockMask (int m)                { m_forced.color_text_contrast_mask = (short)m;     }
04000         int             GetColorTextContrastForcedLockMask () const           { return m_forced.color_text_contrast_mask;         }
04001 
04006         void            SetColorTextContrastForcedLockValue (int v)               { m_forced.color_text_contrast_value = (short)v;    }
04011         int             GetColorTextContrastForcedLockValue () const          { return m_forced.color_text_contrast_value;        }
04012 
04013 
04014 
04015 
04017         void            SetBufferOptionsMask (int v)            { m_buffer_options_mask = (unsigned char)v;        }
04019         int             GetBufferOptionsMask () const       { return m_buffer_options_mask;     }
04021         void            SetBufferOptionsValue (int v)           { m_buffer_options_value = (unsigned char) v; }
04023         int             GetBufferOptionsValue () const      { return m_buffer_options_value;    }
04025         void            SetBufferSizeLimit (int l)              { m_buffer_size_limit = l;          }
04027         int             GetBufferSizeLimit () const         { return m_buffer_size_limit;       }
04028 
04029 
04031         void            SetStereoSeparation (float s)           { m_stereo_separation = s;          }
04033         float           GetStereoSeparation () const        { return m_stereo_separation;       }
04035         void            SetStereoDistance (float d)           { m_stereo_distance = d;          }
04037         float           GetStereoDistance () const        { return m_stereo_distance;       }
04038 
04039 
04041         void            SetHlrOptions (int o) {
04042                             m_hlr_options = o;
04043                             if ((o & TKO_Hidden_Line_Extended_Mask) != 0) {
04044                                 m_hlr_options |= TKO_Hidden_Line_Extended;
04045                             if ((o & TKO_Hidden_Line_Extended2_Mask) != 0)
04046                                 m_hlr_options |= TKO_Hidden_Line_Extended2;
04047                         }
04048             }
04050         int             GetHlrOptions () const              { return m_hlr_options;             }
04052         void            SetHlrDimFactor (float d)               { m_hlr_dim_factor = d;             }
04054         float           GetHlrDimFactor () const            { return m_hlr_dim_factor;          }
04056         void            SetHlrFaceDisplacement (float d)        { m_hlr_face_displacement = d;      }
04058         float           GetHlrFaceDisplacement () const     { return m_hlr_face_displacement;   }
04060         void            SetHlrLinePattern (int p)               { m_hlr_line_pattern = p;           }
04062         int             GetHlrLinePattern () const          { return m_hlr_line_pattern;        }
04064         void            SetHlrFaceSortingAlgorithm (int a)       { m_hlr_hsr_algorithm = (unsigned char)a;  }
04066         float           GetHlrFaceSortingAlgorithm () const { return m_hlr_hsr_algorithm;           }
04067 
04068 
04070         void            SetNURBSOptionsMask (int m) {
04071                             m_nurbs_options_mask = m;
04072                             if ((m & TKO_NURBS_Extended_Mask) != 0)
04073                                 m_nurbs_options_mask |= TKO_NURBS_Extended;
04074                         }
04076         int             GetNURBSOptionsMask () const        { return m_nurbs_options_mask;     }
04078         void            SetNURBSOptionsValue (int v)            { m_nurbs_options_value = v;       }
04080         int             GetNURBSOptionsValue () const       { return m_nurbs_options_value;    }
04082         void            SetNURBSCurveBudget (int b)             { m_curve_budget = b;               }
04084         int             GetNURBSCurveBudget () const        { return m_curve_budget;            }
04086         void            SetNURBSCurveContinuedBudget (int b)        { m_curve_continued_budget = b;     }
04088         int             GetNURBSCurveContinuedBudget () const   { return m_curve_continued_budget;  }
04090         void            SetNURBSSurfaceBudget (int b)           { m_surface_budget = b;               }
04092         int             GetNURBSSurfaceBudget () const      { return m_surface_budget;            }
04094         void            SetNURBSSurfaceTrimBudget (int b)       { m_surface_trim_budget = b;        }
04096         int             GetNURBSSurfaceTrimBudget () const  { return m_surface_trim_budget;     }
04097 
04098 
04100         void            SetLodOptionsMask (int v)               { m_lod_options_mask = v;           }
04102         int             GetLodOptionsMask () const          { return m_lod_options_mask;        }
04104         void            SetLodOptionsValue (int v)              { m_lod_options_value = v;          }
04106         int             GetLodOptionsValue () const         { return m_lod_options_value;       }
04108         void            SetLodAlgorithm (int v)                 { m_lod_algorithm = (char)v;        }
04110         int             GetLodAlgorithm () const            { return m_lod_algorithm;           }
04112         void            SetLodMinimumTriangleCount (int v)          { m_min_triangle_count = v;     }
04114         int             GetLodMinimumTriangleCount () const     { return m_min_triangle_count;  }
04116         void            SetLodNumLevels (int v)                 { m_num_levels = (unsigned char)v;  }
04118         int             GetLodNumLevels () const            { return m_num_levels;              }
04120         void            SetLodClamp (int v)                     { m_clamp = (unsigned char)v;       }
04122         int             GetLodClamp () const                { return m_clamp;                   }
04124         void            SetLodMaxDegree (int v)                 { m_max_degree = v;                 }
04126         int             GetLodMaxDegree () const            { return m_max_degree;              }
04128         void            SetLodTolerance (float v)               { m_tolerance = v;                  }
04130         float           GetLodTolerance () const            { return m_tolerance;               }
04132         void            SetLodFallback (int v)                  { m_fallback = (char)v;             }
04134         int             GetLodFallback () const             { return m_fallback;                }
04135 
04137         void            SetLodBounding (float x1, float y1, float z1, float x2, float y2, float z2) {
04138                             m_bounding[0] = x1;  m_bounding[1] = y1;  m_bounding[2] = z1;
04139                             m_bounding[3] = x2;  m_bounding[4] = y2;  m_bounding[5] = z2;
04140                         }
04142         void            SetLodBounding (float const * s, float const * e) {
04143                             SetLodBounding (s[0], s[1], s[2],  e[0], e[1], e[2]);
04144                         }
04146         void            SetLodBounding (float const * p)        { SetLodBounding (&p[0], &p[3]);    }
04148         float const *   GetLodBounding () const             { return m_bounding;                }
04149 
04151         void            SetLodRatio (float r)                   { m_num_ratios = 1; m_ratio[0] = r; }
04153         void            SetLodRatios (int c, float const * r = 0) {
04154                             m_num_ratios = (char)c;
04155                             if (r != 0) {
04156                                 int i;
04157                                 for (i=0; i<c; ++i)
04158                                     m_ratio[i] = r[i];
04159                             }
04160                         }
04162         int             GetLodNumRatios () const            { return m_num_ratios;              }
04164         float const *   GetLodRatios () const               { return m_ratio;                   }
04166         float *         GetLodRatios ()                     { return m_ratio;                   }
04167 
04169         void            SetLodThresholdType (int v)             { m_threshold_type = (char)v; }
04171         int             GetLodThresholdType () const        { return m_threshold_type; }
04173         void            SetLodThreshold (float r)                   { m_num_thresholds = 1; m_threshold[0] = r;    }
04175         void            SetLodThresholds (int c, float const * r = 0) {
04176                             m_num_thresholds = (char)c;
04177                             if (r != 0) {
04178                                 int i;
04179                                 for (i=0; i<c; ++i)
04180                                     m_threshold[i] = r[i];
04181                             }
04182                         }
04184         int             GetLodNumThresholds () const            { return m_num_thresholds;              }
04186         float const *   GetLodThresholds () const               { return m_threshold;                  }
04188         float *         GetLodThresholds ()                     { return m_threshold;                  }
04189 
04191         void            SetLodCutoff (float r)                   { m_num_cutoffs = 1; m_cutoff[0] = r;    }
04193         void            SetLodCutoffs (int c, float const * r = 0) {
04194                             m_num_cutoffs = (char)c;
04195                             if (r != 0) {
04196                                 int i;
04197                                 for (i=0; i<c; ++i)
04198                                     m_cutoff[i] = r[i];
04199                             }
04200                         }
04202         int             GetLodNumCutoffs () const           { return m_num_cutoffs;             }
04204         float const *   GetLodCutoffs () const              { return m_cutoff;                  }
04206         float *         GetLodCutoffs ()                    { return m_cutoff;                  }
04207 
04208 
04210         void            SetTessellationMask (int m)             { m_tessellations = (unsigned char)m;          }
04212         int             GetTessellationMask () const        { return m_tessellations;       }
04214         void            SetCylinderTessellation (int n)          { m_num_cylinder = (char)1; m_cylinder[0] = (char)n;    }
04216         void            SetCylinderTessellations (int c, char const * n = 0) {
04217                             m_num_cylinder = (char)c;
04218                             if (n != 0) {
04219                                 int i;
04220                                 for (i=0; i<c; ++i)
04221                                     m_cylinder[i] = n[i];
04222                             }
04223                         }
04225         int             GetNumCylinderTessellations () const { return m_num_cylinder;           }
04227         char const *    GetCylinderTessellations () const    { return m_cylinder;               }
04229         char *          GetCylinderTessellations ()          { return m_cylinder;               }
04231         void            SetSphereTessellation (int n)          { m_num_sphere = (char)1; m_sphere[0] = (char)n;    }
04233         void            SetSphereTessellations (int c, char const * n = 0) {
04234                             m_num_sphere = (char)c;
04235                             if (n != 0) {
04236                                 int i;
04237                                 for (i=0; i<c; ++i)
04238                                     m_sphere[i] = n[i];
04239                             }
04240                         }
04242         int             GetNumSphereTessellations () const  { return m_num_sphere;           }
04244         char const *    GetSphereTessellations () const     { return m_sphere;               }
04246         char *          GetSphereTessellations ()           { return m_sphere;               }
04247 
04249         void            SetGeometryOptionsMask (int m)          { m_geometry_options = (unsigned char)m;    }
04251         int             GetGeometryOptionsMask () const         { return m_geometry_options;    }
04252 
04254         void            SetHardEdgeAngle (int m)            { m_dihedral = (unsigned char)m;    }
04256         float           GetHardEdgeAngle () const           { return m_dihedral;    }
04257 
04259         void            SetMaskTransform (int m)            { m_mask_transform = (unsigned short)m;  }
04261         int             GetMaskTransform () const           { return (int)m_mask_transform;         }
04262 
04263 
04265         void            SetCutGeometry (int m)              { m_cut_geometry = (unsigned char)m;  }
04267         int             GetCutGeometry () const             { return (int)m_cut_geometry;         }
04268 
04270         void            SetCutGeometryLevel (int m)         { m_cut_geometry_level = (unsigned char)m;  }
04272         int             GetCutGeometryLevel () const        { return (int)m_cut_geometry_level;         }
04273 
04275         void            SetCutGeometryColorMatch (int m)        { m_cut_geometry_match = (unsigned char)m;  }
04277         int             GetCutGeometryColorMatch () const       { return (int)m_cut_geometry_match;         }
04278 
04280         void            SetCutGeometryTolerance (float m)           { m_cut_geometry_tolerance = m; }
04282         float           GetCutGeometryTolerance () const            { return m_cut_geometry_tolerance;  }
04283 
04284 
04286         void            SetDisplayListLevel (int m)         { m_display_list_level = (unsigned char)m;  }
04288         int             GetDisplayListLevel () const        { return (int)m_display_list_level;         }
04289 
04291         void            SetSimpleShadow (int m) {
04292                             m_simple_shadow = (unsigned short)m;
04293                             if ((m & TKO_Simple_Shadow_Extended_Mask) != 0)
04294                                 m_simple_shadow |= TKO_Simple_Shadow_Extended;
04295                         }
04297         int             GetSimpleShadow () const            { return (int)m_simple_shadow;         }
04298 
04300         void            SetSimpleShadowBlur (int m)             { m_simple_shadow_blur = (unsigned char)m;  }
04302         int             GetSimpleShadowBlur () const            { return (int)m_simple_shadow_blur;         }
04303 
04305         void            SetSimpleShadowResolution (int m)           { m_simple_shadow_resolution = (unsigned short)m;  }
04307         int             GetSimpleShadowResolution () const          { return (int)m_simple_shadow_resolution;         }
04308 
04310         void            SetSimpleShadowLight (float x, float y, float z) {
04311                             m_simple_shadow_light[0] = x;
04312                             m_simple_shadow_light[1] = y;
04313                             m_simple_shadow_light[2] = z;
04314                         }
04316         void            SetSimpleShadowLight (float const * l)          { SetSimpleShadowLight (l[0], l[1], l[2]); }
04318         float const *   getSimpleShadowLight () const               { return m_simple_shadow_light; }
04319 
04321         void            SetSimpleShadowPlane (float a, float b, float c, float d) {
04322                             m_simple_shadow_plane[0] = a;
04323                             m_simple_shadow_plane[1] = b;
04324                             m_simple_shadow_plane[2] = c;
04325                             m_simple_shadow_plane[3] = d;
04326                         }
04328         void            SetSimpleShadowPlane (float const * p)          { SetSimpleShadowPlane (p[0], p[1], p[2], p[3]); }
04330         float const *   GetSimpleShadowPlane () const               { return m_simple_shadow_plane; }
04331 
04333         void            SetSimpleShadowColor (float r, float g, float b)
04334                 { m_simple_shadow_color[0] = r; m_simple_shadow_color[1] = g; m_simple_shadow_color[2] = b; }
04336         void            SetSimpleShadowColor (float const * rgb)            { SetSimpleShadowColor (rgb[0], rgb[1], rgb[2]);    }
04338         float const *   GetSimpleShadowColor () const                   { return m_simple_shadow_color;     }
04339 
04341         void            SetSimpleShadowOpacity (float o)        { m_simple_shadow_opacity = o;      }
04343         float           GetSimpleShadowOpacity () const         { return m_simple_shadow_opacity;   }
04344 
04345   
04347         void            SetShadowMap (int m)            { m_shadow_map = (unsigned char)m;  }
04349         int             GetShadowMap () const           { return (int)m_shadow_map;         }
04350 
04352         void            SetShadowMapResolution (int m)          { m_shadow_map_resolution = (unsigned short)m;  }
04354         int             GetShadowMapResolution () const         { return (int)m_shadow_map_resolution;         }
04355 
04357         void            SetShadowMapSamples (int m)             { m_shadow_map_samples = (unsigned char)m;  }
04359         int             GetShadowMapSamples () const            { return (int)m_shadow_map_samples;         }
04360 
04361 
04363         void            SetSimpleReflection (int m)             { m_simple_reflection = (unsigned short)m;  }
04365         int             GetSimpleReflection () const            { return (int)m_simple_reflection;          }
04366 
04368         void            SetSimpleReflectionPlane (float a, float b, float c, float d) {
04369                             m_simple_reflection_plane[0] = a;
04370                             m_simple_reflection_plane[1] = b;
04371                             m_simple_reflection_plane[2] = c;
04372                             m_simple_reflection_plane[3] = d;
04373                         }
04375         void            SetSimpleReflectionPlane (float const * p)          { SetSimpleReflectionPlane (p[0], p[1], p[2], p[3]); }
04377         float const *   GetSimpleReflectionPlane () const               { return m_simple_reflection_plane; }
04378 
04380         void            SetSimpleReflectionOpacity (float o)        { m_simple_reflection_opacity = o;      }
04382         float           GetSimpleReflectionOpacity () const         { return m_simple_reflection_opacity;   }
04383 
04385         void            SetSimpleReflectionVisibilityMask (int m)           { m_simple_reflection_visibility_mask = m;  }
04387         int             GetSimpleReflectionVisibilityValue () const         { return m_simple_reflection_visibility_value;          }
04388 
04389 
04391         void            SetDepthRange (float n, float f)         { m_depth_range[0] = n; m_depth_range[1] = f; }
04393         void            SetDepthRange (float const * l)          { SetDepthRange (l[0], l[1]);                }
04395         float const *   GetDepthRange () const               { return m_depth_range;                      }
04396 
04397 
04399         void            SetScreenRange (float l, float r, float b, float t)
04400                             { m_screen_range[0] = l; m_screen_range[1] = r; m_screen_range[2] = b; m_screen_range[3] = t; }
04402         void            SetScreenRange (float const * l)          { SetScreenRange (l[0], l[1], l[2], l[3]);    }
04404         float const *   GetScreenRange () const               { return m_screen_range;                      }
04405 
04409         void            SetAmbientUpVector (float x, float y, float z)
04410                             { m_ambient_up_vector[0] = x; m_ambient_up_vector[1] = y; m_ambient_up_vector[2] = z; }
04412         void            SetAmbientUpVector (float const * v)        { SetAmbientUpVector (v[0], v[1], v[2]); }
04414         float const *   GetAmbientUpVector () const               { return m_ambient_up_vector; }
04415 
04417         void            SetImageScale (float x, float y)         { m_image_scale[0] = x; m_image_scale[1] = y; }
04419         void            SetImageScale (float const * s)          { SetImageScale (s[0], s[1]);                }
04421         float const *   GetImageScale () const               { return m_image_scale;                      }
04422 
04423 
04425         void            SetImageTintColor (float r, float g, float b)
04426                             { m_image_tint_color[0] = r; m_image_tint_color[1] = g; m_image_tint_color[2] = b; }
04428         void            SetImageTintColor (float const * rgb)           { SetImageTintColor (rgb[0], rgb[1], rgb[2]);   }
04430         float const *   GetImageTintColor () const                   { return m_image_tint_color;     }
04431 
04433         void            SetDiffuseTextureTintColor (float r, float g, float b)
04434                             { m_texture_tint_color[0] = r; m_texture_tint_color[1] = g; m_texture_tint_color[2] = b; }
04436         void            SetDiffuseTextureTintColor (float const * rgb)       { SetDiffuseTextureTintColor (rgb[0], rgb[1], rgb[2]); }
04438         float const *   GetDiffuseTextureTintColor () const                   { return m_texture_tint_color;     }
04439 
04441         void            SetAntiAlias (int m)            { m_antialias = (unsigned char)m;   }
04443         int             GetAntiAlias () const           { return (int)m_antialias;          }
04444 
04446         void            SetVertexDecimation (float f)           { m_vertex_decimation = f;  }
04448         float           GetVertexDecimation () const            { return m_vertex_decimation;           }
04449 };
04450 
04452 
04456 enum TKO_Heuristic_Bits {
04457     TKO_Heuristic_Hidden_Surfaces           = 0x00000001,  
04458     TKO_Heuristic_Backplane_Cull            = 0x00000002,  
04459     TKO_Heuristic_Polygon_Handedness        = 0x00000004,  
04460     TKO_Heuristic_Quick_Moves               = 0x00000008,  
04461     TKO_Heuristic_Partial_Erase             = 0x00000010,  
04462     TKO_Heuristic_Memory_Purge              = 0x00000020,  
04463     TKO_Heuristic_Related_Select_Limit      = 0x00000040,  
04464     TKO_Heuristic_Internal_Shell_Limit      = 0x00000080,  
04465     TKO_Heuristic_Clipping                  = 0x00000100,  
04466     TKO_Heuristic_Transformations           = 0x00000200,  
04467     TKO_Heuristic_Intersecting_Polygons     = 0x00000400,  
04468     TKO_Heuristic_Polygon_Crossings         = 0x00000800,  
04469     TKO_Heuristic_Concave_Polygons          = 0x00001000,  
04470     TKO_Heuristic_Incremental_Updates       = 0x00002000,  
04471     TKO_Heuristic_Selection_Sorting         = 0x00004000,  
04472 
04473     TKO_Heuristic_Extended                  = 0x00008000,  
04474     TKO_Heuristic_Extended_Mask             = 0xFFFF0000,  
04475     TKO_Heuristic_Extended_Shift            = 16,           
04476 
04477     TKO_Heuristic_Culling                   = 0x00010000,  
04478     TKO_Heuristic_Exclude_Bounding          = 0x00020000,  
04479     TKO_Heuristic_Detail_Selection          = 0x00040000,  
04480     TKO_Heuristic_Ordered_Drawing           = 0x00080000,  
04481     TKO_Heuristic_Ordered_Unit              = 0x00100000,  
04482     TKO_Heuristic_Ordered_Weights           = 0x00200000,  
04483     TKO_Heuristic_Internal_Polyline_Limit   = 0x00400000,  
04484     TKO_Heuristic_Ordered_Grid              = 0x00800000,  
04485 
04486     TKO_Heuristic_Selection_Level           = 0x01000000,  
04487     TKO_Heuristic_Static                    = 0x02000000,  
04488     TKO_Heuristic_Force_Defer               = 0x04000000,  
04489     TKO_Heuristic_Model_Type                = 0x08000000,  
04490 
04491     TKO_Heuristic_Internal_Select_Limit = TKO_Heuristic_Internal_Shell_Limit | TKO_Heuristic_Internal_Polyline_Limit,  
04492     TKO_Heuristic_Extras                = TKO_Heuristic_Polygon_Handedness | TKO_Heuristic_Quick_Moves,  
04493 
04494     TKO_Heur_Extra_Left_Handed_Polys    = 0x01,         
04495     TKO_Heur_Extra_Quick_Move_Spriting  = 0x02,         
04496 
04497     TKO_Heur_View_Frustum_Culling       = 0x00000001,           
04498     TKO_Heur_Obscuration_Culling        = 0x00000002,           
04499     TKO_Heur_Extent_Culling             = 0x00000004,           
04500     TKO_Heur_View_Frustum_Culling_Off   = 0x00000010,           
04501     TKO_Heur_Obscuration_Culling_Off    = 0x00000020,           
04502     TKO_Heur_Extent_Culling_Off         = 0x00000040,           
04503     TKO_Heur_Culling_Extended           = 0x00000080,           
04504     TKO_Heur_Culling_Extended_Mask      = 0xFFFFFF00,           
04505     TKO_Heur_Culling_Extended_Shift     = 8,                
04506     TKO_Heur_Obscuration_Use_Octree     = 0x00000100,           
04507     TKO_Heur_Maximum_Extent_Mode        = 0x00000200,           
04508     TKO_Heur_Vector_Culling             = 0x00000400,           
04509     TKO_Heur_Vector_Tolerance           = 0x00000800,           
04510     TKO_Heur_Vector_Culling_Off         = 0x00001000,           
04511     TKO_Heur_Vector_Tolerance_Off       = 0x00002000,           
04512     TKO_Heur_Hard_Extent_Culling        = 0x00004000,           
04513     TKO_Heur_Culling_Extended2          = 0x00008000,           
04514     TKO_Heur_Culling_Extended2_Mask     = 0xFFFF0000,       
04515     TKO_Heur_Culling_Extended2_Shift    = 16,               
04516     TKO_Heur_Maximum_Extent_Level       = 0x00010000,           
04517     TKO_Heur_Hard_Extent_Culling_Off    = 0x00020000,           
04518     TKO_Heur_Extent_Culling_Detail_On   = 0x00040000,           
04519     TKO_Heur_Extent_Culling_Detail_Off  = 0x00080000,           
04520 
04521 
04522     TKO_Heur_Max_Extent_Mode_None       = 0,                
04523     TKO_Heur_Max_Extent_Mode_Dot        = 1,                
04524     TKO_Heur_Max_Extent_Mode_Bounding   = 2,                
04525     TKO_Heur_Max_Extent_Mode_Defer      = 3,                
04526 
04527     TKO_Heur_Max_Extent_Level_None      = 0x00,             
04528     TKO_Heur_Max_Extent_Level_Segment   = 0x01,             
04529     TKO_Heur_Max_Extent_Level_Geometry  = 0x02,             
04530     TKO_Heur_Max_Extent_Level_Primitive = 0x04,             
04531     TKO_Heur_Max_Extent_Level_All       = 0x07,             
04532 
04533     TKO_Heur_Order_World_Volume     = 0,                
04534     TKO_Heur_Order_Screen_Extent    = 1,                
04535     TKO_Heur_Order_Distance         = 2,                
04536     TKO_Heur_Order_Divergence       = 3,                
04537     TKO_Heur_Order_Density          = 4,                
04538     TKO_Heur_Order_Priority         = 5,                
04539     TKO_Heur_Order_Count            = 6,                
04540 
04541     TKO_Heur_Selection_Level_Entity       = 0,   
04542     TKO_Heur_Selection_Level_Segment      = 1,   
04543     TKO_Heur_Selection_Level_Segment_Tree = 2,   
04544 
04545     TKO_Heur_Model_Type_Default         = 0,   
04546     TKO_Heur_Model_Type_LMV             = 1   
04547 };
04548 
04549 
04550 
04552 
04558 class BBINFILETK_API TK_Heuristics : public BBaseOpcodeHandler {
04559     protected:
04560         int             m_mask;                 
04561         int             m_value;                
04562 
04563         int             m_related;              
04564         int             m_internal_shell;       
04565         int             m_internal_polyline;    
04566 
04567         unsigned char   m_extras;               
04568         int             m_culling;              
04569         int             m_pixel_threshold;      
04570         int             m_maximum_extent;       
04571         int             m_maximum_extent_mode;  
04572         char            m_maximum_extent_level; 
04573         int             m_hard_extent;          
04574         int             m_force_defer;          
04575         float           m_vector[3];            
04576         float           m_vector_tolerance;     
04577 
04578         unsigned char   m_ordered_weights_mask;
04579         float           m_ordered_weights[TKO_Heur_Order_Count];
04580         unsigned char   m_selection_level;
04581         unsigned char   m_model_type;
04582 
04583     public:
04585         TK_Heuristics () : BBaseOpcodeHandler (TKE_Heuristics),
04586                                   m_mask (0), m_value (0), m_culling(0), m_pixel_threshold (0), m_maximum_extent (0), m_maximum_extent_mode(0) {}
04587         ~TK_Heuristics ();
04588 
04589         TK_Status   Read (BStreamFileToolkit & tk);
04590         TK_Status   Write (BStreamFileToolkit & tk);
04591         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04592 
04593         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04594         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04595 
04597         void            SetMask (int m) {
04598                             m_mask = m;
04599                             if ((m & TKO_Heuristic_Extended_Mask) != 0)
04600                                 m_mask |= TKO_Heuristic_Extended;
04601                         }
04603         int             GetMask () const            { return m_mask;    }
04604 
04606         void            SetValue (int v)                { m_value = v;      }
04608         int             GetValue () const           { return m_value;   }
04609 
04611         void            SetRelatedSelectionLimit (int r)        { m_related = r;      }
04613         int             GetRelatedSelectionLimit () const   { return m_related;   }
04614 
04616         void            SetInternalSelectionLimit (int i)       { m_internal_shell = m_internal_polyline = i;     }
04618         int             GetInternalSelectionLimit () const  { return m_internal_shell;  }
04619 
04621         void            SetInternalShellSelectionLimit (int i)       { m_internal_shell = i;     }
04623         int             GetInternalShellSelectionLimit () const  { return m_internal_shell;  }
04624 
04626         void            SetInternalPolylineSelectionLimit (int i)       { m_internal_polyline = i;     }
04628         int             GetInternalPolylineSelectionLimit () const  { return m_internal_polyline;  }
04629 
04631         void            SetExtras (int e)               { m_extras = (unsigned char)e;  }
04633         int             GetExtras () const          { return (int)m_extras;         }
04634 
04636         void            SetCulling (int c)              { m_culling = (unsigned short)c; }
04638         int             GetCulling () const         { return (int)m_culling;        }
04640         void            SetPixelThreshold (int c)              { m_pixel_threshold = c;     }
04642         int             GetPixelThreshold () const         { return m_pixel_threshold;  }
04644         void            SetMaximumExtent (int c)               { m_maximum_extent = c;      }
04646         int             GetMaximumExtent () const          { return m_maximum_extent;   }
04648         int             GetMaximumExtentMode () const          { return m_maximum_extent_mode; }
04650         void            SetMaximumExtentMode (int c)               { m_maximum_extent_mode = c;     }
04652         int             GetMaximumExtentLevel () const         { return m_maximum_extent_level; }
04654         void            SetMaximumExtentLevel (int c)               { m_maximum_extent_level = (unsigned char)c;        }
04656         void            SetHardExtent (int c)               { m_hard_extent = c;        }
04658         int             GetHardExtent () const          { return m_hard_extent; }
04660         float const *   GetVector () const                          { return m_vector; }
04662         void            SetVector (float x, float y, float z) {
04663                             m_vector[0] = x;
04664                             m_vector[1] = y;
04665                             m_vector[2] = z;
04666                         }
04668         void            SetVector (float const * v)                 { SetVector(v[0], v[1], v[2]); }
04670         float           GetVectorTolerance () const                 { return m_vector_tolerance; }
04672         void            SetVectorTolerance (float tol)              { m_vector_tolerance = tol; }
04673 
04675         void            SetOrderedWeightsMask (int c)          { m_ordered_weights_mask = (unsigned char)c; }
04677         int             GetOrderedWeightsMask () const     { return (int)m_ordered_weights_mask;        }
04678 
04680         void            SetOrderedWeight (int index, float weight) {
04681                             m_ordered_weights[index] = weight;
04682                             m_ordered_weights_mask |= 1<<index;
04683                         }
04685         float           GetOrderedWeight (int index) const          { return m_ordered_weights[index];  }
04687         float const *   GetOrderedWeights () const                  { return m_ordered_weights;         }
04689         float *         GetOrderedWeights ()                        { return m_ordered_weights;         }
04690 
04692         void            SetSelectionLevel (int l)              { m_selection_level = (unsigned char)l; }
04694         int             GetSelectionLevel () const         { return (int)m_selection_level;        }
04695 
04697         void            SetForceDefer (int l)              { m_force_defer = l; }
04699         int             GetForceDefer () const         { return m_force_defer;        }
04700 
04701 };
04702 
04704 
04708 enum TKO_Geometry_Options {
04709     TKO_Geometry_Options_Orientation        = 0x0001,  
04710     TKO_Geometry_Options_Camera_Relative    = 0x0002   
04711 };
04712 
04713 
04715 
04721 class BBINFILETK_API TK_Geometry_Options : public BBaseOpcodeHandler {
04722     protected:
04723         unsigned short  m_mask;                 
04724         unsigned short  m_value;                
04725 
04726         char            m_orientation_count;    
04727         float           m_orientation[6];       
04728 
04729     public:
04731         TK_Geometry_Options () : BBaseOpcodeHandler (TKE_Geometry_Options),
04732                                   m_mask (0), m_value (0), m_orientation_count (0) {}
04733         ~TK_Geometry_Options ();
04734 
04735         TK_Status   Read (BStreamFileToolkit & tk);
04736         TK_Status   Write (BStreamFileToolkit & tk);
04737         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04738 
04739         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04740         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04741 
04743         void            SetMask (int m)       { m_mask = (unsigned short)m; }
04745         int             GetMask () const            { return (int)m_mask;    }
04746 
04748         void            SetOrientation (int count, float const * o) {
04749                                 if (count != 3 && count != 6)
04750                                     return;
04751                                 m_orientation_count = (unsigned char)count;
04752                                 while (count-- > 0)
04753                                     m_orientation[count] = o[count];
04754                             }
04756         int             GetOrientationCount () const { return (int) m_orientation_count; }
04758         float const *   GetOrientation () const { return m_orientation; }
04759 };
04760 
04763 
04768 class BBINFILETK_API TK_Visibility : public BBaseOpcodeHandler {
04769     protected:
04770         int             m_mask;     
04771         int             m_value;    
04772 
04773     public:
04775         TK_Visibility (void)
04776             : BBaseOpcodeHandler (TKE_Visibility), m_mask (0), m_value (0) {}
04777 
04778         TK_Status   Read (BStreamFileToolkit & tk);
04779         TK_Status   Write (BStreamFileToolkit & tk);
04780         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04781 
04782         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04783         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04784 
04788         void            SetGeometry (int m) {
04789                             m_mask = m & TKO_Geo_All_Visibles;
04790                             if ((m & TKO_Geo_Extended_Mask) != 0) {
04791                                 m_mask |= TKO_Geo_Extended;
04792                                 if ((m & TKO_Geo_Extended2_Mask) != 0)
04793                                     m_mask |= TKO_Geo_Extended2;
04794                             }
04795                         }
04800         int             GetGeometry () const        { return m_mask;    }
04801 
04806         void            SetValue (int m)                { m_value = m;       }
04811         int             GetValue () const           { return m_value;    }
04812 };
04813 
04816 
04823 class BBINFILETK_API TK_Selectability : public BBaseOpcodeHandler {
04824     protected:
04825         int             m_mask;         
04826         int             m_down;         
04827         int             m_up;           
04828         int             m_move_down;    
04829         int             m_move_up;      
04830         int             m_invisible;    
04831 
04832     public:
04834         TK_Selectability (void)
04835             : BBaseOpcodeHandler (TKE_Selectability),
04836             m_mask (0), m_down (0), m_up (0), m_move_down (0), m_move_up (0), m_invisible (0) {}
04837 
04838         TK_Status   Read (BStreamFileToolkit & tk);
04839         TK_Status   Write (BStreamFileToolkit & tk);
04840         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04841 
04842         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04843         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04844 
04848         void            SetGeometry (int m) {
04849                             m_mask = m & TKO_Geo_All_Selects;
04850                             if ((m & TKO_Geo_Extended_Mask) != 0)
04851                                 m_mask |= TKO_Geo_Extended;
04852                         }
04857         int             GetGeometry () const        { return m_mask;        }
04858 
04863         void            SetDown (int m)                 { m_down = m;           }
04868         int             GetDown () const            { return m_down;        }
04869 
04874         void            SetUp (int m)                   { m_up = m;             }
04879         int             GetUp () const              { return m_up;          }
04880 
04885         void            SetMoveDown (int m)             { m_move_down = m;      }
04890         int             GetMoveDown () const        { return m_move_down;   }
04891 
04896         void            SetMoveUp (int m)               { m_move_up = m;        }
04901         int             GetMoveUp () const          { return m_move_up;     }
04902 
04907         void            SetWhenInvisible (int m)        { m_invisible = m;      }
04912         int             GetWhenInvisible () const   { return m_invisible;   }
04913 };
04914 
04916 
04922 class BBINFILETK_API TK_Matrix : public BBaseOpcodeHandler {
04923     protected:
04924         float           m_matrix[16];  
04925         double          m_dmatrix[16];  
04926 
04927     public:
04929         TK_Matrix (unsigned char opcode)
04930             : BBaseOpcodeHandler (opcode) {}
04931 
04932         TK_Status   Read (BStreamFileToolkit & tk);
04933         TK_Status   Write (BStreamFileToolkit & tk);
04934         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
04935 
04936         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
04937         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
04938 
04940         void            SetMatrix (float const * m) {
04941                             int i;  for (i=0; i<16; i++) m_matrix[i] = m[i];
04942                         }
04944         void            SetDMatrix (double const * m) {
04945                             int i;  for (i=0; i<16; i++) m_dmatrix[i] = m[i];
04946                         }
04948         float const *   GetMatrix () const              { return m_matrix;  }
04950         float *         GetMatrix ()                    { return m_matrix;  }
04952         double const *  GetDMatrix () const             { return m_dmatrix;  }
04954         double *        GetDMatrix ()                   { return m_dmatrix;  }
04955 };
04956 
04957 
04961 enum TKO_Enumerations {
04962     TKO_Line_Pattern_Solid      = 0,  
04963     TKO_Line_Pattern_Dash_Dot   = 1,  
04964     TKO_Line_Pattern_Dashed     = 2,  
04965     TKO_Line_Pattern_Dotted     = 3,  
04966     TKO_Line_Pattern_Dash_2Dot  = 4,  
04967     TKO_Line_Pattern_Dash_3Dot  = 5,  
04968     TKO_Line_Pattern_Long_Dash  = 6,  
04969     TKO_Line_Pattern_Center     = 7,  
04970     TKO_Line_Pattern_Phantom    = 8,  
04971     TKO_Line_Pattern_Find_Dots  = 9,  
04972 
04973     TKO_Fill_Pattern_Hash       = 0,  
04974     TKO_Fill_Pattern_Vertical   = 1,  
04975     TKO_Fill_Pattern_Horizontal = 2,  
04976     TKO_Fill_Pattern_Right      = 3,  
04977     TKO_Fill_Pattern_Left       = 4,  
04978     TKO_Fill_Pattern_Diamond    = 5,  
04979     TKO_Fill_Pattern_Dots       = 6,  
04980     TKO_Fill_Pattern_Boxes      = 7,  
04981     TKO_Fill_Pattern_Solid      = 8,  
04982     TKO_Fill_Pattern_Clear      = 9,  
04983     TKO_Fill_Pattern_Gradient_N = 10,  
04984     TKO_Fill_Pattern_Gradient_NE= 11,  
04985     TKO_Fill_Pattern_Gradient_E = 12,  
04986     TKO_Fill_Pattern_Gradient_SE= 13,  
04987     TKO_Fill_Pattern_Gradient_S = 14,  
04988     TKO_Fill_Pattern_Gradient_SW= 15,  
04989     TKO_Fill_Pattern_Gradient_W = 16,  
04990     TKO_Fill_Pattern_Gradient_NW= 17,  
04991     TKO_Fill_Pattern_Blend  = 18,  
04992     TKO_Fill_Pattern_Invisible  = 19,  
04993 
04994     TKO_Marker_Circle                       = 0,  
04995     TKO_Marker_Circle_Dot                   = 1,  
04996     TKO_Marker_Circle_Plus                  = 2,  
04997     TKO_Marker_Circle_X                     = 3,  
04998     TKO_Marker_Circle_Circle                = 4,  
04999     TKO_Marker_Circle_Filled                = 5,  
05000     TKO_Marker_Dot                          = 6,  
05001     TKO_Marker_Plus                         = 7,  
05002     TKO_Marker_X                            = 8,  
05003     TKO_Marker_Star                         = 9,  
05004     TKO_Marker_Box                          = 10,  
05005     TKO_Marker_Box_Dot                      = 11,  
05006     TKO_Marker_Box_X                        = 12,  
05007     TKO_Marker_Box_Filled                   = 13,  
05008     TKO_Marker_Diamond                      = 14,  
05009     TKO_Marker_Diamond_Dot                  = 15,  
05010     TKO_Marker_Diamond_Plus                 = 16,  
05011     TKO_Marker_Diamond_Filled               = 17,  
05012     TKO_Marker_Triangle_Up                  = 18,  
05013     TKO_Marker_Triangle_Up_Vertex           = 19,  
05014     TKO_Marker_Triangle_Up_Dot              = 20,  
05015     TKO_Marker_Triangle_Up_Filled           = 21,  
05016     TKO_Marker_Triangle_Up_Filled_Vertex    = 22,  
05017     TKO_Marker_Triangle_Down                = 23,  
05018     TKO_Marker_Triangle_Down_Vertex         = 24,  
05019     TKO_Marker_Triangle_Down_Dot            = 25,  
05020     TKO_Marker_Triangle_Down_Filled         = 26,  
05021     TKO_Marker_Triangle_Down_Filled_Vertex  = 27,  
05022     TKO_Marker_Triangle_Right               = 28,  
05023     TKO_Marker_Triangle_Right_Vertex        = 29,  
05024     TKO_Marker_Triangle_Right_Dot           = 30,  
05025     TKO_Marker_Triangle_Right_Filled        = 31,  
05026     TKO_Marker_Triangle_Right_Filled_Vertex = 32,  
05027     TKO_Marker_Triangle_Left                = 33,  
05028     TKO_Marker_Triangle_Left_Vertex         = 34,  
05029     TKO_Marker_Triangle_Left_Dot            = 35,  
05030     TKO_Marker_Triangle_Left_Filled         = 36,  
05031     TKO_Marker_Triangle_Left_Filled_Vertex  = 37,  
05032     TKO_Marker_Hash                         = 38,  
05033     TKO_Marker_Wide_Plus                    = 39,  
05034     TKO_Marker_Open_Arrow                   = 40,  
05035     TKO_Marker_Closed_Arrow                 = 41,  
05036     TKO_Marker_Vertical_Bar                 = 42,  
05037     TKO_Marker_Half_Arrow_Left              = 43,  
05038     TKO_Marker_Half_Arrow_Right             = 44,  
05039     TKO_Marker_Wide_Arrow                   = 45,  
05040     TKO_Marker_Double_Arrow                 = 46,  
05041     TKO_Marker_Y                            = 47,  
05042     TKO_Marker_Z                            = 48,  
05043 
05044     // alignment format change in 17.80.
05045 
05046     // old alignment enum choices in lower nibble
05047     TKO_Text_Alignment_Lower_Left       = 0,  
05048     TKO_Text_Alignment_Upper_Left       = 1,  
05049     TKO_Text_Alignment_Middle_Left      = 2,  
05050     TKO_Text_Alignment_Lower_Right      = 3,  
05051     TKO_Text_Alignment_Upper_Right      = 4,  
05052     TKO_Text_Alignment_Middle_Right     = 5,  
05053     TKO_Text_Alignment_Lower_Center     = 6,  
05054     TKO_Text_Alignment_Upper_Center     = 7,  
05055     TKO_Text_Alignment_Middle_Center    = 8,  
05056     TKO_Text_Alignment_Insertion_Left   = 9,  
05057     TKO_Text_Alignment_Insertion_Right  = 10, 
05058     TKO_Text_Alignment_Insertion_Center = 11, 
05059     TKO_Text_Alignment_Insertion        = 9,  
05060     // and justification in higher nibble
05061     TKO_Text_Justification_Unspecified  = 0,  
05062     TKO_Text_Justification_Left         = 1,  
05063     TKO_Text_Justification_Center       = 2,  
05064     TKO_Text_Justification_Right        = 3,  
05065 
05066     // new format defines bits for "building" alignment setting
05067     TKO_Text_Alignment_Center           = 0x00,
05068     TKO_Text_Alignment_Left             = 0x01,
05069     TKO_Text_Alignment_Right            = 0x02,
05070     TKO_Text_Alignment_Bottom           = 0x04,
05071     TKO_Text_Alignment_Top              = 0x08,
05072     TKO_Text_Alignment_Point            = 0x10,
05073     // can't have left & right, or bottom & top, so all bits is good as an "unset" placeholder
05074     TKO_Text_Alignment_Unspecified      = 0x1F,
05075     // and uses same justification but shifted a bit higher
05076     TKO_Text_Justification_Mask         = 0x60,  
05077     TKO_Text_Justification_Shift        = 5,  
05078     // and the high bit will be set
05079     TKO_Text_Alignment_New_Format       = 0x80,
05080 
05081 
05082 
05083     TKO_Window_Frame_Off    = 0,  
05084     TKO_Window_Frame_On     = 1,  
05085 
05086     TKO_Handedness_Left     = 0,  
05087     TKO_Handedness_Right    = 1  
05088 };
05089 
05095 class BBINFILETK_API TK_Enumerated : public BBaseOpcodeHandler {
05096     protected:
05097         char            m_index;    
05098 
05099     public:
05101         TK_Enumerated (unsigned char opcode)
05102             : BBaseOpcodeHandler (opcode), m_index (0) {}
05103 
05104         TK_Status   Read (BStreamFileToolkit & tk);
05105         TK_Status   Write (BStreamFileToolkit & tk);
05106         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05107 
05108         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05109         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05110 
05111         void            SetIndex (int i)        { m_index = (char)i;   }
05113         int             GetIndex () const   { return (int)m_index;  }
05114 };
05115 
05119 enum TKO_Generic_Size_Units {
05120     TKO_Generic_Size_Object,        
05121     TKO_Generic_Size_Screen,        
05122     TKO_Generic_Size_Window,        
05123     TKO_Generic_Size_Points,        
05124     TKO_Generic_Size_Pixels,        
05125     TKO_Generic_Size_Percent,       
05126     TKO_Generic_Size_World,         
05127 
05128     TKO_Generic_Size_Unspecified    
05129 };
05130 // NOTE: any changes to this need to be reflected in generic_units_table in parse.cpp & HOpcodeHandler.cpp
05131 
05132 
05138 class BBINFILETK_API TK_Size : public BBaseOpcodeHandler {
05139     protected:
05140         float           m_value;  
05141         unsigned char   m_units;  
05142 
05143     public:
05145         TK_Size (unsigned char opcode)
05146             : BBaseOpcodeHandler (opcode), m_value (0.0f), m_units (TKO_Generic_Size_Unspecified) {}
05147 
05148         TK_Status   Read (BStreamFileToolkit & tk);
05149         TK_Status   Write (BStreamFileToolkit & tk);
05150         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05151 
05152         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05153         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05154 
05156         void            SetSize (float value, int units = TKO_Generic_Size_Unspecified) {
05157                             m_value = (value > 0.0f) ? value : 0.0f;
05158                             m_units = (m_value > 0.0f) ? (unsigned char) units : (unsigned char) TKO_Generic_Size_Unspecified;
05159                         }
05161         float           GetSize () const    { return m_value;  }
05163         int             GetUnits () const   { return m_units;  }
05164 };
05165 
05170 class BBINFILETK_API TK_Linear_Pattern : public BBaseOpcodeHandler {
05171     protected:
05172         unsigned short  m_pattern;  
05173 
05174     public:
05176         TK_Linear_Pattern (unsigned char opcode)
05177             : BBaseOpcodeHandler (opcode), m_pattern (0) {}
05178 
05179         TK_Status   Read (BStreamFileToolkit & tk);
05180         TK_Status   Write (BStreamFileToolkit & tk);
05181         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05182 
05183         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05184         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05185 
05187         void            SetPattern (int p)          { m_pattern = (unsigned short)p;    }
05189         int             GetPattern () const     { return (int)m_pattern;            }
05190 };
05191 
05197 class BBINFILETK_API TK_Named : public BBaseOpcodeHandler {
05198     protected:
05199         int     m_name_length;  
05200         char *  m_name;         
05201         int     m_index;        
05202 
05203     public:
05205         TK_Named (unsigned char opcode)
05206             : BBaseOpcodeHandler (opcode), m_name_length (0), m_name (0), m_index (0) {}
05207         ~TK_Named();
05208 
05209         TK_Status   Read (BStreamFileToolkit & tk);
05210         TK_Status   Write (BStreamFileToolkit & tk);
05211         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05212 
05213         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05214         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05215 
05216         void        Reset ();
05217 
05219         void            SetName (char const * name);
05221         void            SetName (int length);
05223         char const *    GetName () const            { return m_name;        }
05225         char *          GetName ()                  { return m_name;        }
05226 
05228         void            SetIndex (int i)        { Reset(); m_index = i;   }
05230         int             GetIndex () const   { return (int)m_index;      }
05231 };
05232 
05233 
05234 
05241 class BBINFILETK_API TK_Streaming : public BBaseOpcodeHandler {
05242     protected:
05243         bool            m_flag;  
05244 
05245     public:
05247         TK_Streaming () : BBaseOpcodeHandler (TKE_Streaming_Mode) {}
05248 
05249         TK_Status   Read (BStreamFileToolkit & tk);
05250         TK_Status   Write (BStreamFileToolkit & tk);
05251         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05252 
05253         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05254         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05255 
05256         void        SetStreaming (bool s)       { m_flag = s;       }
05258         bool        GetStreaming () const   { return m_flag;    }
05259 };
05260 
05263 
05269 class BBINFILETK_API TK_Conditions : public BBaseOpcodeHandler {
05270     protected:
05271         int                     m_length;       
05272         char *                  m_string;       
05274     public:
05276         TK_Conditions () : BBaseOpcodeHandler (TKE_Conditions), m_length (0), m_string (0) {}
05277         ~TK_Conditions();
05278 
05279         TK_Status   Read (BStreamFileToolkit & tk);
05280         TK_Status   Write (BStreamFileToolkit & tk);
05281         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05282 
05283         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05284         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05285 
05286         void        Reset ();
05287 
05289         void            SetConditions (char const * options);
05291         void            SetConditions (int length);
05293         char const *    GetConditions () const                 { return m_string;          }
05295         char *          GetConditions ()                       { return m_string;          }
05297         int             GetLength()                         { return m_length;          }
05298 };
05299 
05300 
05304 enum TKO_Actions {
05305     TKO_Action_Type_Prune_Segment   = 1,    
05306 
05307     TKO_Action_Option_Segment_Tree  = 0x0001    
05308 };
05309 
05310 
05313 
05318 class BBINFILETK_API TK_Conditional_Action : public BBaseOpcodeHandler {
05319     protected:
05320         short                   m_type;         
05321         short                   m_options;      
05322         int                     m_length;       
05323         char *                  m_string;       
05325     public:
05327         TK_Conditional_Action () : BBaseOpcodeHandler (TKE_Conditional_Action), m_length (0), m_string (0) {}
05328         ~TK_Conditional_Action();
05329 
05330         TK_Status   Read (BStreamFileToolkit & tk);
05331         TK_Status   Write (BStreamFileToolkit & tk);
05332         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05333 
05334         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05335         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05336 
05337         void        Reset ();
05338 
05340         void            SetCondition (char const * options);
05342         void            SetCondition (int length);
05344         char const *    GetCondition () const                 { return m_string;          }
05346         char *          GetCondition ()                       { return m_string;          }
05348         int             GetLength()                         { return m_length;          }
05349 
05351         void            SetAction (int at)          { m_type = (short)at; }
05353         int             GetAction () const          { return (int)m_type; }
05355         void            SetOptions (int at)         { m_options = (short)at; }
05357         int             GetOptions () const         { return (int)m_options; }
05358 };
05359 
05362 
05368 class BBINFILETK_API TK_User_Options : public BBaseOpcodeHandler {
05369     protected:
05370         int                     m_length;       
05371         char *                  m_string;       
05372         BBaseOpcodeHandler *    m_indices;      
05373         BBaseOpcodeHandler *    m_unicode;      
05374         BBaseOpcodeHandler *    m_index_data;   
05376         void    set_options (char const * options);       
05377         void    set_options (int length);                 
05378 
05379     public:
05381         TK_User_Options () : BBaseOpcodeHandler (TKE_User_Options), m_length (0), m_string (0),
05382                              m_indices (0), m_unicode (0), m_index_data(0) {}
05383         ~TK_User_Options();
05384 
05385         TK_Status   Read (BStreamFileToolkit & tk);
05386         TK_Status   Write (BStreamFileToolkit & tk);
05387         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05388 
05389         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05390         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05391 
05392         void        Reset ();
05393 
05395         void            SetOptions (char const * options)       { set_options (options);    }
05397         void            SetOptions (int length)                 { set_options (length);     }
05399         char const *    GetOptions () const                 { return m_string;          }
05401         char *          GetOptions ()                       { return m_string;          }
05403         int             GetLength()                         { return m_length;          }
05404 };
05405 
05408 
05414 class BBINFILETK_API TK_Unicode_Options : public BBaseOpcodeHandler {
05415     protected:
05416         int                     m_length;       
05417         unsigned short *        m_string;       
05419     public:
05421         TK_Unicode_Options () : BBaseOpcodeHandler (TKE_Unicode_Options), m_length (0), m_string (0) {}
05422         ~TK_Unicode_Options();
05423 
05424         TK_Status   Read (BStreamFileToolkit & tk);
05425         TK_Status   Write (BStreamFileToolkit & tk);
05426         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05427 
05428         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05429         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05430 
05431         void        Reset ();
05432 
05434         void                    SetOptions (unsigned short const * options);
05436         void                    SetOptions (int length);
05438         unsigned short const *  GetOptions () const                 { return m_string;          }
05440         unsigned short *        GetOptions ()                       { return m_string;          }
05442         int                     GetLength()                         { return m_length;          }
05443 };
05444 
05446 
05452 class BBINFILETK_API TK_User_Index : public BBaseOpcodeHandler {
05453     protected:
05454         int             m_count;            
05455         int *           m_indices;          
05456         HLONG *          m_values;           
05457         int             m_current_value;        
05458         void    set_indices (int count, int const * indices, POINTER_SIZED_INT const * values);  
05459         void    set_indices (int count);                                            
05460 
05461     public:
05463         TK_User_Index ()
05464             : BBaseOpcodeHandler (TKE_User_Index), m_count (0), m_indices (0), m_values (0), m_current_value(0) {}
05465         ~TK_User_Index();
05466 
05467         TK_Status   Read (BStreamFileToolkit & tk);
05468         TK_Status   Write (BStreamFileToolkit & tk);
05469         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05470 
05471         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05472         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05473 
05474         void        Reset ();
05475 
05477         void            SetIndices (int count, int const * indices, POINTER_SIZED_INT const * values)
05478                                                         { set_indices (count, indices, values); }
05480         void            SetIndices (int count)          { set_indices (count);                  }
05482         int             GetCount () const           { return m_count;                       }
05484         int const *     GetIndices () const         { return m_indices;                     }
05486         int *           GetIndices ()               { return m_indices;                     }
05488         HLONG const *    GetValues () const          { return m_values;                      }
05490         HLONG *          GetValues ()                { return m_values;                      }
05491 };
05492 
05494 
05500 class BBINFILETK_API TK_User_Index_Data : public BBaseOpcodeHandler {
05501 protected:
05502     int             m_count;            
05503     int *           m_indices;          
05504     void **         m_values;           
05505     int *           m_sizes;
05506 
05507     int             m_current_value;        
05508     void    set_indices (int count, int const indices[], void const * values[], int const sizes[]);  
05509     void    set_indices (int count);                                            
05510     void        FreeMem ();
05511 
05512 public:
05514     TK_User_Index_Data ()
05515         : BBaseOpcodeHandler (TKE_User_Index_Data), m_count (0), m_indices (0), m_values (0), m_sizes(0), m_current_value(0) {}
05516     ~TK_User_Index_Data();
05517 
05518     TK_Status   Read (BStreamFileToolkit & tk);
05519     TK_Status   Write (BStreamFileToolkit & tk);
05520     TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05521 
05522     void        Reset ();
05523 
05525     void            SetIndices (int count, int const indices[], void const * values[], int const sizes[]) {
05526         set_indices (count, indices, values, sizes); 
05527     }
05528 
05530     void            SetIndices (int count)          { set_indices (count);}
05531 
05533     int             GetCount () const           { return m_count;}
05534 
05536     int const *     GetIndices () const         { return m_indices;}
05537 
05539     int *           GetIndices ()               { return m_indices;}
05540 
05542     void ** const   GetValues () const          { return m_values;}
05543 
05545     void ** const    GetValues ()                { return m_values;}
05546 
05548     int const *    GetSizes () const          { return m_sizes;}
05549 
05551     int *          GetSizes ()                { return m_sizes;}
05552 };
05553 
05554 
05556 
05561 class BBINFILETK_API TK_User_Value : public BBaseOpcodeHandler {
05562     protected:
05563         HLONG            m_value;  
05564 
05565     public:
05567         TK_User_Value ()
05568             : BBaseOpcodeHandler (TKE_User_Value), m_value (0) {}
05569 
05570         TK_Status   Read (BStreamFileToolkit & tk);
05571         TK_Status   Write (BStreamFileToolkit & tk);
05572         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05573 
05574         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05575         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05576 
05578         void            SetValue (HLONG v)           { m_value = v;      }
05580         HLONG            GetValue () const       { return m_value;   }
05581 };
05582 
05586 enum TKO_Camera_Projection {
05587     TKO_Camera_Perspective_Bit  = 0x01,  
05588     TKO_Camera_Stretched_Bit    = 0x02,  
05589     TKO_Camera_Projection_Mask  = 0x03,  
05590 
05591     TKO_Camera_Orthographic     = 0x00,  
05592     TKO_Camera_Perspective      = 0x01,  
05593     TKO_Camera_Stretched        = 0x02,  
05594 
05595     TKO_Camera_Oblique_Y        = 0x04,  
05596     TKO_Camera_Oblique_X        = 0x08,  
05597     TKO_Camera_Oblique_Mask     = 0x0C,  
05598 
05599     TKO_Camera_Near_Limit       = 0x10,  
05600 
05601     TKO_Camera_Thumbnail        = 0x80   
05602 };
05603 
05605 
05610 class BBINFILETK_API2 TK_Camera : public BBaseOpcodeHandler {
05611     protected:
05615         float           m_settings[14];
05617         double          m_dsettings[14];
05619         float           m_details[3];
05620         unsigned char   m_projection;   
05621         int             m_length;       
05622         char *          m_name;         
05625         void    set_name (char const * name);   
05626     
05627         void    set_name (int length);      
05628 
05629     public:
05631         TK_Camera (unsigned char opcode = TKE_Camera)
05632             : BBaseOpcodeHandler (opcode), m_length (0), m_name (0) {
05633                 int i;
05634                 int count = (int)(sizeof(m_settings) / sizeof(m_settings[0]));
05635                 for (i = 0; i < count; i++) {
05636                     m_settings[i] = 0;
05637                     m_dsettings[i] = 0;
05638                 }
05639         }
05640         ~TK_Camera();
05641 
05642         TK_Status   Read (BStreamFileToolkit & tk);
05643         TK_Status   Write (BStreamFileToolkit & tk);
05644         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05645 
05646         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05647         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05648 
05650         void            SetPosition (float x, float y, float z)
05651                                         { m_settings[0] = x;  m_settings[1] = y;  m_settings[2] = z;        }
05653         void            SetPosition (float const * p)       { SetPosition (p[0], p[1], p[2]);               }
05655         float const *   GetPosition () const                { return &m_settings[0];                        }
05657         void            GetPosition (float * p) const       { memcpy(p, GetPosition(), 3*sizeof(float));    }
05658 
05660         void            SetDPosition (double x, double y, double z)
05661                                         { m_dsettings[0] = x;  m_dsettings[1] = y;  m_dsettings[2] = z;    }
05663         void            SetDPosition (double const * p)     { SetDPosition (p[0], p[1], p[2]);              }
05665         double const *  GetDPosition () const               { return &m_dsettings[0];                       }
05667         void            GetDPosition (double * p) const     { memcpy(p, GetDPosition(), 3*sizeof(double));  }
05668 
05670         void            SetTarget (float x, float y, float z)
05671                                         { m_settings[3] = x;  m_settings[4] = y;  m_settings[5] = z;    }
05673         void            SetTarget (float const * t)         { SetTarget (t[0], t[1], t[2]);             }
05675         float const *   GetTarget () const                  { return &m_settings[3];                    }
05677         void            GetTarget (float * t) const         { memcpy(t, GetTarget(), 3*sizeof(float));  }
05678 
05680         void            SetDTarget (double x, double y, double z)
05681                                         { m_dsettings[3] = x;  m_dsettings[4] = y;  m_dsettings[5] = z;     }
05683         void            SetDTarget (double const * t)       { SetDTarget (t[0], t[1], t[2]);                }
05685         double const *  GetDTarget () const             { return &m_dsettings[3];                       }
05687         void            GetDTarget (double * t) const       { memcpy(t, GetDTarget(), 3*sizeof(double));    }
05688 
05690         void            SetUpVector (float x, float y, float z)
05691                                         { m_settings[6] = x;  m_settings[7] = y;  m_settings[8] = z;    }
05693         void            SetUpVector (float const * u)       { SetUpVector (u[0], u[1], u[2]);           }
05695         float const *   GetUpVector () const                { return &m_settings[6];                    }
05697         void            GetUpVector (float * u) const       { memcpy(u,GetUpVector(),3*sizeof(float));  }
05698 
05700         void            SetDUpVector (double x, double y, double z)
05701                                         { m_dsettings[6] = x;  m_dsettings[7] = y;  m_dsettings[8] = z;     }
05703         void            SetDUpVector (double const * u)     { SetDUpVector (u[0], u[1], u[2]);              }
05705         double const *  GetDUpVector () const               { return &m_dsettings[6];                       }
05707         void            GetDUpVector (double * u) const     { memcpy(u, GetDUpVector(), 3*sizeof(double));  }
05708 
05710         void            SetField (float w, float h)         { m_settings[9] = w;  m_settings[10] = h;   }
05712         void             SetField (float const * f)         { SetField (f[0], f[1]);                    }
05714         float const *   GetField () const                   { return &m_settings[9];                    }
05716         void            GetField (float *f) const           { memcpy(f,GetField(),2*sizeof(float));     }
05717 
05719         void            SetDField (double w, double h)      { m_dsettings[9] = w;  m_dsettings[10] = h; }
05721         void            SetDField (double const * f)        { SetDField (f[0], f[1]);                   }
05723         double const *  GetDField () const                  { return &m_dsettings[9];                   }
05725         void            GetDField (double * f) const        { memcpy(f, GetDField(), 2*sizeof(double)); }
05726 
05727 
05729         void            SetOblique (float h, float v)       { m_details[0] = h;  m_details[1] = v;
05730                                                               m_projection &= ~TKO_Camera_Oblique_Mask;
05731                                                               if (h != 0.0f) m_projection |= TKO_Camera_Oblique_Y;
05732                                                               if (v != 0.0f) m_projection |= TKO_Camera_Oblique_Mask;
05733                                                             }
05735         void            SetOblique (float const * o)        { SetOblique (o[0], o[1]);                  }
05737         float const *   GetOblique () const                 { return m_details;                         }
05739         void            GetOblique (float * o) const        { memcpy(o, GetOblique(), 2*sizeof(float)); }
05740 
05742         void            SetNearLimit (float l)              { m_details[2] = l;
05743                                                               m_projection &= ~TKO_Camera_Near_Limit;
05744                                                               if (l != 0.0f) m_projection |= TKO_Camera_Near_Limit;
05745                                                             }
05747         float           GetNearLimit () const               { return m_details[2];      }
05748 
05749 
05751         void            SetProjection (int p)               { m_projection = (char)p;   }
05753         int             GetProjection () const              { return (int)m_projection; }
05754 
05755 
05757         void            SetView (char const * name)         { set_name (name);          }
05759         void            SetView (int length)                { set_name (length);        }
05761         char const *    GetView () const                    { return m_name;            }
05763         char *          GetView ()                          { return m_name;            }
05764 };
05765 
05767 
05772 class BBINFILETK_API TK_Window : public BBaseOpcodeHandler {
05773     protected:
05774         float           m_window[4];  
05775 
05776     public:
05778         TK_Window ()
05779             : BBaseOpcodeHandler (TKE_Window) {}
05780 
05781         TK_Status   Read (BStreamFileToolkit & tk);
05782         TK_Status   Write (BStreamFileToolkit & tk);
05783         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05784 
05785         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05786         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05787 
05789         void            SetWindow (float l, float r, float b, float t)
05790                                 { m_window[0] = l;  m_window[1] = r;  m_window[2] = b;  m_window[3] = t;    }
05792         void            SetWindow (float const * w)            { SetWindow (w[0], w[1], w[2], w[3]);        }
05794         float const *   GetWindow () const                 { return m_window;                           }
05795 };
05796 
05797 
05802 enum TKO_Font_Options {
05803     TKO_Font_Names              = 0x00000001,   
05804     TKO_Font_Size               = 0x00000002,   
05805     TKO_Font_Size_Tolerance     = 0x00000004,   
05806     TKO_Font_Transforms         = 0x00000008,   
05807     TKO_Font_Rotation           = 0x00000010,   
05808     TKO_Font_Slant              = 0x00000020,   
05809     TKO_Font_Width_Scale        = 0x00000040,   
05810     TKO_Font_Extended           = 0x00000080,   
05811     TKO_Font_Extended_Mask      = 0xFFFFFF00,   //   internal use, indicates bits which require TKO_Font_Extended
05812     TKO_Font_Extended_Shift     = 8,            //   internal use, indicatesshift of extended section
05813     TKO_Font_Extra_Space        = 0x00000100,   
05814     TKO_Font_Line_Spacing       = 0x00000200,   
05815     TKO_Font_Outline            = 0x00000400,   
05816     TKO_Font_Underline          = 0x00000800,   
05817     TKO_Font_Strikethrough      = 0x00001000,   
05818     TKO_Font_Overline           = 0x00002000,   
05819     TKO_Font_Uniform_Spacing    = 0x00004000,   
05820     TKO_Font_Extended2          = 0x00008000,   
05821     TKO_Font_Extended2_Mask     = 0xFFFF0000,   
05822     TKO_Font_Extended2_Shift    = 16,           
05823     TKO_Font_Greeking_Limit     = 0x00010000,   
05824     TKO_Font_Fill_Edges         = 0x00020000,   
05825     TKO_Font_Bold               = 0x00040000,   
05826     TKO_Font_Italic             = 0x00080000,   
05827     TKO_Font_Renderer           = 0x00100000,   
05828     TKO_Font_Greeking_Mode      = 0x00200000,   
05829     TKO_Font_Preference         = 0x00400000,   
05830     TKO_Font_Layout             = 0x00800000    
05831 };
05832 
05833 
05834 
05838 enum TKO_Font_Layout {
05839     TKO_Font_Layout_Default = 0, 
05840     TKO_Font_Layout_Unicode = 1  
05841 };
05842 
05843 
05844 #define TKO_Font_Size_Units TKO_Generic_Size_Units
05845 #define TKO_Font_Size_Object TKO_Generic_Size_Object
05846 #define TKO_Font_Size_Screen TKO_Generic_Size_Screen
05847 #define TKO_Font_Size_Window TKO_Generic_Size_Window
05848 #define TKO_Font_Size_Points TKO_Generic_Size_Points
05849 #define TKO_Font_Size_Pixels TKO_Generic_Size_Pixels
05850 #define TKO_Font_Size_Percent TKO_Generic_Size_Percent
05851 #define TKO_Font_Size_World TKO_Generic_Size_World
05852 
05853 
05859 enum TKO_Font_Transforms {
05860     TKO_Font_Transform_Position_Only = 0,  
05861     TKO_Font_Transform_Full = 1            
05862 };
05863 
05864 
05868 enum TKO_Font_Renderers {
05869     TKO_Font_Renderer_Undefined = -1,   
05870     TKO_Font_Renderer_Default   = 0,    
05871     TKO_Font_Renderer_Driver    = 1,    
05872     TKO_Font_Renderer_Truetype  = 2,    
05873     TKO_Font_Renderer_Defined   = 3     
05874 };
05875 
05879 enum TKO_Font_Preferences {
05880     TKO_Font_Preference_Undefined = -1, 
05881     TKO_Font_Preference_Default   = 0,  
05882     TKO_Font_Preference_Bitmap    = 1,  
05883     TKO_Font_Preference_Outline   = 2,  
05884     TKO_Font_Preference_Exterior  = 3  
05885 };
05886 
05890 enum TKO_Font_Greeking_Modes {
05891     TKO_Font_Greeking_Mode_None  = 0, 
05892     TKO_Font_Greeking_Mode_Lines = 1, 
05893     TKO_Font_Greeking_Mode_Box   = 2  
05894 };
05895 
05897 
05904 class BBINFILETK_API TK_Text_Font : public BBaseOpcodeHandler {
05905     protected:
05906         int             m_mask;  
05907         int             m_value;  
05908         int             m_names_length; 
05909         char *          m_names;        
05910         float           m_size;         
05911         float           m_tolerance;    
05912         float           m_rotation;     
05913         float           m_slant;        
05914         float           m_width_scale;  
05915         float           m_extra_space;  
05916         float           m_line_spacing; 
05917         float           m_greeking_limit;
05918         float           m_renderer_cutoff;
05919         float           m_preference_cutoff;
05920         int             m_renderers[2];   
05921         int             m_preferences[2];   
05922         unsigned char   m_size_units;   
05923         unsigned char   m_tolerance_units;
05924         unsigned char   m_space_units;  
05925         unsigned char   m_greeking_units;  
05926         unsigned char   m_greeking_mode;   
05927         unsigned char   m_transforms;   
05928         unsigned char   m_renderer_cutoff_units;  
05929         unsigned char   m_preference_cutoff_units;  
05930         unsigned char   m_layout; 
05931 
05932         void    set_names (int length);           
05933         void    set_names (char const * names);   
05934 
05935     public:
05937         TK_Text_Font ()
05938             : BBaseOpcodeHandler (TKE_Text_Font), m_names_length (0), m_names (0) {}
05939         ~TK_Text_Font ();
05940 
05941         TK_Status   Read (BStreamFileToolkit & tk);
05942         TK_Status   Write (BStreamFileToolkit & tk);
05943         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
05944 
05945         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
05946         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
05947 
05948         void        Reset ();
05949 
05951         void            SetMask (int m) {
05952                             m_mask = m;
05953                             if ((m & TKO_Font_Extended2_Mask) != 0)
05954                                 m_mask |= TKO_Font_Extended2;
05955                             if ((m & TKO_Font_Extended_Mask) != 0)
05956                                 m_mask |= TKO_Font_Extended;
05957                         }
05959         int             GetMask () const                    { return m_mask;        }
05960 
05962         void            SetValue (int v)                        { m_value = v;          }
05964         int             GetValue () const                   { return m_value;       }
05965 
05967         void            SetNames (char const * names)           { set_names (names);    }
05969         void            SetNames (int length)                   { set_names (length);   }
05971         char const *    GetNames () const                   { return m_names;       }
05973         char *          GetNames ()                         { return m_names;       }
05974 
05976         void            SetSize (float s)                       { m_size = s;                           }
05978         float           GetSize () const                    { return m_size;                        }
05979 
05981         void            SetSizeUnits (int u)                    { m_size_units = (unsigned char)u;      }
05983         int             GetSizeUnits () const               { return (int)m_size_units;             }
05984 
05986         void            SetTolerance (float t)                  { m_tolerance = t;                      }
05988         float           GetTolerance () const               { return m_tolerance;                   }
05989 
05991         void            SetToleranceUnits (int u)               { m_tolerance_units = (unsigned char)u; }
05993         int             GetToleranceUnits () const          { return (int)m_tolerance_units;        }
05994 
05996         void            SetRotation (float r)                   { m_rotation = r;                       }
05998         float           GetRotation () const                { return m_rotation;                    }
05999 
06001         void            SetSlant (float s)                      { m_slant = s;                          }
06003         float           GetSlant () const                   { return m_slant;                       }
06004 
06006         void            SetWidthScale (float s)                 { m_width_scale = s;                    }
06008         float           GetWidthScale () const              { return m_width_scale;                 }
06009 
06011         void            SetExtraSpace (float s)                 { m_extra_space = s;                    }
06013         float           GetExtraSpace () const              { return m_extra_space;                 }
06014 
06016         void            SetExtraSpaceUnits (int u)              { m_space_units = (unsigned char)u;     }
06018         int             GetExtraSpaceUnits () const         { return (int)m_space_units;            }
06019 
06021         void            SetLineSpacing (float s)                { m_line_spacing = s;                   }
06023         float           GetLineSpacing () const             { return m_line_spacing;                }
06024 
06026         void            SetTransforms (int t)                   { m_transforms = (unsigned char)t;      }
06028         int             GetTransforms () const              { return (int)m_transforms;             }
06029 
06031         void            SetGreekingLimit (float s)                 { m_greeking_limit = s;                    }
06033         float           GetGreekingLimit () const              { return m_greeking_limit;                 }
06034 
06036         void            SetGreekingLimitUnits (int u)              { m_greeking_units = (unsigned char)u;     }
06038         int             GetGreekingLimitUnits () const         { return (int)m_greeking_units;            }
06039 
06041         void            SetGreekingMode (int m)              { m_greeking_mode = (unsigned char)m;     }
06043         int             GetGreekingMode () const         { return (int)m_greeking_mode;            }
06044 
06045 
06047         void            SetRenderer (int r)                   { m_renderers[0] = m_renderers[1] = r;    }
06049         int             GetRenderer () const              { return m_renderers[0];                  }
06050 
06052         void            SetRenderers (int r1, int r2)         { m_renderers[0] = r1; m_renderers[1] = r2;   }
06054         int const *      GetRenderers () const            { return m_renderers;                         }
06055 
06057         void            SetRendererCutoff (float s)           { m_renderer_cutoff = s;                    }
06059         float           GetRendererCutoff () const        { return m_renderer_cutoff;                 }
06060 
06062         void            SetRendererCutoffUnits (int u)              { m_renderer_cutoff_units = (unsigned char)u;     }
06064         int             GetRendererCutoffUnits () const         { return (int)m_renderer_cutoff_units;            }
06065 
06066 
06068         void            SetPreference (int r)                   { m_preferences[0] = m_preferences[1] = r;    }
06070         int             GetPreference () const              { return m_preferences[0];                  }
06071 
06073         void            SetPreferences (int r1, int r2)         { m_preferences[0] = r1; m_preferences[1] = r2; }
06075         int const *      GetPreferences () const            { return m_preferences;                         }
06076 
06078         void            SetPreferenceCutoff (float s)           { m_preference_cutoff = s;                    }
06080         float           GetPreferenceCutoff () const        { return m_preference_cutoff;                 }
06081 
06083         void            SetPreferenceCutoffUnits (int u)              { m_preference_cutoff_units = (unsigned char)u;     }
06085         int             GetPreferenceCutoffUnits () const         { return (int)m_preference_cutoff_units;            }
06086 
06088         void            SetLayout (int l) {m_layout = (unsigned char)l;}
06090         int             GetLayout () const {return (int)m_layout;}
06091 };
06092 
06094 
06096 
06108 enum TKO_Bounding_Type_Options {
06109     TKO_Bounding_Type_Cuboid    = 0,    
06110     TKO_Bounding_Type_Sphere    = 1     
06111 };
06112 
06113 
06114 
06116 
06127 class BBINFILETK_API2 TK_Bounding : public BBaseOpcodeHandler {
06128     protected:
06129         double          m_dvalues[6];       
06130         float           m_values[6];        
06131         char            m_type;             
06132         bool            m_is_valid;         
06133     public:
06135         TK_Bounding (unsigned char opcode)
06136             : BBaseOpcodeHandler (opcode) {}
06138         TK_Bounding (unsigned char opcode, float * min, float * max)
06139             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) {
06140                 m_values[0] = min[0]; m_values[1] = min[1]; m_values[2] = min[2];
06141                 m_values[3] = max[0]; m_values[4] = max[1]; m_values[5] = max[2];
06142             }
06144         TK_Bounding (unsigned char opcode, float * center, float radius)
06145             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) {
06146                 m_values[0] = center[0]; m_values[1] = center[1]; m_values[2] = center[2];
06147                 m_values[3] = radius;
06148             }
06150         TK_Bounding (unsigned char opcode, double * min, double * max)
06151             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) {
06152                 m_dvalues[0] = min[0]; m_dvalues[1] = min[1]; m_dvalues[2] = min[2];
06153                 m_dvalues[3] = max[0]; m_dvalues[4] = max[1]; m_dvalues[5] = max[2];
06154                 Set_General_Flags (TK_Double_Precision);
06155             }
06157         TK_Bounding (unsigned char opcode, double * center, double radius)
06158             : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) {
06159                 m_dvalues[0] = center[0]; m_dvalues[1] = center[1]; m_dvalues[2] = center[2];
06160                 m_dvalues[3] = radius;
06161                 Set_General_Flags (TK_Double_Precision);
06162             }
06163 
06164         TK_Status   Read (BStreamFileToolkit & tk);
06165         TK_Status   Write (BStreamFileToolkit & tk);
06166         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06167 
06168         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06169         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06170 };
06171 
06173 
06177 enum TKO_Light_Options {
06178     TKO_Light_Camera_Relative = 0x1
06179 };
06180 
06181 
06183 
06185 
06191 class BBINFILETK_API TK_Point : public BBaseOpcodeHandler {
06192     protected:
06193         float           m_point[3];     
06194         double          m_dpoint[3];    
06195         char            m_options;      
06196 
06197     public:
06199         TK_Point (unsigned char opcode)
06200             : BBaseOpcodeHandler (opcode) {
06201             m_point[0] = m_point[1] = m_point[2] = 0; 
06202             m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 
06203             m_options = 0; 
06204         };
06205 
06206         TK_Status   Read (BStreamFileToolkit & tk);
06207         TK_Status   Write (BStreamFileToolkit & tk);
06208         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06209 
06210         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06211         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06212 
06213         void        Reset(void) { 
06214                         m_point[0] = m_point[1] = m_point[2] = 0; 
06215                         m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 
06216                         m_options = 0; 
06217                         BBaseOpcodeHandler::Reset(); 
06218                     };
06219 
06220 
06221 
06223         void            SetPoint (float x, float y, float z)    { m_point[0] = x; m_point[1] = y; m_point[2] = z; }
06225         void            SetPoint (float const * p)              { SetPoint (p[0], p[1], p[2]);  }
06227         float const *   GetPoint () const                       { return m_point;               }
06228 
06230         void             SetDPoint (double x, double y, double z)   { m_dpoint[0] = x; m_dpoint[1] = y; m_dpoint[2] = z; }
06232         void             SetDPoint (double const * p)               { SetDPoint (p[0], p[1], p[2]);  }
06234         double const *  GetDPoint () const                          { return m_dpoint;               }
06235 
06237         void    SetOptions (int o)          { m_options = (char)o;      }
06239         int     GetOptions () const         { return (int)m_options;    }
06240 
06241 };
06242 
06243 
06244 
06246 
06251 class BBINFILETK_API TK_Line : public BBaseOpcodeHandler {
06252     protected:
06254         float           m_points[6];    
06256         double          m_dpoints[6];    
06257 
06258     public:
06260         TK_Line (unsigned char opcode = TKE_Line)
06261             : BBaseOpcodeHandler (opcode) {}
06262 
06263         TK_Status   Read (BStreamFileToolkit & tk);
06264         TK_Status   Write (BStreamFileToolkit & tk);
06265         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06266 
06267         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06268         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06269 
06271         void            SetPoints (float x1, float y1, float z1, float x2, float y2, float z2) {
06272                                 m_points[0] = x1;  m_points[1] = y1;  m_points[2] = z1;
06273                                 m_points[3] = x2;  m_points[4] = y2;  m_points[5] = z2;
06274                             }
06276         void            SetPoints (float const * s, float const * e) {
06277                                 SetPoints (s[0], s[1], s[2],  e[0], e[1], e[2]);
06278                             }
06280         void            SetPoints (float const * p)             { SetPoints (&p[0], &p[3]); }
06282         float const *   GetPoints () const                      { return m_points;          }
06283 
06285         void            SetDPoints (double x1, double y1, double z1, double x2, double y2, double z2) {
06286                                 m_dpoints[0] = x1;  m_dpoints[1] = y1;  m_dpoints[2] = z1;
06287                                 m_dpoints[3] = x2;  m_dpoints[4] = y2;  m_dpoints[5] = z2;
06288                             }
06290         void            SetDPoints (double const * s, double const * e) {
06291                                 SetDPoints (s[0], s[1], s[2],  e[0], e[1], e[2]);
06292                             }
06294         void            SetDPoints (double const * p)           { SetDPoints (&p[0], &p[3]); }
06296         double const *  GetDPoints () const                     { return m_dpoints;          }
06297 
06298 };
06299 
06300 
06301 
06303 
06310 class BBINFILETK_API TK_Polypoint : public BBaseOpcodeHandler {
06311     protected:
06312         int             m_count;    
06313         int             m_allocated;
06314         float *         m_points;   
06315         double *        m_dpoints;   
06318         void    set_points (int count, float const * points = 0)            { SetPoints (count, points); }      
06319     public:
06323         TK_Polypoint (unsigned char opcode)
06324             : BBaseOpcodeHandler (opcode), m_count (0), m_allocated (0), m_points (0), m_dpoints (0) {}
06325         ~TK_Polypoint();
06326 
06327         TK_Status   Read (BStreamFileToolkit & tk);
06328         TK_Status   Write (BStreamFileToolkit & tk);
06329         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06330 
06331         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06332         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06333 
06334         void        Reset ();
06335 
06338         void            SetPoints (int count, float const * points = 0);
06340         float const *   GetPoints () const                                  { return m_points;              }
06342         float *         GetPoints ()                                        { return m_points;              }
06343 
06346         void            SetDPoints (int count, double const * points = 0);
06348         double const *  GetDPoints () const                                 { return m_dpoints;              }
06350         double *        GetDPoints ()                                       { return m_dpoints;              }
06351 
06353         int             GetCount () const                                   { return m_count;               }
06354 
06355 };
06356 
06357 
06358 
06359 
06360 #define NC_HAS_WEIGHTS 0x01     //!< an array of floats for the weights is specified with the TK_NURBS_Curve
06361 #define NC_HAS_KNOTS   0x02     //!< an array of floats for the knots is specified with the TK_NURBS_Curve
06362 #define NC_HAS_START   0x04     //!< a float is specified for where the TK_NURBS_Curve starts in parametric [0,1] space 
06363 #define NC_HAS_END     0x08     //!< a float is specified for where the TK_NURBS_Curve ends in parametric [0,1] space 
06364 
06366 
06371 class BBINFILETK_API TK_NURBS_Curve : public BBaseOpcodeHandler {
06372     protected:
06373         unsigned char m_optionals;  
06374         unsigned char m_degree;     
06375         int m_control_point_count;  
06376         int m_knot_count_implicit;  
06377         float *m_control_points;    
06378         double *m_dcontrol_points;  
06379         float *m_weights;           
06380         float *m_knots;             
06381         float m_start;              
06382         float m_end;                
06384 
06385         void    set_curve (int degree, int control_count, float const * points = 0,
06386                            float const * weights = 0, float const * knots = 0,
06387                            float start = 0.0f, float end = 1.0f);
06388     public:
06389         TK_NURBS_Curve();
06390         ~TK_NURBS_Curve();
06391 
06392         TK_Status   Read (BStreamFileToolkit & tk);
06393         TK_Status   Write (BStreamFileToolkit & tk);
06394         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06395 
06396         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06397         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06398 
06399         void        Reset ();
06400 
06402         void            SetCurve (int degree, int control_count, float const * points = 0,
06403                                   float const * weights = 0, float const * knots = 0,
06404                                   float start = 0.0f, float end = 1.0f) {
06405                             set_curve (degree, control_count, points, weights, knots, start, end);
06406                         }
06407         void            SetDCurve (int degree, int control_count, double const * points = 0,
06408                                   float const * weights = 0, float const * knots = 0,
06409                                   float start = 0.0f, float end = 1.0f);
06410 
06411         float const *   GetPoints () const          { return m_control_points;          } 
06412         float *         GetPoints ()                { return m_control_points;          } 
06413         double const *  GetDPoints () const         { return m_dcontrol_points;          } 
06414         double *        GetDPoints ()               { return m_dcontrol_points;          } 
06416         int             GetDegree () const          { return m_degree;                  } 
06417         int             GetCount () const           { return m_control_point_count;     } 
06418         float const *   GetWeights () const         { return m_weights;                 } 
06419         float *         GetWeights ()               { return m_weights;                 } 
06420         float const *   GetKnots () const           { return m_knots;                   } 
06421         float *         GetKnots ()                 { return m_knots;                   } 
06423         void            SetStart (float s)              { m_start = s;                      } 
06424         float           GetStart () const           { return m_start;                   } 
06425         void            SetEnd (float e)                { m_end = e;                        } 
06426         float           GetEnd () const             { return m_end;                     } 
06428         void            SetOptions (int o)              { m_optionals = (unsigned char)o;   } 
06429         int             GetOptions () const         { return m_optionals;               } 
06431 };
06432 
06433 
06434 
06435 
06436 
06437 #define NS_HAS_WEIGHTS 0x01   //!< an array of floats for the weights is specified with the TK_NURBS_Surface
06438 #define NS_HAS_KNOTS   0x02   //!< an array of floats for the knots is specified with the TK_NURBS_Surface
06439 #define NS_HAS_TRIMS   0x04   //!< the TK_NURBS_Surface contains a list of trims
06440 
06441 #define NS_TRIM_END         0       //!< terminates an NS_TRIM_COLLECTION if one is active, otherwise terminates the list of trims
06442 #define NS_TRIM_POLY        1       //!< the next trim is a polyline (closed automatically if not already a closed loop)
06443 #define NS_TRIM_CURVE       2       //!< the next trim is a nurbs curve in parametric space
06444 #define NS_TRIM_COLLECTION  3       //!< all trim objects up to the next NS_TRIM_END should be combined as one.
06445 #define NS_TRIM_LAST_KNOWN_TYPE 3   //!< the last known trim type defined as of the current version of the toolkit
06446 
06447 #define NS_TRIM_KEEP        0x01 //!< instead of the usual cutting away the enclosed area, cut away everything but
06448 #define NS_TRIM_HAS_WEIGHTS 0x02 //!< applies only to trims of type NS_TRIM_CURVE: an array of floats for the weights is specified with the trim curve
06449 #define NS_TRIM_HAS_KNOTS   0x04 //!< applies only to trims of type NS_TRIM_CURVE: an array of floats for the knots is specified with the trim curve
06450 
06452 
06458 class BBINFILETK_API HT_NURBS_Trim : public BBaseOpcodeHandler  {
06459     friend class TK_NURBS_Surface;
06460     protected:
06461         //first 5 are relevant to polys and curves
06462         int             m_substage;             
06463         HT_NURBS_Trim * m_next;                 
06464         unsigned char   m_type;                 
06465         int             m_count;                
06466         float *         m_points;               
06467         //next 6 are specific to curves
06468         unsigned char   m_degree;               
06469         unsigned char   m_options;              
06470         float *         m_weights;              
06471         float *         m_knots;                
06472         float           m_start_u;              
06473         float           m_end_u;                
06474         HT_NURBS_Trim * m_list;                 
06475         HT_NURBS_Trim * m_current_trim;         
06477         HT_NURBS_Trim();
06478         TK_Status read_collection(BStreamFileToolkit & tk);  
06479         TK_Status write_collection(BStreamFileToolkit & tk); 
06482     public:
06483         ~HT_NURBS_Trim();
06484         void    SetPoly (int count, float const * points = 0);    
06485         void    SetCurve (int degree, int control_count, float const * points = 0, 
06486                           float const * weights = 0, float const * knots = 0, float start_u = 0, float end_u = 1); 
06487         void    SetCollection ();                                 
06488         void    SetOptions (int o)       { m_options = (unsigned char)o; }             
06489         void    SetList (HT_NURBS_Trim *node)       { m_list = node; }  
06490         void    SetNext (HT_NURBS_Trim *next) { m_next = next; }        
06492         TK_Status   Read (BStreamFileToolkit & tk);
06493         TK_Status   Write (BStreamFileToolkit & tk);
06494 
06495         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06496         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06497         
06498         TK_Status   read_collection_ascii(BStreamFileToolkit & tk);
06499         TK_Status   write_collection_ascii(BStreamFileToolkit & tk);
06500 
06502         HT_NURBS_Trim * GetNext (void)              { return m_next;    } 
06504         int             GetType () const        { return m_type;    } 
06506         int             GetCount () const       { return m_count;   } 
06508         float const *   GetPoints () const      { return m_points;  } 
06510         float *         GetPoints ()            { return m_points;  } 
06512         int             GetDegree () const      { return m_degree;  } 
06514         int             GetOptions () const     { return m_options; } 
06516         float const *   GetWeights () const     { return m_weights; } 
06518         float *         GetWeights ()           { return m_weights; } 
06520         float const *   GetKnots () const       { return m_knots;   } 
06522         float *         GetKnots ()             { return m_knots;   } 
06524         HT_NURBS_Trim const *GetList () const   { return m_list;    } 
06526         HT_NURBS_Trim *GetList ()               { return m_list;    } 
06527     
06528 };
06529 
06531 
06536 class BBINFILETK_API TK_NURBS_Surface : public BBaseOpcodeHandler {
06537     protected:
06538         unsigned char   m_optionals;        
06539         unsigned char   m_degree[2];        
06540         int             m_size[2];          
06541         float *         m_control_points;   
06542         double *        m_dcontrol_points;  
06543         float *         m_weights;          
06544         float *         m_u_knots;          
06545         float *         m_v_knots;          
06547         HT_NURBS_Trim * m_trims;            
06548         HT_NURBS_Trim * m_current_trim;     
06551     public:
06552         TK_NURBS_Surface();
06553         ~TK_NURBS_Surface();
06554 
06555         TK_Status   Read (BStreamFileToolkit & tk);   
06556         TK_Status   Write (BStreamFileToolkit & tk);  
06557         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06558 
06559         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06560         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06561 
06562         void        Reset (); 
06564         void            SetSurface (int u_degree, int v_degree,  int u_size, int v_size,
06565                                     float const * points = 0,    float const * weights = 0,
06566                                     float const * u_knots = 0,   float const * v_knots = 0);  
06567         void            SetDSurface (int u_degree, int v_degree,  int u_size, int v_size,
06568                                     double const * points = 0,   float const * weights = 0,
06569                                     float const * u_knots = 0,   float const * v_knots = 0);  
06572         float const *   GetPoints () const          { return m_control_points;          }
06574         float *         GetPoints ()                { return m_control_points;          }
06576         double const *  GetDPoints () const         { return m_dcontrol_points;         }
06578         double *        GetDPoints ()               { return m_dcontrol_points;         }
06579 
06581         int             GetUDegree () const         { return m_degree[0];               } 
06583         int             GetVDegree () const         { return m_degree[1];               } 
06585         int             GetUSize () const           { return m_size[0];                 } 
06587         int             GetVSize () const           { return m_size[1];                 } 
06589         float const *   GetWeights () const         { return m_weights;                 } 
06591         float *         GetWeights ()               { return m_weights;                 } 
06593         float const *   GetUKnots () const          { return m_u_knots;                 } 
06595         float *         GetUKnots ()                { return m_u_knots;                 } 
06597         float const *   GetVKnots () const          { return m_v_knots;                 } 
06599         float *         GetVKnots ()                { return m_v_knots;                 } 
06600 
06602         void            SetOptions (int o)              { m_optionals = (unsigned char)o;   } 
06604         int             GetOptions () const         { return m_optionals;               } 
06605 
06607         HT_NURBS_Trim * NewTrim (int type = NS_TRIM_END);                                 
06609         HT_NURBS_Trim * GetTrims ()                 { return m_trims;                   }
06610 
06611 
06612 };
06613 
06615 
06620 class BBINFILETK_API TK_Area_Light : public BBaseOpcodeHandler {
06621     protected:
06622         int             m_count;    
06623         float *         m_points;   
06624         double *        m_dpoints;  
06625         char            m_options;  
06626 
06628         void    set_points (int count, float const * points = 0);
06629 
06630     public:
06632         TK_Area_Light ()
06633             : BBaseOpcodeHandler (TKE_Area_Light), m_count (0), m_points (0), m_dpoints (0), m_options (0) {}
06634         ~TK_Area_Light();
06635 
06636         TK_Status   Read (BStreamFileToolkit & tk);
06637         TK_Status   Write (BStreamFileToolkit & tk);
06638         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06639 
06640         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06641         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06642 
06643         void        Reset ();
06644 
06649         void            SetPoints (int count, float const * points = 0)     { set_points (count, points);   }
06651         float const *   GetPoints () const                                  { return m_points;              }
06653         float *         GetPoints ()                                        { return m_points;              }
06654 
06659         void            SetDPoints (int count, double const * points = 0) ;
06661         double const *  GetDPoints () const                                 { return m_dpoints;             }
06663         double *        GetDPoints ()                                       { return m_dpoints;             }
06664 
06666         int             GetCount () const                                   { return m_count;               }
06667 
06669         void            SetOptions (int o)                                      { m_options = (char)o;          }
06671         int             GetOptions () const                                 { return (int)m_options;        }
06672 };
06673 
06674 
06678 enum TKO_Spot_Light_Options {
06679     TKO_Spot_Outer_Degrees      = 0x01,  
06680     TKO_Spot_Outer_Field        = 0x02,  
06681 
06682     TKO_Spot_Inner_Degrees      = 0x04,  
06683     TKO_Spot_Inner_Field        = 0x08,  
06684     TKO_Spot_Inner_Percent      = 0x0C,  
06685 
06686     TKO_Spot_Outer_Mask         = 0x03,  
06687     TKO_Spot_Inner_Mask         = 0x0C,  
06688 
06689     TKO_Spot_Camera_Relative    = 0x10,  
06690 
06691     TKO_Spot_Concentration      = 0x20  
06692 };
06693 
06694 
06696 
06701 class BBINFILETK_API TK_Spot_Light : public BBaseOpcodeHandler {
06702     protected:
06703         float           m_position[3];      
06704         float           m_target[3];        
06705         double          m_dposition[3];      
06706         double          m_dtarget[3];        
06707         float           m_outer;            
06708         float           m_inner;            
06709         float           m_concentration;    
06710         char            m_options;          
06711 
06712     public:
06714         TK_Spot_Light ()
06715             : BBaseOpcodeHandler (TKE_Spot_Light), m_options (0) {}
06716 
06717         TK_Status   Read (BStreamFileToolkit & tk);
06718         TK_Status   Write (BStreamFileToolkit & tk);
06719         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06720 
06721         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06722         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06723 
06725         void            SetPosition (float x, float y, float z)
06726                                         { m_position[0] = x; m_position[1] = y; m_position[2] = z;      }
06728         void            SetPosition (float const * p)       { SetPosition (p[0], p[1], p[2]);   }
06730         float const *   GetPosition () const                { return m_position;                }
06731 
06733         void            SetDPosition (double x, double y, double z)
06734                                         { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z;   }
06736         void            SetDPosition (double const * p)     { SetDPosition (p[0], p[1], p[2]);  }
06738         double const *  GetDPosition () const               { return m_dposition;               }
06739 
06741         void            SetTarget (float x, float y, float z)
06742                                         { m_target[0] = x; m_target[1] = y; m_target[2] = z;    }
06744         void            SetTarget (float const * t)         { SetTarget (t[0], t[1], t[2]);     }
06746         float const *   GetTarget () const                  { return m_target;                  }
06747 
06749         void            SetDTarget (double x, double y, double z)
06750                                         { m_dtarget[0] = x; m_dtarget[1] = y; m_dtarget[2] = z; }
06752         void            SetDTarget (double const * t)       { SetDTarget (t[0], t[1], t[2]);    }
06754         double const *  GetDTarget () const                 { return m_dtarget;                 }
06755 
06757         void            SetOuter (float o)                  { m_outer = o;      }
06759         float           GetOuter () const                   { return m_outer;   }
06760 
06762         void            SetInner (float i)                  { m_inner = i;      }
06764         float           GetInner () const                   { return m_inner;   }
06765 
06767         void            SetConcentration (float c)          { m_concentration = c;      }
06769         float           GetConcentration () const           { return m_concentration;   }
06770 
06772         void            SetOptions (int o)                  { m_options = (char)o;      }
06774         int             GetOptions () const                 { return (int)m_options;    }
06775 };
06776 
06777 
06779 
06784 class BBINFILETK_API TK_Cutting_Plane : public BBaseOpcodeHandler {
06785     protected:
06786         float *         m_planes;       
06787         double *        m_dplanes;      
06788         int             m_count;        
06789 
06790     public:
06792         TK_Cutting_Plane ()
06793             : BBaseOpcodeHandler (TKE_Cutting_Plane), m_planes (0), m_dplanes (0), m_count (0) {}
06794         ~TK_Cutting_Plane ();
06795 
06796         TK_Status   Read (BStreamFileToolkit & tk);
06797         TK_Status   Write (BStreamFileToolkit & tk);
06798         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06799 
06800         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06801         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06802 
06803         void        Reset ();
06804 
06806         void            SetPlanes (int count, float const * p=0);
06808         void            SetDPlanes (int count, double const * p=0);
06809 
06811         void            SetPlane (float a, float b, float c, float d)
06812                                     { SetPlanes(1);
06813                                         m_planes[0] = a;  m_planes[1] = b;  m_planes[2] = c;  m_planes[3] = d;      }
06815         void            SetDPlane (double a, double b, double c, double d)
06816                                     { SetDPlanes(1);
06817                                         m_dplanes[0] = a;  m_dplanes[1] = b;  m_dplanes[2] = c;  m_dplanes[3] = d;  }
06818 
06820         void            SetPlane (float const * p)              { SetPlanes (1, p);    }
06822         void            SetDPlane (double const * p)            { SetDPlanes (1, p);    }
06823 
06825         float const *   GetPlane () const                       { return m_planes;  }
06827         double const *  GetDPlane () const                      { return m_dplanes; }
06828 
06830         float const *   GetPlanes () const                      { return m_planes;  }
06832         double const *  GetDPlanes () const                     { return m_dplanes; }
06833 
06835         int             GetCount () const                       { return m_count;   }
06836 };
06837 
06838 
06842 enum TKO_Circular_Options {
06843     TKO_Circular_Center     = 0x01  
06844 };
06845 
06847 
06854 class BBINFILETK_API TK_Circle : public BBaseOpcodeHandler {
06855     protected:
06856         float           m_points[9];     
06857         float           m_center[3];    
06858         double          m_dpoints[9];     
06859         double          m_dcenter[3];    
06860         unsigned char   m_flags;        
06863     public:
06865         TK_Circle (unsigned char opcode)
06866             : BBaseOpcodeHandler (opcode), m_flags (0) {}
06867 
06868         TK_Status   Read (BStreamFileToolkit & tk);
06869         TK_Status   Write (BStreamFileToolkit & tk);
06870         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06871 
06872         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
06873         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
06874 
06875         void        Reset ();
06876 
06878         void            SetStart (float x, float y, float z) {
06879                             m_points[0] = x;    m_points[1] = y;    m_points[2] = z;
06880                         }
06882         void            SetStart (float const * s) {
06883                             SetStart (s[0], s[1], s[2]);
06884                         }
06886         void            SetMiddle (float x, float y, float z) {
06887                             m_points[3] = x;    m_points[4] = y;    m_points[5] = z;
06888                         }
06890         void            SetMiddle (float const * m) {
06891                             SetMiddle (m[0], m[1], m[2]);
06892                         }
06894         void            SetEnd (float x, float y, float z) {
06895                             m_points[6] = x;    m_points[7] = y;    m_points[8] = z;
06896                         }
06898         void            SetEnd (float const * e) {
06899                             SetEnd (e[0], e[1], e[2]);
06900                         }
06902         void            SetCenter (float x, float y, float z) {
06903                             m_center[0] = x;    m_center[1] = y;    m_center[2] = z;
06904                             m_flags = TKO_Circular_Center;
06905                         }
06907         void            SetCenter (float const * c) {
06908                             if (c) SetCenter (c[0], c[1], c[2]);
06909                             else m_flags = 0;
06910                         }
06912         void            SetPoints (float const * s, float const * m, float const * e,
06913                                    float const * c = 0) {
06914                             SetStart (s); SetMiddle (m); SetEnd (e); SetCenter (c);
06915                         }
06916 
06918         float const *   GetStart () const   { return &m_points[0];  }
06920         float const *   GetMiddle () const  { return &m_points[3];  }
06922         float const *   GetEnd () const     { return &m_points[6];  }
06924         float const *   GetCenter () const  { return (m_flags & TKO_Circular_Center) ? m_center : 0;    }
06925 
06927         void            SetDStart (double x, double y, double z) {
06928                             m_dpoints[0] = x;   m_dpoints[1] = y;   m_dpoints[2] = z;
06929                         }
06931         void            SetDStart (double const * s) {
06932                             SetDStart (s[0], s[1], s[2]);
06933                         }
06935         void            SetDMiddle (double x, double y, double z) {
06936                             m_dpoints[3] = x;   m_dpoints[4] = y;   m_dpoints[5] = z;
06937                         }
06939         void            SetDMiddle (double const * m) {
06940                             SetDMiddle (m[0], m[1], m[2]);
06941                         }
06943         void            SetDEnd (double x, double y, double z) {
06944                             m_dpoints[6] = x;   m_dpoints[7] = y;   m_dpoints[8] = z;
06945                         }
06947         void            SetDEnd (double const * e) {
06948                             SetDEnd (e[0], e[1], e[2]);
06949                         }
06951         void            SetDCenter (double x, double y, double z) {
06952                             m_dcenter[0] = x;   m_dcenter[1] = y;   m_dcenter[2] = z;
06953                             m_flags = TKO_Circular_Center;
06954                         }
06956         void            SetDCenter (double const * c) {
06957                             if (c) SetDCenter (c[0], c[1], c[2]);
06958                             else m_flags = 0;
06959                         }
06961         void            SetDPoints (double const * s, double const * m, double const * e,
06962                                     double const * c = 0) {
06963                             SetDStart (s); SetDMiddle (m); SetDEnd (e); SetDCenter (c);
06964                         }
06965 
06967         double const *  GetDStart () const  { return &m_dpoints[0]; }
06969         double const *  GetDMiddle () const { return &m_dpoints[3]; }
06971         double const *  GetDEnd () const    { return &m_dpoints[6]; }
06973         double const *  GetDCenter () const { return (m_flags & TKO_Circular_Center) ? m_dcenter : 0;   }
06974 };
06975 
06976 
06978 
06985 class BBINFILETK_API TK_Ellipse : public BBaseOpcodeHandler {
06986     protected:
06987         float           m_points[9];    
06988         double          m_dpoints[9];    
06989         float           m_limits[2];    
06991     public:
06993         TK_Ellipse (unsigned char opcode)
06994             : BBaseOpcodeHandler (opcode) {}
06995 
06996         TK_Status   Read (BStreamFileToolkit & tk);
06997         TK_Status   Write (BStreamFileToolkit & tk);
06998         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
06999 
07000         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07001         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07002 
07004         void            SetCenter (float x, float y, float z) {
07005                             m_points[0] = x;    m_points[1] = y;    m_points[2] = z;
07006                         }
07008         void            SetCenter (float const * s)     { SetCenter (s[0], s[1], s[2]); }
07010         float const *   GetCenter () const              { return &m_points[0];          }
07011 
07013         void            SetMajor (float x, float y, float z) {
07014                             m_points[3] = x;    m_points[4] = y;    m_points[5] = z;
07015                         }
07017         void            SetMajor (float const * m)     { SetMajor (m[0], m[1], m[2]);   }
07019         float const *   GetMajor () const            { return &m_points[3];             }
07020 
07022         void            SetMinor (float x, float y, float z) {
07023                             m_points[6] = x;    m_points[7] = y;    m_points[8] = z;
07024                         }
07026         void            SetMinor (float const * m)      { SetMinor (m[0], m[1], m[2]);  }
07028         float const *   GetMinor () const               { return &m_points[6];          }
07029 
07030 
07032         void            SetDCenter (double x, double y, double z) {
07033                             m_dpoints[0] = x;   m_dpoints[1] = y;   m_dpoints[2] = z;
07034                         }
07036         void            SetDCenter (double const * s)   { SetDCenter (s[0], s[1], s[2]);}
07038         double const *  GetDCenter () const             { return &m_dpoints[0];         }
07039 
07041         void            SetDMajor (double x, double y, double z) {
07042                             m_dpoints[3] = x;   m_dpoints[4] = y;   m_dpoints[5] = z;
07043                         }
07045         void            SetDMajor (double const * m)    { SetDMajor (m[0], m[1], m[2]); }
07047         double const *  GetDMajor () const              { return &m_dpoints[3];         }
07048 
07050         void            SetDMinor (double x, double y, double z) {
07051                             m_dpoints[6] = x;   m_dpoints[7] = y;   m_dpoints[8] = z;
07052                         }
07054         void            SetDMinor (double const * m)    { SetDMinor (m[0], m[1], m[2]); }
07056         double const *  GetDMinor () const              { return &m_dpoints[6];         }
07057 
07059         void            SetLimits (float s, float e) {
07060                             m_limits[0] = s;    m_limits[1] = e;
07061                         }
07063         float const *   GetLimits () const              { return m_limits;              }
07064 };
07065 
07066 
07068 
07075 class BBINFILETK_API TK_Sphere : public BBaseOpcodeHandler {
07076     protected:
07077         unsigned char   m_flags;        
07078         float           m_center[3];    
07079         float           m_radius;       
07080         float           m_axis[3];      
07081         float           m_ortho[3];     
07082         double          m_dcenter[3];    
07083         double          m_dradius;       
07084         double          m_daxis[3];      
07085         double          m_dortho[3];     
07087     public:
07089         TK_Sphere ()
07090             : BBaseOpcodeHandler (TKE_Sphere) { Reset(); }
07091 
07092         TK_Status   Read (BStreamFileToolkit & tk);
07093         TK_Status   Write (BStreamFileToolkit & tk);
07094         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07095 
07096         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07097         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07098 
07099         void        Reset ();
07100 
07102         void            SetCenter (float x, float y, float z) {
07103                             m_center[0] = x;    m_center[1] = y;    m_center[2] = z;
07104                         }
07106         void            SetCenter (float const * s)     { SetCenter (s[0], s[1], s[2]); }
07108         float const *   GetCenter () const              { return m_center;              }
07109 
07110 
07112         void            SetRadius (float r)             { m_radius = r;                 }
07114         float           GetRadius () const              { return m_radius;              }
07115 
07117         void            SetAxis (float x, float y, float z) {
07118                             m_axis[0] = x;  m_axis[1] = y;  m_axis[2] = z;
07119                             if (x != 0.0f || y != 1.0f || z != 0.0f)
07120                                 m_flags &= ~TKSPH_NULL_AXIS;
07121                         }
07123         void            SetAxis (float const * s)       { SetAxis (s[0], s[1], s[2]);   }
07125         float const *   GetAxis () const                { return m_axis;                }
07126 
07128         void            SetOrtho (float x, float y, float z) {
07129                             m_ortho[0] = x; m_ortho[1] = y; m_ortho[2] = z;
07130                             if (x != 1.0f || y != 0.0f || z != 0.0f)
07131                                 m_flags &= ~TKSPH_NULL_AXIS;
07132                         }
07134         void            SetOrtho (float const * s)      { SetOrtho (s[0], s[1], s[2]);  }
07136         float const *   GetOrtho () const               { return m_ortho;               }
07137 
07138 
07140         void            SetDCenter (double x, double y, double z) {
07141                             m_dcenter[0] = x;   m_dcenter[1] = y;   m_dcenter[2] = z;
07142                         }
07144         void            SetDCenter (double const * s)   { SetDCenter (s[0], s[1], s[2]);}
07146         double const *  GetDCenter () const             { return m_dcenter;             }
07147 
07148 
07150         void            SetDRadius (double r)           { m_dradius = r;                }
07152         double          GetDRadius () const             { return m_dradius;             }
07153 
07155         void            SetDAxis (double x, double y, double z) {
07156                             m_daxis[0] = x; m_daxis[1] = y; m_daxis[2] = z;
07157                             if (x != 0.0f || y != 1.0f || z != 0.0f)
07158                                 m_flags &= ~TKSPH_NULL_AXIS;
07159                         }
07161         void            SetDAxis (double const * s)     { SetDAxis (s[0], s[1], s[2]);  }
07163         double const *  GetDAxis () const               { return m_daxis;               }
07164 
07166         void            SetDOrtho (double x, double y, double z) {
07167                             m_dortho[0] = x;    m_dortho[1] = y;    m_dortho[2] = z;
07168                             if (x != 1.0f || y != 0.0f || z != 0.0f)
07169                                 m_flags &= ~TKSPH_NULL_AXIS;
07170                         }
07172         void            SetDOrtho (double const * s)    { SetDOrtho (s[0], s[1], s[2]); }
07174         double const *  GetDOrtho () const              { return m_dortho;              }
07175 
07176 
07180         enum Flags {
07181             TKSPH_NONE      = 0x0,   
07182             TKSPH_NULL_AXIS = 0x1    
07183         };
07184 
07185 };
07186 
07187 
07189 
07196 class BBINFILETK_API TK_Cylinder : public BBaseOpcodeHandler {
07197     protected:
07198         float           m_axis[6];      
07199         float           m_radius;       
07200         double          m_daxis[6];      
07201         double          m_dradius;       
07202         unsigned char   m_flags;        
07204     public:
07206         TK_Cylinder ()
07207             : BBaseOpcodeHandler (TKE_Cylinder) {}
07208 
07209         TK_Status   Read (BStreamFileToolkit & tk);
07210         TK_Status   Write (BStreamFileToolkit & tk);
07211         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07212 
07213         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07214         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07215 
07217         void            SetAxis (float x1, float y1, float z1, float x2, float y2, float z2) {
07218                             m_axis[0] = x1;     m_axis[1] = y1;     m_axis[2] = z1;
07219                             m_axis[3] = x2;     m_axis[4] = y2;     m_axis[5] = z2;
07220                         }
07222         void            SetAxis (float const * s, float const * e)      { SetAxis (s[0], s[1], s[2], e[0], e[1], e[2]); }
07224         void            SetAxis (float const * a)                       { SetAxis (&a[0], &a[3]);   }
07226         float const *   GetAxis () const        { return m_axis;        }
07228         float const *   GetStart () const       { return &m_axis[0];    }
07230         float const *   GetEnd () const         { return &m_axis[3];    }
07231 
07233         void            SetRadius (float r)     { m_radius = r;     }
07235         float           GetRadius () const      { return m_radius;  }
07236 
07237 
07239         void            SetDAxis (double x1, double y1, double z1, double x2, double y2, double z2) {
07240                             m_daxis[0] = x1;    m_daxis[1] = y1;    m_daxis[2] = z1;
07241                             m_daxis[3] = x2;    m_daxis[4] = y2;    m_daxis[5] = z2;
07242                         }
07244         void            SetDAxis (double const * s, double const * e)   { SetDAxis (s[0], s[1], s[2], e[0], e[1], e[2]);    }
07246         void            SetDAxis (double const * a)                     { SetDAxis (&a[0], &a[3]);  }
07248         double const *  GetDAxis () const       { return m_daxis;       }
07250         double const *  GetDStart () const      { return &m_daxis[0];   }
07252         double const *  GetDEnd () const        { return &m_daxis[3];   }
07253 
07255         void            SetDRadius (double r)   { m_dradius = r;        }
07257         double          GetDRadius () const     { return m_dradius; }
07258 
07259 
07261         void            SetCaps (int f)         { m_flags = (unsigned char)f;   }
07263         int             GetCaps () const        { return m_flags;               }
07264 
07268         enum Capping_Options {
07269             TKCYL_NONE   = 0,  
07270             TKCYL_FIRST  = 1,  
07271             TKCYL_SECOND = 2,  
07272             TKCYL_BOTH   = 3   
07273         };
07274 
07275 };
07276 
07277 
07279 
07286 #include "BPolyhedron.h"
07287 
07288 class BBINFILETK_API TK_PolyCylinder : public TK_Polyhedron {
07289     protected:
07290         int             m_count;        
07291         float *         m_points;       
07292         double *        m_dpoints;       
07293         int             m_radius_count; 
07294         float *         m_radii;        
07295         double *        m_dradii;        
07296         unsigned char   m_flags;        
07297         float           m_normals[6];   
07299     public:
07301         TK_PolyCylinder ()
07302             : TK_Polyhedron (TKE_PolyCylinder), m_count (0), m_points (0), m_dpoints (0),
07303             m_radius_count (0), m_radii (0), m_dradii (0) {}
07304         ~TK_PolyCylinder();
07305 
07306         TK_Status   Read (BStreamFileToolkit & tk);
07307         TK_Status   Write (BStreamFileToolkit & tk);
07308         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07309 
07310         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07311         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07312 
07313         void        Reset ();
07314 
07318         enum Capping_Options {
07319             TKCYL_NORMAL_FIRST  = 0x04,  
07320             TKCYL_NORMAL_SECOND = 0x08,  
07321             TKCYL_OPTIONALS     = 0x10   
07322         };
07323 
07328         void            SetPoints (int count, float const * points = 0);
07330         float const *   GetPoints () const              { return m_points;          }
07332         float *         GetPoints ()                    { return m_points;          }
07333 
07338         void            SetRadii (int count, float const * radii = 0);
07340         void            SetRadius (float radius)        { SetRadii (1, &radius);    }
07342         float const *   GetRadii () const               { return m_radii;           }
07344         float *         GetRadii ()                     { return m_radii;           }
07345 
07346 
07351         void            SetDPoints (int count, double const * points = 0);
07353         double const *  GetDPoints () const             { return m_dpoints;         }
07355         double *        GetDPoints ()                   { return m_dpoints;         }
07356 
07361         void            SetDRadii (int count, double const * radii = 0);
07363         void            SetDRadius (double radius)      { SetDRadii (1, &radius);   }
07365         double const *  GetDRadii () const              { return m_dradii;          }
07367         double *        GetDRadii ()                    { return m_dradii;          }
07368 
07369 
07371         int             GetCount () const               { return m_count;           }
07373         int             GetRadiusCount () const         { return m_radius_count;    }
07374 
07375 
07376 
07377 
07379         void            SetCaps (int f)                 { m_flags &= ~0x03; m_flags |= f;   }
07381         int             GetCaps () const                { return m_flags & 0x03;            }
07382 
07384         void            SetEndNormal (int index, float const * normal = 0) {
07385                             int     mask = 0x40 << index;
07386                             if (normal == 0)
07387                                 m_flags &= ~mask;
07388                             else {
07389                                 m_flags |= mask;
07390                                 m_normals[3*index+0] = normal[0];
07391                                 m_normals[3*index+1] = normal[1];
07392                                 m_normals[3*index+2] = normal[2];
07393                             }
07394                         }
07396         float const *   GetEndNormal (int index) const      {
07397                             int     mask = 0x40 << index;
07398                             if (m_flags & mask)
07399                                 return &m_normals[3*index];
07400                             else
07401                                 return 0;
07402                         }
07403 };
07404 
07405 
07407 
07413 class BBINFILETK_API TK_Grid : public BBaseOpcodeHandler {
07414     protected:
07415         char            m_type;      
07416         float           m_points[9]; 
07417         double          m_dpoints[9]; 
07418         int             m_counts[2]; 
07420     public:
07422         TK_Grid ()
07423             : BBaseOpcodeHandler (TKE_Grid) {}
07424 
07425         TK_Status   Read (BStreamFileToolkit & tk);
07426         TK_Status   Write (BStreamFileToolkit & tk);
07427         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07428 
07429         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07430         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07431 
07433         void            SetOrigin (float x, float y, float z) {
07434                             m_points[0] = x;    m_points[1] = y;    m_points[2] = z;
07435                         }
07437         void            SetOrigin (float const * o)     { SetOrigin (o[0], o[1], o[2]); }
07439         float const *   GetOrigin () const              { return &m_points[0];          }
07441         float *         GetOrigin ()                    { return &m_points[0];          }
07442 
07444         void            SetRef1 (float x, float y, float z) {
07445                             m_points[3] = x;    m_points[4] = y;    m_points[5] = z;
07446                         }
07448         void            SetRef1 (float const * r)       { SetRef1 (r[0], r[1], r[2]);   }
07450         float const *   GetRef1 () const                { return &m_points[3];          }
07452         float *         GetRef1 ()                      { return &m_points[3];          }
07453 
07455         void            SetRef2 (float x, float y, float z) {
07456                             m_points[6] = x;    m_points[7] = y;    m_points[8] = z;
07457                         }
07459         void            SetRef2 (float const * r)       { SetRef2 (r[0], r[1], r[2]);   }
07461         float const *   GetRef2 () const                { return &m_points[6];          }
07463         float *         GetRef2 ()                      { return &m_points[6];          }
07464 
07465 
07467         void            SetDOrigin (double x, double y, double z) {
07468                             m_dpoints[0] = x;   m_dpoints[1] = y;   m_dpoints[2] = z;
07469                         }
07471         void            SetDOrigin (double const * o)   { SetDOrigin (o[0], o[1], o[2]);}
07473         double const *  GetDOrigin () const             { return &m_dpoints[0];         }
07475         double *        GetDOrigin ()                   { return &m_dpoints[0];         }
07476 
07478         void            SetDRef1 (double x, double y, double z) {
07479                             m_dpoints[3] = x;   m_dpoints[4] = y;   m_dpoints[5] = z;
07480                         }
07482         void            SetDRef1 (double const * r)     { SetDRef1 (r[0], r[1], r[2]);  }
07484         double const *  GetDRef1 () const               { return &m_dpoints[3];         }
07486         double *        GetDRef1 ()                     { return &m_dpoints[3];         }
07487 
07489         void            SetDRef2 (double x, double y, double z) {
07490                             m_dpoints[6] = x;   m_dpoints[7] = y;   m_dpoints[8] = z;
07491                         }
07493         void            SetDRef2 (double const * r)     { SetDRef2 (r[0], r[1], r[2]);  }
07495         double const *  GetDRef2 () const               { return &m_dpoints[6];         }
07497         double *        GetDRef2 ()                     { return &m_dpoints[6];         }
07498 
07499 
07501         void            SetCounts (int c1, int c2) {
07502                             m_counts[0] = c1;   m_counts[1] = c2;
07503                         }
07505         int const *     GetCounts () const              { return m_counts;              }
07507         int *           GetCounts ()                    { return m_counts;              }
07508 
07510         void            SetType (int t)                 { m_type = (char)t;             }
07512         int             GetType () const                { return (int)m_type;           }
07513 };
07514 
07516 
07520 enum TKO_Text_Encodings {
07521     TKO_Enc_ISO_Latin_One,  
07522     TKO_Enc_ISO_Latin,      
07523     TKO_Enc_JEC,            
07524     TKO_Enc_EUC,            
07525     TKO_Enc_Raw_16,         
07526     TKO_Enc_Unicode,        
07527     TKO_Enc_Unicode32,      
07528     TKO_Enc_UTF8,           
07529     TKO_Enc_UTF16,          
07530     TKO_Enc_UTF32,          
07531     TKO_Enc_WCS             
07532 };
07533 
07537 enum TKO_Text_Options {
07538     TKO_Text_Option_Region                  = 0x01, 
07539     TKO_Text_Option_Character_Attributes    = 0x02  
07540 };
07541 
07545 enum TKO_Text_Region_Options {
07546     TKO_Text_Region_Window      = 0x01, 
07547     TKO_Text_Region_Relative    = 0x02, 
07548     TKO_Text_Region_Adjusted    = 0x04, 
07549     TKO_Text_Region_Center      = 0x08, 
07550     TKO_Text_Region_Top         = 0x10, 
07551     TKO_Text_Region_HFit        = 0x20, 
07552     TKO_Text_Region_VFit        = 0x40, 
07553     TKO_Text_Region_Fitting     = 0x60, 
07554     TKO_Text_Region_Extended    = 0x80  
07555 };
07556 
07560 enum TKO_Text_Region_Fit_Options {
07561     TKO_Text_Region_Fit_None    = 0,    
07562     TKO_Text_Region_Fit_Spacing = 1,    
07563     TKO_Text_Region_Fit_Size    = 2     
07564 };
07565 
07566 
07570 enum TKO_Character_Attributes {
07571     TKO_Character_Name              = 0x0001,  
07572     TKO_Character_Size              = 0x0002,  
07573     TKO_Character_Vertical_Offset   = 0x0004,  
07574     TKO_Character_Omitted           = 0x0008,  
07575     TKO_Character_Invisible         = 0x0010,  
07576     TKO_Character_Slant             = 0x0020,  
07577     TKO_Character_Width_Scale       = 0x0040,  
07578     TKO_Character_Rotation          = 0x0080,  
07579     TKO_Character_Rotation_Fixed    = 0x0100,
07580     TKO_Character_Horizontal_Offset = 0x0200,  
07581     TKO_Character_Color             = 0x0400,  
07582     TKO_Character_Extended          = 0x8000   
07583 };
07584 
07586 struct TK_Character_Attribute {
07587     char *              name;                   
07588 
07589     float               color[3];               
07590     float               size;                   
07591     float               vertical_offset;        
07592     float               horizontal_offset;      
07593     float               slant;                  
07594     float               rotation;               
07595     float               width_scale;            
07596 
07597     unsigned short      mask;                   
07598     unsigned short      value;                  
07599 
07600     unsigned char       size_units;             
07601     unsigned char       vertical_offset_units;  
07602     unsigned char       horizontal_offset_units;    
07603 };
07604 
07605 
07607 
07613 class BBINFILETK_API TK_Text : public BBaseOpcodeHandler {
07614     protected:
07615         float           m_position[3];  
07616         double          m_dposition[3];  
07617         int             m_length;       
07618         int             m_allocated;    
07619         char *          m_string;       
07620         unsigned char   m_encoding;     
07621         unsigned char   m_options;      
07622         unsigned char   m_region_options;
07623         unsigned char   m_region_fit;   
07624         unsigned char   m_region_count; 
07625         float           m_region[4*3];  
07626         int             m_count;        
07627         TK_Character_Attribute  *m_character_attributes;    
07628         int             m_substage;     
07629         int             m_tmp;          
07631         void    set_string (char const * string);     
07632         void    set_string (int length);              
07633 
07634     public:
07636         TK_Text (unsigned char opcode);
07637         ~TK_Text();
07638 
07639         TK_Status   Read (BStreamFileToolkit & tk);
07640         TK_Status   Write (BStreamFileToolkit & tk);
07641         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07642 
07643         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07644         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07645 
07646         void        Reset ();
07647 
07649         void            SetString (char const * string)         { set_string (string);  }
07651         void            SetString (unsigned short const * string);
07653         void            SetString (unsigned int const * string);
07655         void            SetString (int length)                  { set_string (length);  }
07657         char const *    GetString () const                  { return m_string;      }
07659         char *          GetString ()                        { return m_string;      }
07660 
07662         void            SetPosition (float x, float y, float z)
07663                                         {   m_position[0] = x;  m_position[1] = y;  m_position[2] = z;  }
07665         void            SetPosition (float const * p)           { SetPosition (p[0], p[1], p[2]);       }
07667         float const *   GetPosition () const                    { return &m_position[0];                }
07668 
07670         void            SetDPosition (double x, double y, double z)
07671                                         {   m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; }
07673         void            SetDPosition (double const * p)         { SetDPosition (p[0], p[1], p[2]);      }
07675         double const *   GetDPosition () const                  { return &m_dposition[0];               }
07676 
07678         void            SetEncoding (int e)                     { m_encoding = (unsigned char)e;        }
07680         int             GetEncoding () const                    { return (int)m_encoding;               }
07681 
07683         void            SetTextRegion (int c, float const * p, int o=0, int f=0);
07685         int             GetTextRegionCount () const         { return (int)m_region_count;   }
07687         float const *   GetTextRegionPoints () const        { return m_region;              }
07689         int             GetTextRegionOptions () const       { return (int)m_region_options; }
07691         int             GetTextRegionFitting () const       { return (int)m_region_fit;     }
07692 };
07693 
07695 
07697 
07703 enum TKO_Font_Type {
07704     TKO_Font_HOOPS_Stroked      // data represents a HOOPS stroked font definition
07705 };
07706 
07707 
07709 
07715 class BBINFILETK_API TK_Font : public BBaseOpcodeHandler {
07716     protected:
07717         char *          m_name;         
07718         char *          m_lookup;       
07719         char *          m_bytes;        
07720         int             m_name_length;  
07721         int             m_lookup_length;
07722         int             m_length;       
07723         unsigned char   m_type;         
07724         unsigned char   m_encoding;     
07726 
07727         void    set_bytes (int size, char const * bytes = 0);
07729         void    set_name (char const * string);
07731         void    set_name (int length);
07733         void    set_lookup (char const * string);
07735         void    set_lookup (int length);
07736 
07737     public:
07739         TK_Font () : BBaseOpcodeHandler (TKE_Font),
07740             m_name (0), m_lookup (0), m_bytes (0), m_name_length (0), m_lookup_length (0), m_length (0),
07741             m_type (0), m_encoding (0) {}
07742         ~TK_Font();
07743 
07744         TK_Status   Read (BStreamFileToolkit & tk);
07745         TK_Status   Write (BStreamFileToolkit & tk);
07746         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07747 
07748         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07749         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07750 
07751         void        Reset ();
07752 
07753 
07755         void            SetType (int t)                                     { m_type = (unsigned char)t;}
07757         int             GetType () const                                { return (int)m_type;       }
07758 
07763         void            SetBytes (int size, char const * bytes = 0)         { set_bytes (size, bytes);  }
07765         int             GetBytesCount () const                          { return m_length;          }
07767         char const *    GetBytes () const                               { return m_bytes;           }
07769         char *          GetBytes ()                                     { return m_bytes;           }
07770 
07772         void            SetName (char const * string)                       { set_name (string);        }
07774         void            SetName (int length)                                { set_name (length);        }
07776         char const *    GetName () const                                { return m_name;            }
07778         char *          GetName ()                                      { return m_name;            }
07779 
07781         void            SetLookup (char const * string)                     { set_lookup (string);      }
07783         void            SetLookup (int length)                              { set_lookup (length);      }
07785         char const *    GetLookup () const                              { return m_lookup;          }
07787         char *          GetLookup ()                                    { return m_lookup;          }
07788 
07790         void            SetEncoding (int e)                             { m_encoding = (unsigned char)e;}
07792         int             GetEncoding () const                        { return (int)m_encoding;       }
07793 };
07794 
07796 
07800 enum TKO_Image_Formats {
07801     TKO_Image_Mapped    = 0,         
07802     TKO_Image_Mapped_16 = 1,         
07803     TKO_Image_RGB       = 2,         
07804     TKO_Image_RGBA      = 3,         
07805     TKO_Image_BGRA      = 4,         
07806     TKO_Image_DEPTH     = 5,         
07807     TKO_Image_LUMINANCE8 = 6,         
07808     TKO_Image_JPEG      = 7,         
07809     TKO_Image_DXT1      = 8,         
07810     TKO_Image_DXT3      = 9,         
07811     TKO_Image_DXT5      = 10,        
07812     TKO_Image_TARGA     = 11,        
07813     TKO_Image_PNG       = 12,        
07814     TKO_Image_Format_Mask   = 0x0F,  
07815 
07816     TKO_Image_Explicit_Size = 0x10,         
07817     TKO_Image_Local_Texture = 0x20,         
07818     TKO_Image_Is_Named      = 0x80,         
07819 
07820     TKO_Image_Compression_Quality = 0x00000100,         
07821     TKO_Image_Discard       = 0x00000200,         
07822     TKO_Image_Options_Mask  = 0xFFFFFFF0,         
07823 
07824     TKO_Image_Invalid       = 0xFF          
07825 };
07826 
07827 
07829 extern const int TK_Image_Bytes_Per_Pixel[];
07830 
07834 enum TKO_Compression {
07835     TKO_Compression_None  = 0,  
07836     TKO_Compression_RLE   = 1,  
07837     TKO_Compression_JPEG  = 2,  
07838     TKO_Compression_DXT   = 3,  
07839     TKO_Compression_TARGA = 4,  
07840     TKO_Compression_PNG   = 5,  
07841     TKO_Compression_Reference = 99  
07842 };
07843 
07844 #ifndef DOXYGEN_SHOULD_SKIP_THIS
07845 
07846 class BBINFILETK_API2 TK_Image_Data_Buffer {
07847     protected:
07848         unsigned char *                 m_buffer;   
07849         unsigned int                    m_allocated;    
07850         unsigned int                    m_used;     
07851 
07852     public:
07854         TK_Image_Data_Buffer() : m_buffer (0),  m_allocated (0), m_used (0) {}
07855         ~TK_Image_Data_Buffer();
07856 
07857         void    Resize (unsigned int size);
07858         void    Expand (unsigned int size)              { Resize (Size() + size);   }
07859         void    Reset ();
07860 
07861         unsigned int const &     Size () const      { return m_allocated;   }
07862         unsigned int const &     Used () const      { return m_used;        }
07863         unsigned int       &     Used ()            { return m_used;        }
07864         unsigned char const *    Buffer () const    { return m_buffer;      }
07865         unsigned char *          Buffer ()          { return m_buffer;      }
07866 };
07867 
07868 
07869 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
07870 
07871 
07873 
07879 class BBINFILETK_API2 TK_Image : public BBaseOpcodeHandler {
07880     protected:
07881         char *                  m_bytes;        
07882         char *                  m_name;         
07883         char *                  m_reference;    
07884         float                   m_position[3];  
07885         double                  m_dposition[3];  
07886         int                     m_size[2];      
07887         int                     m_data_size;      
07888         int                     m_name_length;  
07889         int                     m_reference_length; 
07890         unsigned char           m_format;       
07891         unsigned int            m_options;      
07892         unsigned char           m_compression;  
07893         unsigned char           m_bytes_format; 
07894         float                   m_explicit_size[2]; 
07895         unsigned char           m_explicit_units[2];    
07896         TK_Image_Data_Buffer    m_work_area[2];    
07897         float                   m_compression_quality;  
07899         bool                    m_jpeg_native;  
07901 
07902         void    set_data (int size, char const * bytes = 0, unsigned char data_format = TKO_Compression_None);
07904         void    set_name (char const * string);
07906         void    set_name (int length);
07907 
07909         TK_Status compress_image (BStreamFileToolkit & tk, int active_work_area = 0);
07911         TK_Status decompress_image (BStreamFileToolkit & tk, int active_work_area = 0);
07913         TK_Status read_jpeg_header ();
07914 
07915     public:
07917         TK_Image ();
07918         ~TK_Image();
07919 
07920         TK_Status   Read (BStreamFileToolkit & tk);
07921         TK_Status   Write (BStreamFileToolkit & tk);
07922         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
07923 
07924         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
07925         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
07926         TK_Status   compress_image_ascii (BStreamFileToolkit & tk);
07927 
07928 
07929         void        Reset ();
07930 
07935         void            SetBytes (int size, char const * bytes = 0,
07936                                   unsigned char data_format = TKO_Compression_None)
07937                                                                             { set_data (size, bytes, data_format);  }
07939         char const *    GetBytes () const                               { return m_bytes;           }
07941         char *          GetBytes ()                                     { return m_bytes;           }
07942 
07944         void            SetName (char const * string)                       { set_name (string);        }
07946         void            SetName (int length)                                { set_name (length);        }
07948         char const *    GetName () const                                { return m_name;            }
07950         char *          GetName ()                                      { return m_name;            }
07951 
07953         void            SetReference (char const * string);
07955         void            SetReference (int length);
07957         char const *    GetReference () const                           { return m_reference;       }
07959         char *          GetReference ()                                 { return m_reference;       }
07960 
07962         void            SetPosition (float x, float y, float z)
07963                                         {   m_position[0] = x;  m_position[1] = y;  m_position[2] = z;  }
07965         void            SetPosition (float const * p)       { SetPosition (p[0], p[1], p[2]);           }
07967         float const *   GetPosition () const                { return &m_position[0];                    }
07968 
07970         void            SetDPosition (double x, double y, double z)
07971                                         {   m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; }
07973         void            SetDPosition (double const * p)     { SetDPosition (p[0], p[1], p[2]);          }
07975         double const *  GetDPosition () const               { return &m_dposition[0];                   }
07976 
07978         void            SetSize (int w, int h)                  { m_size[0] = w; m_size[1] = h;         }
07980         void            SetSize (int const * s)                 { m_size[0] = s[0]; m_size[1] = s[1];   }
07982         int const *     GetSize () const                    { return m_size;                        }
07983 
07985         void            SetFormat (int f)                       { m_format = (unsigned char)(f & TKO_Image_Format_Mask);    }
07987         int             GetFormat () const                  { return (int)m_format;         }
07988 
07990         void            SetOptions (int f)                       { m_options = (unsigned char)(f & TKO_Image_Options_Mask); }
07992         int             GetOptions () const                  { return (int)m_options;       }
07993 
07995         void            SetCompression (int c)                  { m_compression = (unsigned char)c;     }
07997         int             GetCompression () const             { return (int)m_compression;            }
07998 };
07999 
08000 
08002 
08003 
08007 enum TKO_Texture_Option_Bits {
08008     TKO_Texture_Param_Source        = 0x00000001,   
08009     TKO_Texture_Tiling              = 0x00000002,   
08010     TKO_Texture_Interpolation       = 0x00000004,   
08011     TKO_Texture_Decimation          = 0x00000008,   
08012     TKO_Texture_Red_Mapping         = 0x00000010,   
08013     TKO_Texture_Green_Mapping       = 0x00000020,   
08014     TKO_Texture_Blue_Mapping        = 0x00000040,   
08015     TKO_Texture_Alpha_Mapping       = 0x00000080,   
08016     TKO_Texture_Param_Function      = 0x00000100,   
08017     TKO_Texture_Layout              = 0x00000200,   
08018     TKO_Texture_Transform           = 0x00000400,   
08019     TKO_Texture_Value_Scale         = 0x00000800,   
08020     TKO_Texture_Caching             = 0x00001000,   
08021     TKO_Texture_DownSample          = 0x00002000,   
08022     TKO_Texture_No_DownSample       = 0x00004000,   
08023     TKO_Texture_Extended            = 0x00008000,   
08024     TKO_Texture_Extended_Mask       = 0xFFFF0000,   //   internal use, indicates bit which require TKO_Texture_Extended
08025     TKO_Texture_Extended_Shift      = 16,           //   internal use, indicates shift of extended section
08026     TKO_Texture_Decal               = 0x00010000,   
08027     TKO_Texture_Modulate            = 0x00020000,   
08028     TKO_Texture_Param_Offset        = 0x00040000,   
08029     TKO_Texture_Transform_Override  = 0x00080000,   
08030     TKO_Texture_Shader              = 0x00100000,   
08031     TKO_Texture_Shader_Multitexture = 0x00200000,   
08032     TKO_Texture_Camera              = 0x00400000,   
08033     TKO_Texture_Source_Dimensions   = 0x00800000,   
08034     TKO_Texture_Geometry_Shader     = 0x01000000    
08035 };
08036 
08040 enum TKO_Texture_Param_Sources {
08041     TKO_Texture_Param_Source_U,   
08042     TKO_Texture_Param_Source_UV,   
08043     TKO_Texture_Param_Source_UVW,   
08044     TKO_Texture_Param_Source_Object,   
08045     TKO_Texture_Param_Source_World,   
08046     TKO_Texture_Param_Source_Surface_Normal,   
08047     TKO_Texture_Param_Source_Reflection_Vector,   
08048     TKO_Texture_Param_Source_Natural_UV,   
08049     TKO_Texture_Param_Source_Local_Pixels,   
08050     TKO_Texture_Param_Source_Outer_Pixels,   
08051     TKO_Texture_Param_Source_Local_Window,   
08052     TKO_Texture_Param_Source_Outer_Window,   
08053     TKO_Texture_Param_Source_Transmission_Vector,   
08054     TKO_Texture_Param_Source_Sphere_Map,   
08055     TKO_Texture_Param_Source_Cylinder_Map,  
08056     TKO_Texture_Param_Source_Physical_Reflection_Vector   
08057 };
08058 
08059 
08063 enum TKO_Texture_Param_Functions {
08064     TKO_Texture_Param_Function_None,   
08065     TKO_Texture_Param_Function_Sphere,   
08066     TKO_Texture_Param_Function_Cylinder,   
08067     TKO_Texture_Param_Function_Box   
08068 };
08069 
08070 
08074 enum TKO_Texture_Layouts {
08075     TKO_Texture_Layout_Rectilinear,   
08076     TKO_Texture_Layout_Spherical,   
08077     TKO_Texture_Layout_Hemispherical,   
08078     TKO_Texture_Layout_Cubic_Faces,   
08079     TKO_Texture_Layout_Unknown   
08080 };
08081 
08085 enum TKO_Texture_Tilings {
08086     TKO_Texture_Tiling_None,   
08087     TKO_Texture_Tiling_Clamp,   
08088     TKO_Texture_Tiling_Repeat,   
08089     TKO_Texture_Tiling_Mirror,   
08090     TKO_Texture_Tiling_Drop    
08091 };
08092 
08093 
08097 enum TKO_Texture_Filters {
08098     TKO_Texture_Filter_None,   
08099     TKO_Texture_Filter_Bilinear,   
08100     TKO_Texture_Filter_Trilinear,   
08101     TKO_Texture_Filter_MipMap,   
08102     TKO_Texture_Filter_Summed_Areas,   
08103     TKO_Texture_Filter_Gaussian,   
08104     TKO_Texture_Filter_Stochastic,   
08105     TKO_Texture_Filter_Anisotropic  
08106 };
08107 
08108 
08112 enum TKO_Texture_Channel_Mappings {
08113     TKO_Texture_Channel_Mapping_Red,   
08114     TKO_Texture_Channel_Mapping_Green,   
08115     TKO_Texture_Channel_Mapping_Blue,   
08116     TKO_Texture_Channel_Mapping_Alpha,   
08117     TKO_Texture_Channel_Mapping_Zero,   
08118     TKO_Texture_Channel_Mapping_One,   
08119     TKO_Texture_Channel_Mapping_Luminance,   
08120     TKO_Texture_Channel_Mapping_None   
08121 };
08122 
08123 
08127 enum TKO_Texture_Application_Modes {
08128     TKO_Texture_Modulate_Set    = 0x01,     
08129     TKO_Texture_Decal_Set   = 0x02      
08130 };
08131 
08132 
08134 
08140 class BBINFILETK_API2 TK_Texture : public BBaseOpcodeHandler {
08141     protected:
08142         char *          m_name;             
08143         char *          m_shader_source;    
08144         char *          m_image;            
08145         char *          m_camera;            
08146         int             m_name_length;      
08147         int             m_shader_source_length;  
08148         int             m_image_length;     
08149         int             m_camera_length;      
08150         int             m_flags;            
08151         int             m_substage;         
08153         char            m_param_source;     
08154         char            m_interpolation;    
08155         char            m_decimation;       
08156         char            m_red_mapping;      
08157         char            m_green_mapping;    
08158         char            m_blue_mapping;     
08159         char            m_alpha_mapping;    
08160         char            m_param_function;   
08161         char            m_layout;           
08162         char            m_tiling;           
08163         float           m_value_scale[2];   
08164         int             m_source_dimensions[3]; 
08165         char *          m_transform;        
08166         char            m_apply_mode;       
08167         char            m_param_offset;     
08169         void    set_name (int length);                    
08170         void    set_name (char const * name);             
08171         void    set_image (int length);                   
08172         void    set_image (char const * image);           
08173         void    set_transform (int length);               
08174         void    set_transform (char const * transform);   
08175 
08176     public:
08178         TK_Texture () : BBaseOpcodeHandler (TKE_Texture),
08179             m_name (0), m_shader_source(0), m_image (0), m_camera (0),
08180             m_name_length (0), m_shader_source_length(0), m_image_length (0), m_camera_length (0),
08181             m_transform (0) {
08182                 Reset();
08183             }
08184         ~TK_Texture();
08185 
08186         TK_Status   Read (BStreamFileToolkit & tk);
08187         TK_Status   Write (BStreamFileToolkit & tk);
08188         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08189 
08190         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08191         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08192 
08193         void        Reset ();
08194 
08196         void            SetName (char const * name)                 { set_name (name);              }
08198         void            SetName (int length)                        { set_name (length);            }
08200         char const *    GetName () const                        { return m_name;                }
08202         char *          GetName ()                              { return m_name;                }
08203 
08205         void            SetShaderSource (char const * shader_source);
08207         void            SetShaderSource (int length);
08209         char const *    GetShaderSource () const                            { return m_shader_source;                }
08211         char *          GetShaderSource ()                                  { return m_shader_source;                }
08212 
08214         void            SetImage (char const * image)               { set_image (image);            }
08216         void            SetImage (int length)                       { set_image (length);           }
08218         char const *    GetImage () const                       { return m_image;               }
08220         char *          GetImage ()                             { return m_image;               }
08221 
08223         void            SetCamera (char const * camera);
08225         void            SetCamera (int length);
08227         char const *    GetCamera () const                       { return m_camera;               }
08229         char *          GetCamera ()                             { return m_camera;               }
08230 
08232         void            SetFlags (int f) {
08233                             m_flags = f;
08234                             if ((f & TKO_Texture_Extended_Mask) != 0)
08235                                 m_flags |= TKO_Texture_Extended;
08236                         }
08238         int             GetFlags () const                       { return m_flags;           }
08239 
08241         void            SetParameterSource (int p)                  { m_param_source = (char)p;     }
08243         int             GetParameterSource () const             { return (int)m_param_source;   }
08244 
08246         void            SetInterpolation (int p)                    { m_interpolation = (char)p;    }
08248         int             GetInterpolation () const               { return (int)m_interpolation;  }
08249 
08251         void            SetDecimation (int p)                       { m_decimation = (char)p;       }
08253         int             GetDecimation () const                  { return (int)m_decimation;     }
08254 
08256         void            SetRedMapping (int p)                       { m_red_mapping = (char)p;      }
08258         int             GetRedMapping () const                  { return (int)m_red_mapping;    }
08259 
08261         void            SetGreenMapping (int p)                     { m_green_mapping = (char)p;    }
08263         int             GetGreenMapping () const                { return (int)m_green_mapping;  }
08264 
08266         void            SetBlueMapping (int p)                      { m_blue_mapping = (char)p;     }
08268         int             GetBlueMapping () const                 { return (int)m_blue_mapping;   }
08269 
08271         void            SetAlphaMapping (int p)                     { m_alpha_mapping = (char)p;    }
08273         int             GetAlphaMapping () const                { return (int)m_alpha_mapping;  }
08274 
08276         void            SetParameterFunction (int p)                { m_param_function = (char)p;   }
08278         int             GetParameterFunction () const           { return (int)m_param_function; }
08279 
08281         void            SetLayout (int p)                           { m_layout = (char)p;           }
08283         int             GetLayout () const                      { return (int)m_layout;         }
08284 
08286         void            SetTiling (int p)                           { m_tiling = (char)p;           }
08288         int             GetTiling () const                      { return (int)m_tiling;         }
08289 
08291         void            SetValueScale (float v1, float v2)          { m_value_scale[0] = v1; m_value_scale[1] = v2; }
08293         float const *   GetValueScale () const                  { return m_value_scale;         }
08294 
08296         void            SetApplicationMode (int p)                  { m_apply_mode = (char)p;       }
08298         int             GetApplicationMode () const             { return (int)m_apply_mode;         }
08299 
08301         void            SetParameterOffset (int p)                  { m_param_offset = (char)p;     }
08303         int             GetParameterOffset () const             { return (int)m_param_offset;   }
08304 
08309         void            SetTransform (char const * transform)       { set_transform (transform);    }
08314         void            SetTransform (int length)                   { set_transform (length);       }
08316         char const *    GetTransform () const                   { return m_transform;           }
08318         char *          GetTransform ()                         { return m_transform;           }
08319 };
08320 
08321 
08325 enum TKO_Thumbnail_Formats {
08326     TKO_Thumbnail_RGB       = 0,         
08327     TKO_Thumbnail_RGBA      = 1,         
08328 
08329     TKO_Thumbnail_Invalid   = 0xFF       
08330 };
08331 
08333 
08339 class BBINFILETK_API2 TK_Thumbnail : public BBaseOpcodeHandler {
08340     protected:
08341         unsigned char *         m_bytes;        
08342         int                     m_allocated;    
08343         int                     m_size[2];      
08344         unsigned char           m_format;       
08346     public:
08348     TK_Thumbnail() : BBaseOpcodeHandler (TKE_Thumbnail), m_bytes (0), m_allocated (0), m_format (TKO_Thumbnail_Invalid) {}
08349         ~TK_Thumbnail();
08350 
08351         TK_Status   Read (BStreamFileToolkit & tk);
08352         TK_Status   Write (BStreamFileToolkit & tk);
08353         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08354 
08355         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08356         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08357 
08358         TK_Status   Execute (BStreamFileToolkit & tk);
08359         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, int variant);
08360         TK_Status   Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special)
08361                                 { return BBaseOpcodeHandler::Interpret(tk, key, special); }
08362         void        Reset ();
08363 
08368         void            SetBytes (int size, unsigned char const * bytes = 0);
08370         unsigned char const *    GetBytes () const                   { return m_bytes;          }
08372         unsigned char *          GetBytes ()                         { return m_bytes;          }
08373 
08375         void            SetSize (int w, int h)                  { m_size[0] = w; m_size[1] = h;     }
08377         void            SetSize (int const * s)                 { m_size[0] = s[0]; m_size[1] = s[1];   }
08379         int const *     GetSize () const                    { return m_size;            }
08380 
08382         void            SetFormat (int f)                       { m_format = (unsigned char)f;      }
08384         int             GetFormat () const                  { return (int)m_format;         }
08385 };
08386 
08387 
08389 
08391 
08396 class BBINFILETK_API2 TK_Glyph_Definition : public BBaseOpcodeHandler {
08397     protected:
08398         int             m_name_length;      
08399         int             m_size;         
08400         char *          m_name;             
08401         char *          m_data;         
08403     public:
08405         TK_Glyph_Definition () : BBaseOpcodeHandler (TKE_Glyph_Definition),
08406             m_name_length (0), m_size (0),
08407             m_name (0), m_data (0) {}
08408         ~TK_Glyph_Definition();
08409 
08410         TK_Status   Read (BStreamFileToolkit & tk);
08411         TK_Status   Write (BStreamFileToolkit & tk);
08412         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08413 
08414         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08415         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08416 
08417         void        Reset ();
08418 
08420         void            SetName (char const * name);
08422         void            SetName (int length);
08424         char const *    GetName () const            { return m_name;    }
08426         char *          GetName ()                  { return m_name;    }
08427 
08429         void            SetDefinition (int size, char const * data = 0);
08431         int     GetDefinitionSize () const      { return m_size;    }
08433         char const *    GetDefinition () const      { return m_data;    }
08435         char *          GetDefinition ()            { return m_data;    }
08436 };
08437 
08438 
08440 
08445 class BBINFILETK_API2 TK_Named_Style_Def : public BBaseOpcodeHandler {
08446     protected:
08447         int             m_name_length;      
08448         char *          m_name;             
08450         int             m_segment_length;   
08451         char *          m_segment;          
08453         int             m_cond_length;          
08454         int             m_cond_allocated;       
08455         char *          m_condition;            
08457         ID_Key          m_key;                  
08458         BBaseOpcodeHandler *     m_referee;     
08459         bool            m_follow;               
08460 
08461     public:
08463         TK_Named_Style_Def () : BBaseOpcodeHandler (TKE_Named_Style_Def),
08464             m_name_length (0), m_name (0),
08465             m_segment_length (0), m_segment (0) , 
08466             m_cond_length (0), m_cond_allocated (0), m_condition (0),
08467             m_key(-1), m_referee(0), m_follow(true) {}
08468         ~TK_Named_Style_Def();
08469 
08470         TK_Status   Read (BStreamFileToolkit & tk);
08471         TK_Status   Write (BStreamFileToolkit & tk);
08472         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08473 
08474         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08475         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08476 
08477         void        Reset ();
08478 
08480         void            SetName (char const * name);
08482         void            SetName (int length);
08484         char const *    GetName () const            { return m_name;    }
08486         char *          GetName ()                  { return m_name;    }
08487 
08492         void            SetSegment (char const * segment);
08497         void            SetSegment (int length);
08501         char const *    GetSegment () const                 { return m_segment; }
08506         char *          GetSegment ()                       { return m_segment; }
08507 };
08508 
08510 
08515 class BBINFILETK_API2 TK_Line_Style : public BBaseOpcodeHandler {
08516     protected:
08517         int             m_name_length;      
08518         int             m_definition_length;
08519         char *          m_name;             
08520         char *          m_definition;       
08522     public:
08524         TK_Line_Style () : BBaseOpcodeHandler (TKE_Line_Style),
08525             m_name_length (0), m_definition_length (0),
08526             m_name (0), m_definition (0) {}
08527         ~TK_Line_Style();
08528 
08529         TK_Status   Read (BStreamFileToolkit & tk);
08530         TK_Status   Write (BStreamFileToolkit & tk);
08531         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08532 
08533         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08534         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08535 
08536         void        Reset ();
08537 
08539         void            SetName (char const * name);
08541         void            SetName (int length);
08543         char const *    GetName () const            { return m_name;        }
08545         char *          GetName ()                  { return m_name;        }
08546 
08548         void            SetDefinition (char const * def);
08550         void            SetDefinition (int length);
08552         char const *    GetDefinition () const  { return m_definition;  }
08554         char *          GetDefinition ()        { return m_definition;  }
08555 };
08556 
08558 
08560 
08565 class BBINFILETK_API TK_Clip_Rectangle : public BBaseOpcodeHandler {
08566     protected:
08567         char            m_options;  
08568         float           m_rect[4];  
08570     public:
08572         TK_Clip_Rectangle ()
08573             : BBaseOpcodeHandler (TKE_Clip_Rectangle), m_options (0) {}
08574 
08575         TK_Status   Read (BStreamFileToolkit & tk);
08576         TK_Status   Write (BStreamFileToolkit & tk);
08577         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08578 
08579         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08580         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08581 
08582         void        Reset ();
08583 
08585         void            SetRectangle (float left, float right, float bottom, float top)
08586                             { m_rect[0] = left;  m_rect[1] = right;  m_rect[2] = bottom;  m_rect[3] = top; }
08588         void            SetRectangle (float const * rect)
08589                             { SetRectangle (rect[0], rect[1], rect[2], rect[3]); }
08591         float const *   GetRectangle () const       { return m_rect;            }
08592 
08594         void            SetOptions (int o)              { m_options = (char)o;      }
08596         int             GetOptions () const         { return (int)m_options;    }
08597 };
08598 
08600 
08604 enum TKO_Clip_Region_Options {
08605     TKO_Clip_Region_World_Space = 0x01,    
08606     TKO_Clip_Region_Window_Space = 0x02,   
08607     TKO_Clip_Region_Object_Space = 0x10,   
08608     TKO_Clip_Region_Clip = 0x04,           
08609     TKO_Clip_Region_Mask = 0x08            
08610 };
08611 
08613 
08618 class BBINFILETK_API TK_Clip_Region : public BBaseOpcodeHandler {
08619     protected:
08620         char            m_options;  
08621         int             m_count;    
08622         float *         m_points;   
08623         double *        m_dpoints;   
08625     public:
08627         TK_Clip_Region ()
08628             : BBaseOpcodeHandler (TKE_Clip_Region), m_options (0), m_count (0), m_points (0), m_dpoints (0) {}
08629         ~TK_Clip_Region();
08630 
08631         TK_Status   Read (BStreamFileToolkit & tk);
08632         TK_Status   Write (BStreamFileToolkit & tk);
08633         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08634 
08635         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08636         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08637 
08638         void        Reset ();
08639 
08644         void            SetPoints (int count, float const * points = 0);
08646         float const *   GetPoints () const          { return m_points;          }
08648         float *         GetPoints ()                { return m_points;          }
08649 
08654         void            SetDPoints (int count, double const * points = 0);
08656         double const *  GetDPoints () const         { return m_dpoints;         }
08658         double *        GetDPoints ()               { return m_dpoints;         }
08659 
08660 
08662         int             GetCount () const           { return m_count;           }
08663 
08664 
08666         void            SetOptions (int o)          { m_options = (char)o;      }
08668         int             GetOptions () const         { return (int)m_options;    }
08669 };
08670 
08671 
08673 
08675 
08691 class BBINFILETK_API2 TK_User_Data : public BBaseOpcodeHandler {
08692     protected:
08693         int             m_size;  
08694         unsigned char *          m_data;  
08695         int             m_buffer_size;   
08697 
08698         void    set_data (int size, unsigned char const * bytes = 0);  
08699 
08700     public:
08702         TK_User_Data ()
08703             : BBaseOpcodeHandler (TKE_Start_User_Data), m_size (0), m_data (0), m_buffer_size(0) {}
08704         ~TK_User_Data();
08705 
08706         TK_Status   Read (BStreamFileToolkit & tk);
08707         TK_Status   Write (BStreamFileToolkit & tk);
08708         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08709 
08710         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08711         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08712 
08713         TK_Status   Execute (BStreamFileToolkit & tk);
08714         void        Reset ();
08715 
08720         void            SetUserData (int size, unsigned char const * bytes = 0)          { set_data (size, bytes);   }
08722         unsigned char const *    GetUserData () const                                { return m_data;            }
08724         unsigned char *          GetUserData ()                                      { return m_data;            }
08726         int             GetSize () const                                    { return m_size;            }
08727 
08729         void            Resize (int size);  
08730 
08732         void            SetSize (int size);
08733 };
08734 
08735 
08737 
08739 
08751 class BBINFILETK_API2 TK_Material : public BBaseOpcodeHandler {
08752     protected:
08753         int                     m_total_size; 
08754 
08757         struct vlist_s *m_data;             
08758 
08759     public:
08761         TK_Material () : BBaseOpcodeHandler (TKE_Material), m_total_size(0), m_data(0) {}
08762         ~TK_Material();
08763 
08764         TK_Status   Read (BStreamFileToolkit & tk);
08765         TK_Status   Write (BStreamFileToolkit & tk);
08766         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08767         void        Reset ();
08768 
08769         TK_Status   PushUserData (char const *buffer, int buffer_size, bool tally_total_size = true);       
08770         TK_Status   GetBlock (char const **ptr, int *buffer_size);      
08771 };
08772 
08774 
08779 class BBINFILETK_API TK_XML : public BBaseOpcodeHandler {
08780     protected:
08781         int             m_size;  
08782         char *          m_data;  
08784     public:
08786         TK_XML (): BBaseOpcodeHandler (TKE_XML), m_size (0), m_data (0) {}
08787         ~TK_XML();
08788 
08789         TK_Status   Read (BStreamFileToolkit & tk);
08790         TK_Status   Write (BStreamFileToolkit & tk);
08791         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08792 
08793         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08794         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08795 
08796         TK_Status   Execute (BStreamFileToolkit & tk);
08797         void        Reset ();
08798 
08803         void            SetXML (int size, char const * data = 0);
08807         void            AppendXML (int size, char const * data = 0);
08809         char const *    GetXML () const                     { return m_data;            }
08811         char *          GetXML ()                           { return m_data;            }
08813         int             GetSize () const                    { return m_size;            }
08814 };
08815 
08816 
08817 
08819 
08825 class BBINFILETK_API TK_URL : public BBaseOpcodeHandler {
08826     protected:
08827         int             m_length;       
08828         int             m_allocated;    
08829         char *          m_string;       
08831     public:
08833         TK_URL () : BBaseOpcodeHandler (TKE_URL),
08834                                     m_length (0), m_allocated (0), m_string (0) {}
08835         ~TK_URL();
08836 
08837         TK_Status   Read (BStreamFileToolkit & tk);
08838         TK_Status   Write (BStreamFileToolkit & tk);
08839         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08840 
08841         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08842         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08843 
08844         void        Reset ();
08845 
08847         void            SetString (char const * string);
08849         void            SetString (int length);
08851         char const *    GetString () const                  { return m_string;      }
08853         char *          GetString ()                        { return m_string;      }
08854 };
08855 
08856 
08858 
08864 class BBINFILETK_API TK_External_Reference : public BBaseOpcodeHandler {
08865     protected:
08866         int             m_length;       
08867         int             m_allocated;    
08868         char *          m_string;       
08870     public:
08871         TK_External_Reference () : BBaseOpcodeHandler (TKE_External_Reference),
08872                                     m_length (0), m_allocated (0), m_string (0) {}
08873         ~TK_External_Reference();
08874 
08875         TK_Status   Read (BStreamFileToolkit & tk);
08876         TK_Status   Write (BStreamFileToolkit & tk);
08877         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08878 
08879         TK_Status   ReadAscii (BStreamFileToolkit & tk); 
08880         TK_Status   WriteAscii (BStreamFileToolkit & tk); 
08881 
08882         TK_Status   Execute (BStreamFileToolkit & tk);
08883         void        Reset ();
08884 
08886         void            SetString (char const * string);
08888         void            SetString (int length);
08890         char const *    GetString () const                  { return m_string;      }
08892         char *          GetString ()                        { return m_string;      }
08893 };
08894 
08895 
08897 
08903 class BBINFILETK_API TK_External_Reference_Unicode : public BBaseOpcodeHandler {
08904     protected:
08905         int             m_length;       
08906         int             m_allocated;    
08907         wchar_t *       m_string;       
08909     public:
08910         TK_External_Reference_Unicode () : BBaseOpcodeHandler (TKE_External_Reference_Unicode),
08911                                     m_length (0), m_allocated (0), m_string (0) {}
08912         ~TK_External_Reference_Unicode();
08913 
08914         TK_Status   Read (BStreamFileToolkit & tk);
08915         TK_Status   Write (BStreamFileToolkit & tk);
08916         TK_Status   Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
08917 
08918         TK_Status   Execute (BStreamFileToolkit & tk);
08919         void        Reset ();
08920 
08922         void            SetString (__wchar_t const * string);
08923 #ifdef _MSC_VER
08924         void            SetString (unsigned short const * string);
08925 #endif
08926 
08927         void            SetString (int length);
08929         wchar_t const *    GetString () const                  { return m_string;      }
08931         wchar_t *          GetString ()                        { return m_string;      }
08932 };
08933 
08934 
08935 #endif //BOPCODE_HANDLER
08936