00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 // $Id$ 00010 00011 #ifndef BOPCODE_HANDLER 00012 #define BOPCODE_HANDLER 00013 00014 #ifndef BBINFILETK_TOOLKIT 00015 #include "BStreamFileToolkit.h" 00016 #endif 00017 00018 #ifndef POINTER_SIZED_INT 00019 #if defined(WIN64) || defined(_M_X64) || defined(_WIN64) 00020 # define POINTER_SIZED_INT __int64 00021 # define POINTER_SIZED_UINT unsigned __int64 00022 #else 00023 # define POINTER_SIZED_INT long 00024 # define POINTER_SIZED_UINT unsigned long 00025 #endif 00026 #endif 00027 00028 00030 00033 00034 00054 class BBINFILETK_API2 BBaseOpcodeHandler 00055 #ifdef HPS_CORE_BUILD 00056 : public CMO 00057 #else 00058 : public BControlledMemoryObject 00059 #endif 00060 { 00061 protected: 00062 int m_stage; 00063 int m_progress; 00064 unsigned char m_opcode; 00065 unsigned char m_general_flags; 00066 bool m_needs_tag; 00067 00068 int m_debug_length; 00069 int m_debug_allocated; 00070 char * m_debug_string; 00072 char * m_ascii_buffer; 00073 int m_ascii_size; 00074 int m_ascii_length; 00075 00076 int m_ascii_stage; 00077 int m_ascii_progress; 00078 00079 unsigned char m_byte; 00080 unsigned short m_unsigned_short; 00081 int m_int; 00082 char m_char; 00083 00084 public: 00090 BBaseOpcodeHandler (int op) 00091 : m_stage (0), m_progress (0), m_opcode ((unsigned char)op), m_general_flags(0), m_needs_tag (false), 00092 m_debug_length (0), m_debug_allocated (0), m_debug_string (0), 00093 00094 m_ascii_buffer (0), m_ascii_size (0), m_ascii_length (0), m_ascii_stage (0), m_ascii_progress(0), 00095 m_byte(0), m_unsigned_short(0), m_int(0), m_char('\0') 00096 {} 00097 virtual ~BBaseOpcodeHandler (); 00098 00106 virtual TK_Status Read (BStreamFileToolkit & tk) = 0; 00107 00115 virtual TK_Status Write (BStreamFileToolkit & tk) = 0; 00116 00124 virtual TK_Status Execute (BStreamFileToolkit & tk); 00125 00135 virtual TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant = 0); 00136 00146 virtual TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special); 00147 00153 virtual void Reset (); 00154 00159 virtual bool Match_Instance (BStreamFileToolkit const & tk, Recorded_Instance * instance); 00160 00161 00163 unsigned char Opcode () const { return m_opcode; } 00164 00166 unsigned char General_Flags () const { return m_general_flags; } 00167 00169 void Set_General_Flags (int f) { m_general_flags = (unsigned char)f; } 00170 00175 int Pass (BStreamFileToolkit & tk) const { return tk.pass(); } 00176 00181 TK_Status Tag (BStreamFileToolkit & tk, int variant= -1) const { return tk.tag(variant); } 00182 00186 bool Tagging (BStreamFileToolkit & tk) const { 00187 return m_needs_tag || tk.GetWriteFlags(TK_Force_Tags) != 0; 00188 } 00189 00193 void SetNeedsTag (bool n) { m_needs_tag = n; } 00194 00198 bool NeedsTag () const { return m_needs_tag; } 00199 00206 virtual TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const { 00207 *handler = 0; 00208 return tk.Error(); 00209 } 00210 00216 virtual bool NeedsContext (BStreamFileToolkit & tk) const { (void)tk; return false; } 00217 00222 void SetLoggingString (char const * segment); 00223 00228 void SetLoggingString (int length); 00229 00233 char const * GetLoggingString () const { return m_debug_string; } 00238 char * GetLoggingString () { return m_debug_string; } 00239 00243 void LogDebug (BStreamFileToolkit & tk, char const * string = 0); 00244 00245 protected: 00246 // various means of pulling data from the toolkit buffer 00247 // Note: format conversion is safe to do in output buffer 00248 00250 static TK_Status GetData (BStreamFileToolkit & tk, char * b, int n) { return tk.read (b, n); } 00251 00253 static TK_Status GetData (BStreamFileToolkit & tk, short * s, int n) { 00254 TK_Status status; 00255 if ((status = GetData (tk, (char *)s, n * (int)sizeof (short))) == TK_Normal) 00256 fix (s, n); 00257 return status; 00258 } 00259 00261 static TK_Status GetData (BStreamFileToolkit & tk, int * i, int n) { 00262 TK_Status status; 00263 if ((status = GetData (tk, (char *)i, n * (int)sizeof (int))) == TK_Normal) 00264 fix (i, n); 00265 return status; 00266 } 00267 00269 static TK_Status GetData (BStreamFileToolkit & tk, float * f, int n) { 00270 TK_Status status; 00271 if ((status = GetData (tk, (char *)f, n * (int)sizeof (float))) == TK_Normal) 00272 fix_in (f, n); 00273 return status; 00274 } 00275 00277 static TK_Status GetData (BStreamFileToolkit & tk, double * d, int n) { 00278 TK_Status status; 00279 if ((status = GetData (tk, (char *)d, n * (int)sizeof (double))) == TK_Normal) 00280 fix_in (d, n); 00281 return status; 00282 } 00283 00285 static TK_Status GetData (BStreamFileToolkit & tk, unsigned char * b, int n) { return GetData (tk, (char *)b, n); } 00286 00288 static TK_Status GetData (BStreamFileToolkit & tk, unsigned short * s, int n) { return GetData (tk, (short *)s, n); } 00289 00291 static TK_Status GetData (BStreamFileToolkit & tk, unsigned int * i, int n) { return GetData (tk, (int *)i, n); } 00292 00294 static TK_Status GetData (BStreamFileToolkit & tk, char & c) { return GetData (tk, &c, 1); } 00295 00297 static TK_Status GetData (BStreamFileToolkit & tk, short & s) { return GetData (tk, &s, 1); } 00298 00300 static TK_Status GetData (BStreamFileToolkit & tk, int & i) { return GetData (tk, &i, 1); } 00301 00303 static TK_Status GetData (BStreamFileToolkit & tk, unsigned char & b) { return GetData (tk, &b, 1); } 00304 00306 static TK_Status GetData (BStreamFileToolkit & tk, unsigned short & s) { return GetData (tk, &s, 1); } 00307 00309 static TK_Status GetData (BStreamFileToolkit & tk, unsigned int & i) { return GetData (tk, &i, 1); } 00310 00312 static TK_Status GetData (BStreamFileToolkit & tk, float & f) { return GetData (tk, &f, 1); } 00313 00315 static TK_Status GetData (BStreamFileToolkit & tk, double & d) { return GetData (tk, &d, 1); } 00316 00317 00319 TK_Status GetGeneral (BStreamFileToolkit & tk) { 00320 TK_Status status = TK_Normal; 00321 00322 if (tk.GetVersion() >= 1975 && 00323 (status = GetData (tk, m_general_flags)) != TK_Normal) 00324 return status; 00325 00326 return status; 00327 } 00328 00329 00330 00331 00333 static TK_Status LookatData (BStreamFileToolkit & tk, unsigned char & b) { return tk.lookat ((char &)b); } 00334 00335 // various means of putting data into the toolkit buffer 00336 // Note: format conversion is NOT safe in input buffer -- use temps 00337 00339 static TK_Status PutData (BStreamFileToolkit & tk, char const * b, int n) { return tk.write (b, n); } 00340 00342 static TK_Status PutData (BStreamFileToolkit & tk, short const * s, int n) { 00343 #ifdef STREAM_BIGENDIAN 00344 short * buffer; 00345 short * tmp; 00346 TK_Status status; 00347 int i; 00348 BSTREAM_ALLOC_ARRAY(buffer, n, short); 00349 tmp = buffer; 00350 for (i=0; i<n; ++i) 00351 *tmp++ = flip (*s++); 00352 status = PutData (tk, (char const *)buffer, n * (int)sizeof (short)); 00353 BSTREAM_FREE_ARRAY(buffer, n, short); 00354 if (status != TK_Normal) 00355 return status; 00356 return TK_Normal; 00357 #else 00358 return PutData (tk, (char const *)s, n * (int)sizeof (short)); 00359 #endif 00360 } 00361 00363 static TK_Status PutData (BStreamFileToolkit & tk, int const * i, int n) { 00364 #ifdef STREAM_BIGENDIAN 00365 int * buffer; 00366 int * tmp; 00367 TK_Status status; 00368 int j; 00369 BSTREAM_ALLOC_ARRAY(buffer, n, int); 00370 tmp = buffer; 00371 for (j=0; j<n; ++j) 00372 *tmp++ = flip (*i++); 00373 status = PutData (tk, (char const *)buffer, n * (int)sizeof (int)); 00374 BSTREAM_FREE_ARRAY(buffer, n, int); 00375 if (status != TK_Normal) 00376 return status; 00377 return TK_Normal; 00378 #else 00379 return PutData (tk, (char const *)i, n * (int)sizeof (int)); 00380 #endif 00381 } 00382 00384 static TK_Status PutData (BStreamFileToolkit & tk, float const * f, int n) { 00385 #if defined(NON_IEEE) || defined(STREAM_BIGENDIAN) 00386 float * buffer; 00387 float * tmp; 00388 TK_Status status; 00389 int i; 00390 BSTREAM_ALLOC_ARRAY(buffer, n, float); 00391 tmp = buffer; 00392 for (i=0; i<n; ++i) { 00393 *tmp = *f++; 00394 fix_out (tmp++, 1); 00395 } 00396 status = PutData (tk, (char const *)buffer, n * (int)sizeof (float)); 00397 BSTREAM_FREE_ARRAY(buffer, n, float); 00398 if (status != TK_Normal) 00399 return status; 00400 return TK_Normal; 00401 #else 00402 return PutData (tk, (char const *)f, n * (int)sizeof (float)); 00403 #endif 00404 } 00405 00407 static TK_Status PutData (BStreamFileToolkit & tk, double const * d, int n) { 00408 #if defined(NON_IEEE) || defined(STREAM_BIGENDIAN) 00409 double * buffer; 00410 double * tmp; 00411 TK_Status status; 00412 int i; 00413 BSTREAM_ALLOC_ARRAY(buffer, n, double); 00414 tmp = buffer; 00415 for (i=0; i<n; ++i) { 00416 *tmp = *d++; 00417 fix_out (tmp++, 1); 00418 } 00419 status = PutData (tk, (char const *)buffer, n * (int)sizeof (double)); 00420 BSTREAM_FREE_ARRAY(buffer, n, double); 00421 if (status != TK_Normal) 00422 return status; 00423 return TK_Normal; 00424 #else 00425 return PutData (tk, (char const *)d, n * (int)sizeof (double)); 00426 #endif 00427 } 00428 00430 static TK_Status PutData (BStreamFileToolkit & tk, unsigned char const * b, int n) { return PutData (tk, (char const *)b, n); } 00431 00433 static TK_Status PutData (BStreamFileToolkit & tk, unsigned short const * s, int n) { return PutData (tk, (short const *)s, n); } 00434 00436 static TK_Status PutData (BStreamFileToolkit & tk, unsigned int const * i, int n) { return PutData (tk, (int const *)i, n); } 00437 00439 static TK_Status PutData (BStreamFileToolkit & tk, char const & c) { return PutData (tk, &c, 1); } 00440 00442 static TK_Status PutData (BStreamFileToolkit & tk, short const & s) { return PutData (tk, &s, 1); } 00443 00445 static TK_Status PutData (BStreamFileToolkit & tk, int const & i) { return PutData (tk, &i, 1); } 00446 00448 static TK_Status PutData (BStreamFileToolkit & tk, unsigned char const & b) { return PutData (tk, &b, 1); } 00449 00451 static TK_Status PutData (BStreamFileToolkit & tk, unsigned short const & s) { return PutData (tk, &s, 1); } 00452 00454 static TK_Status PutData (BStreamFileToolkit & tk, unsigned int const & i) { return PutData (tk, &i, 1); } 00455 00457 static TK_Status PutData (BStreamFileToolkit & tk, float const & f) { return PutData (tk, &f, 1); } 00458 00460 static TK_Status PutData (BStreamFileToolkit & tk, double const & d) { return PutData (tk, &d, 1); } 00461 00463 TK_Status PutOpcode (BStreamFileToolkit & tk, int adjust = 1) { 00464 TK_Status status; 00465 unsigned int sequence; 00466 00467 if ((status = PutData (tk, Opcode ())) != TK_Normal) 00468 return status; 00469 00470 tk.adjust_written (adjust); 00471 00472 sequence = tk.NextOpcodeSequence(); 00473 if (tk.GetLogging()) 00474 log_opcode (tk, sequence, Opcode()); 00475 00476 return status; 00477 } 00478 00480 TK_Status PutGeneral (BStreamFileToolkit & tk) { 00481 TK_Status status = TK_Normal; 00482 00483 if (tk.GetTargetVersion() >= 1975 && 00484 (status = PutData (tk, General_Flags ())) != TK_Normal) 00485 return status; 00486 00487 return status; 00488 } 00489 00490 00491 00492 /* note -- fix for int types will work during read OR write phase, but floats need separate routines for native->IEEE and IEEE->native 00493 */ 00495 static short flip (short s) { 00496 return (short)(((s >> 8) & 0x00FF) | (s << 8)); 00497 } 00499 static int flip (int i) { 00500 return ((i >> 24) & 0x000000FF) | ((i >> 8) & 0x0000FF00) | 00501 ((i << 8) & 0x00FF0000) | (i << 24); 00502 } 00503 00504 #ifdef STREAM_BIGENDIAN 00505 00506 static void flip (double * d) { 00507 char b[8]; 00508 memcpy (b, &d, sizeof(double)); 00509 Swap (b[0], b[7]); 00510 Swap (b[1], b[6]); 00511 Swap (b[2], b[5]); 00512 Swap (b[3], b[4]); 00513 memcpy (&d, b, sizeof(double)); 00514 } 00515 #endif 00516 00517 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00518 #ifndef UNREFERENCED 00519 #define UNREFERENCED(x) (void)(x) 00520 #endif 00521 #endif 00522 00524 static void fix (int * i, int n) { 00525 #ifdef STREAM_BIGENDIAN 00526 while (n--){ 00527 *i = flip (*i); 00528 i++; 00529 } 00530 #else 00531 UNREFERENCED(i); 00532 UNREFERENCED(n); 00533 #endif 00534 } 00536 static void fix (short * s, int n) { 00537 #ifdef STREAM_BIGENDIAN 00538 while (n--){ 00539 *s = flip (*s); 00540 s++; 00541 } 00542 #else 00543 UNREFERENCED(s); 00544 UNREFERENCED(n); 00545 #endif 00546 } 00547 00549 static void fix_in (float * f, int n) { 00550 #ifdef NON_IEEE 00551 // need to re-interpret from IEEE to native format 00552 #endif 00553 00554 #ifdef STREAM_BIGENDIAN 00555 int * i = (int *) f; 00556 while (n--) { 00557 *i = flip (*i); 00558 i++; 00559 } 00560 #else 00561 UNREFERENCED(f); 00562 UNREFERENCED(n); 00563 #endif 00564 } 00566 static void fix_in (double * d, int n) { 00567 #ifdef NON_IEEE 00568 // need to re-interpret from IEEE to native format 00569 #endif 00570 00571 #ifdef STREAM_BIGENDIAN 00572 while (n--) { 00573 flip (d++); 00574 } 00575 #else 00576 UNREFERENCED(d); 00577 UNREFERENCED(n); 00578 #endif 00579 } 00581 static void fix_out (float * f, int n) { 00582 #ifdef NON_IEEE 00583 // need to re-interpret from native format to IEEE 00584 #endif 00585 00586 #ifdef STREAM_BIGENDIAN 00587 int * i = (int*) f; 00588 while (n--) { 00589 *i = flip (*i); 00590 i++; 00591 } 00592 #else 00593 UNREFERENCED(f); 00594 UNREFERENCED(n); 00595 #endif 00596 } 00598 static void fix_out (double * d, int n) { 00599 #ifdef NON_IEEE 00600 // need to re-interpret from native format to IEEE 00601 #endif 00602 00603 #ifdef STREAM_BIGENDIAN 00604 while (n--) { 00605 flip (d++); 00606 } 00607 #else 00608 UNREFERENCED(d); 00609 UNREFERENCED(n); 00610 #endif 00611 } 00612 00614 void log_opcode (BStreamFileToolkit & tk, unsigned int sequence, unsigned char opcode); 00615 00616 00617 /* common conversions 00618 these two are for converting between floats [0.0,1.0] and unsigned chars [0,255] 00619 */ 00621 void floats_to_bytes (float const * in, unsigned char * out, int count) const { 00622 while (count-- > 0) 00623 *out++ = char (*in++ * 255.999f); 00624 } 00626 void bytes_to_floats (unsigned char const * in, float * out, int count) const { 00627 while (count-- > 0) 00628 *out++ = float (*in++) * (1.0f/255.0f); 00629 } 00630 00631 // access to toolkit utility functions 00633 void add_segment (BStreamFileToolkit & tk, ID_Key key) { tk.add_segment (key); } 00635 ID_Key remove_segment (BStreamFileToolkit & tk) { return tk.remove_segment(); } 00637 void set_last_key (BStreamFileToolkit & tk, ID_Key key) { tk.set_last_key (key); } 00639 ID_Key last_key (BStreamFileToolkit & tk) const { 00640 if (tk.m_last_keys_used == 1) 00641 return tk.m_last_keys[0]; 00642 else 00643 return -1; 00644 } 00646 void adjust_written (BStreamFileToolkit & tk, int count) { tk.adjust_written (count); } 00648 void increase_nesting (BStreamFileToolkit & tk, int amount=1) { tk.increase_nesting (amount); } 00650 void decrease_nesting (BStreamFileToolkit & tk, int amount=1) { tk.decrease_nesting (amount); } 00651 00655 void Revisit (BStreamFileToolkit & tk, float priority=0.0f, int variant=0) const { tk.revisit (Opcode(), priority, variant); } 00656 00660 BBaseOpcodeHandler * Opcode_Handler (BStreamFileToolkit & tk, unsigned char op) const 00661 { return tk.opcode_handler (op); } 00662 00664 void Record_Instance (BStreamFileToolkit & tk, ID_Key key, int variant, 00665 int val1, int val2, int val3) const { 00666 tk.record_instance (key, variant, this, val1, val2, val3); 00667 } 00669 bool Find_Instance (BStreamFileToolkit & tk, int val1, int val2, int val3) { 00670 return tk.find_instance (this, val1, val2, val3); 00671 } 00672 00674 void Remember_Item (BStreamFileToolkit & tk, ID_Key key) const { tk.remember_item(key); } 00676 bool Find_Item (BStreamFileToolkit & tk, ID_Key key) const { return tk.find_item(key); } 00677 00679 bool validate_count (int count, int limit = 1<<24) const { return 0 <= count && count <= limit; } 00680 00684 static float read_float (char const *cp, char const ** newcpp = 0); 00686 static float read_float (char const *cp, char ** newcpp) 00687 { return read_float (cp, (char const **)newcpp); } 00689 static char * write_float (char * buffer, double f); 00690 00691 00692 00694 TK_Status SkipNewlineAndTabs(BStreamFileToolkit & tk, unsigned int* readSize=0); 00696 TK_Status ReadAsciiLine(BStreamFileToolkit & tk, unsigned int* readSize=0); 00698 TK_Status ReadAsciiWord(BStreamFileToolkit & tk, unsigned int* readSize=0); 00700 TK_Status ReadEndOpcode(BStreamFileToolkit & tk); 00702 bool RemoveAngularBrackets(char* string); 00704 bool RemoveQuotes(char* string); 00706 TK_Status Read_Referenced_Segment(BStreamFileToolkit & tk, int &i_progress); 00707 00708 //TK_Status GetAsciiData(BStreamFileToolkit & tk, float * rFloats, unsigned int n); 00709 00711 TK_Status GetAsciiData(BStreamFileToolkit & tk, int * rInts, unsigned int n); 00712 //TK_Status GetAsciiData(BStreamFileToolkit & tk, short * rShorts, unsigned int n); 00713 00715 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned char& value); 00717 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, char& value); 00719 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned short& value); 00721 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, short& value); 00723 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, int& value); 00725 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, float& value); 00727 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, float * rFloats, unsigned int n); 00729 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, char * m_string, unsigned int n); 00731 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned char * m_string, unsigned int n); 00733 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, int * rInts, unsigned int n); 00735 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, short * rShorts, unsigned int n); 00737 TK_Status GetAsciiData(BStreamFileToolkit & tk, const char * tag, unsigned short * rShorts, unsigned int n); 00739 TK_Status GetAsciiHex(BStreamFileToolkit & tk, const char * tag, unsigned char &value); 00741 TK_Status GetAsciiHex(BStreamFileToolkit & tk, const char * tag, int &value); 00743 TK_Status GetAsciiHex(BStreamFileToolkit & tk, const char * tag, char &value); 00745 TK_Status GetAsciiHex(BStreamFileToolkit & tk, const char * tag, unsigned short &value); 00747 TK_Status GetAsciiImageData(BStreamFileToolkit & tk, const char * tag, unsigned char * rValues, unsigned int n); 00748 00750 TK_Status PutAsciiOpcode (BStreamFileToolkit & tk, int adjust = 1, bool is_end = false, bool want_newline = true); 00751 // TK_Status PutAsciiOpcode (BStreamFileToolkit & tk, int adjust = 1); 00752 00754 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, char const * b, int n); 00756 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, short const * s, int n); 00758 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, int const * i, int n); 00760 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, float const * f, int n); 00762 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned char const * b, int n); 00764 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned short const * s, int n); 00766 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned int const * i, int n); 00768 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, char const & c); 00770 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, short const & s); 00772 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, int const & i); 00774 TK_Status PutAsciiFlag (BStreamFileToolkit & tk, char const *tag, int const & i); 00776 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned char const & b); 00778 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned short const & s); 00780 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, unsigned int const & i); 00782 TK_Status PutAsciiData (BStreamFileToolkit & tk, char const *tag, float const & f); 00784 TK_Status PutAsciiMask (BStreamFileToolkit & tk,char const *tag, int const & i); 00786 TK_Status PutAsciiHex (BStreamFileToolkit & tk, char const *tag, int const & i); 00788 TK_Status PutStartXMLTag (BStreamFileToolkit & tk, char const *tag); 00790 TK_Status PutEndXMLTag (BStreamFileToolkit & tk, char const *tag); 00791 }; 00792 00794 #define IMPLEMENT_CLONE(class_name) \ 00795 TK_Status class_name::Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **newhandler) const { \ 00796 *newhandler = BSTREAM_NEW(class_name); \ 00797 if (*newhandler != null) \ 00798 return TK_Normal; \ 00799 else \ 00800 return tk.Error ("memory allocation in" #class_name "::clone failed"); \ 00801 } // 00802 00803 #define IMPLEMENT_CLONE_OPCODE(class_name) \ 00804 TK_Status class_name::Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **newhandler) const { \ 00805 *newhandler = BSTREAM_NEW(class_name)(Opcode()); \ 00806 if (*newhandler != null) \ 00807 return TK_Normal; \ 00808 else \ 00809 return tk.Error ("memory allocation in" #class_name "::clone failed"); \ 00810 } // 00811 00812 00813 00815 00823 // Additions need to be reflected in the 'opcode_string' table in BOpcodeHandler.cpp 00824 enum TKE_Object_Types { 00825 TKE_Termination = '\x00', 00826 TKE_Pause = '\x01', 00827 00828 TKE_Comment = ';', 00829 00830 TKE_Font = 'f', 00831 TKE_Texture = 't', 00832 TKE_Material = '\x02', 00833 00834 TKE_Open_Segment = '(', 00835 TKE_Close_Segment = ')', 00836 TKE_Reopen_Segment = 's', 00837 TKE_Include_Segment = '<', 00838 TKE_Style_Segment = '{', 00839 TKE_Named_Style = 'y', 00840 00841 TKE_Geometry_Attributes = ':', 00842 TKE_Renumber_Key_Global = 'K', 00843 TKE_Renumber_Key_Local = 'k', 00844 TKE_Priority = '0', 00845 TKE_Tag = 'q', 00846 00847 TKE_Bounding = 'b', 00848 TKE_Bounding_Info = 'B', 00849 TKE_Callback = '\x07', 00850 TKE_Camera = '>', 00851 TKE_Conditional_Action = '\'', 00852 TKE_Conditions = '?', 00853 TKE_Color = '"', 00854 TKE_Color_By_Index = '\x08', 00855 TKE_Color_By_Index_16 = '\x09', 00856 TKE_Color_By_FIndex = '\x0A', 00857 TKE_Color_RGB = '~', 00858 TKE_Color_By_Value = '\x0B', 00859 TKE_Color_Map = '\x0C', 00860 TKE_Edge_Pattern = '\x0D', 00861 TKE_Edge_Weight = '\x0E', 00862 TKE_Face_Pattern = 'P', 00863 TKE_Geometry_Options = '\x17', 00864 TKE_Handedness = 'h', 00865 TKE_Heuristics = 'H', 00866 TKE_Line_Pattern = '-', 00867 TKE_Line_Weight = '=', 00868 TKE_Marker_Size = '+', 00869 TKE_Marker_Symbol = '@', 00870 TKE_Modelling_Matrix = '%', 00871 TKE_LOD = '\x19', 00872 TKE_Rendering_Options = 'R', 00873 TKE_Selectability = '!', 00874 TKE_Text_Alignment = '*', 00875 TKE_Text_Font = 'F', 00876 TKE_Text_Path = '|', 00877 TKE_Text_Spacing = ' ', 00878 TKE_Texture_Matrix = '$', 00879 TKE_Unicode_Options = '\x16', 00880 TKE_User_Index = 'n', 00881 TKE_User_Index_Data = 'm', 00882 TKE_User_Options = 'U', 00883 TKE_User_Value = 'v', 00884 TKE_Visibility = 'V', 00885 TKE_Window = 'W', 00886 TKE_Window_Frame = '#', 00887 TKE_Window_Pattern = 'p', 00888 TKE_Glyph_Definition = 'j', 00889 TKE_Line_Style = 'J', 00890 TKE_Named_Style_Def = 'u', 00891 00892 TKE_Area_Light = 'a', 00893 TKE_Circle = 'C', 00894 TKE_Circular_Arc = 'c', 00895 TKE_Circular_Chord = '\\', 00896 TKE_Circular_Wedge = 'w', 00897 TKE_Cutting_Plane = '/', 00898 TKE_Cylinder = 'Y', 00899 TKE_Distant_Light = 'd', 00900 TKE_Ellipse = 'E', 00901 TKE_Elliptical_Arc = 'e', 00902 TKE_Grid = 'g', 00903 TKE_Image = 'i', 00904 TKE_Infinite_Line = '`', 00905 TKE_Infinite_Ray = '\x11', 00906 TKE_Line = 'l', 00907 TKE_Local_Light = '.', 00908 TKE_Marker = 'X', 00909 TKE_Mesh = 'M', 00910 TKE_NURBS_Curve = 'N', 00911 TKE_NURBS_Surface = 'A', 00912 TKE_PolyCylinder = 'Q', 00913 TKE_Polygon = 'G', 00914 TKE_Polyline = 'L', 00915 TKE_PolyPolyline = '\x10', 00916 TKE_Reference = 'r', 00917 TKE_Shell = 'S', 00918 TKE_Sphere = '\x1a', 00919 TKE_Spot_Light = '^', 00920 TKE_Text = 'T', 00921 TKE_Text_With_Encoding = 'x', 00922 00923 TKE_Start_User_Data = '[', 00924 TKE_Stop_User_Data = ']', 00925 TKE_XML = '\x18', 00926 TKE_External_Reference = '\x12', 00927 TKE_External_Reference_Unicode = '\x13', 00928 TKE_URL = '\x15', 00929 00930 TKE_Start_Compression = 'Z', 00931 TKE_Stop_Compression = 'z', 00932 00933 TKE_Repeat_Object = '&', 00934 TKE_View = '}', 00935 TKE_Clip_Rectangle = 'o', 00936 TKE_Clip_Region = 'O', 00937 TKE_Complex_Clip_Region = '\x0F', 00938 00939 TKE_File_Info = 'I', 00940 TKE_Dictionary = 'D', 00941 TKE_Dictionary_Locater = '_', 00942 TKE_Thumbnail = '\x14', 00943 TKE_Delete_Object = '\x7F', 00944 00945 TKE_Tag_Implicit = TKE_Tag, 00946 TKE_Streaming_Mode = ',', 00947 00948 TKE_First_User_Opcode = '\xA0', 00949 TKE_Last_User_Opcode = '\xEF', 00950 TKE_HW3D_Image = 0xE0, 00952 TKE_Pseudo_Handler = '\xFE', 00953 TKE_Extended_Code = '\xFF' 00954 }; 00955 00956 00958 00959 00965 class BBINFILETK_API TK_Default : public BBaseOpcodeHandler { 00966 00967 protected: 00968 char * m_opcode_buffer; 00969 int m_buffer_count; 00970 00971 public: 00973 TK_Default () : BBaseOpcodeHandler (TKE_Pseudo_Handler) {m_opcode_buffer = 0, m_buffer_count = 0;} 00974 00975 TK_Status Read (BStreamFileToolkit & tk); 00976 00977 TK_Status Write (BStreamFileToolkit & tk); 00978 00979 00980 TK_Status ReadAscii (BStreamFileToolkit & tk); 00981 TK_Status WriteAscii (BStreamFileToolkit & tk); 00982 00983 }; 00984 00990 class BBINFILETK_API TK_Unavailable : public BBaseOpcodeHandler { 00991 public: 00993 TK_Unavailable (char opcode) : BBaseOpcodeHandler (opcode) {} 00994 00995 TK_Status Read (BStreamFileToolkit & tk); 00996 TK_Status Write (BStreamFileToolkit & tk); 00997 }; 00998 01001 01007 class BBINFILETK_API TK_Header : public BBaseOpcodeHandler { 01008 protected: 01010 BBaseOpcodeHandler * m_current_object; 01011 01012 public: 01014 TK_Header () : BBaseOpcodeHandler (TKE_Pseudo_Handler), m_current_object (0) {} 01015 ~TK_Header(); 01016 01017 TK_Status Read (BStreamFileToolkit & tk); 01018 TK_Status Write (BStreamFileToolkit & tk); 01019 01020 01021 TK_Status ReadAscii (BStreamFileToolkit & tk); 01022 TK_Status WriteAscii (BStreamFileToolkit & tk); 01023 01024 01025 void Reset (); 01026 }; 01027 01028 01030 01036 class BBINFILETK_API TK_File_Info : public BBaseOpcodeHandler { 01037 protected: 01039 int m_flags; 01040 01041 public: 01043 TK_File_Info () : BBaseOpcodeHandler (TKE_File_Info), m_flags (0) {} 01044 01045 01046 TK_Status Read (BStreamFileToolkit & tk); 01047 TK_Status Write (BStreamFileToolkit & tk); 01048 TK_Status Execute (BStreamFileToolkit & tk); 01049 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant); 01050 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 01051 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 01052 01053 01054 TK_Status ReadAscii (BStreamFileToolkit & tk); 01055 TK_Status WriteAscii (BStreamFileToolkit & tk); 01056 01057 01059 void SetFlags (int f) { m_flags = f; } 01061 int GetFlags () { return m_flags; } 01062 }; 01063 01064 01066 01074 class BBINFILETK_API TK_Comment : public BBaseOpcodeHandler { 01075 protected: 01077 int m_length; 01079 int m_allocated; 01081 char * m_comment; 01082 01084 void set_comment (char const * comment); 01086 void set_comment (int length); 01087 01088 public: 01090 TK_Comment (char const * comment = 0); 01091 ~TK_Comment(); 01092 01093 TK_Status Read (BStreamFileToolkit & tk); 01094 TK_Status Write (BStreamFileToolkit & tk); 01095 TK_Status Execute (BStreamFileToolkit & tk); 01096 01097 TK_Status ReadAscii (BStreamFileToolkit & tk); 01098 TK_Status WriteAscii (BStreamFileToolkit & tk); 01099 TK_Status ExecuteAscii (BStreamFileToolkit & tk); 01102 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant) { 01103 (void)tk; (void)key; (void)variant; 01104 return TK_Normal; 01105 } 01106 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 01107 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 01108 void Reset (); 01109 01114 void SetComment (char const * comment) { set_comment (comment); } 01119 void SetComment (int length) { set_comment (length); } 01123 char const * GetComment () const { return m_comment; } 01128 char * GetComment () { return m_comment; } 01129 }; 01130 01131 01133 01141 class BBINFILETK_API TK_Terminator : public BBaseOpcodeHandler { 01142 public: 01144 TK_Terminator (char opcode, bool is_file_terminator = true) : BBaseOpcodeHandler (opcode), 01145 m_terminate_file(is_file_terminator) {} 01146 01147 TK_Status Read (BStreamFileToolkit & tk); 01148 TK_Status Write (BStreamFileToolkit & tk); 01149 TK_Status Execute (BStreamFileToolkit & tk); 01150 01151 01152 TK_Status ReadAscii (BStreamFileToolkit & tk); 01153 TK_Status WriteAscii (BStreamFileToolkit & tk); 01154 01155 protected: 01157 // meant to terminate the file or something else (viz. LOD collection) 01158 bool m_terminate_file; 01159 }; 01160 01161 01163 01170 class BBINFILETK_API TK_Compression : public BBaseOpcodeHandler { 01171 public: 01173 TK_Compression (char opcode) : BBaseOpcodeHandler (opcode) {} 01174 01175 TK_Status Read (BStreamFileToolkit & tk); 01176 TK_Status Write (BStreamFileToolkit & tk); 01177 01178 TK_Status ReadAscii (BStreamFileToolkit & tk); 01179 TK_Status WriteAscii (BStreamFileToolkit & tk); 01180 TK_Status Execute (BStreamFileToolkit & tk); 01181 TK_Status ExecuteAscii (BStreamFileToolkit & tk); 01182 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant); 01183 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 01184 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 01185 }; 01186 01188 01192 enum TKO_Geometry_Bits { 01193 // first byte is common/shared items, plus flag for extended bits 01194 TKO_Geo_Face = 0x00000001, 01195 TKO_Geo_Edge = 0x00000002, 01196 TKO_Geo_Line = 0x00000004, 01197 TKO_Geo_Marker = 0x00000008, 01198 TKO_Geo_Text = 0x00000010, 01199 TKO_Geo_Window = 0x00000020, 01200 TKO_Geo_Image = 0x00000040, 01201 01202 TKO_Geo_Extended = 0x00000080, 01203 TKO_Geo_Extended_Mask = 0xFFFFFF00, 01204 TKO_Geo_Extended_Shift = 8, 01205 01206 // extras for color 01207 TKO_Geo_Ambient_Up = 0x00000100, 01208 TKO_Geo_Light = 0x00000200, 01209 TKO_Geo_Face_Contrast = 0x00000400, 01210 TKO_Geo_Window_Contrast = 0x00000800, 01211 TKO_Geo_Front = 0x00001000, 01212 TKO_Geo_Back = 0x00002000, 01213 TKO_Geo_Vertex = 0x00004000, 01214 TKO_Geo_Geom_Colors = 0x0000701F, 01215 TKO_Geo_Every_Colors = 0x000073BF, 01216 01217 TKO_Geo_Extended_Colors = 0x00008000, 01218 TKO_Geo_Extended_Colors_Mask 01219 = 0xFFFF0000, 01220 TKO_Geo_Extended_Colors_Shift 01221 = 16, 01222 01223 TKO_Geo_Edge_Contrast = 0x00010000, 01224 TKO_Geo_Line_Contrast = 0x00020000, 01225 TKO_Geo_Marker_Contrast = 0x00040000, 01226 TKO_Geo_Vertex_Contrast = 0x00080000, 01227 TKO_Geo_Cut_Edge = 0x00100000, 01228 TKO_Geo_Simple_Reflection=0x00200000, 01229 TKO_Geo_Cut_Face = 0x00400000, 01230 01231 TKO_Geo_Extended2 = 0x00800000, 01232 TKO_Geo_Extended2_Mask = 0xFF000000, 01233 TKO_Geo_Extended2_Shift = 24, 01234 01235 TKO_Geo_Text_Contrast = 0x01000000, 01236 TKO_Geo_Ambient_Down = 0x02000000, 01237 TKO_Geo_Cut_Face_Contrast 01238 = 0x04000000, 01239 TKO_Geo_Ambient = 0x02000100, 01240 TKO_Geo_All_Colors = 0x077F7F7F, 01241 01242 //extras for selectability 01243 TKO_Geo_String_Cursor = 0x00000100, 01244 // TKO_Geo_Light = 0x00000200, //!< extra item for selectability; refer to ::HC_Set_Selectability for a description 01245 // TKO_Geo_Vertex = 0x00004000, //!< extra item for selectability; refer to ::HC_Set_Selectability for a description 01246 TKO_Geo_Isoline = 0x00000080, 01247 TKO_Geo_Geom_Selects = 0x0000435F, 01248 TKO_Geo_All_Selects = 0x000043FF, 01249 01250 // extras for visibility 01251 // TKO_Geo_String_Cursor = 0x00000100, //!< extra item for visibility; refer to ::HC_Set_Visibility for a description 01252 TKO_Geo_Face_Lighting = 0x00000200, 01253 TKO_Geo_Edge_Lighting = 0x00000400, 01254 TKO_Geo_Marker_Lighting = 0x00000800, 01255 TKO_Geo_Light_Visibles = 0x00000E00, 01256 01257 TKO_Geo_Silhouette_Edge = 0x00001000, 01258 TKO_Geo_Perimeter_Edge = 0x00002000, 01259 TKO_Geo_Mesh_Quad = 0x00004000, 01260 TKO_Geo_Hard_Edge = 0x00008000, 01261 TKO_Geo_Cutting_Plane = 0x00010000, 01262 TKO_Geo_Shadow_Emit = 0x00020000, 01263 TKO_Geo_Shadow_Cast = 0x00040000, 01264 TKO_Geo_Shadow_Receive = 0x00080000, 01265 TKO_Geo_Shadow_Visibles = 0x000E0000, 01266 // TKO_Geo_Cut_Edge = 0x00100000, //!< extra item for visibility; refer to ::HC_Set_Visibility for a description 01267 TKO_Geo_Vertex_Vis = 0x00200000, 01268 // TKO_Geo_Cut_Face = 0x00400000, //!< extra item for visibility; refer to ::HC_Set_Visibility for a description 01269 TKO_Geo_Cut_Geometry = 0x00500000, 01270 01271 TKO_Geo_Adjacent_Edge = 0x01000000, 01272 TKO_Geo_NonCulled_Edge = 0x02000000, 01273 TKO_Geo_Edge_Visibles = 0x0300F002, 01274 01275 01276 TKO_Geo_Geom_Visibles = 0x0301FFFF, 01277 01278 01279 01280 TKO_Geo_All_Visibles = 0x037FFF7F 01281 }; 01282 01283 01287 enum TKO_Color_Channels { 01288 TKO_Channel_Diffuse = 0, 01289 TKO_Channel_Specular = 1, 01290 TKO_Channel_Mirror = 2, 01291 TKO_Channel_Transmission = 3, 01292 TKO_Channel_Emission = 4, 01293 TKO_Channel_Gloss = 5, 01294 TKO_Channel_Index = 6, 01295 TKO_Channel_Extended = 7, 01296 TKO_Channel_Environment = 8, 01297 TKO_Channel_Bump = 9, 01298 01299 TKO_Channel_Count = 10, 01300 01301 TKO_Channel_Extended_Mask = 0xFF00, 01302 TKO_Channel_Extended_Shift = 8 01303 }; 01304 01305 01307 01311 enum TKO_Attribute_Lock_Bits { 01312 TKO_Lock_Callback = 0x00000001, 01313 TKO_Lock_Camera = 0x00000002, 01314 TKO_Lock_Color = 0x00000004, 01315 TKO_Lock_Color_Map = 0x00000008, 01316 TKO_Lock_Driver = 0x00000010, 01317 TKO_Lock_Driver_Options = 0x00000020, 01318 TKO_Lock_Edge_Pattern = 0x00000040, 01319 TKO_Lock_Edge_Weight = 0x00000080, 01320 TKO_Lock_Face_Pattern = 0x00000100, 01321 TKO_Lock_Handedness = 0x00000200, 01322 TKO_Lock_Heuristics = 0x00000400, 01323 TKO_Lock_Line_Pattern = 0x00000800, 01324 TKO_Lock_Line_Weight = 0x00001000, 01325 TKO_Lock_Marker_Size = 0x00002000, 01326 TKO_Lock_Marker_Symbol = 0x00004000, 01327 TKO_Lock_Metafile = 0x00008000, 01328 TKO_Lock_Modelling_Matrix = 0x00010000, 01329 TKO_Lock_Rendering_Options = 0x00020000, 01330 TKO_Lock_Selectability = 0x00040000, 01331 TKO_Lock_Styles = 0x00080000, 01332 TKO_Lock_Text_Alignment = 0x00100000, 01333 TKO_Lock_Text_Font = 0x00200000, 01334 TKO_Lock_Text_Path = 0x00400000, 01335 TKO_Lock_Text_Spacing = 0x00800000, 01336 TKO_Lock_User_Options = 0x01000000, 01337 TKO_Lock_User_Value = 0x02000000, 01338 TKO_Lock_Texture_Matrix = 0x04000000, 01339 TKO_Lock_Visibility = 0x08000000, 01340 TKO_Lock_Window = 0x10000000, 01341 TKO_Lock_Window_Frame = 0x20000000, 01342 TKO_Lock_Window_Pattern = 0x40000000, 01343 TKO_Lock_All = 0x7FFFFFFF 01344 01345 }; 01346 01350 enum TKO_Color_Channel_Lock_Bits { 01351 TKO_Lock_Channel_Diffuse = 0x0001, 01352 TKO_Lock_Channel_Specular = 0x0002, 01353 TKO_Lock_Channel_Mirror = 0x0004, 01354 TKO_Lock_Channel_Transmission = 0x0008, 01355 TKO_Lock_Channel_Emission = 0x0010, 01356 TKO_Lock_Channel_Gloss = 0x0020, 01357 TKO_Lock_Channel_Index = 0x0040, 01358 TKO_Lock_Channel_Environment = 0x0080, 01359 TKO_Lock_Channel_Bump = 0x0100, 01360 TKO_Lock_Channel_ALL = 0x01FF 01361 }; 01362 01363 01364 // this should be based off a "data handling" interface class broken out from BBaseOpcodeHandler 01365 class BBINFILETK_API Lock_Masks : public BBaseOpcodeHandler { 01366 public: 01367 int mask; 01368 int value; 01369 int color_mask; 01370 int color_value; 01371 short color_face_mask; 01372 short color_face_value; 01373 short color_edge_mask; 01374 short color_edge_value; 01375 short color_line_mask; 01376 short color_line_value; 01377 short color_marker_mask; 01378 short color_marker_value; 01379 short color_text_mask; 01380 short color_text_value; 01381 short color_window_mask; 01382 short color_window_value; 01383 short color_face_contrast_mask; 01384 short color_face_contrast_value; 01385 short color_window_contrast_mask; 01386 short color_window_contrast_value; 01387 short color_back_mask; 01388 short color_back_value; 01389 short color_vertex_mask; 01390 short color_vertex_value; 01391 short color_edge_contrast_mask; 01392 short color_edge_contrast_value; 01393 short color_line_contrast_mask; 01394 short color_line_contrast_value; 01395 short color_marker_contrast_mask; 01396 short color_marker_contrast_value; 01397 short color_vertex_contrast_mask; 01398 short color_vertex_contrast_value; 01399 short color_text_contrast_mask; 01400 short color_text_contrast_value; 01401 short color_simple_reflection_mask; 01402 short color_simple_reflection_value; 01403 short color_cut_face_mask; 01404 short color_cut_face_value; 01405 short color_cut_edge_mask; 01406 short color_cut_edge_value; 01407 int visibility_mask; 01408 int visibility_value; 01409 01410 01411 Lock_Masks () : BBaseOpcodeHandler (0) {} 01412 TK_Status Read (BStreamFileToolkit &) { return TK_Error; } 01413 TK_Status Write (BStreamFileToolkit &) { return TK_Error; } //-V524 01414 01415 TK_Status Read (BStreamFileToolkit & tk, bool mask_only); 01416 TK_Status Write (BStreamFileToolkit & tk, bool mask_only); 01417 01418 void init() { 01419 mask = value = 0; 01420 color_mask = color_value = 0; 01421 color_face_mask = color_face_value = 01422 color_edge_mask = color_edge_value = 01423 color_line_mask = color_line_value = 01424 color_marker_mask = color_marker_value = 01425 color_text_mask = color_text_value = 01426 color_window_mask = color_window_value = 01427 color_face_contrast_mask = color_face_contrast_value = 01428 color_window_contrast_mask = color_window_contrast_value = 01429 color_back_mask = color_back_value = 01430 color_vertex_mask = color_vertex_value = 01431 color_edge_contrast_mask = color_edge_contrast_value = 01432 color_line_contrast_mask = color_line_contrast_value = 01433 color_marker_contrast_mask = color_marker_contrast_value = 01434 color_vertex_contrast_mask = color_vertex_contrast_value = 01435 color_text_contrast_mask = color_text_contrast_value = 0; 01436 color_simple_reflection_mask = color_simple_reflection_value = 0; 01437 color_cut_face_mask = color_cut_face_value = 0; 01438 color_cut_edge_mask = color_cut_edge_value = 0; 01439 visibility_mask = visibility_value = 0; 01440 } 01441 01442 void set_color() { 01443 color_mask = color_value = TKO_Geo_All_Colors; 01444 color_face_mask = color_face_value = 01445 color_edge_mask = color_edge_value = 01446 color_line_mask = color_line_value = 01447 color_marker_mask = color_marker_value = 01448 color_text_mask = color_text_value = 01449 color_window_mask = color_window_value = 01450 color_face_contrast_mask = color_face_contrast_value = 01451 color_window_contrast_mask = color_window_contrast_value = 01452 color_back_mask = color_back_value = 01453 color_vertex_mask = color_vertex_value = 01454 color_edge_contrast_mask = color_edge_contrast_value = 01455 color_line_contrast_mask = color_line_contrast_value = 01456 color_marker_contrast_mask = color_marker_contrast_value = 01457 color_vertex_contrast_mask = color_vertex_contrast_value = 01458 color_text_contrast_mask = color_text_contrast_value = 01459 color_simple_reflection_mask = color_simple_reflection_value = 01460 color_cut_face_mask = color_cut_face_value = 01461 color_cut_edge_mask = color_cut_edge_value = 01462 TKO_Lock_Channel_ALL; 01463 } 01464 }; 01465 01467 01469 01479 class BBINFILETK_API TK_Open_Segment : public BBaseOpcodeHandler { 01480 protected: 01481 int m_length; 01482 int m_allocated; 01483 char * m_string; 01485 01486 void set_segment (char const * segment); 01488 void set_segment (int length); 01489 01490 public: 01492 TK_Open_Segment () : BBaseOpcodeHandler (TKE_Open_Segment), m_length (0), m_allocated (0), m_string (0) {} 01493 ~TK_Open_Segment(); 01494 01495 TK_Status Read (BStreamFileToolkit & tk); 01496 TK_Status Write (BStreamFileToolkit & tk); 01497 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01498 01499 TK_Status ReadAscii (BStreamFileToolkit & tk); 01500 TK_Status WriteAscii (BStreamFileToolkit & tk); 01501 void Reset (); 01502 01507 void SetSegment (char const * segment) { set_segment (segment); } 01508 01513 void SetSegment (int length) { set_segment (length); } 01514 01518 char const * GetSegment () const { return m_string; } 01523 char * GetSegment () { return m_string; } 01524 01525 }; 01526 01527 01529 01538 class BBINFILETK_API TK_Close_Segment : public BBaseOpcodeHandler { 01539 public: 01541 TK_Close_Segment () : BBaseOpcodeHandler (TKE_Close_Segment) {} 01542 01543 TK_Status Read (BStreamFileToolkit & tk); 01544 TK_Status Write (BStreamFileToolkit & tk); 01545 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01546 01547 TK_Status ReadAscii (BStreamFileToolkit & tk); 01548 TK_Status WriteAscii (BStreamFileToolkit & tk); 01549 }; 01550 01551 01552 01554 01566 class BBINFILETK_API TK_Reopen_Segment : public BBaseOpcodeHandler { 01567 protected: 01568 int m_index; 01570 public: 01572 TK_Reopen_Segment () : BBaseOpcodeHandler (TKE_Reopen_Segment), m_index (-1) {} 01573 01574 TK_Status Read (BStreamFileToolkit & tk); 01575 TK_Status Write (BStreamFileToolkit & tk); 01576 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01577 01578 TK_Status ReadAscii (BStreamFileToolkit & tk); 01579 TK_Status WriteAscii (BStreamFileToolkit & tk); 01580 01582 void SetIndex (int i) { m_index = i; } 01584 int GetIndex () const { return m_index; } 01585 }; 01586 01587 01589 01597 class BBINFILETK_API TK_Referenced_Segment : public BBaseOpcodeHandler { 01598 protected: 01599 int m_length; 01600 int m_allocated; 01601 char * m_string; 01602 int m_cond_length; 01603 int m_cond_allocated; 01604 char * m_condition; 01606 ID_Key m_key; 01607 ID_Key m_renumbered_key; 01608 unsigned char m_renumbered_scope; 01609 BBaseOpcodeHandler * m_referee; 01610 bool m_follow; 01611 Lock_Masks m_filter; 01612 01613 void set_segment (char const * segment); 01614 void set_segment (int length); 01615 01616 public: 01618 TK_Referenced_Segment (unsigned char opcode); 01619 ~TK_Referenced_Segment(); 01620 01621 TK_Status Read (BStreamFileToolkit & tk); 01622 TK_Status Write (BStreamFileToolkit & tk); 01623 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01624 01625 TK_Status ReadAscii (BStreamFileToolkit & tk); 01626 TK_Status WriteAscii (BStreamFileToolkit & tk); 01627 void Reset (); 01628 01633 void SetSegment (char const * segment) { set_segment (segment); } 01638 void SetSegment (int length) { set_segment (length); } 01642 char const * GetSegment () const { return m_string; } 01647 char * GetSegment () { return m_string; } 01648 01649 01654 void SetCondition (char const * condition); 01659 void SetCondition (int length); 01663 char const * GetCondition () const { return m_condition; } 01668 char * GetCondition () { return m_condition; } 01669 01670 01672 void SetFollow (bool f) { m_follow = f; } 01674 bool GetFollow () { return m_follow; } 01675 01676 }; 01677 01678 01680 01688 class BBINFILETK_API TK_Reference : public BBaseOpcodeHandler { 01689 protected: 01690 int m_index; 01691 int m_cond_length; 01692 int m_cond_allocated; 01693 char * m_condition; 01695 ID_Key m_this_key; 01696 ID_Key m_key; 01697 BBaseOpcodeHandler * m_referee; 01698 bool m_follow; 01699 01700 public: 01702 TK_Reference (); 01703 ~TK_Reference(); 01704 01705 TK_Status Read (BStreamFileToolkit & tk); 01706 TK_Status Write (BStreamFileToolkit & tk); 01707 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01708 01709 TK_Status ReadAscii (BStreamFileToolkit & tk); 01710 TK_Status WriteAscii (BStreamFileToolkit & tk); 01711 void Reset (); 01712 01714 void SetIndex (int index) { m_index = index; } 01716 ID_Key GetIndex () { return m_index; } 01717 01722 void SetCondition (char const * condition); 01727 void SetCondition (int length); 01731 char const * GetCondition () const { return m_condition; } 01736 char * GetCondition () { return m_condition; } 01737 01738 01740 void SetFollow (bool f) { m_follow = f; } 01742 bool GetFollow () { return m_follow; } 01743 }; 01744 01745 01749 enum Instance_Options { 01750 Instance_By_Tristrip = 0x01 01751 }; 01752 01753 01755 01763 class BBINFILETK_API TK_Instance : public BBaseOpcodeHandler { 01764 protected: 01765 int m_from_index; 01766 int m_from_variant; 01767 int m_to_index; 01768 int m_to_variant; 01769 int m_options; 01770 float m_matrix[16]; 01771 01772 public: 01774 TK_Instance (int from_index=0, int from_variant=0, int to_index=0, int to_variant=0, 01775 int options=0, float const xform[]=0); 01776 01777 TK_Status Read (BStreamFileToolkit & tk); 01778 TK_Status Write (BStreamFileToolkit & tk); 01779 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01780 01781 TK_Status ReadAscii (BStreamFileToolkit & tk); 01782 TK_Status WriteAscii (BStreamFileToolkit & tk); 01783 01784 void Reset (); 01785 }; 01786 01788 01791 class BBINFILETK_API TK_Delete_Object : public BBaseOpcodeHandler { 01792 protected: 01793 int m_index; 01794 01795 public: 01797 TK_Delete_Object () : BBaseOpcodeHandler (TKE_Delete_Object), m_index (-1) {} 01798 01799 TK_Status Read (BStreamFileToolkit & tk); 01800 TK_Status Write (BStreamFileToolkit & tk); 01801 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01802 01803 TK_Status ReadAscii (BStreamFileToolkit & tk); 01804 TK_Status WriteAscii (BStreamFileToolkit & tk); 01805 01807 void SetIndex (int i) { m_index = i; } 01809 int GetIndex () { return m_index; } 01810 }; 01811 01812 01814 01815 01817 01820 class BBINFILETK_API TK_LOD : public BBaseOpcodeHandler { 01821 protected: 01822 int *m_num_primitives; 01823 BBaseOpcodeHandler ***m_primitives; 01824 int m_highest_level; 01825 int m_levels_allocated; 01826 int m_substage; 01827 struct vlist_s *m_current_working; 01828 int m_current_level; 01829 01830 TK_Status ReadOneList (BStreamFileToolkit & tk); 01831 01832 public: 01834 TK_LOD () : BBaseOpcodeHandler (TKE_LOD) { 01835 m_num_primitives = 0; 01836 m_primitives = 0; 01837 m_highest_level = 0; 01838 m_levels_allocated = 0; 01839 m_substage = 0; 01840 m_current_working = 0; 01841 m_current_level = 0; 01842 } 01843 ~TK_LOD(); 01844 01845 TK_Status Read (BStreamFileToolkit & tk); 01846 TK_Status Write (BStreamFileToolkit & tk); 01847 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01848 01849 TK_Status ReadAscii (BStreamFileToolkit & tk); 01850 TK_Status WriteAscii (BStreamFileToolkit & tk); 01851 01852 void Reset (); 01853 }; 01855 #define TKLOD_ESCAPE 255 01856 01857 01859 01861 01866 class BBINFILETK_API TK_Geometry_Attributes : public BBaseOpcodeHandler { 01867 protected: 01868 01869 public: 01871 TK_Geometry_Attributes () : BBaseOpcodeHandler (TKE_Geometry_Attributes) {} 01872 01873 TK_Status Read (BStreamFileToolkit & tk); 01874 TK_Status Write (BStreamFileToolkit & tk); 01875 01876 TK_Status ReadAscii (BStreamFileToolkit & tk); 01877 TK_Status WriteAscii (BStreamFileToolkit & tk); 01878 TK_Status Execute (BStreamFileToolkit & tk); 01879 }; 01880 01882 01892 class BBINFILETK_API TK_Renumber : public BBaseOpcodeHandler { 01893 protected: 01894 ID_Key m_key; 01895 01896 public: 01900 TK_Renumber (unsigned char opcode, ID_Key key = 0) : BBaseOpcodeHandler (opcode), m_key (key) {} 01901 01902 TK_Status Read (BStreamFileToolkit & tk); 01903 TK_Status Write (BStreamFileToolkit & tk); 01904 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 01905 01906 TK_Status ReadAscii (BStreamFileToolkit & tk); 01907 TK_Status WriteAscii (BStreamFileToolkit & tk); 01908 01909 void SetKey (ID_Key k) { m_key = k; } 01911 ID_Key GetKey () const { return m_key; } 01912 }; 01913 01914 01916 01921 class BBINFILETK_API TK_Tag : public BBaseOpcodeHandler { 01922 protected: 01923 01924 public: 01926 TK_Tag (unsigned char opcode = TKE_Tag) : BBaseOpcodeHandler (opcode) {} 01927 01928 TK_Status Read (BStreamFileToolkit & tk); 01929 TK_Status Write (BStreamFileToolkit & tk); 01930 01931 TK_Status ReadAscii (BStreamFileToolkit & tk); 01932 TK_Status WriteAscii (BStreamFileToolkit & tk); 01933 01934 TK_Status Execute (BStreamFileToolkit & tk); 01935 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant=0); 01936 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 01937 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 01938 }; 01939 01941 01948 // Note: unlike most opcode handlers, this one does not contain its own data, it is primarily a 01949 // wrapper around the key <-> index translation table in the toolkit. 01950 class BBINFILETK_API TK_Dictionary : public BBaseOpcodeHandler { 01951 protected: 01952 unsigned char m_format; 01953 int m_placeholder; 01954 unsigned char m_present; 01955 int m_number_of_items; 01956 01957 Internal_Translator::Index_Key_Pair * m_item; 01958 01959 public: 01961 TK_Dictionary () : BBaseOpcodeHandler (TKE_Dictionary), m_format (0) {} 01962 01963 TK_Status Read (BStreamFileToolkit & tk); 01964 TK_Status Write (BStreamFileToolkit & tk); 01965 01966 TK_Status ReadAscii (BStreamFileToolkit & tk); 01967 TK_Status WriteAscii (BStreamFileToolkit & tk); 01968 01969 TK_Status Execute (BStreamFileToolkit & tk); 01970 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant=0); 01971 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 01972 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 01973 void Reset (); 01974 }; 01975 01976 01978 01985 class BBINFILETK_API TK_Dictionary_Locater : public BBaseOpcodeHandler { 01986 protected: 01987 int m_size; 01988 int m_offset; 01989 01990 public: 01992 TK_Dictionary_Locater () : BBaseOpcodeHandler (TKE_Dictionary_Locater), m_offset (0) {} 01993 01994 TK_Status Read (BStreamFileToolkit & tk); 01995 TK_Status Write (BStreamFileToolkit & tk); 01996 01997 TK_Status ReadAscii (BStreamFileToolkit & tk); 01998 TK_Status WriteAscii (BStreamFileToolkit & tk); 01999 02000 TK_Status Execute (BStreamFileToolkit & tk); 02001 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant=0); 02002 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 02003 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 02004 void Reset (); 02005 02007 void SetSize (int size) { m_size = size; } 02009 int GetSize () const { return m_size; } 02011 void SetOffset (int offset) { m_offset = offset; } 02013 int GetOffset () const { return m_offset; } 02014 }; 02015 02016 02018 02019 02021 02026 class BBINFILETK_API TK_Color : public BBaseOpcodeHandler { 02027 protected: 02028 int m_mask; 02029 short m_channels; 02030 02034 class BBINFILETK_API channel { 02035 public: 02036 float m_rgb[3]; 02037 char * m_name; 02038 02039 channel() : m_name (0) {} 02040 ~channel() { Reset(); } 02041 void Reset () { 02042 if (m_name) 02043 BSTREAM_FREE_ARRAY(m_name, (int)(strlen(m_name) + 1), char); 02044 m_name = 0; 02045 } 02046 }; 02047 02048 channel m_diffuse; 02049 channel m_specular; 02050 channel m_mirror; 02051 channel m_transmission; 02052 channel m_emission; 02053 channel m_environment; 02054 channel m_bump; 02055 float m_gloss; 02056 float m_index; 02057 int m_substage; 02058 02060 void set_channel_rgb (channel & c, float r, float g, float b, int which_channel = -1) { 02061 c.m_rgb[0] = r; c.m_rgb[1] = g; c.m_rgb[2] = b; 02062 if (which_channel != -1) { 02063 m_channels |= (1 << which_channel); 02064 if (which_channel > TKO_Channel_Extended) 02065 m_channels |= (1 << TKO_Channel_Extended); 02066 } 02067 } 02069 void set_channel_name (channel & c, char const * name, int which_channel = -1); 02071 void set_channel_name (channel & c, int length, int which_channel = -1); 02072 02073 public: 02074 TK_Color (); 02075 ~TK_Color (); 02076 02077 TK_Status Read (BStreamFileToolkit & tk); 02078 TK_Status Write (BStreamFileToolkit & tk); 02079 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02080 02081 TK_Status ReadAscii (BStreamFileToolkit & tk); 02082 TK_Status WriteAscii (BStreamFileToolkit & tk); 02083 02084 void Reset (); 02085 02087 void SetGeometry (int m) { 02088 m_mask = m & TKO_Geo_All_Colors; 02089 if ((m & TKO_Geo_Extended_Mask) != 0) { 02090 m_mask |= TKO_Geo_Extended; 02091 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) { 02092 m_mask |= TKO_Geo_Extended_Colors; 02093 if ((m & TKO_Geo_Extended2_Mask) != 0) 02094 m_mask |= TKO_Geo_Extended2; 02095 } 02096 } 02097 } 02099 int GetGeometry () const { return m_mask; } 02101 void SetChannels (int c) { 02102 m_channels = (short)c; 02103 if ((c & (((unsigned int)~0) << (TKO_Channel_Extended_Shift))) != 0) 02104 m_channels |= (1 << TKO_Channel_Extended); 02105 } 02107 int GetChannels () const { return (int)m_channels; } 02108 02110 void SetDiffuse (float r, float g, float b) { set_channel_rgb (m_diffuse, r, g, b, TKO_Channel_Diffuse); } 02112 void SetDiffuse (float const rgb[]) { SetDiffuse (rgb[0], rgb[1], rgb[2]); } 02114 void SetDiffuseName (char const * name) { set_channel_name (m_diffuse, name, TKO_Channel_Diffuse); } 02116 void SetDiffuseName (int length) { set_channel_name (m_diffuse, length, TKO_Channel_Diffuse); } 02118 float const * GetDiffuse () const { return m_diffuse.m_rgb; } 02120 char const * GetDiffuseName () const { return m_diffuse.m_name; } 02122 char * GetDiffuseName () { return m_diffuse.m_name; } 02123 02125 void SetSpecular (float r, float g, float b) { set_channel_rgb (m_specular, r, g, b, TKO_Channel_Specular);} 02127 void SetSpecular (float const rgb[]) { SetSpecular (rgb[0], rgb[1], rgb[2]); } 02129 void SetSpecularName (char const * name) { set_channel_name (m_specular, name, TKO_Channel_Specular); } 02131 void SetSpecularName (int length) { set_channel_name (m_specular, length, TKO_Channel_Specular);} 02133 float const * GetSpecular () const { return m_specular.m_rgb; } 02135 char const * GetSpecularName () const { return m_specular.m_name; } 02137 char * GetSpecularName () { return m_specular.m_name; } 02138 02140 void SetMirror (float r, float g, float b) { set_channel_rgb (m_mirror, r, g, b, TKO_Channel_Mirror); } 02142 void SetMirror (float const rgb[]) { SetMirror (rgb[0], rgb[1], rgb[2]); } 02144 void SetMirrorName (char const * name) { set_channel_name (m_mirror, name, TKO_Channel_Mirror); } 02146 void SetMirrorName (int length) { set_channel_name (m_mirror, length, TKO_Channel_Mirror); } 02148 float const * GetMirror () const { return m_mirror.m_rgb; } 02150 char const * GetMirrorName () const { return m_mirror.m_name; } 02152 char * GetMirrorName () { return m_mirror.m_name; } 02153 02155 void SetTransmission (float r, float g, float b) { set_channel_rgb (m_transmission, r, g, b, TKO_Channel_Transmission); } 02157 void SetTransmission (float const rgb[]) { SetTransmission (rgb[0], rgb[1], rgb[2]); } 02159 void SetTransmissionName (char const * name) { set_channel_name (m_transmission, name, TKO_Channel_Transmission); } 02161 void SetTransmissionName (int length) { set_channel_name (m_transmission, length, TKO_Channel_Transmission); } 02163 float const * GetTransmission () const { return m_transmission.m_rgb; } 02165 char const * GetTransmissionName () const { return m_transmission.m_name; } 02167 char * GetTransmissionName () { return m_transmission.m_name; } 02168 02170 void SetEmission (float r, float g, float b) { set_channel_rgb (m_emission, r, g, b, TKO_Channel_Emission);} 02172 void SetEmission (float const rgb[]) { SetEmission (rgb[0], rgb[1], rgb[2]); } 02174 void SetEmissionName (char const * name) { set_channel_name (m_emission, name, TKO_Channel_Emission); } 02176 void SetEmissionName (int length) { set_channel_name (m_emission, length, TKO_Channel_Emission);} 02178 float const * GetEmission () const { return m_emission.m_rgb; } 02180 char const * GetEmissionName () const { return m_emission.m_name; } 02182 char * GetEmissionName () { return m_emission.m_name; } 02183 02185 void SetEnvironmentName (char const * name) { set_channel_name (m_environment, name, TKO_Channel_Environment); } 02187 void SetEnvironmentName (int length) { set_channel_name (m_environment, length, TKO_Channel_Environment); } 02189 char const * GetEnvironmentName () const { return m_environment.m_name; } 02191 char * GetEnvironmentName () { return m_environment.m_name; } 02192 02194 void SetBumpName (char const * name) { set_channel_name (m_bump, name, TKO_Channel_Bump); } 02196 void SetBumpName (int length) { set_channel_name (m_bump, length, TKO_Channel_Bump); } 02198 char const * GetBumpName () const { return m_bump.m_name; } 02200 char * GetBumpName () { return m_bump.m_name; } 02201 02203 void SetGloss (float g) { m_gloss = g; m_channels |= (1<<TKO_Channel_Gloss); } 02205 float GetGloss () const { return m_gloss; } 02207 void SetIndex (float i) { m_index = i; m_channels |= (1<<TKO_Channel_Index); } 02209 float GetIndex () const { return m_index; } 02210 }; 02211 02212 02214 02219 class BBINFILETK_API TK_Color_RGB : public BBaseOpcodeHandler { 02220 protected: 02221 int m_mask; 02222 float m_rgb[3]; 02223 02224 public: 02226 TK_Color_RGB () : BBaseOpcodeHandler (TKE_Color_RGB), m_mask (0) {} 02227 02228 TK_Status Read (BStreamFileToolkit & tk); 02229 TK_Status Write (BStreamFileToolkit & tk); 02230 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02231 02232 TK_Status ReadAscii (BStreamFileToolkit & tk); 02233 TK_Status WriteAscii (BStreamFileToolkit & tk); 02234 02239 void SetGeometry (int m) { 02240 m_mask = m & TKO_Geo_All_Colors; 02241 if ((m & TKO_Geo_Extended_Mask) != 0) { 02242 m_mask |= TKO_Geo_Extended; 02243 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) { 02244 m_mask |= TKO_Geo_Extended_Colors; 02245 if ((m & TKO_Geo_Extended2_Mask) != 0) 02246 m_mask |= TKO_Geo_Extended2; 02247 } 02248 } 02249 } 02254 int GetGeometry () const { return m_mask; } 02255 02257 void SetRGB (float r, float g, float b) { m_rgb[0] = r; m_rgb[1] = g; m_rgb[2] = b; } 02259 void SetRGB (float const rgb[]) { SetRGB (rgb[0], rgb[1], rgb[2]); } 02261 float const * GetRGB () const { return m_rgb; } 02262 }; 02263 02264 02266 02271 class BBINFILETK_API TK_Color_By_Value : public BBaseOpcodeHandler { 02272 protected: 02273 int m_mask; 02274 float m_value[3]; 02275 char m_space; 02276 02277 public: 02279 TK_Color_By_Value () : BBaseOpcodeHandler (TKE_Color_By_Value), m_mask (0) {} 02280 02281 TK_Status Read (BStreamFileToolkit & tk); 02282 TK_Status Write (BStreamFileToolkit & tk); 02283 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02284 02285 TK_Status ReadAscii (BStreamFileToolkit & tk); 02286 TK_Status WriteAscii (BStreamFileToolkit & tk); 02287 02292 void SetGeometry (int m) { 02293 m_mask = m & TKO_Geo_All_Colors; 02294 if ((m & TKO_Geo_Extended_Mask) != 0) { 02295 m_mask |= TKO_Geo_Extended; 02296 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) { 02297 m_mask |= TKO_Geo_Extended_Colors; 02298 if ((m & TKO_Geo_Extended2_Mask) != 0) 02299 m_mask |= TKO_Geo_Extended2; 02300 } 02301 } 02302 } 02307 int GetGeometry () const { return m_mask; } 02308 02310 void SetSpace (int s) { m_space = (char)s; } 02312 int GetSpace () const { return (int)m_space; } 02313 02315 void SetValue (float a, float b, float c) { 02316 m_value[0] = a; m_value[1] = b; m_value[2] = c; 02317 } 02319 void SetValue (float const triple[]) { SetValue (triple[0], triple[1], triple[2]); } 02321 float const * GetValue () const { return m_value; } 02322 }; 02323 02324 02326 02332 class BBINFILETK_API TK_Color_By_Index : public BBaseOpcodeHandler { 02333 protected: 02334 int m_mask; 02335 int m_index; 02336 02337 public: 02339 TK_Color_By_Index (unsigned char opcode) : BBaseOpcodeHandler (opcode), m_mask (0), m_index (-1) {} 02340 02341 TK_Status Read (BStreamFileToolkit & tk); 02342 TK_Status Write (BStreamFileToolkit & tk); 02343 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02344 02345 TK_Status ReadAscii (BStreamFileToolkit & tk); 02346 TK_Status WriteAscii (BStreamFileToolkit & tk); 02347 02352 void SetGeometry (int m) { 02353 m_mask = m & TKO_Geo_All_Colors; 02354 if ((m & TKO_Geo_Extended_Mask) != 0) { 02355 m_mask |= TKO_Geo_Extended; 02356 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) { 02357 m_mask |= TKO_Geo_Extended_Colors; 02358 if ((m & TKO_Geo_Extended2_Mask) != 0) 02359 m_mask |= TKO_Geo_Extended2; 02360 } 02361 } 02362 } 02367 int GetGeometry () const { return m_mask; } 02368 02370 void SetIndex (int i) { m_index = i; } 02372 int GetIndex () const { return m_index; } 02373 }; 02374 02376 02381 class BBINFILETK_API TK_Color_By_FIndex : public BBaseOpcodeHandler { 02382 protected: 02383 int m_mask; 02384 float m_index; 02385 02386 public: 02388 TK_Color_By_FIndex () : BBaseOpcodeHandler (TKE_Color_By_FIndex), m_mask (0), m_index (-1.0f) {} 02389 02390 TK_Status Read (BStreamFileToolkit & tk); 02391 TK_Status Write (BStreamFileToolkit & tk); 02392 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02393 02394 TK_Status ReadAscii (BStreamFileToolkit & tk); 02395 TK_Status WriteAscii (BStreamFileToolkit & tk); 02396 02401 void SetGeometry (int m) { 02402 m_mask = m & TKO_Geo_All_Colors; 02403 if ((m & TKO_Geo_Extended_Mask) != 0) { 02404 m_mask |= TKO_Geo_Extended; 02405 if ((m & TKO_Geo_Extended_Colors_Mask) != 0) { 02406 m_mask |= TKO_Geo_Extended_Colors; 02407 if ((m & TKO_Geo_Extended2_Mask) != 0) 02408 m_mask |= TKO_Geo_Extended2; 02409 } 02410 } 02411 } 02416 int GetGeometry () const { return m_mask; } 02417 02419 void SetIndex (float val) { m_index = val; } 02421 float GetIndex () const { return m_index; } 02422 }; 02423 02427 enum TKO_Map_Format { 02428 TKO_Map_RGB_Values, 02429 TKO_Map_String 02430 }; 02431 02434 02439 class BBINFILETK_API TK_Color_Map : public BBaseOpcodeHandler { 02440 protected: 02441 int m_length; 02442 int m_values_length; 02443 float * m_values; 02444 int m_string_length; 02445 char * m_string; 02446 unsigned char m_format; 02447 02449 void set_values (int length, float const values[] = 0); 02450 02451 public: 02453 TK_Color_Map () 02454 : 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) {} 02455 ~TK_Color_Map(); 02456 02457 TK_Status Read (BStreamFileToolkit & tk); 02458 TK_Status Write (BStreamFileToolkit & tk); 02459 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02460 02461 TK_Status ReadAscii (BStreamFileToolkit & tk); 02462 TK_Status WriteAscii (BStreamFileToolkit & tk); 02463 02464 void Reset (); 02465 02467 void SetFormat (int f) { m_format = (unsigned char)f; } 02469 int GetFormat () const { return (int)m_format; } 02470 02475 void SetValues (int count, float const values[] = 0) { set_values (count, values); } 02477 float const * GetValues () const { return m_values; } 02479 float * GetValues () { return m_values; } 02481 int GetLength () const { return m_length; } 02482 02487 void SetString (char const * string); 02492 void SetString (int length); 02496 char const * GetString () const { return m_string; } 02501 char * GetString () { return m_string; } 02502 }; 02503 02505 02508 02514 class BBINFILETK_API TK_Callback : public BBaseOpcodeHandler { 02515 protected: 02516 int m_length; 02517 char * m_string; 02520 void set_callback (char const * callback); 02521 02522 void set_callback (int length); 02523 02524 public: 02526 TK_Callback () : BBaseOpcodeHandler (TKE_Callback), m_length (0), m_string (0) {} 02527 ~TK_Callback(); 02528 02529 TK_Status Read (BStreamFileToolkit & tk); 02530 TK_Status Write (BStreamFileToolkit & tk); 02531 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 02532 02533 TK_Status ReadAscii (BStreamFileToolkit & tk); 02534 TK_Status WriteAscii (BStreamFileToolkit & tk); 02535 02536 void Reset (); 02537 02539 void SetCallback (char const * callback) { set_callback (callback); } 02541 void SetCallback (int length) { set_callback (length); } 02543 char const * GetCallback () const { return m_string; } 02545 char * GetCallback () { return m_string; } 02546 }; 02547 02549 02550 02558 enum TKO_Rendering_Option_Bits { 02559 TKO_Interp_Texture_Faces = 0x00000001, 02560 TKO_Interp_Texture_Edges = 0x00000002, 02561 TKO_Interp_Texture_Markers = 0x00000004, 02562 TKO_Interp_Texture = 0x00000007, 02563 02564 TKO_Interp_Color_Faces = 0x00000008, 02565 TKO_Interp_Color_Edges = 0x00000010, 02566 TKO_Interp_Color_Markers = 0x00000020, 02567 TKO_Interp_Color = 0x00000038, 02568 02569 TKO_Interp_Index_Faces = 0x00000040, 02570 TKO_Interp_Index_Edges = 0x00000080, 02571 TKO_Interp_Index_FE = 0x000000C0, 02572 02573 TKO_Interp_Lighting_Faces_Gouraud = 0x00000100, 02574 TKO_Interp_Lighting_Faces_Phong = 0x00000200, 02575 TKO_Interp_Lighting_Edges_Gouraud = 0x00000400, 02576 TKO_Interp_Lighting_Edges_Phong = 0x00000800, 02577 TKO_Interp_Lighting_Faces = 0x00000300, 02578 TKO_Interp_Lighting_Edges = 0x00000C00, 02579 TKO_Interp_Lighting_Gouraud = 0x00000500, 02580 TKO_Interp_Lighting_Phong = 0x00000A00, 02581 TKO_Interp_Lighting = 0x00000F00, 02582 02583 TKO_Rendo_HSR_Algorithm = 0x00001000, 02584 TKO_Rendo_THSR_Algorithm = 0x00002000, 02585 TKO_Rendo_Any_HSR = 0x00003000, 02586 02587 TKO_Rendo_Local_Viewer = 0x00004000, 02588 TKO_Rendo_Perspective_Correction = 0x00008000, 02589 TKO_Rendo_Display_Lists = 0x00010000, 02590 02591 TKO_Rendo_Debug = 0x00020000, 02592 02593 TKO_Rendo_Technology = 0x00040000, 02594 TKO_Rendo_Quantization = 0x00080000, 02595 TKO_Rendo_TQ = 0x000C0000, 02596 02597 TKO_Rendo_Attribute_Lock = 0x00100000, 02598 02599 TKO_Rendo_Face_Displacement = 0x00200000, 02600 TKO_Rendo_Fog = 0x00400000, 02601 02602 TKO_Rendo_Buffer_Options = 0x00800000, 02603 TKO_Rendo_Hidden_Line_Options = 0x01000000, 02604 02605 TKO_Rendo_LOD = 0x02000000, 02606 TKO_Rendo_LOD_Options = 0x04000000, 02607 02608 TKO_Rendo_NURBS_Curve_Options = 0x08000000, 02609 TKO_Rendo_NURBS_Surface_Options = 0x10000000, 02610 TKO_Rendo_NURBS_Options = 0x18000000, 02611 02612 TKO_Rendo_Stereo = 0x20000000, 02613 TKO_Rendo_Stereo_Separation = 0x40000000, 02614 02615 // hpux doesn't like the high bit set as part of the enumerated type 02616 //TKO_Rendo_Extended = 0x80000000, 02617 #ifndef SWIG 02618 #define TKO_Rendo_Extended 0x80000000 02619 #else 02620 TKO_Rendo_Extended = 0x8000000, 02621 #endif 02622 02623 // extended settings 02624 TKO_Rendo_Tessellation = 0x00000001, 02625 TKO_Rendo_Transparency_Style = 0x00000002, 02626 TKO_Rendo_Transparency_Hardware = 0x00000004, 02627 TKO_Rendo_Cut_Geometry = 0x00000008, 02628 TKO_Rendo_Depth_Range = 0x00000010, 02629 TKO_Rendo_Mask_Transform = 0x00000020, 02630 TKO_Rendo_Image_Scale = 0x00000040, 02631 TKO_Rendo_Local_Cutting_Planes = 0x00000080, 02632 TKO_Rendo_Simple_Shadow = 0x00000100, 02633 TKO_Rendo_Geometry_Options = 0x00000200, 02634 TKO_Rendo_Image_Tint = 0x00000400, 02635 TKO_Interp_Index_Face_Isolines = 0x00000800, 02636 TKO_Rendo_Force_Grayscale = 0x00001000, 02637 TKO_Rendo_Transparency_Options = 0x00002000, 02638 TKO_Rendo_General_Displacement = 0x00004000, 02639 TKO_Rendo_Join_Cutoff_Angle = 0x00008000, 02640 TKO_Rendo_Screen_Range = 0x00010000, 02641 TKO_Rendo_Stereo_Distance = 0x00020000, 02642 TKO_Rendo_Shadow_Map = 0x00040000, 02643 TKO_Rendo_Simple_Reflection = 0x00080000, 02644 TKO_Rendo_Ambient_Up_Vector = 0x00100000, 02645 TKO_Rendo_Gooch_Color_Range = 0x00200000, 02646 TKO_Rendo_Gooch_Diffuse_Weight = 0x00400000, 02647 TKO_Rendo_Antialias = 0x00800000, 02648 TKO_Interp_Index_Markers = 0x01000000, 02649 TKO_Rendo_Gooch_Color_Map = 0x02000000, 02650 TKO_Interp_Lighting_Faces_Gooch = 0x04000000, 02651 TKO_Interp_Lighting_Edges_Gooch = 0x08000000, 02652 TKO_Interp_Lighting_Gooch = 0x0C000000, 02653 TKO_Rendo_Transparency_Depth_Writing= 0x10000000, 02654 TKO_Rendo_Vertex_Decimation = 0x20000000, 02655 TKO_Rendo_Vertex_Displacement = 0x40000000, 02656 02657 #ifndef SWIG 02658 #define TKO_Rendo_Extended2 0x80000000 02659 #else 02660 TKO_Rendo_Extended2 = 0x8000000, 02661 #endif 02662 02663 // more extended settings 02664 TKO_Rendo_Forced_Lock = 0x00000001, 02665 TKO_Rendo_Frame_Buffer_Effects = 0x00000002, 02666 TKO_Rendo_Scaled_Displacement = 0x00000004, 02667 TKO_Rendo_Contour_Options = 0x00000008, 02668 TKO_Rendo_Isoline_Options = 0x00000010, 02669 TKO_Rendo_Diffuse_Texture_Tint = 0x00000020, 02670 TKO_Rendo_Diffuse_Color_Tint = 0x00000040, 02671 TKO_Rendo_Edge_Join_Cutoff_Angle = 0x00000080, 02672 TKO_Rendo_Bump_Mapping_Parallax = 0x00000100, 02673 TKO_Rendo_Randomize_Vertices = 0x00000200, 02674 02675 // type for specific fields 02676 TKO_HSR_Hardware = 0, 02677 TKO_HSR_SZB = 1, 02678 TKO_HSR_Painters = 2, 02679 TKO_HSR_Z_Sort_Only = 3, 02680 TKO_HSR_Priority = 4, 02681 TKO_HSR_Spider_Web = 5, 02682 TKO_HSR_Hidden_Line = 6, 02683 TKO_HSR_None = 7, 02684 TKO_HSR_Fast_Hidden_Line = 8, 02685 TKO_HSR_Depth_Peeling = 9, 02686 TKO_HSR_Mask = 0x0F, 02687 TKO_THSR_Mask = 0xF0, 02688 02689 TKO_Peeling_Buffer = 0, 02690 TKO_Peeling_Pixel = 1, 02691 02692 TKO_Transparency_None = 0x0000, 02693 TKO_Transparency_Blending = 0x0001, 02694 TKO_Transparency_Screen_Door = 0x0002, 02695 TKO_Transparency_Style_Mask = 0x000F, 02696 TKO_Transparency_Peeling_Layers = 0x0010, 02697 TKO_Transparency_Peeling_Min_Area = 0x0020, 02698 TKO_Transparency_Peeling_Algorithm = 0x0040, 02699 TKO_Transparency_Extended = 0x0080, 02700 TKO_Transparency_Extended_Mask = 0xFF00, 02701 TKO_Transparency_Extended_Shift = 8, 02702 TKO_Transparency_ZSort_Fast = 0x0100, 02703 TKO_Transparency_ZSort_Nice = 0x0200, 02704 02705 02706 TKO_Cut_Geometry_Level = 0x01, 02707 TKO_Cut_Geometry_Tolerance = 0x02, 02708 TKO_Cut_Geometry_Match_Color = 0x04, 02709 TKO_Cut_Geometry_Level_Entity = 0, 02710 TKO_Cut_Geometry_Level_Segment = 1, 02711 TKO_Cut_Geometry_Level_Segment_Tree = 2, 02712 TKO_Cut_Geometry_Match_Color_Off = 0, 02713 TKO_Cut_Geometry_Match_Color_Current = 1, 02714 TKO_Cut_Geometry_Match_Color_First = 2, 02715 TKO_Cut_Geometry_Match_Color_Last = 3, 02716 02717 TKO_Display_List_Level_Entity = 0, 02718 TKO_Display_List_Level_Segment = 1, 02719 TKO_Display_List_Level_Segment_Tree = 2, 02720 02721 TKO_Simple_Shadow_On = 0x0001, 02722 TKO_Simple_Shadow_Off = 0x0002, 02723 TKO_Simple_Shadow_Plane = 0x0004, 02724 TKO_Simple_Shadow_Light_Direction = 0x0008, 02725 TKO_Simple_Shadow_Color = 0x0010, 02726 TKO_Simple_Shadow_Resolution = 0x0020, 02727 TKO_Simple_Shadow_Blur = 0x0040, 02728 TKO_Simple_Shadow_Extended = 0x0080, // internal use, indicates presence of extended bits 02729 TKO_Simple_Shadow_Extended_Mask = 0xFF00, // internal use, indicates bits which require TKO_Simple_Shadow_Extended 02730 TKO_Simple_Shadow_Extended_Shift = 8, // internal use, shift of extended section 02731 TKO_Simple_Shadow_Auto = 0x0100, 02732 TKO_Simple_Shadow_Opacity = 0x0200, 02733 TKO_Simple_Shadow_Ignore_Transparency=0x0400, 02734 TKO_Simple_Shadow_Use_Transparency = 0x0800, 02735 TKO_Simple_Shadow_Extended2 = 0x8000, // reserved for future expansion 02736 02737 TKO_Shadow_Map_On = 0x0001, 02738 TKO_Shadow_Map_Off = 0x0002, 02739 TKO_Shadow_Map_Resolution = 0x0004, 02740 TKO_Shadow_Map_Samples = 0x0008, 02741 TKO_Shadow_Map_Jitter_On = 0x0010, 02742 TKO_Shadow_Map_Jitter_Off = 0x0020, 02743 TKO_Shadow_Map_Extended = 0x0080, // indicates presence of extended bits 02744 TKO_Shadow_Map_View_Depedent_On = 0x0100, 02745 TKO_Shadow_Map_View_Depedent_Off = 0x0200, 02746 TKO_Shadow_Map_Extended_Mask = 0xFF00, // mask of bits requiring extended 02747 TKO_Shadow_Map_Extended2 = 0x8000, // reserved for future expansion 02748 02749 TKO_Simple_Reflection_On = 0x0001, 02750 TKO_Simple_Reflection_Off = 0x0002, 02751 TKO_Simple_Reflection_Plane = 0x0004, 02752 TKO_Simple_Reflection_Opacity = 0x0008, 02753 TKO_Simple_Reflection_Fading_On = 0x0010, 02754 TKO_Simple_Reflection_Fading_Off = 0x0020, 02755 TKO_Simple_Reflection_Blur = 0x0040, 02756 TKO_Simple_Reflection_Extended = 0x0080, 02757 TKO_Simple_Reflection_Extended_Mask = 0xFF00, 02758 TKO_Simple_Reflection_Extended_Shift= 8, 02759 TKO_Simple_Reflection_Attenuation = 0x0100, 02760 TKO_Simple_Reflection_Visibility = 0x0200, 02761 TKO_Simple_Reflection_Extended2 = 0x8000, // reserved for future expansion 02762 02763 TKO_Mask_None = 0x0000, 02764 TKO_Mask_Camera_Rotation = 0x0001, 02765 TKO_Mask_Camera_Scale = 0x0002, 02766 TKO_Mask_Camera_Translation = 0x0004, 02767 TKO_Mask_Camera_Perspective = 0x0008, 02768 TKO_Mask_Model_Rotation = 0x0010, 02769 TKO_Mask_Model_Scale = 0x0020, 02770 TKO_Mask_Model_Translation = 0x0040, 02771 TKO_Mask_Camera = 0x000F, 02772 TKO_Mask_Model = 0x0070, 02773 TKO_Mask_All = 0x007F, 02774 TKO_Mask_Extended = 0x0080, 02775 TKO_Mask_Extended_Mask = 0xFF00, 02776 TKO_Mask_Extended_Shift = 8, 02777 TKO_Mask_Camera_Offset = 0x0100, 02778 TKO_Mask_Model_Offset = 0x0200, 02779 TKO_Mask_Camera_Projection = 0x0400, 02780 02781 TKO_Technology_Standard = 0x01, 02782 TKO_Technology_Soft_Frame_Buffer = 0x02, 02783 TKO_Technology_Radiosity = 0x04, 02784 TKO_Technology_Ray_Trace = 0x08, 02785 TKO_Technology_Mask = 0x0F, 02786 02787 TKO_Quantization_Threshold = 0x10, 02788 TKO_Quantization_Dither = 0x20, 02789 TKO_Quantization_Error_Diffusion = 0x40, 02790 TKO_Quantization_Mask = 0xF0, 02791 02792 TKO_Buffer_Size_Limit = 0x01, 02793 TKO_Buffer_Retention = 0x02, 02794 TKO_Buffer_Color_Depth_Match = 0x04, 02795 TKO_Buffer_Color_Depth_Full = 0x08, 02796 02797 TKO_Antialias_Screen_On = 0x01, 02798 TKO_Antialias_Lines_On = 0x02, 02799 TKO_Antialias_Text_On = 0x04, 02800 TKO_Antialias_All_On = 0x07, 02801 TKO_Antialias_Screen_Off = 0x10, 02802 TKO_Antialias_Lines_Off = 0x20, 02803 TKO_Antialias_Text_Off = 0x40, 02804 TKO_Antialias_All_Off = 0x70, 02805 02806 TKO_Hidden_Line_Visibility_On = 0x00000001, 02807 TKO_Hidden_Line_Visibility_Off = 0x00000002, 02808 TKO_Hidden_Line_Pattern = 0x00000004, 02809 TKO_Hidden_Line_Face_Displacement = 0x00000008, 02810 TKO_Hidden_Line_Dim_Factor = 0x00000010, 02811 TKO_Hidden_Line_Render_Faces_On = 0x00000020, 02812 TKO_Hidden_Line_Render_Faces_Off = 0x00000040, 02813 TKO_Hidden_Line_Extended = 0x00000080, 02814 TKO_Hidden_Line_Extended_Mask = 0xFFFFFF00, 02815 TKO_Hidden_Line_Extended_Shift = 8, 02816 TKO_Hidden_Line_Silhouette_Cleanup_On = 0x00000100, 02817 TKO_Hidden_Line_Silhouette_Cleanup_Off = 0x00000200, 02818 TKO_Hidden_Line_Extended2 = 0x00008000, 02819 TKO_Hidden_Line_Extended2_Mask = 0xFFFF0000, 02820 TKO_Hidden_Line_Extended2_Shift = 16, 02821 TKO_Hidden_Line_Color = 0x00010000, 02822 TKO_Hidden_Line_Weight = 0x00020000, 02823 TKO_Hidden_Line_Image_Outline_On = 0x00040000, 02824 TKO_Hidden_Line_Image_Outline_Off = 0x00080000, 02825 TKO_Hidden_Line_HSR_Algorithm = 0x00100000, 02826 TKO_Hidden_Line_Render_Text_On = 0x00200000, 02827 TKO_Hidden_Line_Render_Text_Off = 0x00400000, 02828 TKO_Hidden_Line_Transparency_Cutoff = 0x00800000, 02829 TKO_Hidden_Line_Remove_Duplicates_On = 0x01000000, 02830 TKO_Hidden_Line_Remove_Duplicates_Off = 0x02000000, 02831 02832 TKO_Contour_Face_Visibility_On = 0x0001, 02833 TKO_Contour_Face_Visibility_Off = 0x0002, 02834 TKO_Contour_Isoline_Visibility_On = 0x0004, 02835 TKO_Contour_Isoline_Visibility_Off = 0x0008, 02836 TKO_Contour_Visibility_Mask = 0x000F, 02837 TKO_Contour_Value_Adjustment = 0x0010, 02838 02839 TKO_Contour_Adjustment_None = 0, 02840 TKO_Contour_Adjustment_Normalized = 1, 02841 TKO_Contour_Adjustment_Explicit = 2, 02842 02843 TKO_Isoline_Positions = 0x0001, 02844 TKO_Isoline_Colors = 0x0002, 02845 TKO_Isoline_Patterns = 0x0004, 02846 TKO_Isoline_Weights = 0x0008, 02847 TKO_Isoline_Lighting_On = 0x0010, 02848 TKO_Isoline_Lighting_Off = 0x0020, 02849 02850 TKO_Isoline_Positions_Default = 0, 02851 TKO_Isoline_Positions_Repeat = 1, 02852 TKO_Isoline_Positions_Explicit = 2, 02853 02854 TKO_Tint_On = 0x0001, 02855 TKO_Tint_Off = 0x0002, 02856 TKO_Tint_Range = 0x0004, 02857 TKO_Tint_Color = 0x0008, 02858 TKO_Tint_Effect = 0x0010, 02859 02860 TKO_Tint_Effect_Grayscale = 1, 02861 TKO_Tint_Effect_Modulate = 2, 02862 TKO_Tint_Effect_Modulate_Gray = 3, 02863 TKO_Tint_Effect_Tone = 4, 02864 02865 TKO_LOD_Conserve_Memory = 0x00000001, 02866 TKO_LOD_Screen_Space = 0x00000002, 02867 TKO_LOD_Physical = 0x00000004, 02868 TKO_LOD_Tolerance_FRU = 0x00000008, 02869 TKO_LOD_Tolerance_ORU = 0x00000010, 02870 TKO_LOD_Preprocess = 0x00000020, 02871 TKO_LOD_Bounding_Current = 0x00000040, 02872 TKO_LOD_Bounding_Explicit = 0x00000080, 02873 TKO_LOD_Ratio = 0x00000100, 02874 TKO_LOD_Threshold = 0x00000200, 02875 TKO_LOD_Min_Triangle_Count = 0x00000400, 02876 TKO_LOD_Clamp = 0x00000800, 02877 TKO_LOD_Num_Levels = 0x00001000, 02878 TKO_LOD_Max_Degree = 0x00002000, 02879 TKO_LOD_Tolerance = 0x00004000, 02880 TKO_LOD_Usefulness_Heuristic = 0x00008000, 02881 TKO_LOD_Calculation_Cutoff = 0x00010000, 02882 TKO_LOD_Fallback = 0x00020000, 02883 TKO_LOD_Collapse_Vertices = 0x00040000, 02884 TKO_LOD_Algorithm = 0x00080000, 02885 TKO_LOD_Mode_Segment = 0x00100000, 02886 02887 TKO_LOD_Threshold_Tris_Per_Pix_Sq = 1, 02888 TKO_LOD_Threshold_Tris_Per_CM_Sq = 2, 02889 TKO_LOD_Threshold_Percent_Area = 3, 02890 TKO_LOD_Threshold_Distance = 4, 02891 02892 TKO_LOD_Algorithm_Fast = 1, 02893 TKO_LOD_Algorithm_Nice = 2, 02894 02895 TKO_LOD_Heur_Is_Diagonal = 0x00, 02896 TKO_LOD_Heur_Is_Per_Triangle = 0x01, 02897 TKO_LOD_Heur_Is_Ratio = 0x02, 02898 TKO_LOD_Heur_Is_Volume = 0x04, 02899 TKO_LOD_Heur_Triangle_Size = 0x08, 02900 02901 TKO_LOD_Heur_Diag = 0, 02902 TKO_LOD_Heur_Tri_Diag = 1, 02903 TKO_LOD_Heur_Diag_Ratio = 2, 02904 TKO_LOD_Heur_Tri_Diag_Ratio = 3, 02905 TKO_LOD_Heur_Vol = 4, 02906 TKO_LOD_Heur_Tri_Vol = 5, 02907 TKO_LOD_Heur_Vol_Ratio = 6, 02908 TKO_LOD_Heur_Tri_Vol_Ratio = 7, 02909 02910 TKO_LOD_Fallback_None = 0, 02911 TKO_LOD_Fallback_Bounding = 1, 02912 TKO_LOD_Fallback_Coarsest = 2, 02913 TKO_LOD_Fallback_Coarsest_None = 3, 02914 TKO_LOD_Fallback_Coarsest_Bounding = 4, 02915 TKO_LOD_Fallback_Bounding_None = 5, 02916 02917 TKO_NURBS_Curve_Budget = 0x0001, 02918 TKO_NURBS_Curve_Continued_Budget = 0x0002, 02919 TKO_NURBS_Curve_View_Dependent = 0x0004, 02920 TKO_NURBS_Curve_Max_Deviation = 0x0008, 02921 TKO_NURBS_Surface_Budget = 0x0010, 02922 TKO_NURBS_Surface_Trim_Budget = 0x0020, 02923 TKO_NURBS_Surface_Max_Facet_Width = 0x0040, 02924 TKO_NURBS_Curve_Max_Angle = 0x1000, 02925 TKO_NURBS_Curve_Max_Length = 0x2000, 02926 02927 TKO_NURBS_Extended = 0x0080, 02928 TKO_NURBS_Extended_Mask = 0xFF00, 02929 TKO_NURBS_Extended_Shift = 8, 02930 02931 TKO_NURBS_Surface_Max_Facet_Angle = 0x0100, 02932 TKO_NURBS_Surface_Max_Facet_Deviation 02933 = 0x0200, 02934 TKO_NURBS_Surface_Max_Trim_Curve_Deviation 02935 = 0x0400, 02936 02937 TKO_NURBS_Curve_Mask = 0xF00F, 02938 TKO_NURBS_Surface_Mask = 0x0FF0, 02939 02940 TKO_Tessellation_Cylinder = 0x01, 02941 TKO_Tessellation_Sphere = 0x02, 02942 02943 TKO_Geometry_Options_Dihedral = 0x01, 02944 TKO_Geometry_Options_Reverse_PolyCylinder_Radii = 0x02, 02945 TKO_Geometry_Options_No_Reverse_PolyCylinder_Radii = 0x04, 02946 TKO_Geometry_Options_Reverse_PolyCylinder_Colors = 0x08, 02947 TKO_Geometry_Options_No_Reverse_PolyCylinder_Colors = 0x10, 02948 TKO_Geometry_Options_FEA_Nodes_On = 0x20, 02949 TKO_Geometry_Options_FEA_Nodes_Off = 0x40, 02950 TKO_Geometry_Options_Extended = 0x80 02951 }; 02952 02953 02954 #if 0 02955 class BBINFILETK_API TK_Radiosity_RayTrace_Options : public BBaseOpcodeHandler { 02956 protected: 02957 02958 public: 02959 TK_Radiosity_RayTrace_Options () : BBaseOpcodeHandler (TKE_Radiosity_RayTrace_Options) {} 02960 ~TK_Radiosity_RayTrace_Options () {} 02961 02962 TK_Status Read (BStreamFileToolkit & tk); 02963 TK_Status Write (BStreamFileToolkit & tk); 02964 02965 TK_Status ReadAscii (BStreamFileToolkit & tk); 02966 TK_Status WriteAscii (BStreamFileToolkit & tk); 02967 }; 02968 #endif 02969 02970 02972 02978 class BBINFILETK_API TK_Rendering_Options : public BBaseOpcodeHandler { 02979 protected: 02980 int m_mask[3]; 02981 int m_value[3]; 02982 02983 unsigned char m_hsr; 02984 unsigned char m_tq; 02985 int m_debug; 02986 int m_face_displacement; 02987 int m_vertex_displacement; 02988 02989 float m_fog_limits[2]; 02990 02991 Lock_Masks m_lock; 02992 Lock_Masks m_forced; 02993 02994 unsigned char m_buffer_options_mask; 02995 unsigned char m_buffer_options_value; 02996 int m_buffer_size_limit; 02997 02998 int m_hlr_options; 02999 float m_hlr_dim_factor; 03000 float m_hlr_face_displacement; 03001 float m_hlr_transparency_cutoff; 03002 int m_hlr_line_pattern; 03003 float m_hlr_color[3]; 03004 float m_hlr_weight; 03005 unsigned char m_hlr_weight_units; 03006 unsigned char m_hlr_hsr_algorithm; 03007 03008 unsigned short m_contour_options; 03009 unsigned short m_isoline_options; 03010 char m_contour_value_adjustment; 03011 float m_contour_value_scale; 03012 float m_contour_value_translate; 03013 char m_isoline_position_type; 03014 int m_isoline_position_count; 03015 float * m_isoline_positions; 03016 int m_isoline_color_count; 03017 float * m_isoline_colors; 03018 int m_isoline_pattern_count; 03019 char ** m_isoline_patterns; 03020 int m_isoline_weight_count; 03021 float * m_isoline_weights_value; 03022 unsigned char * m_isoline_weights_unit; 03023 03024 unsigned short m_tint_options; 03025 float m_tint_color[3]; 03026 float m_tint_range[2]; 03027 char m_tint_effect; 03028 03029 int m_lod_options_mask; 03030 int m_lod_options_value; 03031 char m_lod_algorithm; 03032 char m_num_ratios; 03033 float m_ratio[8]; 03034 char m_num_thresholds; 03035 float m_threshold[8]; 03036 char m_threshold_type; 03037 int m_min_triangle_count; 03038 unsigned char m_clamp; 03039 unsigned char m_num_levels; 03040 int m_max_degree; 03041 float m_tolerance; 03042 float m_bounding[6]; 03043 char m_num_cutoffs; 03044 float m_cutoff[8]; 03045 unsigned char m_heuristic; 03046 unsigned char m_fallback; 03047 03048 int m_nurbs_options_mask; 03049 int m_nurbs_options_value; 03050 int m_curve_budget; 03051 int m_curve_continued_budget; 03052 int m_surface_budget; 03053 int m_surface_trim_budget; 03054 float m_surface_max_trim_curve_deviation; 03055 float m_surface_max_facet_angle; 03056 float m_surface_max_facet_deviation; 03057 float m_surface_max_facet_width; 03058 float m_curve_max_angle; 03059 float m_curve_max_deviation; 03060 float m_curve_max_length; 03061 03062 float m_stereo_separation; 03063 float m_stereo_distance; 03064 03065 unsigned char m_tessellations; 03066 char m_num_cylinder; 03067 char m_cylinder[8]; 03068 char m_num_sphere; 03069 char m_sphere[8]; 03070 03071 float m_gooch_color_range[2]; 03072 float m_gooch_diffuse_weight; 03073 char * m_gooch_color_map_segment; 03074 int m_gooch_color_map_segment_length; 03075 unsigned short m_transparency_options; 03076 03077 unsigned char m_cut_geometry; 03078 unsigned char m_cut_geometry_level; 03079 unsigned char m_cut_geometry_match; 03080 float m_cut_geometry_tolerance; 03081 03082 unsigned short m_simple_shadow; 03083 unsigned char m_simple_shadow_blur; 03084 unsigned short m_simple_shadow_resolution; 03085 float m_simple_shadow_plane[4]; 03086 float m_simple_shadow_light[3]; 03087 float m_simple_shadow_color[3]; 03088 float m_simple_shadow_opacity; 03089 03090 unsigned short m_shadow_map; 03091 unsigned short m_shadow_map_resolution; 03092 unsigned char m_shadow_map_samples; 03093 03094 unsigned short m_simple_reflection; 03095 float m_simple_reflection_plane[4]; 03096 float m_simple_reflection_opacity; 03097 int m_simple_reflection_blur; 03098 float m_simple_reflection_hither; 03099 float m_simple_reflection_yon; 03100 int m_simple_reflection_visibility_mask; 03101 int m_simple_reflection_visibility_value; 03102 03103 float m_depth_range[2]; 03104 float m_screen_range[4]; 03105 float m_ambient_up_vector[3]; 03106 float m_image_scale[2]; 03107 unsigned short m_mask_transform; 03108 03109 unsigned char m_geometry_options; 03110 float m_dihedral; 03111 03112 float m_image_tint_color[3]; 03113 float m_texture_tint_color[3]; 03114 unsigned char m_depth_peeling_layers; 03115 float m_depth_peeling_min_area; 03116 unsigned char m_depth_peeling_algorithm; 03117 03118 int m_general_displacement; 03119 int m_join_cutoff_angle; 03120 int m_edge_join_cutoff_angle; 03121 float m_vertex_decimation; 03122 unsigned char m_display_list_level; 03123 unsigned char m_antialias; 03124 03125 int m_extra; 03126 03127 #if 0 03128 TK_Radiosity_RayTrace_Options *m_rrt; 03129 #endif 03130 03131 public: 03133 TK_Rendering_Options (); 03134 ~TK_Rendering_Options (); 03135 03136 TK_Status Read (BStreamFileToolkit & tk); 03137 TK_Status Write (BStreamFileToolkit & tk); 03138 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 03139 03140 TK_Status ReadAscii (BStreamFileToolkit & tk); 03141 TK_Status WriteAscii (BStreamFileToolkit & tk); 03142 03143 void Reset (); 03144 03146 void SetMask (int m0, int m1=0, int m2=0) { 03147 m_mask[0] = m0; 03148 m_mask[1] = m1; 03149 m_mask[2] = m2; 03150 if (m2 != 0) 03151 m_mask[1] |= TKO_Rendo_Extended; 03152 if (m1 != 0) 03153 m_mask[0] |= TKO_Rendo_Extended; 03154 } 03156 int GetMask (int index=0) const { return m_mask[index]; } 03157 03159 void SetValue (int v0, int v1=0, int v2=0) { m_value[0] = v0; m_value[1] = v1; m_value[2] = v2; } 03161 int GetValue (int index=0) const { return m_value[index]; } 03162 03164 void SetHSR (int h) { m_hsr &= 0xF0; m_hsr |= (unsigned char)h & 0x0F; } 03166 int GetHSR () const { return (int)(m_hsr & 0x0F); } 03167 03169 void SetTransparentHSR (int t) { m_hsr &= 0x0F; m_hsr |= (unsigned char)t << 4; } 03171 int GetTransparentHSR () const { return (int)(m_hsr >> 4); } 03172 03174 void SetTransparentStyle (int s) { m_transparency_options = (unsigned short)s; } 03176 int GetTransparentStyle () const { return (int)m_transparency_options; } 03177 03179 void SetTechnology (int t) { m_tq &= 0xF0; m_tq |= (unsigned char)t & 0x0F; } 03181 int GetTechnology () const { return (int)(m_tq & 0x0F); } 03182 03184 void SetQuantization (int q) { m_tq &= 0x0F; m_tq |= (unsigned char)q << 4; } 03186 int GetQuantization () const { return (int)(m_tq >> 4); } 03187 03189 void SetDebug (int d) { m_debug = d; } 03191 int GetDebug () const { return m_debug; } 03192 03194 void SetFaceDisplacement (int d) { m_face_displacement = d; } 03196 int GetFaceDisplacement () const { return m_face_displacement; } 03197 03199 void SetVertexDisplacement (int d) { m_vertex_displacement = d; } 03201 int GetVertexDisplacement () const { return m_vertex_displacement; } 03202 03204 void SetGeneralDisplacement (int d) { m_general_displacement = d; } 03206 int GetGeneralDisplacement () const { return m_general_displacement; } 03207 03209 void SetJoinCutoffAngle (int d) { m_join_cutoff_angle = d; } 03211 int GetJoinCutoffAngle () const { return m_join_cutoff_angle; } 03212 03214 void SetFogLimits (float n, float f) { m_fog_limits[0] = n; m_fog_limits[1] = f; } 03216 void SetFogLimits (float const l[]) { SetFogLimits (l[0], l[1]); } 03218 float const * GetFogLimits () const { return m_fog_limits; } 03219 03220 03222 void SetLockMask (int m) { m_lock.mask = m; } 03224 int GetLockMask () const { return m_lock.mask; } 03225 03227 void SetLockValue (int v) { m_lock.value = v; } 03229 int GetLockValue () const { return m_lock.value; } 03230 03235 void SetVisibilityLockMask (int m) { m_lock.visibility_mask = m; } 03240 int GetVisibilityLockMask () const { return m_lock.visibility_mask; } 03241 03246 void SetVisibilityLockValue (int v) { m_lock.visibility_value = v; } 03251 int GetVisibilityLockValue () const { return m_lock.visibility_value; } 03252 03253 03258 void SetColorLockMask (int m) { m_lock.color_mask = m; } 03263 int GetColorLockMask () const { return m_lock.color_mask; } 03264 03269 void SetColorLockValue (int v) { m_lock.color_value = v; } 03274 int GetColorLockValue () const { return m_lock.color_value; } 03275 03276 03281 void SetColorFaceLockMask (int m) { m_lock.color_face_mask = (short)m; } 03286 int GetColorFaceLockMask () const { return m_lock.color_face_mask; } 03287 03292 void SetColorFaceLockValue (int v) { m_lock.color_face_value = (short)v; } 03297 int GetColorFaceLockValue () const { return m_lock.color_face_value; } 03298 03299 03304 void SetColorEdgeLockMask (int m) { m_lock.color_edge_mask = (short)m; } 03309 int GetColorEdgeLockMask () const { return m_lock.color_edge_mask; } 03310 03315 void SetColorEdgeLockValue (int v) { m_lock.color_edge_value = (short)v; } 03320 int GetColorEdgeLockValue () const { return m_lock.color_edge_value; } 03321 03322 03327 void SetColorLineLockMask (int m) { m_lock.color_line_mask = (short)m; } 03332 int GetColorLineLockMask () const { return m_lock.color_line_mask; } 03333 03338 void SetColorLineLockValue (int v) { m_lock.color_line_value = (short)v; } 03343 int GetColorLineLockValue () const { return m_lock.color_line_value; } 03344 03345 03350 void SetColorMarkerLockMask (int m) { m_lock.color_marker_mask = (short)m; } 03355 int GetColorMarkerLockMask () const { return m_lock.color_marker_mask; } 03356 03361 void SetColorMarkerLockValue (int v) { m_lock.color_marker_value = (short)v; } 03366 int GetColorMarkerLockValue () const { return m_lock.color_marker_value; } 03367 03368 03373 void SetColorTextLockMask (int m) { m_lock.color_text_mask = (short)m; } 03378 int GetColorTextLockMask () const { return m_lock.color_text_mask; } 03379 03384 void SetColorTextLockValue (int v) { m_lock.color_text_value = (short)v; } 03389 int GetColorTextLockValue () const { return m_lock.color_text_value; } 03390 03391 03396 void SetColorWindowLockMask (int m) { m_lock.color_window_mask = (short)m; } 03401 int GetColorWindowLockMask () const { return m_lock.color_window_mask; } 03402 03407 void SetColorWindowLockValue (int v) { m_lock.color_window_value = (short)v; } 03412 int GetColorWindowLockValue () const { return m_lock.color_window_value; } 03413 03414 03419 void SetColorFaceContrastLockMask (int m) { m_lock.color_face_contrast_mask = (short)m; } 03424 int GetColorFaceContrastLockMask () const { return m_lock.color_face_contrast_mask; } 03425 03430 void SetColorFaceContrastLockValue (int v) { m_lock.color_face_contrast_value = (short)v; } 03435 int GetColorFaceContrastLockValue () const { return m_lock.color_face_contrast_value; } 03436 03437 03442 void SetColorWindowContrastLockMask (int m) { m_lock.color_window_contrast_mask = (short)m; } 03447 int GetColorWindowContrastLockMask () const { return m_lock.color_window_contrast_mask; } 03448 03453 void SetColorWindowContrastLockValue (int v) { m_lock.color_window_contrast_value = (short)v; } 03458 int GetColorWindowContrastLockValue () const { return m_lock.color_window_contrast_value; } 03459 03460 03465 void SetColorBackLockMask (int m) { m_lock.color_back_mask = (short)m; } 03470 int GetColorBackLockMask () const { return m_lock.color_back_mask; } 03471 03476 void SetColorBackLockValue (int v) { m_lock.color_back_value = (short)v; } 03481 int GetColorBackLockValue () const { return m_lock.color_back_value; } 03482 03483 03488 void SetColorVertexLockMask (int m) { m_lock.color_vertex_mask = (short)m; } 03493 int GetColorVertexLockMask () const { return m_lock.color_vertex_mask; } 03494 03499 void SetColorVertexLockValue (int v) { m_lock.color_vertex_value = (short)v; } 03504 int GetColorVertexLockValue () const { return m_lock.color_vertex_value; } 03505 03506 03511 void SetColorEdgeContrastLockMask (int m) { m_lock.color_edge_contrast_mask = (short)m; } 03516 int GetColorEdgeContrastLockMask () const { return m_lock.color_edge_contrast_mask; } 03517 03522 void SetColorEdgeContrastLockValue (int v) { m_lock.color_edge_contrast_value = (short)v; } 03527 int GetColorEdgeContrastLockValue () const { return m_lock.color_edge_contrast_value; } 03528 03529 03534 void SetColorLineContrastLockMask (int m) { m_lock.color_line_contrast_mask = (short)m; } 03539 int GetColorLineContrastLockMask () const { return m_lock.color_line_contrast_mask; } 03540 03545 void SetColorLineContrastLockValue (int v) { m_lock.color_line_contrast_value = (short)v; } 03550 int GetColorLineContrastLockValue () const { return m_lock.color_line_contrast_value; } 03551 03552 03557 void SetColorMarkerContrastLockMask (int m) { m_lock.color_marker_contrast_mask = (short)m; } 03562 int GetColorMarkerContrastLockMask () const { return m_lock.color_marker_contrast_mask; } 03563 03568 void SetColorMarkerContrastLockValue (int v) { m_lock.color_marker_contrast_value = (short)v; } 03573 int GetColorMarkerContrastLockValue () const { return m_lock.color_marker_contrast_value; } 03574 03575 03580 void SetColorVertexContrastLockMask (int m) { m_lock.color_vertex_contrast_mask = (short)m; } 03585 int GetColorVertexContrastLockMask () const { return m_lock.color_vertex_contrast_mask; } 03586 03591 void SetColorVertexContrastLockValue (int v) { m_lock.color_vertex_contrast_value = (short)v; } 03596 int GetColorVertexContrastLockValue () const { return m_lock.color_vertex_contrast_value; } 03597 03598 03603 void SetColorTextContrastLockMask (int m) { m_lock.color_text_contrast_mask = (short)m; } 03608 int GetColorTextContrastLockMask () const { return m_lock.color_text_contrast_mask; } 03609 03614 void SetColorTextContrastLockValue (int v) { m_lock.color_text_contrast_value = (short)v; } 03619 int GetColorTextContrastLockValue () const { return m_lock.color_text_contrast_value; } 03620 03621 03622 03623 03625 void SetForcedLockMask (int m) { m_forced.mask = m; } 03627 int GetForcedLockMask () const { return m_forced.mask; } 03628 03630 void SetForcedLockValue (int v) { m_forced.value = v; } 03632 int GetForcedLockValue () const { return m_forced.value; } 03633 03638 void SetVisibilityForcedLockMask (int m) { m_forced.visibility_mask = m; } 03643 int GetVisibilityForcedLockMask () const { return m_forced.visibility_mask; } 03644 03649 void SetVisibilityForcedLockValue (int v) { m_forced.visibility_value = v; } 03654 int GetVisibilityForcedLockValue () const { return m_forced.visibility_value; } 03655 03656 03661 void SetColorForcedLockMask (int m) { m_forced.color_mask = m; } 03666 int GetColorForcedLockMask () const { return m_forced.color_mask; } 03667 03672 void SetColorForcedLockValue (int v) { m_forced.color_value = v; } 03677 int GetColorForcedLockValue () const { return m_forced.color_value; } 03678 03679 03684 void SetColorFaceForcedLockMask (int m) { m_forced.color_face_mask = (short)m; } 03689 int GetColorFaceForcedLockMask () const { return m_forced.color_face_mask; } 03690 03695 void SetColorFaceForcedLockValue (int v) { m_forced.color_face_value = (short)v; } 03700 int GetColorFaceForcedLockValue () const { return m_forced.color_face_value; } 03701 03702 03707 void SetColorEdgeForcedLockMask (int m) { m_forced.color_edge_mask = (short)m; } 03712 int GetColorEdgeForcedLockMask () const { return m_forced.color_edge_mask; } 03713 03718 void SetColorEdgeForcedLockValue (int v) { m_forced.color_edge_value = (short)v; } 03723 int GetColorEdgeForcedLockValue () const { return m_forced.color_edge_value; } 03724 03725 03730 void SetColorLineForcedLockMask (int m) { m_forced.color_line_mask = (short)m; } 03735 int GetColorLineForcedLockMask () const { return m_forced.color_line_mask; } 03736 03741 void SetColorLineForcedLockValue (int v) { m_forced.color_line_value = (short)v; } 03746 int GetColorLineForcedLockValue () const { return m_forced.color_line_value; } 03747 03748 03753 void SetColorMarkerForcedLockMask (int m) { m_forced.color_marker_mask = (short)m; } 03758 int GetColorMarkerForcedLockMask () const { return m_forced.color_marker_mask; } 03759 03764 void SetColorMarkerForcedLockValue (int v) { m_forced.color_marker_value = (short)v; } 03769 int GetColorMarkerForcedLockValue () const { return m_forced.color_marker_value; } 03770 03771 03776 void SetColorTextForcedLockMask (int m) { m_forced.color_text_mask = (short)m; } 03781 int GetColorTextForcedLockMask () const { return m_forced.color_text_mask; } 03782 03787 void SetColorTextForcedLockValue (int v) { m_forced.color_text_value = (short)v; } 03792 int GetColorTextForcedLockValue () const { return m_forced.color_text_value; } 03793 03794 03799 void SetColorWindowForcedLockMask (int m) { m_forced.color_window_mask = (short)m; } 03804 int GetColorWindowForcedLockMask () const { return m_forced.color_window_mask; } 03805 03810 void SetColorWindowForcedLockValue (int v) { m_forced.color_window_value = (short)v; } 03815 int GetColorWindowForcedLockValue () const { return m_forced.color_window_value; } 03816 03817 03822 void SetColorFaceContrastForcedLockMask (int m) { m_forced.color_face_contrast_mask = (short)m; } 03827 int GetColorFaceContrastForcedLockMask () const { return m_forced.color_face_contrast_mask; } 03828 03833 void SetColorFaceContrastForcedLockValue (int v) { m_forced.color_face_contrast_value = (short)v; } 03838 int GetColorFaceContrastForcedLockValue () const { return m_forced.color_face_contrast_value; } 03839 03840 03845 void SetColorWindowContrastForcedLockMask (int m) { m_forced.color_window_contrast_mask = (short)m; } 03850 int GetColorWindowContrastForcedLockMask () const { return m_forced.color_window_contrast_mask; } 03851 03856 void SetColorWindowContrastForcedLockValue (int v) { m_forced.color_window_contrast_value = (short)v; } 03861 int GetColorWindowContrastForcedLockValue () const { return m_forced.color_window_contrast_value; } 03862 03863 03868 void SetColorBackForcedLockMask (int m) { m_forced.color_back_mask = (short)m; } 03873 int GetColorBackForcedLockMask () const { return m_forced.color_back_mask; } 03874 03879 void SetColorBackForcedLockValue (int v) { m_forced.color_back_value = (short)v; } 03884 int GetColorBackForcedLockValue () const { return m_forced.color_back_value; } 03885 03886 03891 void SetColorVertexForcedLockMask (int m) { m_forced.color_vertex_mask = (short)m; } 03896 int GetColorVertexForcedLockMask () const { return m_forced.color_vertex_mask; } 03897 03902 void SetColorVertexForcedLockValue (int v) { m_forced.color_vertex_value = (short)v; } 03907 int GetColorVertexForcedLockValue () const { return m_forced.color_vertex_value; } 03908 03909 03914 void SetColorEdgeContrastForcedLockMask (int m) { m_forced.color_edge_contrast_mask = (short)m; } 03919 int GetColorEdgeContrastForcedLockMask () const { return m_forced.color_edge_contrast_mask; } 03920 03925 void SetColorEdgeContrastForcedLockValue (int v) { m_forced.color_edge_contrast_value = (short)v; } 03930 int GetColorEdgeContrastForcedLockValue () const { return m_forced.color_edge_contrast_value; } 03931 03932 03937 void SetColorLineContrastForcedLockMask (int m) { m_forced.color_line_contrast_mask = (short)m; } 03942 int GetColorLineContrastForcedLockMask () const { return m_forced.color_line_contrast_mask; } 03943 03948 void SetColorLineContrastForcedLockValue (int v) { m_forced.color_line_contrast_value = (short)v; } 03953 int GetColorLineContrastForcedLockValue () const { return m_forced.color_line_contrast_value; } 03954 03955 03960 void SetColorMarkerContrastForcedLockMask (int m) { m_forced.color_marker_contrast_mask = (short)m; } 03965 int GetColorMarkerContrastForcedLockMask () const { return m_forced.color_marker_contrast_mask; } 03966 03971 void SetColorMarkerContrastForcedLockValue (int v) { m_forced.color_marker_contrast_value = (short)v; } 03976 int GetColorMarkerContrastForcedLockValue () const { return m_forced.color_marker_contrast_value; } 03977 03978 03983 void SetColorVertexContrastForcedLockMask (int m) { m_forced.color_vertex_contrast_mask = (short)m; } 03988 int GetColorVertexContrastForcedLockMask () const { return m_forced.color_vertex_contrast_mask; } 03989 03994 void SetColorVertexContrastForcedLockValue (int v) { m_forced.color_vertex_contrast_value = (short)v; } 03999 int GetColorVertexContrastForcedLockValue () const { return m_forced.color_vertex_contrast_value; } 04000 04001 04006 void SetColorTextContrastForcedLockMask (int m) { m_forced.color_text_contrast_mask = (short)m; } 04011 int GetColorTextContrastForcedLockMask () const { return m_forced.color_text_contrast_mask; } 04012 04017 void SetColorTextContrastForcedLockValue (int v) { m_forced.color_text_contrast_value = (short)v; } 04022 int GetColorTextContrastForcedLockValue () const { return m_forced.color_text_contrast_value; } 04023 04024 04025 04026 04028 void SetBufferOptionsMask (int v) { m_buffer_options_mask = (unsigned char)v; } 04030 int GetBufferOptionsMask () const { return m_buffer_options_mask; } 04032 void SetBufferOptionsValue (int v) { m_buffer_options_value = (unsigned char) v; } 04034 int GetBufferOptionsValue () const { return m_buffer_options_value; } 04036 void SetBufferSizeLimit (int l) { m_buffer_size_limit = l; } 04038 int GetBufferSizeLimit () const { return m_buffer_size_limit; } 04039 04040 04042 void SetStereoSeparation (float s) { m_stereo_separation = s; } 04044 float GetStereoSeparation () const { return m_stereo_separation; } 04046 void SetStereoDistance (float d) { m_stereo_distance = d; } 04048 float GetStereoDistance () const { return m_stereo_distance; } 04049 04050 04052 void SetHlrOptions (int o) { 04053 m_hlr_options = o; 04054 if ((o & TKO_Hidden_Line_Extended_Mask) != 0) { 04055 m_hlr_options |= TKO_Hidden_Line_Extended; 04056 if ((o & TKO_Hidden_Line_Extended2_Mask) != 0) 04057 m_hlr_options |= TKO_Hidden_Line_Extended2; 04058 } 04059 } 04061 int GetHlrOptions () const { return m_hlr_options; } 04063 void SetHlrDimFactor (float d) { m_hlr_dim_factor = d; } 04065 float GetHlrDimFactor () const { return m_hlr_dim_factor; } 04067 void SetHlrFaceDisplacement (float d) { m_hlr_face_displacement = d; } 04069 float GetHlrFaceDisplacement () const { return m_hlr_face_displacement; } 04071 void SetHlrLinePattern (int p) { m_hlr_line_pattern = p; } 04073 int GetHlrLinePattern () const { return m_hlr_line_pattern; } 04075 void SetHlrFaceSortingAlgorithm (int a) { m_hlr_hsr_algorithm = (unsigned char)a; } 04077 float GetHlrFaceSortingAlgorithm () const { return m_hlr_hsr_algorithm; } 04078 04079 04081 void SetNURBSOptionsMask (int m) { 04082 m_nurbs_options_mask = m; 04083 if ((m & TKO_NURBS_Extended_Mask) != 0) 04084 m_nurbs_options_mask |= TKO_NURBS_Extended; 04085 } 04087 int GetNURBSOptionsMask () const { return m_nurbs_options_mask; } 04089 void SetNURBSOptionsValue (int v) { m_nurbs_options_value = v; } 04091 int GetNURBSOptionsValue () const { return m_nurbs_options_value; } 04093 void SetNURBSCurveBudget (int b) { m_curve_budget = b; } 04095 int GetNURBSCurveBudget () const { return m_curve_budget; } 04097 void SetNURBSCurveContinuedBudget (int b) { m_curve_continued_budget = b; } 04099 int GetNURBSCurveContinuedBudget () const { return m_curve_continued_budget; } 04101 void SetNURBSSurfaceBudget (int b) { m_surface_budget = b; } 04103 int GetNURBSSurfaceBudget () const { return m_surface_budget; } 04105 void SetNURBSSurfaceTrimBudget (int b) { m_surface_trim_budget = b; } 04107 int GetNURBSSurfaceTrimBudget () const { return m_surface_trim_budget; } 04108 04109 04111 void SetLodOptionsMask (int v) { m_lod_options_mask = v; } 04113 int GetLodOptionsMask () const { return m_lod_options_mask; } 04115 void SetLodOptionsValue (int v) { m_lod_options_value = v; } 04117 int GetLodOptionsValue () const { return m_lod_options_value; } 04119 void SetLodAlgorithm (int v) { m_lod_algorithm = (char)v; } 04121 int GetLodAlgorithm () const { return m_lod_algorithm; } 04123 void SetLodMinimumTriangleCount (int v) { m_min_triangle_count = v; } 04125 int GetLodMinimumTriangleCount () const { return m_min_triangle_count; } 04127 void SetLodNumLevels (int v) { m_num_levels = (unsigned char)v; } 04129 int GetLodNumLevels () const { return m_num_levels; } 04131 void SetLodClamp (int v) { m_clamp = (unsigned char)v; } 04133 int GetLodClamp () const { return m_clamp; } 04135 void SetLodMaxDegree (int v) { m_max_degree = v; } 04137 int GetLodMaxDegree () const { return m_max_degree; } 04139 void SetLodTolerance (float v) { m_tolerance = v; } 04141 float GetLodTolerance () const { return m_tolerance; } 04143 void SetLodFallback (int v) { m_fallback = (char)v; } 04145 int GetLodFallback () const { return m_fallback; } 04146 04148 void SetLodBounding (float x1, float y1, float z1, float x2, float y2, float z2) { 04149 m_bounding[0] = x1; m_bounding[1] = y1; m_bounding[2] = z1; 04150 m_bounding[3] = x2; m_bounding[4] = y2; m_bounding[5] = z2; 04151 } 04153 void SetLodBounding (float const s[], float const e[]) { 04154 SetLodBounding (s[0], s[1], s[2], e[0], e[1], e[2]); 04155 } 04157 void SetLodBounding (float const p[]) { SetLodBounding (&p[0], &p[3]); } 04159 float const * GetLodBounding () const { return m_bounding; } 04160 04162 void SetLodRatio (float r) { m_num_ratios = 1; m_ratio[0] = r; } 04164 void SetLodRatios (int c, float const r[] = 0) { 04165 m_num_ratios = (char)c; 04166 if (r != 0) { 04167 int i; 04168 for (i=0; i<c; ++i) 04169 m_ratio[i] = r[i]; 04170 } 04171 } 04173 int GetLodNumRatios () const { return m_num_ratios; } 04175 float const * GetLodRatios () const { return m_ratio; } 04177 float * GetLodRatios () { return m_ratio; } 04178 04180 void SetLodThresholdType (int v) { m_threshold_type = (char)v; } 04182 int GetLodThresholdType () const { return m_threshold_type; } 04184 void SetLodThreshold (float r) { m_num_thresholds = 1; m_threshold[0] = r; } 04186 void SetLodThresholds (int c, float const r[] = 0) { 04187 m_num_thresholds = (char)c; 04188 if (r != 0) { 04189 int i; 04190 for (i=0; i<c; ++i) 04191 m_threshold[i] = r[i]; 04192 } 04193 } 04195 int GetLodNumThresholds () const { return m_num_thresholds; } 04197 float const * GetLodThresholds () const { return m_threshold; } 04199 float * GetLodThresholds () { return m_threshold; } 04200 04202 void SetLodCutoff (float r) { m_num_cutoffs = 1; m_cutoff[0] = r; } 04204 void SetLodCutoffs (int c, float const r[] = 0) { 04205 m_num_cutoffs = (char)c; 04206 if (r != 0) { 04207 int i; 04208 for (i=0; i<c; ++i) 04209 m_cutoff[i] = r[i]; 04210 } 04211 } 04213 int GetLodNumCutoffs () const { return m_num_cutoffs; } 04215 float const * GetLodCutoffs () const { return m_cutoff; } 04217 float * GetLodCutoffs () { return m_cutoff; } 04218 04219 04221 void SetTessellationMask (int m) { m_tessellations = (unsigned char)m; } 04223 int GetTessellationMask () const { return m_tessellations; } 04225 void SetCylinderTessellation (int n) { m_num_cylinder = (char)1; m_cylinder[0] = (char)n; } 04227 void SetCylinderTessellations (int c, char const * n = 0) { 04228 m_num_cylinder = (char)c; 04229 if (n != 0) { 04230 int i; 04231 for (i=0; i<c; ++i) 04232 m_cylinder[i] = n[i]; 04233 } 04234 } 04236 int GetNumCylinderTessellations () const { return m_num_cylinder; } 04238 char const * GetCylinderTessellations () const { return m_cylinder; } 04240 char * GetCylinderTessellations () { return m_cylinder; } 04242 void SetSphereTessellation (int n) { m_num_sphere = (char)1; m_sphere[0] = (char)n; } 04244 void SetSphereTessellations (int c, char const * n = 0) { 04245 m_num_sphere = (char)c; 04246 if (n != 0) { 04247 int i; 04248 for (i=0; i<c; ++i) 04249 m_sphere[i] = n[i]; 04250 } 04251 } 04253 int GetNumSphereTessellations () const { return m_num_sphere; } 04255 char const * GetSphereTessellations () const { return m_sphere; } 04257 char * GetSphereTessellations () { return m_sphere; } 04258 04260 void SetGeometryOptionsMask (int m) { m_geometry_options = (unsigned char)m; } 04262 int GetGeometryOptionsMask () const { return m_geometry_options; } 04263 04265 void SetHardEdgeAngle (int m) { m_dihedral = (unsigned char)m; } 04267 float GetHardEdgeAngle () const { return m_dihedral; } 04268 04270 void SetMaskTransform (int m) { m_mask_transform = (unsigned short)m; } 04272 int GetMaskTransform () const { return (int)m_mask_transform; } 04273 04274 04276 void SetCutGeometry (int m) { m_cut_geometry = (unsigned char)m; } 04278 int GetCutGeometry () const { return (int)m_cut_geometry; } 04279 04281 void SetCutGeometryLevel (int m) { m_cut_geometry_level = (unsigned char)m; } 04283 int GetCutGeometryLevel () const { return (int)m_cut_geometry_level; } 04284 04286 void SetCutGeometryColorMatch (int m) { m_cut_geometry_match = (unsigned char)m; } 04288 int GetCutGeometryColorMatch () const { return (int)m_cut_geometry_match; } 04289 04291 void SetCutGeometryTolerance (float m) { m_cut_geometry_tolerance = m; } 04293 float GetCutGeometryTolerance () const { return m_cut_geometry_tolerance; } 04294 04295 04297 void SetDisplayListLevel (int m) { m_display_list_level = (unsigned char)m; } 04299 int GetDisplayListLevel () const { return (int)m_display_list_level; } 04300 04302 void SetSimpleShadow (int m) { 04303 m_simple_shadow = (unsigned short)m; 04304 if ((m & TKO_Simple_Shadow_Extended_Mask) != 0) 04305 m_simple_shadow |= TKO_Simple_Shadow_Extended; 04306 } 04308 int GetSimpleShadow () const { return (int)m_simple_shadow; } 04309 04311 void SetSimpleShadowBlur (int m) { m_simple_shadow_blur = (unsigned char)m; } 04313 int GetSimpleShadowBlur () const { return (int)m_simple_shadow_blur; } 04314 04316 void SetSimpleShadowResolution (int m) { m_simple_shadow_resolution = (unsigned short)m; } 04318 int GetSimpleShadowResolution () const { return (int)m_simple_shadow_resolution; } 04319 04321 void SetSimpleShadowLight (float x, float y, float z) { 04322 m_simple_shadow_light[0] = x; 04323 m_simple_shadow_light[1] = y; 04324 m_simple_shadow_light[2] = z; 04325 } 04327 void SetSimpleShadowLight (float const l[]) { SetSimpleShadowLight (l[0], l[1], l[2]); } 04329 float const * getSimpleShadowLight () const { return m_simple_shadow_light; } 04330 04332 void SetSimpleShadowPlane (float a, float b, float c, float d) { 04333 m_simple_shadow_plane[0] = a; 04334 m_simple_shadow_plane[1] = b; 04335 m_simple_shadow_plane[2] = c; 04336 m_simple_shadow_plane[3] = d; 04337 } 04339 void SetSimpleShadowPlane (float const p[]) { SetSimpleShadowPlane (p[0], p[1], p[2], p[3]); } 04341 float const * GetSimpleShadowPlane () const { return m_simple_shadow_plane; } 04342 04344 void SetSimpleShadowColor (float r, float g, float b) 04345 { m_simple_shadow_color[0] = r; m_simple_shadow_color[1] = g; m_simple_shadow_color[2] = b; } 04347 void SetSimpleShadowColor (float const rgb[]) { SetSimpleShadowColor (rgb[0], rgb[1], rgb[2]); } 04349 float const * GetSimpleShadowColor () const { return m_simple_shadow_color; } 04350 04352 void SetSimpleShadowOpacity (float o) { m_simple_shadow_opacity = o; } 04354 float GetSimpleShadowOpacity () const { return m_simple_shadow_opacity; } 04355 04356 04358 void SetShadowMap (int m) { m_shadow_map = (unsigned char)m; } 04360 int GetShadowMap () const { return (int)m_shadow_map; } 04361 04363 void SetShadowMapResolution (int m) { m_shadow_map_resolution = (unsigned short)m; } 04365 int GetShadowMapResolution () const { return (int)m_shadow_map_resolution; } 04366 04368 void SetShadowMapSamples (int m) { m_shadow_map_samples = (unsigned char)m; } 04370 int GetShadowMapSamples () const { return (int)m_shadow_map_samples; } 04371 04372 04374 void SetSimpleReflection (int m) { m_simple_reflection = (unsigned short)m; } 04376 int GetSimpleReflection () const { return (int)m_simple_reflection; } 04377 04379 void SetSimpleReflectionPlane (float a, float b, float c, float d) { 04380 m_simple_reflection_plane[0] = a; 04381 m_simple_reflection_plane[1] = b; 04382 m_simple_reflection_plane[2] = c; 04383 m_simple_reflection_plane[3] = d; 04384 } 04386 void SetSimpleReflectionPlane (float const p[]) { SetSimpleReflectionPlane (p[0], p[1], p[2], p[3]); } 04388 float const * GetSimpleReflectionPlane () const { return m_simple_reflection_plane; } 04389 04391 void SetSimpleReflectionOpacity (float o) { m_simple_reflection_opacity = o; } 04393 float GetSimpleReflectionOpacity () const { return m_simple_reflection_opacity; } 04394 04396 void SetSimpleReflectionVisibilityMask (int m) { m_simple_reflection_visibility_mask = m; } 04398 int GetSimpleReflectionVisibilityValue () const { return m_simple_reflection_visibility_value; } 04399 04400 04402 void SetDepthRange (float n, float f) { m_depth_range[0] = n; m_depth_range[1] = f; } 04404 void SetDepthRange (float const l[]) { SetDepthRange (l[0], l[1]); } 04406 float const * GetDepthRange () const { return m_depth_range; } 04407 04408 04410 void SetScreenRange (float l, float r, float b, float t) 04411 { m_screen_range[0] = l; m_screen_range[1] = r; m_screen_range[2] = b; m_screen_range[3] = t; } 04413 void SetScreenRange (float const l[]) { SetScreenRange (l[0], l[1], l[2], l[3]); } 04415 float const * GetScreenRange () const { return m_screen_range; } 04416 04420 void SetAmbientUpVector (float x, float y, float z) 04421 { m_ambient_up_vector[0] = x; m_ambient_up_vector[1] = y; m_ambient_up_vector[2] = z; } 04423 void SetAmbientUpVector (float const v[]) { SetAmbientUpVector (v[0], v[1], v[2]); } 04425 float const * GetAmbientUpVector () const { return m_ambient_up_vector; } 04426 04428 void SetImageScale (float x, float y) { m_image_scale[0] = x; m_image_scale[1] = y; } 04430 void SetImageScale (float const s[]) { SetImageScale (s[0], s[1]); } 04432 float const * GetImageScale () const { return m_image_scale; } 04433 04434 04436 void SetImageTintColor (float r, float g, float b) 04437 { m_image_tint_color[0] = r; m_image_tint_color[1] = g; m_image_tint_color[2] = b; } 04439 void SetImageTintColor (float const rgb[]) { SetImageTintColor (rgb[0], rgb[1], rgb[2]); } 04441 float const * GetImageTintColor () const { return m_image_tint_color; } 04442 04444 void SetDiffuseTextureTintColor (float r, float g, float b) 04445 { m_texture_tint_color[0] = r; m_texture_tint_color[1] = g; m_texture_tint_color[2] = b; } 04447 void SetDiffuseTextureTintColor (float const rgb[]) { SetDiffuseTextureTintColor (rgb[0], rgb[1], rgb[2]); } 04449 float const * GetDiffuseTextureTintColor () const { return m_texture_tint_color; } 04450 04452 void SetAntiAlias (int m) { m_antialias = (unsigned char)m; } 04454 int GetAntiAlias () const { return (int)m_antialias; } 04455 04457 void SetVertexDecimation (float f) { m_vertex_decimation = f; } 04459 float GetVertexDecimation () const { return m_vertex_decimation; } 04460 }; 04461 04463 04467 enum TKO_Heuristic_Bits { 04468 TKO_Heuristic_Hidden_Surfaces = 0x00000001, 04469 TKO_Heuristic_Backplane_Cull = 0x00000002, 04470 TKO_Heuristic_Polygon_Handedness = 0x00000004, 04471 TKO_Heuristic_Quick_Moves = 0x00000008, 04472 TKO_Heuristic_Partial_Erase = 0x00000010, 04473 TKO_Heuristic_Memory_Purge = 0x00000020, 04474 TKO_Heuristic_Related_Select_Limit = 0x00000040, 04475 TKO_Heuristic_Internal_Shell_Limit = 0x00000080, 04476 TKO_Heuristic_Clipping = 0x00000100, 04477 TKO_Heuristic_Transformations = 0x00000200, 04478 TKO_Heuristic_Intersecting_Polygons = 0x00000400, 04479 TKO_Heuristic_Polygon_Crossings = 0x00000800, 04480 TKO_Heuristic_Concave_Polygons = 0x00001000, 04481 TKO_Heuristic_Incremental_Updates = 0x00002000, 04482 TKO_Heuristic_Selection_Sorting = 0x00004000, 04483 04484 TKO_Heuristic_Extended = 0x00008000, 04485 TKO_Heuristic_Extended_Mask = 0xFFFF0000, 04486 TKO_Heuristic_Extended_Shift = 16, 04487 04488 TKO_Heuristic_Culling = 0x00010000, 04489 TKO_Heuristic_Exclude_Bounding = 0x00020000, 04490 TKO_Heuristic_Detail_Selection = 0x00040000, 04491 TKO_Heuristic_Ordered_Drawing = 0x00080000, 04492 TKO_Heuristic_Ordered_Unit = 0x00100000, 04493 TKO_Heuristic_Ordered_Weights = 0x00200000, 04494 TKO_Heuristic_Internal_Polyline_Limit = 0x00400000, 04495 TKO_Heuristic_Ordered_Grid = 0x00800000, 04496 04497 TKO_Heuristic_Selection_Level = 0x01000000, 04498 TKO_Heuristic_Static = 0x02000000, 04499 TKO_Heuristic_Force_Defer = 0x04000000, 04500 TKO_Heuristic_Model_Type = 0x08000000, 04501 TKO_Heuristic_Selection_Culling = 0x10000000, 04502 04503 TKO_Heuristic_Internal_Select_Limit = TKO_Heuristic_Internal_Shell_Limit | TKO_Heuristic_Internal_Polyline_Limit, 04504 TKO_Heuristic_Extras = TKO_Heuristic_Polygon_Handedness | TKO_Heuristic_Quick_Moves, 04505 04506 TKO_Heur_Extra_Left_Handed_Polys = 0x01, 04507 TKO_Heur_Extra_Quick_Move_Spriting = 0x02, 04508 04509 TKO_Heur_View_Frustum_Culling = 0x00000001, 04510 TKO_Heur_Obscuration_Culling = 0x00000002, 04511 TKO_Heur_Extent_Culling = 0x00000004, 04512 TKO_Heur_View_Frustum_Culling_Off = 0x00000010, 04513 TKO_Heur_Obscuration_Culling_Off = 0x00000020, 04514 TKO_Heur_Extent_Culling_Off = 0x00000040, 04515 TKO_Heur_Culling_Extended = 0x00000080, 04516 TKO_Heur_Culling_Extended_Mask = 0xFFFFFF00, 04517 TKO_Heur_Culling_Extended_Shift = 8, 04518 TKO_Heur_Obscuration_Use_Octree = 0x00000100, 04519 TKO_Heur_Maximum_Extent_Mode = 0x00000200, 04520 TKO_Heur_Vector_Culling = 0x00000400, 04521 TKO_Heur_Vector_Tolerance = 0x00000800, 04522 TKO_Heur_Vector_Culling_Off = 0x00001000, 04523 TKO_Heur_Vector_Tolerance_Off = 0x00002000, 04524 TKO_Heur_Hard_Extent_Culling = 0x00004000, 04525 TKO_Heur_Culling_Extended2 = 0x00008000, 04526 TKO_Heur_Culling_Extended2_Mask = 0xFFFF0000, 04527 TKO_Heur_Culling_Extended2_Shift = 16, 04528 TKO_Heur_Maximum_Extent_Level = 0x00010000, 04529 TKO_Heur_Hard_Extent_Culling_Off = 0x00020000, 04530 TKO_Heur_Extent_Culling_Detail_On = 0x00040000, 04531 TKO_Heur_Extent_Culling_Detail_Off = 0x00080000, 04532 TKO_Heur_Max_Distance_Culling = 0x00100000, 04533 TKO_Heur_Max_Distance_Culling_Off = 0x00200000, 04534 TKO_Heur_View_Volume_Culling = 0x00400000, 04535 TKO_Heur_View_Volume_Culling_Off = 0x00800000, 04536 04537 04538 TKO_Heur_Max_Extent_Mode_None = 0, 04539 TKO_Heur_Max_Extent_Mode_Dot = 1, 04540 TKO_Heur_Max_Extent_Mode_Bounding = 2, 04541 TKO_Heur_Max_Extent_Mode_Defer = 3, 04542 04543 TKO_Heur_Max_Extent_Level_None = 0x00, 04544 TKO_Heur_Max_Extent_Level_Segment = 0x01, 04545 TKO_Heur_Max_Extent_Level_Geometry = 0x02, 04546 TKO_Heur_Max_Extent_Level_Primitive = 0x04, 04547 TKO_Heur_Max_Extent_Level_All = 0x07, 04548 04549 TKO_Heur_Order_World_Volume = 0, 04550 TKO_Heur_Order_Screen_Extent = 1, 04551 TKO_Heur_Order_Distance = 2, 04552 TKO_Heur_Order_Divergence = 3, 04553 TKO_Heur_Order_Density = 4, 04554 TKO_Heur_Order_Priority = 5, 04555 TKO_Heur_Order_Count = 6, 04556 04557 TKO_Heur_Selection_Level_Entity = 0, 04558 TKO_Heur_Selection_Level_Segment = 1, 04559 TKO_Heur_Selection_Level_Segment_Tree = 2, 04560 04561 TKO_Heur_Model_Type_Default = 0, 04562 TKO_Heur_Model_Type_LMV = 1 04563 }; 04564 04565 04566 04568 04574 class BBINFILETK_API TK_Heuristics : public BBaseOpcodeHandler { 04575 protected: 04576 int m_mask; 04577 int m_value; 04578 04579 int m_related; 04580 int m_internal_shell; 04581 int m_internal_polyline; 04582 04583 unsigned char m_extras; 04584 int m_culling; 04585 int m_selection_culling; 04586 int m_pixel_threshold; 04587 int m_maximum_extent; 04588 int m_maximum_extent_mode; 04589 char m_maximum_extent_level; 04590 int m_hard_extent; 04591 int m_force_defer; 04592 float m_vector[3]; 04593 float m_vector_tolerance; 04594 float m_max_distance; 04595 float m_view_volume[6]; 04596 04597 unsigned char m_ordered_weights_mask; 04598 float m_ordered_weights[TKO_Heur_Order_Count]; 04599 unsigned char m_selection_level; 04600 unsigned char m_model_type; 04601 04602 public: 04604 TK_Heuristics () : BBaseOpcodeHandler (TKE_Heuristics), 04605 m_mask (0), m_value (0), m_culling(0), m_selection_culling(0), m_pixel_threshold (0), 04606 m_maximum_extent (0), m_maximum_extent_mode(0) {} 04607 ~TK_Heuristics (); 04608 04609 TK_Status Read (BStreamFileToolkit & tk); 04610 TK_Status Write (BStreamFileToolkit & tk); 04611 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04612 04613 TK_Status ReadAscii (BStreamFileToolkit & tk); 04614 TK_Status WriteAscii (BStreamFileToolkit & tk); 04615 04617 void SetMask (int m) { 04618 m_mask = m; 04619 if ((m & TKO_Heuristic_Extended_Mask) != 0) 04620 m_mask |= TKO_Heuristic_Extended; 04621 } 04623 int GetMask () const { return m_mask; } 04624 04626 void SetValue (int v) { m_value = v; } 04628 int GetValue () const { return m_value; } 04629 04631 void SetRelatedSelectionLimit (int r) { m_related = r; } 04633 int GetRelatedSelectionLimit () const { return m_related; } 04634 04636 void SetInternalSelectionLimit (int i) { m_internal_shell = m_internal_polyline = i; } 04638 int GetInternalSelectionLimit () const { return m_internal_shell; } 04639 04641 void SetInternalShellSelectionLimit (int i) { m_internal_shell = i; } 04643 int GetInternalShellSelectionLimit () const { return m_internal_shell; } 04644 04646 void SetInternalPolylineSelectionLimit (int i) { m_internal_polyline = i; } 04648 int GetInternalPolylineSelectionLimit () const { return m_internal_polyline; } 04649 04651 void SetExtras (int e) { m_extras = (unsigned char)e; } 04653 int GetExtras () const { return (int)m_extras; } 04654 04656 void SetCulling (int c) { m_culling = (unsigned short)c; } 04658 int GetCulling () const { return (int)m_culling; } 04660 void SetSelectionCulling (int c) { m_selection_culling = (unsigned short)c; } 04662 int GetSelectionCulling () const { return (int)m_selection_culling; } 04664 void SetPixelThreshold (int c) { m_pixel_threshold = c; } 04666 int GetPixelThreshold () const { return m_pixel_threshold; } 04668 void SetMaximumExtent (int c) { m_maximum_extent = c; } 04670 int GetMaximumExtent () const { return m_maximum_extent; } 04672 int GetMaximumExtentMode () const { return m_maximum_extent_mode; } 04674 void SetMaximumExtentMode (int c) { m_maximum_extent_mode = c; } 04676 int GetMaximumExtentLevel () const { return m_maximum_extent_level; } 04678 void SetMaximumExtentLevel (int c) { m_maximum_extent_level = (unsigned char)c; } 04680 void SetHardExtent (int c) { m_hard_extent = c; } 04682 int GetHardExtent () const { return m_hard_extent; } 04684 float const * GetVector () const { return m_vector; } 04686 void SetVector (float x, float y, float z) { 04687 m_vector[0] = x; 04688 m_vector[1] = y; 04689 m_vector[2] = z; 04690 } 04692 void SetVector (float const v[]) { SetVector(v[0], v[1], v[2]); } 04694 float GetVectorTolerance () const { return m_vector_tolerance; } 04696 void SetVectorTolerance (float tol) { m_vector_tolerance = tol; } 04697 04698 void SetMaxDistance (float m) { m_max_distance = m; } 04700 float GetMaxDistance () const { return m_max_distance; } 04701 04703 float const * GetViewVolume () const { return m_view_volume; } 04705 void SetViewVolume (float ax, float ay, float az, float bx, float by, float bz) { 04706 m_view_volume[0] = ax; 04707 m_view_volume[1] = ay; 04708 m_view_volume[2] = az; 04709 m_view_volume[3] = bx; 04710 m_view_volume[4] = by; 04711 m_view_volume[5] = bz; 04712 } 04714 void SetViewVolume (float const v[]) { SetViewVolume(v[0], v[1], v[2], v[3], v[4], v[5]); } 04715 04717 void SetOrderedWeightsMask (int c) { m_ordered_weights_mask = (unsigned char)c; } 04719 int GetOrderedWeightsMask () const { return (int)m_ordered_weights_mask; } 04720 04722 void SetOrderedWeight (int index, float weight) { 04723 m_ordered_weights[index] = weight; 04724 m_ordered_weights_mask |= 1<<index; 04725 } 04727 float GetOrderedWeight (int index) const { return m_ordered_weights[index]; } 04729 float const * GetOrderedWeights () const { return m_ordered_weights; } 04731 float * GetOrderedWeights () { return m_ordered_weights; } 04732 04734 void SetSelectionLevel (int l) { m_selection_level = (unsigned char)l; } 04736 int GetSelectionLevel () const { return (int)m_selection_level; } 04737 04739 void SetForceDefer (int l) { m_force_defer = l; } 04741 int GetForceDefer () const { return m_force_defer; } 04742 04743 }; 04744 04746 04750 enum TKO_Geometry_Options { 04751 TKO_Geometry_Options_Orientation = 0x0001, 04752 TKO_Geometry_Options_Camera_Relative = 0x0002 04753 }; 04754 04755 04757 04763 class BBINFILETK_API TK_Geometry_Options : public BBaseOpcodeHandler { 04764 protected: 04765 unsigned short m_mask; 04766 unsigned short m_value; 04767 04768 char m_orientation_count; 04769 float m_orientation[6]; 04770 04771 public: 04773 TK_Geometry_Options () : BBaseOpcodeHandler (TKE_Geometry_Options), 04774 m_mask (0), m_value (0), m_orientation_count (0) {} 04775 ~TK_Geometry_Options (); 04776 04777 TK_Status Read (BStreamFileToolkit & tk); 04778 TK_Status Write (BStreamFileToolkit & tk); 04779 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04780 04781 TK_Status ReadAscii (BStreamFileToolkit & tk); 04782 TK_Status WriteAscii (BStreamFileToolkit & tk); 04783 04785 void SetMask (int m) { m_mask = (unsigned short)m; } 04787 int GetMask () const { return (int)m_mask; } 04788 04790 void SetOrientation (int count, float const o[]) { 04791 if (count != 3 && count != 6) 04792 return; 04793 m_orientation_count = (unsigned char)count; 04794 while (count-- > 0) 04795 m_orientation[count] = o[count]; 04796 } 04798 int GetOrientationCount () const { return (int) m_orientation_count; } 04800 float const * GetOrientation () const { return m_orientation; } 04801 }; 04802 04805 04810 class BBINFILETK_API TK_Visibility : public BBaseOpcodeHandler { 04811 protected: 04812 int m_mask; 04813 int m_value; 04814 04815 public: 04817 TK_Visibility (void) 04818 : BBaseOpcodeHandler (TKE_Visibility), m_mask (0), m_value (0) {} 04819 04820 TK_Status Read (BStreamFileToolkit & tk); 04821 TK_Status Write (BStreamFileToolkit & tk); 04822 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04823 04824 TK_Status ReadAscii (BStreamFileToolkit & tk); 04825 TK_Status WriteAscii (BStreamFileToolkit & tk); 04826 04830 void SetGeometry (int m) { 04831 m_mask = m & TKO_Geo_All_Visibles; 04832 if ((m & TKO_Geo_Extended_Mask) != 0) { 04833 m_mask |= TKO_Geo_Extended; 04834 if ((m & TKO_Geo_Extended2_Mask) != 0) 04835 m_mask |= TKO_Geo_Extended2; 04836 } 04837 } 04842 int GetGeometry () const { return m_mask; } 04843 04848 void SetValue (int m) { m_value = m; } 04853 int GetValue () const { return m_value; } 04854 }; 04855 04858 04865 class BBINFILETK_API TK_Selectability : public BBaseOpcodeHandler { 04866 protected: 04867 int m_mask; 04868 int m_down; 04869 int m_up; 04870 int m_move_down; 04871 int m_move_up; 04872 int m_invisible; 04873 04874 public: 04876 TK_Selectability (void) 04877 : BBaseOpcodeHandler (TKE_Selectability), 04878 m_mask (0), m_down (0), m_up (0), m_move_down (0), m_move_up (0), m_invisible (0) {} 04879 04880 TK_Status Read (BStreamFileToolkit & tk); 04881 TK_Status Write (BStreamFileToolkit & tk); 04882 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04883 04884 TK_Status ReadAscii (BStreamFileToolkit & tk); 04885 TK_Status WriteAscii (BStreamFileToolkit & tk); 04886 04890 void SetGeometry (int m) { 04891 m_mask = m & TKO_Geo_All_Selects; 04892 if ((m & TKO_Geo_Extended_Mask) != 0) 04893 m_mask |= TKO_Geo_Extended; 04894 } 04899 int GetGeometry () const { return m_mask; } 04900 04905 void SetDown (int m) { m_down = m; } 04910 int GetDown () const { return m_down; } 04911 04916 void SetUp (int m) { m_up = m; } 04921 int GetUp () const { return m_up; } 04922 04927 void SetMoveDown (int m) { m_move_down = m; } 04932 int GetMoveDown () const { return m_move_down; } 04933 04938 void SetMoveUp (int m) { m_move_up = m; } 04943 int GetMoveUp () const { return m_move_up; } 04944 04949 void SetWhenInvisible (int m) { m_invisible = m; } 04954 int GetWhenInvisible () const { return m_invisible; } 04955 }; 04956 04958 04964 class BBINFILETK_API TK_Matrix : public BBaseOpcodeHandler { 04965 protected: 04966 float m_matrix[16]; 04967 double m_dmatrix[16]; 04968 04969 public: 04971 TK_Matrix (unsigned char opcode) 04972 : BBaseOpcodeHandler (opcode) {} 04973 04974 TK_Status Read (BStreamFileToolkit & tk); 04975 TK_Status Write (BStreamFileToolkit & tk); 04976 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04977 04978 TK_Status ReadAscii (BStreamFileToolkit & tk); 04979 TK_Status WriteAscii (BStreamFileToolkit & tk); 04980 04982 void SetMatrix (float const m[]) { 04983 int i; for (i=0; i<16; i++) m_matrix[i] = m[i]; 04984 } 04986 void SetDMatrix (double const m[]) { 04987 int i; for (i=0; i<16; i++) m_dmatrix[i] = m[i]; 04988 } 04990 float const * GetMatrix () const { return m_matrix; } 04992 float * GetMatrix () { return m_matrix; } 04994 double const * GetDMatrix () const { return m_dmatrix; } 04996 double * GetDMatrix () { return m_dmatrix; } 04997 }; 04998 04999 05003 enum TKO_Enumerations { 05004 TKO_Line_Pattern_Solid = 0, 05005 TKO_Line_Pattern_Dash_Dot = 1, 05006 TKO_Line_Pattern_Dashed = 2, 05007 TKO_Line_Pattern_Dotted = 3, 05008 TKO_Line_Pattern_Dash_2Dot = 4, 05009 TKO_Line_Pattern_Dash_3Dot = 5, 05010 TKO_Line_Pattern_Long_Dash = 6, 05011 TKO_Line_Pattern_Center = 7, 05012 TKO_Line_Pattern_Phantom = 8, 05013 TKO_Line_Pattern_Find_Dots = 9, 05014 05015 TKO_Fill_Pattern_Hash = 0, 05016 TKO_Fill_Pattern_Vertical = 1, 05017 TKO_Fill_Pattern_Horizontal = 2, 05018 TKO_Fill_Pattern_Right = 3, 05019 TKO_Fill_Pattern_Left = 4, 05020 TKO_Fill_Pattern_Diamond = 5, 05021 TKO_Fill_Pattern_Dots = 6, 05022 TKO_Fill_Pattern_Boxes = 7, 05023 TKO_Fill_Pattern_Solid = 8, 05024 TKO_Fill_Pattern_Clear = 9, 05025 TKO_Fill_Pattern_Gradient_N = 10, 05026 TKO_Fill_Pattern_Gradient_NE= 11, 05027 TKO_Fill_Pattern_Gradient_E = 12, 05028 TKO_Fill_Pattern_Gradient_SE= 13, 05029 TKO_Fill_Pattern_Gradient_S = 14, 05030 TKO_Fill_Pattern_Gradient_SW= 15, 05031 TKO_Fill_Pattern_Gradient_W = 16, 05032 TKO_Fill_Pattern_Gradient_NW= 17, 05033 TKO_Fill_Pattern_Blend = 18, 05034 TKO_Fill_Pattern_Invisible = 19, 05035 05036 TKO_Marker_Circle = 0, 05037 TKO_Marker_Circle_Dot = 1, 05038 TKO_Marker_Circle_Plus = 2, 05039 TKO_Marker_Circle_X = 3, 05040 TKO_Marker_Circle_Circle = 4, 05041 TKO_Marker_Circle_Filled = 5, 05042 TKO_Marker_Dot = 6, 05043 TKO_Marker_Plus = 7, 05044 TKO_Marker_X = 8, 05045 TKO_Marker_Star = 9, 05046 TKO_Marker_Box = 10, 05047 TKO_Marker_Box_Dot = 11, 05048 TKO_Marker_Box_X = 12, 05049 TKO_Marker_Box_Filled = 13, 05050 TKO_Marker_Diamond = 14, 05051 TKO_Marker_Diamond_Dot = 15, 05052 TKO_Marker_Diamond_Plus = 16, 05053 TKO_Marker_Diamond_Filled = 17, 05054 TKO_Marker_Triangle_Up = 18, 05055 TKO_Marker_Triangle_Up_Vertex = 19, 05056 TKO_Marker_Triangle_Up_Dot = 20, 05057 TKO_Marker_Triangle_Up_Filled = 21, 05058 TKO_Marker_Triangle_Up_Filled_Vertex = 22, 05059 TKO_Marker_Triangle_Down = 23, 05060 TKO_Marker_Triangle_Down_Vertex = 24, 05061 TKO_Marker_Triangle_Down_Dot = 25, 05062 TKO_Marker_Triangle_Down_Filled = 26, 05063 TKO_Marker_Triangle_Down_Filled_Vertex = 27, 05064 TKO_Marker_Triangle_Right = 28, 05065 TKO_Marker_Triangle_Right_Vertex = 29, 05066 TKO_Marker_Triangle_Right_Dot = 30, 05067 TKO_Marker_Triangle_Right_Filled = 31, 05068 TKO_Marker_Triangle_Right_Filled_Vertex = 32, 05069 TKO_Marker_Triangle_Left = 33, 05070 TKO_Marker_Triangle_Left_Vertex = 34, 05071 TKO_Marker_Triangle_Left_Dot = 35, 05072 TKO_Marker_Triangle_Left_Filled = 36, 05073 TKO_Marker_Triangle_Left_Filled_Vertex = 37, 05074 TKO_Marker_Hash = 38, 05075 TKO_Marker_Wide_Plus = 39, 05076 TKO_Marker_Open_Arrow = 40, 05077 TKO_Marker_Closed_Arrow = 41, 05078 TKO_Marker_Vertical_Bar = 42, 05079 TKO_Marker_Half_Arrow_Left = 43, 05080 TKO_Marker_Half_Arrow_Right = 44, 05081 TKO_Marker_Wide_Arrow = 45, 05082 TKO_Marker_Double_Arrow = 46, 05083 TKO_Marker_Y = 47, 05084 TKO_Marker_Z = 48, 05085 05086 // alignment format change in 17.80. 05087 05088 // old alignment enum choices in lower nibble 05089 TKO_Text_Alignment_Lower_Left = 0, 05090 TKO_Text_Alignment_Upper_Left = 1, 05091 TKO_Text_Alignment_Middle_Left = 2, 05092 TKO_Text_Alignment_Lower_Right = 3, 05093 TKO_Text_Alignment_Upper_Right = 4, 05094 TKO_Text_Alignment_Middle_Right = 5, 05095 TKO_Text_Alignment_Lower_Center = 6, 05096 TKO_Text_Alignment_Upper_Center = 7, 05097 TKO_Text_Alignment_Middle_Center = 8, 05098 TKO_Text_Alignment_Insertion_Left = 9, 05099 TKO_Text_Alignment_Insertion_Right = 10, 05100 TKO_Text_Alignment_Insertion_Center = 11, 05101 TKO_Text_Alignment_Insertion = 9, 05102 // and justification in higher nibble 05103 TKO_Text_Justification_Unspecified = 0, 05104 TKO_Text_Justification_Left = 1, 05105 TKO_Text_Justification_Center = 2, 05106 TKO_Text_Justification_Right = 3, 05107 05108 // new format defines bits for "building" alignment setting 05109 TKO_Text_Alignment_Center = 0x00, 05110 TKO_Text_Alignment_Left = 0x01, 05111 TKO_Text_Alignment_Right = 0x02, 05112 TKO_Text_Alignment_Bottom = 0x04, 05113 TKO_Text_Alignment_Top = 0x08, 05114 TKO_Text_Alignment_Point = 0x10, 05115 // can't have left & right, or bottom & top, so all bits is good as an "unset" placeholder 05116 TKO_Text_Alignment_Unspecified = 0x1F, 05117 // and uses same justification but shifted a bit higher 05118 TKO_Text_Justification_Mask = 0x60, 05119 TKO_Text_Justification_Shift = 5, 05120 // and the high bit will be set 05121 TKO_Text_Alignment_New_Format = 0x80, 05122 05123 05124 05125 TKO_Window_Frame_Off = 0, 05126 TKO_Window_Frame_On = 1, 05127 05128 TKO_Handedness_Left = 0, 05129 TKO_Handedness_Right = 1 05130 }; 05131 05137 class BBINFILETK_API TK_Enumerated : public BBaseOpcodeHandler { 05138 protected: 05139 char m_index; 05140 05141 public: 05143 TK_Enumerated (unsigned char opcode) 05144 : BBaseOpcodeHandler (opcode), m_index (0) {} 05145 05146 TK_Status Read (BStreamFileToolkit & tk); 05147 TK_Status Write (BStreamFileToolkit & tk); 05148 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05149 05150 TK_Status ReadAscii (BStreamFileToolkit & tk); 05151 TK_Status WriteAscii (BStreamFileToolkit & tk); 05152 05153 void SetIndex (int i) { m_index = (char)i; } 05155 int GetIndex () const { return (int)m_index; } 05156 }; 05157 05161 enum TKO_Generic_Size_Units { 05162 TKO_Generic_Size_Object, 05163 TKO_Generic_Size_Screen, 05164 TKO_Generic_Size_Window, 05165 TKO_Generic_Size_Points, 05166 TKO_Generic_Size_Pixels, 05167 TKO_Generic_Size_Percent, 05168 TKO_Generic_Size_World, 05169 05170 TKO_Generic_Size_Unspecified 05171 }; 05172 // NOTE: any changes to this need to be reflected in generic_units_table in parse.cpp & HOpcodeHandler.cpp 05173 05174 05180 class BBINFILETK_API TK_Size : public BBaseOpcodeHandler { 05181 protected: 05182 float m_value; 05183 unsigned char m_units; 05184 05185 public: 05187 TK_Size (unsigned char opcode) 05188 : BBaseOpcodeHandler (opcode), m_value (0.0f), m_units (TKO_Generic_Size_Unspecified) {} 05189 05190 TK_Status Read (BStreamFileToolkit & tk); 05191 TK_Status Write (BStreamFileToolkit & tk); 05192 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05193 05194 TK_Status ReadAscii (BStreamFileToolkit & tk); 05195 TK_Status WriteAscii (BStreamFileToolkit & tk); 05196 05198 void SetSize (float value, int units = TKO_Generic_Size_Unspecified) { 05199 m_value = (value > 0.0f) ? value : 0.0f; 05200 m_units = (m_value > 0.0f) ? (unsigned char) units : (unsigned char) TKO_Generic_Size_Unspecified; 05201 } 05203 float GetSize () const { return m_value; } 05205 int GetUnits () const { return m_units; } 05206 }; 05207 05212 class BBINFILETK_API TK_Linear_Pattern : public BBaseOpcodeHandler { 05213 protected: 05214 unsigned short m_pattern; 05215 05216 public: 05218 TK_Linear_Pattern (unsigned char opcode) 05219 : BBaseOpcodeHandler (opcode), m_pattern (0) {} 05220 05221 TK_Status Read (BStreamFileToolkit & tk); 05222 TK_Status Write (BStreamFileToolkit & tk); 05223 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05224 05225 TK_Status ReadAscii (BStreamFileToolkit & tk); 05226 TK_Status WriteAscii (BStreamFileToolkit & tk); 05227 05229 void SetPattern (int p) { m_pattern = (unsigned short)p; } 05231 int GetPattern () const { return (int)m_pattern; } 05232 }; 05233 05239 class BBINFILETK_API TK_Named : public BBaseOpcodeHandler { 05240 protected: 05241 int m_name_length; 05242 char * m_name; 05243 int m_index; 05244 05245 public: 05247 TK_Named (unsigned char opcode) 05248 : BBaseOpcodeHandler (opcode), m_name_length (0), m_name (0), m_index (0) {} 05249 ~TK_Named(); 05250 05251 TK_Status Read (BStreamFileToolkit & tk); 05252 TK_Status Write (BStreamFileToolkit & tk); 05253 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05254 05255 TK_Status ReadAscii (BStreamFileToolkit & tk); 05256 TK_Status WriteAscii (BStreamFileToolkit & tk); 05257 05258 void Reset (); 05259 05261 void SetName (char const * name); 05263 void SetName (int length); 05265 char const * GetName () const { return m_name; } 05267 char * GetName () { return m_name; } 05268 05270 void SetIndex (int i) { Reset(); m_index = i; } 05272 int GetIndex () const { return (int)m_index; } 05273 }; 05274 05275 05276 05283 class BBINFILETK_API TK_Streaming : public BBaseOpcodeHandler { 05284 protected: 05285 bool m_flag; 05286 05287 public: 05289 TK_Streaming () : BBaseOpcodeHandler (TKE_Streaming_Mode) {} 05290 05291 TK_Status Read (BStreamFileToolkit & tk); 05292 TK_Status Write (BStreamFileToolkit & tk); 05293 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05294 05295 TK_Status ReadAscii (BStreamFileToolkit & tk); 05296 TK_Status WriteAscii (BStreamFileToolkit & tk); 05297 05298 void SetStreaming (bool s) { m_flag = s; } 05300 bool GetStreaming () const { return m_flag; } 05301 }; 05302 05305 05311 class BBINFILETK_API TK_Conditions : public BBaseOpcodeHandler { 05312 protected: 05313 int m_length; 05314 char * m_string; 05316 public: 05318 TK_Conditions () : BBaseOpcodeHandler (TKE_Conditions), m_length (0), m_string (0) {} 05319 ~TK_Conditions(); 05320 05321 TK_Status Read (BStreamFileToolkit & tk); 05322 TK_Status Write (BStreamFileToolkit & tk); 05323 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05324 05325 TK_Status ReadAscii (BStreamFileToolkit & tk); 05326 TK_Status WriteAscii (BStreamFileToolkit & tk); 05327 05328 void Reset (); 05329 05331 void SetConditions (char const * options); 05333 void SetConditions (int length); 05335 char const * GetConditions () const { return m_string; } 05337 char * GetConditions () { return m_string; } 05339 int GetLength() { return m_length; } 05340 }; 05341 05342 05346 enum TKO_Actions { 05347 TKO_Action_Type_Prune_Segment = 1, 05348 05349 TKO_Action_Option_Segment_Tree = 0x0001 05350 }; 05351 05352 05355 05360 class BBINFILETK_API TK_Conditional_Action : public BBaseOpcodeHandler { 05361 protected: 05362 short m_type; 05363 short m_options; 05364 int m_length; 05365 char * m_string; 05367 public: 05369 TK_Conditional_Action () : BBaseOpcodeHandler (TKE_Conditional_Action), m_length (0), m_string (0) {} 05370 ~TK_Conditional_Action(); 05371 05372 TK_Status Read (BStreamFileToolkit & tk); 05373 TK_Status Write (BStreamFileToolkit & tk); 05374 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05375 05376 TK_Status ReadAscii (BStreamFileToolkit & tk); 05377 TK_Status WriteAscii (BStreamFileToolkit & tk); 05378 05379 void Reset (); 05380 05382 void SetCondition (char const * options); 05384 void SetCondition (int length); 05386 char const * GetCondition () const { return m_string; } 05388 char * GetCondition () { return m_string; } 05390 int GetLength() { return m_length; } 05391 05393 void SetAction (int at) { m_type = (short)at; } 05395 int GetAction () const { return (int)m_type; } 05397 void SetOptions (int at) { m_options = (short)at; } 05399 int GetOptions () const { return (int)m_options; } 05400 }; 05401 05404 05410 class BBINFILETK_API TK_User_Options : public BBaseOpcodeHandler { 05411 protected: 05412 int m_length; 05413 char * m_string; 05414 BBaseOpcodeHandler * m_indices; 05415 BBaseOpcodeHandler * m_unicode; 05416 BBaseOpcodeHandler * m_index_data; 05418 void set_options (char const * options); 05419 void set_options (int length); 05420 05421 public: 05423 TK_User_Options () : BBaseOpcodeHandler (TKE_User_Options), m_length (0), m_string (0), 05424 m_indices (0), m_unicode (0), m_index_data(0) {} 05425 ~TK_User_Options(); 05426 05427 TK_Status Read (BStreamFileToolkit & tk); 05428 TK_Status Write (BStreamFileToolkit & tk); 05429 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05430 05431 TK_Status ReadAscii (BStreamFileToolkit & tk); 05432 TK_Status WriteAscii (BStreamFileToolkit & tk); 05433 05434 void Reset (); 05435 05437 void SetOptions (char const * options) { set_options (options); } 05439 void SetOptions (int length) { set_options (length); } 05441 char const * GetOptions () const { return m_string; } 05443 char * GetOptions () { return m_string; } 05445 int GetLength() { return m_length; } 05446 }; 05447 05450 05456 class BBINFILETK_API TK_Unicode_Options : public BBaseOpcodeHandler { 05457 protected: 05458 int m_length; 05459 unsigned short * m_string; 05461 public: 05463 TK_Unicode_Options () : BBaseOpcodeHandler (TKE_Unicode_Options), m_length (0), m_string (0) {} 05464 ~TK_Unicode_Options(); 05465 05466 TK_Status Read (BStreamFileToolkit & tk); 05467 TK_Status Write (BStreamFileToolkit & tk); 05468 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05469 05470 TK_Status ReadAscii (BStreamFileToolkit & tk); 05471 TK_Status WriteAscii (BStreamFileToolkit & tk); 05472 05473 void Reset (); 05474 05476 void SetOptions (unsigned short const * options); 05478 void SetOptions (int length); 05480 unsigned short const * GetOptions () const { return m_string; } 05482 unsigned short * GetOptions () { return m_string; } 05484 int GetLength() { return m_length; } 05485 }; 05486 05488 05494 class BBINFILETK_API TK_User_Index : public BBaseOpcodeHandler { 05495 protected: 05496 int m_count; 05497 int * m_indices; 05498 HLONG * m_values; 05499 int m_current_value; 05500 void set_indices (int count, int const indices[], POINTER_SIZED_INT const values[]); 05501 void set_indices (int count); 05502 05503 public: 05505 TK_User_Index () 05506 : BBaseOpcodeHandler (TKE_User_Index), m_count (0), m_indices (0), m_values (0), m_current_value(0) {} 05507 ~TK_User_Index(); 05508 05509 TK_Status Read (BStreamFileToolkit & tk); 05510 TK_Status Write (BStreamFileToolkit & tk); 05511 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05512 05513 TK_Status ReadAscii (BStreamFileToolkit & tk); 05514 TK_Status WriteAscii (BStreamFileToolkit & tk); 05515 05516 void Reset (); 05517 05519 void SetIndices (int count, int const indices[], POINTER_SIZED_INT const values[]) 05520 { set_indices (count, indices, values); } 05522 void SetIndices (int count) { set_indices (count); } 05524 int GetCount () const { return m_count; } 05526 int const * GetIndices () const { return m_indices; } 05528 int * GetIndices () { return m_indices; } 05530 HLONG const * GetValues () const { return m_values; } 05532 HLONG * GetValues () { return m_values; } 05533 }; 05534 05536 05542 class BBINFILETK_API TK_User_Index_Data : public BBaseOpcodeHandler { 05543 protected: 05544 int m_count; 05545 int * m_indices; 05546 void ** m_values; 05547 int * m_sizes; 05548 05549 int m_current_value; 05550 void set_indices (int count, int const indices[], void const * values[], int const sizes[]); 05551 void set_indices (int count); 05552 void FreeMem (); 05553 05554 public: 05556 TK_User_Index_Data () 05557 : BBaseOpcodeHandler (TKE_User_Index_Data), m_count (0), m_indices (0), m_values (0), m_sizes(0), m_current_value(0) {} 05558 ~TK_User_Index_Data(); 05559 05560 TK_Status Read (BStreamFileToolkit & tk); 05561 TK_Status Write (BStreamFileToolkit & tk); 05562 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05563 05564 void Reset (); 05565 05567 void SetIndices (int count, int const indices[], void const * values[], int const sizes[]) { 05568 set_indices (count, indices, values, sizes); 05569 } 05570 05572 void SetIndices (int count) { set_indices (count);} 05573 05575 int GetCount () const { return m_count;} 05576 05578 int const * GetIndices () const { return m_indices;} 05579 05581 int * GetIndices () { return m_indices;} 05582 05584 void ** const GetValues () const { return m_values;} 05585 05587 void ** const GetValues () { return m_values;} 05588 05590 int const * GetSizes () const { return m_sizes;} 05591 05593 int * GetSizes () { return m_sizes;} 05594 }; 05595 05596 05598 05603 class BBINFILETK_API TK_User_Value : public BBaseOpcodeHandler { 05604 protected: 05605 HLONG m_value; 05606 05607 public: 05609 TK_User_Value () 05610 : BBaseOpcodeHandler (TKE_User_Value), m_value (0) {} 05611 05612 TK_Status Read (BStreamFileToolkit & tk); 05613 TK_Status Write (BStreamFileToolkit & tk); 05614 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05615 05616 TK_Status ReadAscii (BStreamFileToolkit & tk); 05617 TK_Status WriteAscii (BStreamFileToolkit & tk); 05618 05620 void SetValue (HLONG v) { m_value = v; } 05622 HLONG GetValue () const { return m_value; } 05623 }; 05624 05628 enum TKO_Camera_Projection { 05629 TKO_Camera_Perspective_Bit = 0x01, 05630 TKO_Camera_Stretched_Bit = 0x02, 05631 TKO_Camera_Projection_Mask = 0x03, 05632 05633 TKO_Camera_Orthographic = 0x00, 05634 TKO_Camera_Perspective = 0x01, 05635 TKO_Camera_Stretched = 0x02, 05636 05637 TKO_Camera_Oblique_Y = 0x04, 05638 TKO_Camera_Oblique_X = 0x08, 05639 TKO_Camera_Oblique_Mask = 0x0C, 05640 05641 TKO_Camera_Near_Limit = 0x10, 05642 05643 TKO_Camera_Thumbnail = 0x80 05644 }; 05645 05647 05652 class BBINFILETK_API2 TK_Camera : public BBaseOpcodeHandler { 05653 protected: 05657 float m_settings[14]; 05659 double m_dsettings[14]; 05661 float m_details[3]; 05662 unsigned char m_projection; 05663 int m_length; 05664 char * m_name; 05667 void set_name (char const * name); 05668 05669 void set_name (int length); 05670 05671 public: 05673 TK_Camera (unsigned char opcode = TKE_Camera) 05674 : BBaseOpcodeHandler (opcode), m_length (0), m_name (0) { 05675 int i; 05676 int count = (int)(sizeof(m_settings) / sizeof(m_settings[0])); 05677 for (i = 0; i < count; i++) { 05678 m_settings[i] = 0; 05679 m_dsettings[i] = 0; 05680 } 05681 } 05682 ~TK_Camera(); 05683 05684 TK_Status Read (BStreamFileToolkit & tk); 05685 TK_Status Write (BStreamFileToolkit & tk); 05686 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05687 05688 TK_Status ReadAscii (BStreamFileToolkit & tk); 05689 TK_Status WriteAscii (BStreamFileToolkit & tk); 05690 05692 void SetPosition (float x, float y, float z) 05693 { m_settings[0] = x; m_settings[1] = y; m_settings[2] = z; } 05695 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 05697 float const * GetPosition () const { return &m_settings[0]; } 05699 void GetPosition (float p[]) const { memcpy(p, GetPosition(), 3*sizeof(float)); } 05700 05702 void SetDPosition (double x, double y, double z) 05703 { m_dsettings[0] = x; m_dsettings[1] = y; m_dsettings[2] = z; } 05705 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 05707 double const * GetDPosition () const { return &m_dsettings[0]; } 05709 void GetDPosition (double p[]) const { memcpy(p, GetDPosition(), 3*sizeof(double)); } 05710 05712 void SetTarget (float x, float y, float z) 05713 { m_settings[3] = x; m_settings[4] = y; m_settings[5] = z; } 05715 void SetTarget (float const t[]) { SetTarget (t[0], t[1], t[2]); } 05717 float const * GetTarget () const { return &m_settings[3]; } 05719 void GetTarget (float t[]) const { memcpy(t, GetTarget(), 3*sizeof(float)); } 05720 05722 void SetDTarget (double x, double y, double z) 05723 { m_dsettings[3] = x; m_dsettings[4] = y; m_dsettings[5] = z; } 05725 void SetDTarget (double const t[]) { SetDTarget (t[0], t[1], t[2]); } 05727 double const * GetDTarget () const { return &m_dsettings[3]; } 05729 void GetDTarget (double t[]) const { memcpy(t, GetDTarget(), 3*sizeof(double)); } 05730 05732 void SetUpVector (float x, float y, float z) 05733 { m_settings[6] = x; m_settings[7] = y; m_settings[8] = z; } 05735 void SetUpVector (float const u[]) { SetUpVector (u[0], u[1], u[2]); } 05737 float const * GetUpVector () const { return &m_settings[6]; } 05739 void GetUpVector (float u[]) const { memcpy(u,GetUpVector(),3*sizeof(float)); } 05740 05742 void SetDUpVector (double x, double y, double z) 05743 { m_dsettings[6] = x; m_dsettings[7] = y; m_dsettings[8] = z; } 05745 void SetDUpVector (double const u[]) { SetDUpVector (u[0], u[1], u[2]); } 05747 double const * GetDUpVector () const { return &m_dsettings[6]; } 05749 void GetDUpVector (double u[]) const { memcpy(u, GetDUpVector(), 3*sizeof(double)); } 05750 05752 void SetField (float w, float h) { m_settings[9] = w; m_settings[10] = h; } 05754 void SetField (float const f[]) { SetField (f[0], f[1]); } 05756 float const * GetField () const { return &m_settings[9]; } 05758 void GetField (float f[]) const { memcpy(f,GetField(),2*sizeof(float)); } 05759 05761 void SetDField (double w, double h) { m_dsettings[9] = w; m_dsettings[10] = h; } 05763 void SetDField (double const f[]) { SetDField (f[0], f[1]); } 05765 double const * GetDField () const { return &m_dsettings[9]; } 05767 void GetDField (double f[]) const { memcpy(f, GetDField(), 2*sizeof(double)); } 05768 05769 05771 void SetOblique (float h, float v) { m_details[0] = h; m_details[1] = v; 05772 m_projection &= ~TKO_Camera_Oblique_Mask; 05773 if (h != 0.0f) m_projection |= TKO_Camera_Oblique_Y; 05774 if (v != 0.0f) m_projection |= TKO_Camera_Oblique_Mask; 05775 } 05777 void SetOblique (float const o[]) { SetOblique (o[0], o[1]); } 05779 float const * GetOblique () const { return m_details; } 05781 void GetOblique (float o[]) const { memcpy(o, GetOblique(), 2*sizeof(float)); } 05782 05784 void SetNearLimit (float l) { m_details[2] = l; 05785 m_projection &= ~TKO_Camera_Near_Limit; 05786 if (l != 0.0f) m_projection |= TKO_Camera_Near_Limit; 05787 } 05789 float GetNearLimit () const { return m_details[2]; } 05790 05791 05793 void SetProjection (int p) { m_projection = (char)p; } 05795 int GetProjection () const { return (int)m_projection; } 05796 05797 05799 void SetView (char const * name) { set_name (name); } 05801 void SetView (int length) { set_name (length); } 05803 char const * GetView () const { return m_name; } 05805 char * GetView () { return m_name; } 05806 }; 05807 05809 05814 class BBINFILETK_API TK_Window : public BBaseOpcodeHandler { 05815 protected: 05816 float m_window[4]; 05817 05818 public: 05820 TK_Window () 05821 : BBaseOpcodeHandler (TKE_Window) {} 05822 05823 TK_Status Read (BStreamFileToolkit & tk); 05824 TK_Status Write (BStreamFileToolkit & tk); 05825 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05826 05827 TK_Status ReadAscii (BStreamFileToolkit & tk); 05828 TK_Status WriteAscii (BStreamFileToolkit & tk); 05829 05831 void SetWindow (float l, float r, float b, float t) 05832 { m_window[0] = l; m_window[1] = r; m_window[2] = b; m_window[3] = t; } 05834 void SetWindow (float const w[]) { SetWindow (w[0], w[1], w[2], w[3]); } 05836 float const * GetWindow () const { return m_window; } 05837 }; 05838 05839 05844 enum TKO_Font_Options { 05845 TKO_Font_Names = 0x00000001, 05846 TKO_Font_Size = 0x00000002, 05847 TKO_Font_Size_Tolerance = 0x00000004, 05848 TKO_Font_Transforms = 0x00000008, 05849 TKO_Font_Rotation = 0x00000010, 05850 TKO_Font_Slant = 0x00000020, 05851 TKO_Font_Width_Scale = 0x00000040, 05852 TKO_Font_Extended = 0x00000080, 05853 TKO_Font_Extended_Mask = 0xFFFFFF00, // internal use, indicates bits which require TKO_Font_Extended 05854 TKO_Font_Extended_Shift = 8, // internal use, indicatesshift of extended section 05855 TKO_Font_Extra_Space = 0x00000100, 05856 TKO_Font_Line_Spacing = 0x00000200, 05857 TKO_Font_Outline = 0x00000400, 05858 TKO_Font_Underline = 0x00000800, 05859 TKO_Font_Strikethrough = 0x00001000, 05860 TKO_Font_Overline = 0x00002000, 05861 TKO_Font_Uniform_Spacing = 0x00004000, 05862 TKO_Font_Extended2 = 0x00008000, 05863 TKO_Font_Extended2_Mask = 0xFFFF0000, 05864 TKO_Font_Extended2_Shift = 16, 05865 TKO_Font_Greeking_Limit = 0x00010000, 05866 TKO_Font_Fill_Edges = 0x00020000, 05867 TKO_Font_Bold = 0x00040000, 05868 TKO_Font_Italic = 0x00080000, 05869 TKO_Font_Renderer = 0x00100000, 05870 TKO_Font_Greeking_Mode = 0x00200000, 05871 TKO_Font_Preference = 0x00400000, 05872 TKO_Font_Layout = 0x00800000 05873 }; 05874 05875 05876 05880 enum TKO_Font_Layout { 05881 TKO_Font_Layout_Default = 0, 05882 TKO_Font_Layout_Unicode = 1 05883 }; 05884 05885 05886 #define TKO_Font_Size_Units TKO_Generic_Size_Units 05887 #define TKO_Font_Size_Object TKO_Generic_Size_Object 05888 #define TKO_Font_Size_Screen TKO_Generic_Size_Screen 05889 #define TKO_Font_Size_Window TKO_Generic_Size_Window 05890 #define TKO_Font_Size_Points TKO_Generic_Size_Points 05891 #define TKO_Font_Size_Pixels TKO_Generic_Size_Pixels 05892 #define TKO_Font_Size_Percent TKO_Generic_Size_Percent 05893 #define TKO_Font_Size_World TKO_Generic_Size_World 05894 05895 05901 enum TKO_Font_Transforms { 05902 TKO_Font_Transform_Position_Only = 0, 05903 TKO_Font_Transform_Full = 1, 05904 TKO_Font_Transform_Position_Adjusted = 2, 05905 }; 05906 05907 05911 enum TKO_Font_Renderers { 05912 TKO_Font_Renderer_Undefined = -1, 05913 TKO_Font_Renderer_Default = 0, 05914 TKO_Font_Renderer_Driver = 1, 05915 TKO_Font_Renderer_Truetype = 2, 05916 TKO_Font_Renderer_Defined = 3 05917 }; 05918 05922 enum TKO_Font_Preferences { 05923 TKO_Font_Preference_Undefined = -1, 05924 TKO_Font_Preference_Default = 0, 05925 TKO_Font_Preference_Bitmap = 1, 05926 TKO_Font_Preference_Outline = 2, 05927 TKO_Font_Preference_Exterior = 3 05928 }; 05929 05933 enum TKO_Font_Greeking_Modes { 05934 TKO_Font_Greeking_Mode_None = 0, 05935 TKO_Font_Greeking_Mode_Lines = 1, 05936 TKO_Font_Greeking_Mode_Box = 2 05937 }; 05938 05940 05947 class BBINFILETK_API TK_Text_Font : public BBaseOpcodeHandler { 05948 protected: 05949 int m_mask; 05950 int m_value; 05951 int m_names_length; 05952 char * m_names; 05953 float m_size; 05954 float m_tolerance; 05955 float m_rotation; 05956 float m_slant; 05957 float m_width_scale; 05958 float m_extra_space; 05959 float m_line_spacing; 05960 float m_greeking_limit; 05961 float m_renderer_cutoff; 05962 float m_preference_cutoff; 05963 int m_renderers[2]; 05964 int m_preferences[2]; 05965 unsigned char m_size_units; 05966 unsigned char m_tolerance_units; 05967 unsigned char m_space_units; 05968 unsigned char m_greeking_units; 05969 unsigned char m_greeking_mode; 05970 unsigned char m_transforms; 05971 unsigned char m_renderer_cutoff_units; 05972 unsigned char m_preference_cutoff_units; 05973 unsigned char m_layout; 05974 05975 void set_names (int length); 05976 void set_names (char const * names); 05977 05978 public: 05980 TK_Text_Font () 05981 : BBaseOpcodeHandler (TKE_Text_Font), m_names_length (0), m_names (0) {} 05982 ~TK_Text_Font (); 05983 05984 TK_Status Read (BStreamFileToolkit & tk); 05985 TK_Status Write (BStreamFileToolkit & tk); 05986 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05987 05988 TK_Status ReadAscii (BStreamFileToolkit & tk); 05989 TK_Status WriteAscii (BStreamFileToolkit & tk); 05990 05991 void Reset (); 05992 05994 void SetMask (int m) { 05995 m_mask = m; 05996 if ((m & TKO_Font_Extended2_Mask) != 0) 05997 m_mask |= TKO_Font_Extended2; 05998 if ((m & TKO_Font_Extended_Mask) != 0) 05999 m_mask |= TKO_Font_Extended; 06000 } 06002 int GetMask () const { return m_mask; } 06003 06005 void SetValue (int v) { m_value = v; } 06007 int GetValue () const { return m_value; } 06008 06010 void SetNames (char const * names) { set_names (names); } 06012 void SetNames (int length) { set_names (length); } 06014 char const * GetNames () const { return m_names; } 06016 char * GetNames () { return m_names; } 06017 06019 void SetSize (float s) { m_size = s; } 06021 float GetSize () const { return m_size; } 06022 06024 void SetSizeUnits (int u) { m_size_units = (unsigned char)u; } 06026 int GetSizeUnits () const { return (int)m_size_units; } 06027 06029 void SetTolerance (float t) { m_tolerance = t; } 06031 float GetTolerance () const { return m_tolerance; } 06032 06034 void SetToleranceUnits (int u) { m_tolerance_units = (unsigned char)u; } 06036 int GetToleranceUnits () const { return (int)m_tolerance_units; } 06037 06039 void SetRotation (float r) { m_rotation = r; } 06041 float GetRotation () const { return m_rotation; } 06042 06044 void SetSlant (float s) { m_slant = s; } 06046 float GetSlant () const { return m_slant; } 06047 06049 void SetWidthScale (float s) { m_width_scale = s; } 06051 float GetWidthScale () const { return m_width_scale; } 06052 06054 void SetExtraSpace (float s) { m_extra_space = s; } 06056 float GetExtraSpace () const { return m_extra_space; } 06057 06059 void SetExtraSpaceUnits (int u) { m_space_units = (unsigned char)u; } 06061 int GetExtraSpaceUnits () const { return (int)m_space_units; } 06062 06064 void SetLineSpacing (float s) { m_line_spacing = s; } 06066 float GetLineSpacing () const { return m_line_spacing; } 06067 06069 void SetTransforms (int t) { m_transforms = (unsigned char)t; } 06071 int GetTransforms () const { return (int)m_transforms; } 06072 06074 void SetGreekingLimit (float s) { m_greeking_limit = s; } 06076 float GetGreekingLimit () const { return m_greeking_limit; } 06077 06079 void SetGreekingLimitUnits (int u) { m_greeking_units = (unsigned char)u; } 06081 int GetGreekingLimitUnits () const { return (int)m_greeking_units; } 06082 06084 void SetGreekingMode (int m) { m_greeking_mode = (unsigned char)m; } 06086 int GetGreekingMode () const { return (int)m_greeking_mode; } 06087 06088 06090 void SetRenderer (int r) { m_renderers[0] = m_renderers[1] = r; } 06092 int GetRenderer () const { return m_renderers[0]; } 06093 06095 void SetRenderers (int r1, int r2) { m_renderers[0] = r1; m_renderers[1] = r2; } 06097 int const * GetRenderers () const { return m_renderers; } 06098 06100 void SetRendererCutoff (float s) { m_renderer_cutoff = s; } 06102 float GetRendererCutoff () const { return m_renderer_cutoff; } 06103 06105 void SetRendererCutoffUnits (int u) { m_renderer_cutoff_units = (unsigned char)u; } 06107 int GetRendererCutoffUnits () const { return (int)m_renderer_cutoff_units; } 06108 06109 06111 void SetPreference (int r) { m_preferences[0] = m_preferences[1] = r; } 06113 int GetPreference () const { return m_preferences[0]; } 06114 06116 void SetPreferences (int r1, int r2) { m_preferences[0] = r1; m_preferences[1] = r2; } 06118 int const * GetPreferences () const { return m_preferences; } 06119 06121 void SetPreferenceCutoff (float s) { m_preference_cutoff = s; } 06123 float GetPreferenceCutoff () const { return m_preference_cutoff; } 06124 06126 void SetPreferenceCutoffUnits (int u) { m_preference_cutoff_units = (unsigned char)u; } 06128 int GetPreferenceCutoffUnits () const { return (int)m_preference_cutoff_units; } 06129 06131 void SetLayout (int l) {m_layout = (unsigned char)l;} 06133 int GetLayout () const {return (int)m_layout;} 06134 }; 06135 06137 06139 06151 enum TKO_Bounding_Type_Options { 06152 TKO_Bounding_Type_Cuboid = 0, 06153 TKO_Bounding_Type_Sphere = 1 06154 }; 06155 06156 06157 06159 06170 class BBINFILETK_API2 TK_Bounding : public BBaseOpcodeHandler { 06171 protected: 06172 double m_dvalues[6]; 06173 float m_values[6]; 06174 char m_type; 06175 bool m_is_valid; 06176 public: 06178 TK_Bounding (unsigned char opcode) 06179 : BBaseOpcodeHandler (opcode) {} 06181 TK_Bounding (unsigned char opcode, float min[], float max[]) 06182 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) { 06183 m_values[0] = min[0]; m_values[1] = min[1]; m_values[2] = min[2]; 06184 m_values[3] = max[0]; m_values[4] = max[1]; m_values[5] = max[2]; 06185 } 06187 TK_Bounding (unsigned char opcode, float center[], float radius) 06188 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) { 06189 m_values[0] = center[0]; m_values[1] = center[1]; m_values[2] = center[2]; 06190 m_values[3] = radius; 06191 } 06193 TK_Bounding (unsigned char opcode, double min[], double max[]) 06194 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) { 06195 m_dvalues[0] = min[0]; m_dvalues[1] = min[1]; m_dvalues[2] = min[2]; 06196 m_dvalues[3] = max[0]; m_dvalues[4] = max[1]; m_dvalues[5] = max[2]; 06197 Set_General_Flags (TK_Double_Precision); 06198 } 06200 TK_Bounding (unsigned char opcode, double center[], double radius) 06201 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) { 06202 m_dvalues[0] = center[0]; m_dvalues[1] = center[1]; m_dvalues[2] = center[2]; 06203 m_dvalues[3] = radius; 06204 Set_General_Flags (TK_Double_Precision); 06205 } 06206 06207 TK_Status Read (BStreamFileToolkit & tk); 06208 TK_Status Write (BStreamFileToolkit & tk); 06209 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06210 06211 TK_Status ReadAscii (BStreamFileToolkit & tk); 06212 TK_Status WriteAscii (BStreamFileToolkit & tk); 06213 }; 06214 06216 06220 enum TKO_Light_Options { 06221 TKO_Light_Camera_Relative = 0x1 06222 }; 06223 06224 06226 06228 06234 class BBINFILETK_API TK_Point : public BBaseOpcodeHandler { 06235 protected: 06236 float m_point[3]; 06237 double m_dpoint[3]; 06238 char m_options; 06239 06240 public: 06242 TK_Point (unsigned char opcode) 06243 : BBaseOpcodeHandler (opcode) { 06244 m_point[0] = m_point[1] = m_point[2] = 0; 06245 m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 06246 m_options = 0; 06247 }; 06248 06249 TK_Status Read (BStreamFileToolkit & tk); 06250 TK_Status Write (BStreamFileToolkit & tk); 06251 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06252 06253 TK_Status ReadAscii (BStreamFileToolkit & tk); 06254 TK_Status WriteAscii (BStreamFileToolkit & tk); 06255 06256 void Reset(void) { 06257 m_point[0] = m_point[1] = m_point[2] = 0; 06258 m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 06259 m_options = 0; 06260 BBaseOpcodeHandler::Reset(); 06261 }; 06262 06263 06264 06266 void SetPoint (float x, float y, float z) { m_point[0] = x; m_point[1] = y; m_point[2] = z; } 06268 void SetPoint (float const p[]) { SetPoint (p[0], p[1], p[2]); } 06270 float const * GetPoint () const { return m_point; } 06271 06273 void SetDPoint (double x, double y, double z) { m_dpoint[0] = x; m_dpoint[1] = y; m_dpoint[2] = z; } 06275 void SetDPoint (double const p[]) { SetDPoint (p[0], p[1], p[2]); } 06277 double const * GetDPoint () const { return m_dpoint; } 06278 06280 void SetOptions (int o) { m_options = (char)o; } 06282 int GetOptions () const { return (int)m_options; } 06283 06284 }; 06285 06286 06287 06289 06294 class BBINFILETK_API TK_Line : public BBaseOpcodeHandler { 06295 protected: 06297 float m_points[6]; 06299 double m_dpoints[6]; 06300 06301 public: 06303 TK_Line (unsigned char opcode = TKE_Line) 06304 : BBaseOpcodeHandler (opcode) {} 06305 06306 TK_Status Read (BStreamFileToolkit & tk); 06307 TK_Status Write (BStreamFileToolkit & tk); 06308 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06309 06310 TK_Status ReadAscii (BStreamFileToolkit & tk); 06311 TK_Status WriteAscii (BStreamFileToolkit & tk); 06312 06314 void SetPoints (float x1, float y1, float z1, float x2, float y2, float z2) { 06315 m_points[0] = x1; m_points[1] = y1; m_points[2] = z1; 06316 m_points[3] = x2; m_points[4] = y2; m_points[5] = z2; 06317 } 06319 void SetPoints (float const s[], float const e[]) { 06320 SetPoints (s[0], s[1], s[2], e[0], e[1], e[2]); 06321 } 06323 void SetPoints (float const p[]) { SetPoints (&p[0], &p[3]); } 06325 float const * GetPoints () const { return m_points; } 06326 06328 void SetDPoints (double x1, double y1, double z1, double x2, double y2, double z2) { 06329 m_dpoints[0] = x1; m_dpoints[1] = y1; m_dpoints[2] = z1; 06330 m_dpoints[3] = x2; m_dpoints[4] = y2; m_dpoints[5] = z2; 06331 } 06333 void SetDPoints (double const s[], double const e[]) { 06334 SetDPoints (s[0], s[1], s[2], e[0], e[1], e[2]); 06335 } 06337 void SetDPoints (double const p[]) { SetDPoints (&p[0], &p[3]); } 06339 double const * GetDPoints () const { return m_dpoints; } 06340 06341 }; 06342 06343 06344 06346 06353 class BBINFILETK_API TK_Polypoint : public BBaseOpcodeHandler { 06354 protected: 06355 int m_count; 06356 int m_allocated; 06357 float * m_points; 06358 double * m_dpoints; 06361 void set_points (int count, float const points[] = 0) { SetPoints (count, points); } 06362 public: 06366 TK_Polypoint (unsigned char opcode) 06367 : BBaseOpcodeHandler (opcode), m_count (0), m_allocated (0), m_points (0), m_dpoints (0) {} 06368 ~TK_Polypoint(); 06369 06370 TK_Status Read (BStreamFileToolkit & tk); 06371 TK_Status Write (BStreamFileToolkit & tk); 06372 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06373 06374 TK_Status ReadAscii (BStreamFileToolkit & tk); 06375 TK_Status WriteAscii (BStreamFileToolkit & tk); 06376 06377 void Reset (); 06378 06381 void SetPoints (int count, float const points[] = 0); 06383 float const * GetPoints () const { return m_points; } 06385 float * GetPoints () { return m_points; } 06386 06389 void SetDPoints (int count, double const points[] = 0); 06391 double const * GetDPoints () const { return m_dpoints; } 06393 double * GetDPoints () { return m_dpoints; } 06394 06396 int GetCount () const { return m_count; } 06397 06398 }; 06399 06400 06401 06402 06403 #define NC_HAS_WEIGHTS 0x01 //!< an array of floats for the weights is specified with the TK_NURBS_Curve 06404 #define NC_HAS_KNOTS 0x02 //!< an array of floats for the knots is specified with the TK_NURBS_Curve 06405 #define NC_HAS_START 0x04 //!< a float is specified for where the TK_NURBS_Curve starts in parametric [0,1] space 06406 #define NC_HAS_END 0x08 //!< a float is specified for where the TK_NURBS_Curve ends in parametric [0,1] space 06407 06409 06414 class BBINFILETK_API TK_NURBS_Curve : public BBaseOpcodeHandler { 06415 protected: 06416 unsigned char m_optionals; 06417 unsigned char m_degree; 06418 int m_control_point_count; 06419 int m_knot_count_implicit; 06420 float *m_control_points; 06421 double *m_dcontrol_points; 06422 float *m_weights; 06423 float *m_knots; 06424 float m_start; 06425 float m_end; 06427 06428 void set_curve (int degree, int control_count, float const points[] = 0, 06429 float const weights[] = 0, float const knots[] = 0, 06430 float start = 0.0f, float end = 1.0f); 06431 public: 06432 TK_NURBS_Curve(); 06433 ~TK_NURBS_Curve(); 06434 06435 TK_Status Read (BStreamFileToolkit & tk); 06436 TK_Status Write (BStreamFileToolkit & tk); 06437 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06438 06439 TK_Status ReadAscii (BStreamFileToolkit & tk); 06440 TK_Status WriteAscii (BStreamFileToolkit & tk); 06441 06442 void Reset (); 06443 06445 void SetCurve (int degree, int control_count, float const points[] = 0, 06446 float const weights[] = 0, float const knots[] = 0, 06447 float start = 0.0f, float end = 1.0f) { 06448 set_curve (degree, control_count, points, weights, knots, start, end); 06449 } 06450 void SetDCurve (int degree, int control_count, double const points[] = 0, 06451 float const weights[] = 0, float const knots[] = 0, 06452 float start = 0.0f, float end = 1.0f); 06453 06454 float const * GetPoints () const { return m_control_points; } 06455 float * GetPoints () { return m_control_points; } 06456 double const * GetDPoints () const { return m_dcontrol_points; } 06457 double * GetDPoints () { return m_dcontrol_points; } 06459 int GetDegree () const { return m_degree; } 06460 int GetCount () const { return m_control_point_count; } 06461 float const * GetWeights () const { return m_weights; } 06462 float * GetWeights () { return m_weights; } 06463 float const * GetKnots () const { return m_knots; } 06464 float * GetKnots () { return m_knots; } 06466 void SetStart (float s) { m_start = s; } 06467 float GetStart () const { return m_start; } 06468 void SetEnd (float e) { m_end = e; } 06469 float GetEnd () const { return m_end; } 06471 void SetOptions (int o) { m_optionals = (unsigned char)o; } 06472 int GetOptions () const { return m_optionals; } 06474 }; 06475 06476 06477 06478 06479 06480 #define NS_HAS_WEIGHTS 0x01 //!< an array of floats for the weights is specified with the TK_NURBS_Surface 06481 #define NS_HAS_KNOTS 0x02 //!< an array of floats for the knots is specified with the TK_NURBS_Surface 06482 #define NS_HAS_TRIMS 0x04 //!< the TK_NURBS_Surface contains a list of trims 06483 06484 #define NS_TRIM_END 0 //!< terminates an NS_TRIM_COLLECTION if one is active, otherwise terminates the list of trims 06485 #define NS_TRIM_POLY 1 //!< the next trim is a polyline (closed automatically if not already a closed loop) 06486 #define NS_TRIM_CURVE 2 //!< the next trim is a nurbs curve in parametric space 06487 #define NS_TRIM_COLLECTION 3 //!< all trim objects up to the next NS_TRIM_END should be combined as one. 06488 #define NS_TRIM_LAST_KNOWN_TYPE 3 //!< the last known trim type defined as of the current version of the toolkit 06489 06490 #define NS_TRIM_KEEP 0x01 //!< instead of the usual cutting away the enclosed area, cut away everything but 06491 #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 06492 #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 06493 06495 06501 class BBINFILETK_API HT_NURBS_Trim : public BBaseOpcodeHandler { 06502 friend class TK_NURBS_Surface; 06503 protected: 06504 //first 5 are relevant to polys and curves 06505 int m_substage; 06506 HT_NURBS_Trim * m_next; 06507 unsigned char m_type; 06508 int m_count; 06509 float * m_points; 06510 //next 6 are specific to curves 06511 unsigned char m_degree; 06512 unsigned char m_options; 06513 float * m_weights; 06514 float * m_knots; 06515 float m_start_u; 06516 float m_end_u; 06517 HT_NURBS_Trim * m_list; 06518 HT_NURBS_Trim * m_current_trim; 06520 HT_NURBS_Trim(); 06521 TK_Status read_collection(BStreamFileToolkit & tk); 06522 TK_Status write_collection(BStreamFileToolkit & tk); 06525 public: 06526 ~HT_NURBS_Trim(); 06527 void SetPoly (int count, float const points[] = 0); 06528 void SetCurve (int degree, int control_count, float const points[] = 0, 06529 float const weights[] = 0, float const knots[] = 0, float start_u = 0, float end_u = 1); 06530 void SetCollection (); 06531 void SetOptions (int o) { m_options = (unsigned char)o; } 06532 void SetList (HT_NURBS_Trim *node) { m_list = node; } 06533 void SetNext (HT_NURBS_Trim *next) { m_next = next; } 06535 TK_Status Read (BStreamFileToolkit & tk); 06536 TK_Status Write (BStreamFileToolkit & tk); 06537 06538 TK_Status ReadAscii (BStreamFileToolkit & tk); 06539 TK_Status WriteAscii (BStreamFileToolkit & tk); 06540 06541 TK_Status read_collection_ascii(BStreamFileToolkit & tk); 06542 TK_Status write_collection_ascii(BStreamFileToolkit & tk); 06543 06545 HT_NURBS_Trim * GetNext (void) { return m_next; } 06547 int GetType () const { return m_type; } 06549 int GetCount () const { return m_count; } 06551 float const * GetPoints () const { return m_points; } 06553 float * GetPoints () { return m_points; } 06555 int GetDegree () const { return m_degree; } 06557 int GetOptions () const { return m_options; } 06559 float const * GetWeights () const { return m_weights; } 06561 float * GetWeights () { return m_weights; } 06563 float const * GetKnots () const { return m_knots; } 06565 float * GetKnots () { return m_knots; } 06567 HT_NURBS_Trim const *GetList () const { return m_list; } 06569 HT_NURBS_Trim * GetList () { return m_list; } 06570 06571 }; 06572 06574 06579 class BBINFILETK_API TK_NURBS_Surface : public BBaseOpcodeHandler { 06580 protected: 06581 unsigned char m_optionals; 06582 unsigned char m_degree[2]; 06583 int m_size[2]; 06584 float * m_control_points; 06585 double * m_dcontrol_points; 06586 float * m_weights; 06587 float * m_u_knots; 06588 float * m_v_knots; 06590 HT_NURBS_Trim * m_trims; 06591 HT_NURBS_Trim * m_current_trim; 06594 public: 06595 TK_NURBS_Surface(); 06596 ~TK_NURBS_Surface(); 06597 06598 TK_Status Read (BStreamFileToolkit & tk); 06599 TK_Status Write (BStreamFileToolkit & tk); 06600 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06601 06602 TK_Status ReadAscii (BStreamFileToolkit & tk); 06603 TK_Status WriteAscii (BStreamFileToolkit & tk); 06604 06605 void Reset (); 06607 void SetSurface (int u_degree, int v_degree, int u_size, int v_size, 06608 float const points[] = 0, float const weights[] = 0, 06609 float const u_knots[] = 0, float const v_knots[] = 0); 06610 void SetDSurface (int u_degree, int v_degree, int u_size, int v_size, 06611 double const points[] = 0, float const weights[] = 0, 06612 float const u_knots[] = 0, float const v_knots[] = 0); 06615 float const * GetPoints () const { return m_control_points; } 06617 float * GetPoints () { return m_control_points; } 06619 double const * GetDPoints () const { return m_dcontrol_points; } 06621 double * GetDPoints () { return m_dcontrol_points; } 06622 06624 int GetUDegree () const { return m_degree[0]; } 06626 int GetVDegree () const { return m_degree[1]; } 06628 int GetUSize () const { return m_size[0]; } 06630 int GetVSize () const { return m_size[1]; } 06632 float const * GetWeights () const { return m_weights; } 06634 float * GetWeights () { return m_weights; } 06636 float const * GetUKnots () const { return m_u_knots; } 06638 float * GetUKnots () { return m_u_knots; } 06640 float const * GetVKnots () const { return m_v_knots; } 06642 float * GetVKnots () { return m_v_knots; } 06643 06645 void SetOptions (int o) { m_optionals = (unsigned char)o; } 06647 int GetOptions () const { return m_optionals; } 06648 06650 HT_NURBS_Trim * NewTrim (int type = NS_TRIM_END); 06652 HT_NURBS_Trim * GetTrims () { return m_trims; } 06653 06654 06655 }; 06656 06658 06663 class BBINFILETK_API TK_Area_Light : public BBaseOpcodeHandler { 06664 protected: 06665 int m_count; 06666 float * m_points; 06667 double * m_dpoints; 06668 char m_options; 06669 06671 void set_points (int count, float const points[] = 0); 06672 06673 public: 06675 TK_Area_Light () 06676 : BBaseOpcodeHandler (TKE_Area_Light), m_count (0), m_points (0), m_dpoints (0), m_options (0) {} 06677 ~TK_Area_Light(); 06678 06679 TK_Status Read (BStreamFileToolkit & tk); 06680 TK_Status Write (BStreamFileToolkit & tk); 06681 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06682 06683 TK_Status ReadAscii (BStreamFileToolkit & tk); 06684 TK_Status WriteAscii (BStreamFileToolkit & tk); 06685 06686 void Reset (); 06687 06692 void SetPoints (int count, float const points[] = 0) { set_points (count, points); } 06694 float const * GetPoints () const { return m_points; } 06696 float * GetPoints () { return m_points; } 06697 06702 void SetDPoints (int count, double const points[] = 0) ; 06704 double const * GetDPoints () const { return m_dpoints; } 06706 double * GetDPoints () { return m_dpoints; } 06707 06709 int GetCount () const { return m_count; } 06710 06712 void SetOptions (int o) { m_options = (char)o; } 06714 int GetOptions () const { return (int)m_options; } 06715 }; 06716 06717 06721 enum TKO_Spot_Light_Options { 06722 TKO_Spot_Outer_Degrees = 0x01, 06723 TKO_Spot_Outer_Field = 0x02, 06724 06725 TKO_Spot_Inner_Degrees = 0x04, 06726 TKO_Spot_Inner_Field = 0x08, 06727 TKO_Spot_Inner_Percent = 0x0C, 06728 06729 TKO_Spot_Outer_Mask = 0x03, 06730 TKO_Spot_Inner_Mask = 0x0C, 06731 06732 TKO_Spot_Camera_Relative = 0x10, 06733 06734 TKO_Spot_Concentration = 0x20 06735 }; 06736 06737 06739 06744 class BBINFILETK_API TK_Spot_Light : public BBaseOpcodeHandler { 06745 protected: 06746 float m_position[3]; 06747 float m_target[3]; 06748 double m_dposition[3]; 06749 double m_dtarget[3]; 06750 float m_outer; 06751 float m_inner; 06752 float m_concentration; 06753 char m_options; 06754 06755 public: 06757 TK_Spot_Light () 06758 : BBaseOpcodeHandler (TKE_Spot_Light), m_options (0) {} 06759 06760 TK_Status Read (BStreamFileToolkit & tk); 06761 TK_Status Write (BStreamFileToolkit & tk); 06762 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06763 06764 TK_Status ReadAscii (BStreamFileToolkit & tk); 06765 TK_Status WriteAscii (BStreamFileToolkit & tk); 06766 06768 void SetPosition (float x, float y, float z) 06769 { m_position[0] = x; m_position[1] = y; m_position[2] = z; } 06771 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 06773 float const * GetPosition () const { return m_position; } 06774 06776 void SetDPosition (double x, double y, double z) 06777 { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; } 06779 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 06781 double const * GetDPosition () const { return m_dposition; } 06782 06784 void SetTarget (float x, float y, float z) 06785 { m_target[0] = x; m_target[1] = y; m_target[2] = z; } 06787 void SetTarget (float const t[]) { SetTarget (t[0], t[1], t[2]); } 06789 float const * GetTarget () const { return m_target; } 06790 06792 void SetDTarget (double x, double y, double z) 06793 { m_dtarget[0] = x; m_dtarget[1] = y; m_dtarget[2] = z; } 06795 void SetDTarget (double const t[]) { SetDTarget (t[0], t[1], t[2]); } 06797 double const * GetDTarget () const { return m_dtarget; } 06798 06800 void SetOuter (float o) { m_outer = o; } 06802 float GetOuter () const { return m_outer; } 06803 06805 void SetInner (float i) { m_inner = i; } 06807 float GetInner () const { return m_inner; } 06808 06810 void SetConcentration (float c) { m_concentration = c; } 06812 float GetConcentration () const { return m_concentration; } 06813 06815 void SetOptions (int o) { m_options = (char)o; } 06817 int GetOptions () const { return (int)m_options; } 06818 }; 06819 06820 06822 06827 class BBINFILETK_API TK_Cutting_Plane : public BBaseOpcodeHandler { 06828 protected: 06829 float * m_planes; 06830 double * m_dplanes; 06831 int m_count; 06832 06833 public: 06835 TK_Cutting_Plane () 06836 : BBaseOpcodeHandler (TKE_Cutting_Plane), m_planes (0), m_dplanes (0), m_count (0) {} 06837 ~TK_Cutting_Plane (); 06838 06839 TK_Status Read (BStreamFileToolkit & tk); 06840 TK_Status Write (BStreamFileToolkit & tk); 06841 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06842 06843 TK_Status ReadAscii (BStreamFileToolkit & tk); 06844 TK_Status WriteAscii (BStreamFileToolkit & tk); 06845 06846 void Reset (); 06847 06849 void SetPlanes (int count, float const p[]=0); 06851 void SetDPlanes (int count, double const p[]=0); 06852 06854 void SetPlane (float a, float b, float c, float d) 06855 { SetPlanes(1); 06856 m_planes[0] = a; m_planes[1] = b; m_planes[2] = c; m_planes[3] = d; } 06858 void SetDPlane (double a, double b, double c, double d) 06859 { SetDPlanes(1); 06860 m_dplanes[0] = a; m_dplanes[1] = b; m_dplanes[2] = c; m_dplanes[3] = d; } 06861 06863 void SetPlane (float const p[]) { SetPlanes (1, p); } 06865 void SetDPlane (double const p[]) { SetDPlanes (1, p); } 06866 06868 float const * GetPlane () const { return m_planes; } 06870 double const * GetDPlane () const { return m_dplanes; } 06871 06873 float const * GetPlanes () const { return m_planes; } 06875 double const * GetDPlanes () const { return m_dplanes; } 06876 06878 int GetCount () const { return m_count; } 06879 }; 06880 06881 06885 enum TKO_Circular_Options { 06886 TKO_Circular_Center = 0x01 06887 }; 06888 06890 06897 class BBINFILETK_API TK_Circle : public BBaseOpcodeHandler { 06898 protected: 06899 float m_points[9]; 06900 float m_center[3]; 06901 double m_dpoints[9]; 06902 double m_dcenter[3]; 06903 unsigned char m_flags; 06906 public: 06908 TK_Circle (unsigned char opcode) 06909 : BBaseOpcodeHandler (opcode), m_flags (0) {} 06910 06911 TK_Status Read (BStreamFileToolkit & tk); 06912 TK_Status Write (BStreamFileToolkit & tk); 06913 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06914 06915 TK_Status ReadAscii (BStreamFileToolkit & tk); 06916 TK_Status WriteAscii (BStreamFileToolkit & tk); 06917 06918 void Reset (); 06919 06921 void SetStart (float x, float y, float z) { 06922 m_points[0] = x; m_points[1] = y; m_points[2] = z; 06923 } 06925 void SetStart (float const s[]) { 06926 SetStart (s[0], s[1], s[2]); 06927 } 06929 void SetMiddle (float x, float y, float z) { 06930 m_points[3] = x; m_points[4] = y; m_points[5] = z; 06931 } 06933 void SetMiddle (float const m[]) { 06934 SetMiddle (m[0], m[1], m[2]); 06935 } 06937 void SetEnd (float x, float y, float z) { 06938 m_points[6] = x; m_points[7] = y; m_points[8] = z; 06939 } 06941 void SetEnd (float const e[]) { 06942 SetEnd (e[0], e[1], e[2]); 06943 } 06945 void SetCenter (float x, float y, float z) { 06946 m_center[0] = x; m_center[1] = y; m_center[2] = z; 06947 m_flags = TKO_Circular_Center; 06948 } 06950 void SetCenter (float const c[]) { 06951 if (c) SetCenter (c[0], c[1], c[2]); 06952 else m_flags = 0; 06953 } 06955 void SetPoints (float const s[], float const m[], float const e[], 06956 float const c[] = 0) { 06957 SetStart (s); SetMiddle (m); SetEnd (e); SetCenter (c); 06958 } 06959 06961 float const * GetStart () const { return &m_points[0]; } 06963 float const * GetMiddle () const { return &m_points[3]; } 06965 float const * GetEnd () const { return &m_points[6]; } 06967 float const * GetCenter () const { return (m_flags & TKO_Circular_Center) ? m_center : 0; } 06968 06970 void SetDStart (double x, double y, double z) { 06971 m_dpoints[0] = x; m_dpoints[1] = y; m_dpoints[2] = z; 06972 } 06974 void SetDStart (double const s[]) { 06975 SetDStart (s[0], s[1], s[2]); 06976 } 06978 void SetDMiddle (double x, double y, double z) { 06979 m_dpoints[3] = x; m_dpoints[4] = y; m_dpoints[5] = z; 06980 } 06982 void SetDMiddle (double const m[]) { 06983 SetDMiddle (m[0], m[1], m[2]); 06984 } 06986 void SetDEnd (double x, double y, double z) { 06987 m_dpoints[6] = x; m_dpoints[7] = y; m_dpoints[8] = z; 06988 } 06990 void SetDEnd (double const e[]) { 06991 SetDEnd (e[0], e[1], e[2]); 06992 } 06994 void SetDCenter (double x, double y, double z) { 06995 m_dcenter[0] = x; m_dcenter[1] = y; m_dcenter[2] = z; 06996 m_flags = TKO_Circular_Center; 06997 } 06999 void SetDCenter (double const c[]) { 07000 if (c) SetDCenter (c[0], c[1], c[2]); 07001 else m_flags = 0; 07002 } 07004 void SetDPoints (double const s[], double const m[], double const e[], 07005 double const c[] = 0) { 07006 SetDStart (s); SetDMiddle (m); SetDEnd (e); SetDCenter (c); 07007 } 07008 07010 double const * GetDStart () const { return &m_dpoints[0]; } 07012 double const * GetDMiddle () const { return &m_dpoints[3]; } 07014 double const * GetDEnd () const { return &m_dpoints[6]; } 07016 double const * GetDCenter () const { return (m_flags & TKO_Circular_Center) ? m_dcenter : 0; } 07017 }; 07018 07019 07021 07028 class BBINFILETK_API TK_Ellipse : public BBaseOpcodeHandler { 07029 protected: 07030 float m_points[9]; 07031 double m_dpoints[9]; 07032 float m_limits[2]; 07034 public: 07036 TK_Ellipse (unsigned char opcode) 07037 : BBaseOpcodeHandler (opcode) {} 07038 07039 TK_Status Read (BStreamFileToolkit & tk); 07040 TK_Status Write (BStreamFileToolkit & tk); 07041 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07042 07043 TK_Status ReadAscii (BStreamFileToolkit & tk); 07044 TK_Status WriteAscii (BStreamFileToolkit & tk); 07045 07047 void SetCenter (float x, float y, float z) { 07048 m_points[0] = x; m_points[1] = y; m_points[2] = z; 07049 } 07051 void SetCenter (float const s[]) { SetCenter (s[0], s[1], s[2]); } 07053 float const * GetCenter () const { return &m_points[0]; } 07054 07056 void SetMajor (float x, float y, float z) { 07057 m_points[3] = x; m_points[4] = y; m_points[5] = z; 07058 } 07060 void SetMajor (float const m[]) { SetMajor (m[0], m[1], m[2]); } 07062 float const * GetMajor () const { return &m_points[3]; } 07063 07065 void SetMinor (float x, float y, float z) { 07066 m_points[6] = x; m_points[7] = y; m_points[8] = z; 07067 } 07069 void SetMinor (float const m[]) { SetMinor (m[0], m[1], m[2]); } 07071 float const * GetMinor () const { return &m_points[6]; } 07072 07073 07075 void SetDCenter (double x, double y, double z) { 07076 m_dpoints[0] = x; m_dpoints[1] = y; m_dpoints[2] = z; 07077 } 07079 void SetDCenter (double const s[]) { SetDCenter (s[0], s[1], s[2]);} 07081 double const * GetDCenter () const { return &m_dpoints[0]; } 07082 07084 void SetDMajor (double x, double y, double z) { 07085 m_dpoints[3] = x; m_dpoints[4] = y; m_dpoints[5] = z; 07086 } 07088 void SetDMajor (double const m[]) { SetDMajor (m[0], m[1], m[2]); } 07090 double const * GetDMajor () const { return &m_dpoints[3]; } 07091 07093 void SetDMinor (double x, double y, double z) { 07094 m_dpoints[6] = x; m_dpoints[7] = y; m_dpoints[8] = z; 07095 } 07097 void SetDMinor (double const m[]) { SetDMinor (m[0], m[1], m[2]); } 07099 double const * GetDMinor () const { return &m_dpoints[6]; } 07100 07102 void SetLimits (float s, float e) { 07103 m_limits[0] = s; m_limits[1] = e; 07104 } 07106 float const * GetLimits () const { return m_limits; } 07107 }; 07108 07109 07111 07118 class BBINFILETK_API TK_Sphere : public BBaseOpcodeHandler { 07119 protected: 07120 unsigned char m_flags; 07121 float m_center[3]; 07122 float m_radius; 07123 float m_axis[3]; 07124 float m_ortho[3]; 07125 double m_dcenter[3]; 07126 double m_dradius; 07127 double m_daxis[3]; 07128 double m_dortho[3]; 07130 public: 07132 TK_Sphere () 07133 : BBaseOpcodeHandler (TKE_Sphere) { Reset(); } 07134 07135 TK_Status Read (BStreamFileToolkit & tk); 07136 TK_Status Write (BStreamFileToolkit & tk); 07137 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07138 07139 TK_Status ReadAscii (BStreamFileToolkit & tk); 07140 TK_Status WriteAscii (BStreamFileToolkit & tk); 07141 07142 void Reset (); 07143 07145 void SetCenter (float x, float y, float z) { 07146 m_center[0] = x; m_center[1] = y; m_center[2] = z; 07147 } 07149 void SetCenter (float const s[]) { SetCenter (s[0], s[1], s[2]); } 07151 float const * GetCenter () const { return m_center; } 07152 07153 07155 void SetRadius (float r) { m_radius = r; } 07157 float GetRadius () const { return m_radius; } 07158 07160 void SetAxis (float x, float y, float z) { 07161 m_axis[0] = x; m_axis[1] = y; m_axis[2] = z; 07162 if (x != 0.0f || y != 1.0f || z != 0.0f) 07163 m_flags &= ~TKSPH_NULL_AXIS; 07164 } 07166 void SetAxis (float const s[]) { SetAxis (s[0], s[1], s[2]); } 07168 float const * GetAxis () const { return m_axis; } 07169 07171 void SetOrtho (float x, float y, float z) { 07172 m_ortho[0] = x; m_ortho[1] = y; m_ortho[2] = z; 07173 if (x != 1.0f || y != 0.0f || z != 0.0f) 07174 m_flags &= ~TKSPH_NULL_AXIS; 07175 } 07177 void SetOrtho (float const s[]) { SetOrtho (s[0], s[1], s[2]); } 07179 float const * GetOrtho () const { return m_ortho; } 07180 07181 07183 void SetDCenter (double x, double y, double z) { 07184 m_dcenter[0] = x; m_dcenter[1] = y; m_dcenter[2] = z; 07185 } 07187 void SetDCenter (double const s[]) { SetDCenter (s[0], s[1], s[2]);} 07189 double const * GetDCenter () const { return m_dcenter; } 07190 07191 07193 void SetDRadius (double r) { m_dradius = r; } 07195 double GetDRadius () const { return m_dradius; } 07196 07198 void SetDAxis (double x, double y, double z) { 07199 m_daxis[0] = x; m_daxis[1] = y; m_daxis[2] = z; 07200 if (x != 0.0f || y != 1.0f || z != 0.0f) 07201 m_flags &= ~TKSPH_NULL_AXIS; 07202 } 07204 void SetDAxis (double const s[]) { SetDAxis (s[0], s[1], s[2]); } 07206 double const * GetDAxis () const { return m_daxis; } 07207 07209 void SetDOrtho (double x, double y, double z) { 07210 m_dortho[0] = x; m_dortho[1] = y; m_dortho[2] = z; 07211 if (x != 1.0f || y != 0.0f || z != 0.0f) 07212 m_flags &= ~TKSPH_NULL_AXIS; 07213 } 07215 void SetDOrtho (double const s[]) { SetDOrtho (s[0], s[1], s[2]); } 07217 double const * GetDOrtho () const { return m_dortho; } 07218 07219 07223 enum Flags { 07224 TKSPH_NONE = 0x0, 07225 TKSPH_NULL_AXIS = 0x1 07226 }; 07227 07228 }; 07229 07230 07232 07239 class BBINFILETK_API TK_Cylinder : public BBaseOpcodeHandler { 07240 protected: 07241 float m_axis[6]; 07242 float m_radius; 07243 double m_daxis[6]; 07244 double m_dradius; 07245 unsigned char m_flags; 07247 public: 07249 TK_Cylinder () 07250 : BBaseOpcodeHandler (TKE_Cylinder) {} 07251 07252 TK_Status Read (BStreamFileToolkit & tk); 07253 TK_Status Write (BStreamFileToolkit & tk); 07254 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07255 07256 TK_Status ReadAscii (BStreamFileToolkit & tk); 07257 TK_Status WriteAscii (BStreamFileToolkit & tk); 07258 07260 void SetAxis (float x1, float y1, float z1, float x2, float y2, float z2) { 07261 m_axis[0] = x1; m_axis[1] = y1; m_axis[2] = z1; 07262 m_axis[3] = x2; m_axis[4] = y2; m_axis[5] = z2; 07263 } 07265 void SetAxis (float const s[], float const e[]) { SetAxis (s[0], s[1], s[2], e[0], e[1], e[2]); } 07267 void SetAxis (float const a[]) { SetAxis (&a[0], &a[3]); } 07269 float const * GetAxis () const { return m_axis; } 07271 float const * GetStart () const { return &m_axis[0]; } 07273 float const * GetEnd () const { return &m_axis[3]; } 07274 07276 void SetRadius (float r) { m_radius = r; } 07278 float GetRadius () const { return m_radius; } 07279 07280 07282 void SetDAxis (double x1, double y1, double z1, double x2, double y2, double z2) { 07283 m_daxis[0] = x1; m_daxis[1] = y1; m_daxis[2] = z1; 07284 m_daxis[3] = x2; m_daxis[4] = y2; m_daxis[5] = z2; 07285 } 07287 void SetDAxis (double const s[], double const e[]) { SetDAxis (s[0], s[1], s[2], e[0], e[1], e[2]); } 07289 void SetDAxis (double const a[]) { SetDAxis (&a[0], &a[3]); } 07291 double const * GetDAxis () const { return m_daxis; } 07293 double const * GetDStart () const { return &m_daxis[0]; } 07295 double const * GetDEnd () const { return &m_daxis[3]; } 07296 07298 void SetDRadius (double r) { m_dradius = r; } 07300 double GetDRadius () const { return m_dradius; } 07301 07302 07304 void SetCaps (int f) { m_flags = (unsigned char)f; } 07306 int GetCaps () const { return m_flags; } 07307 07311 enum Capping_Options { 07312 TKCYL_NONE = 0, 07313 TKCYL_FIRST = 1, 07314 TKCYL_SECOND = 2, 07315 TKCYL_BOTH = 3 07316 }; 07317 07318 }; 07319 07320 07322 07329 #include "BPolyhedron.h" 07330 07331 class BBINFILETK_API TK_PolyCylinder : public TK_Polyhedron { 07332 protected: 07333 int m_count; 07334 float * m_points; 07335 double * m_dpoints; 07336 int m_radius_count; 07337 float * m_radii; 07338 double * m_dradii; 07339 unsigned char m_flags; 07340 float m_normals[6]; 07342 public: 07344 TK_PolyCylinder () 07345 : TK_Polyhedron (TKE_PolyCylinder), m_count (0), m_points (0), m_dpoints (0), 07346 m_radius_count (0), m_radii (0), m_dradii (0) {} 07347 ~TK_PolyCylinder(); 07348 07349 TK_Status Read (BStreamFileToolkit & tk); 07350 TK_Status Write (BStreamFileToolkit & tk); 07351 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07352 07353 TK_Status ReadAscii (BStreamFileToolkit & tk); 07354 TK_Status WriteAscii (BStreamFileToolkit & tk); 07355 07356 virtual void Reset (); 07357 07361 enum Capping_Options { 07362 TKCYL_NORMAL_FIRST = 0x04, 07363 TKCYL_NORMAL_SECOND = 0x08, 07364 TKCYL_OPTIONALS = 0x10 07365 }; 07366 07371 void SetPoints (int count, float const points[] = 0); 07373 float const * GetPoints () const { return m_points; } 07375 float * GetPoints () { return m_points; } 07376 07381 void SetRadii (int count, float const radii[] = 0); 07383 void SetRadius (float radius) { SetRadii (1, &radius); } 07385 float const * GetRadii () const { return m_radii; } 07387 float * GetRadii () { return m_radii; } 07388 07389 07394 void SetDPoints (int count, double const points[] = 0); 07396 double const * GetDPoints () const { return m_dpoints; } 07398 double * GetDPoints () { return m_dpoints; } 07399 07404 void SetDRadii (int count, double const radii[] = 0); 07406 void SetDRadius (double radius) { SetDRadii (1, &radius); } 07408 double const * GetDRadii () const { return m_dradii; } 07410 double * GetDRadii () { return m_dradii; } 07411 07412 07414 int GetCount () const { return m_count; } 07416 int GetRadiusCount () const { return m_radius_count; } 07417 07418 07419 07420 07422 void SetCaps (int f) { m_flags &= ~0x03; m_flags |= f; } 07424 int GetCaps () const { return m_flags & 0x03; } 07425 07427 void SetEndNormal (int index, float const normal[] = 0) { 07428 int mask = 0x40 << index; 07429 if (normal == 0) 07430 m_flags &= ~mask; 07431 else { 07432 m_flags |= mask; 07433 m_normals[3*index+0] = normal[0]; 07434 m_normals[3*index+1] = normal[1]; 07435 m_normals[3*index+2] = normal[2]; 07436 } 07437 } 07439 float const * GetEndNormal (int index) const { 07440 int mask = 0x40 << index; 07441 if (m_flags & mask) 07442 return &m_normals[3*index]; 07443 else 07444 return 0; 07445 } 07446 }; 07447 07448 07450 07456 class BBINFILETK_API TK_Grid : public BBaseOpcodeHandler { 07457 protected: 07458 char m_type; 07459 float m_points[9]; 07460 double m_dpoints[9]; 07461 int m_counts[2]; 07463 public: 07465 TK_Grid () 07466 : BBaseOpcodeHandler (TKE_Grid) {} 07467 07468 TK_Status Read (BStreamFileToolkit & tk); 07469 TK_Status Write (BStreamFileToolkit & tk); 07470 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07471 07472 TK_Status ReadAscii (BStreamFileToolkit & tk); 07473 TK_Status WriteAscii (BStreamFileToolkit & tk); 07474 07476 void SetOrigin (float x, float y, float z) { 07477 m_points[0] = x; m_points[1] = y; m_points[2] = z; 07478 } 07480 void SetOrigin (float const o[]) { SetOrigin (o[0], o[1], o[2]); } 07482 float const * GetOrigin () const { return &m_points[0]; } 07484 float * GetOrigin () { return &m_points[0]; } 07485 07487 void SetRef1 (float x, float y, float z) { 07488 m_points[3] = x; m_points[4] = y; m_points[5] = z; 07489 } 07491 void SetRef1 (float const r[]) { SetRef1 (r[0], r[1], r[2]); } 07493 float const * GetRef1 () const { return &m_points[3]; } 07495 float * GetRef1 () { return &m_points[3]; } 07496 07498 void SetRef2 (float x, float y, float z) { 07499 m_points[6] = x; m_points[7] = y; m_points[8] = z; 07500 } 07502 void SetRef2 (float const r[]) { SetRef2 (r[0], r[1], r[2]); } 07504 float const * GetRef2 () const { return &m_points[6]; } 07506 float * GetRef2 () { return &m_points[6]; } 07507 07508 07510 void SetDOrigin (double x, double y, double z) { 07511 m_dpoints[0] = x; m_dpoints[1] = y; m_dpoints[2] = z; 07512 } 07514 void SetDOrigin (double const o[]) { SetDOrigin (o[0], o[1], o[2]);} 07516 double const * GetDOrigin () const { return &m_dpoints[0]; } 07518 double * GetDOrigin () { return &m_dpoints[0]; } 07519 07521 void SetDRef1 (double x, double y, double z) { 07522 m_dpoints[3] = x; m_dpoints[4] = y; m_dpoints[5] = z; 07523 } 07525 void SetDRef1 (double const r[]) { SetDRef1 (r[0], r[1], r[2]); } 07527 double const * GetDRef1 () const { return &m_dpoints[3]; } 07529 double * GetDRef1 () { return &m_dpoints[3]; } 07530 07532 void SetDRef2 (double x, double y, double z) { 07533 m_dpoints[6] = x; m_dpoints[7] = y; m_dpoints[8] = z; 07534 } 07536 void SetDRef2 (double const r[]) { SetDRef2 (r[0], r[1], r[2]); } 07538 double const * GetDRef2 () const { return &m_dpoints[6]; } 07540 double * GetDRef2 () { return &m_dpoints[6]; } 07541 07542 07544 void SetCounts (int c1, int c2) { 07545 m_counts[0] = c1; m_counts[1] = c2; 07546 } 07548 int const * GetCounts () const { return m_counts; } 07550 int * GetCounts () { return m_counts; } 07551 07553 void SetType (int t) { m_type = (char)t; } 07555 int GetType () const { return (int)m_type; } 07556 }; 07557 07559 07563 enum TKO_Text_Encodings { 07564 TKO_Enc_ISO_Latin_One, 07565 TKO_Enc_ISO_Latin, 07566 TKO_Enc_JEC, 07567 TKO_Enc_EUC, 07568 TKO_Enc_Raw_16, 07569 TKO_Enc_Unicode, 07570 TKO_Enc_Unicode32, 07571 TKO_Enc_UTF8, 07572 TKO_Enc_UTF16, 07573 TKO_Enc_UTF32, 07574 TKO_Enc_WCS 07575 }; 07576 07580 enum TKO_Text_Options { 07581 TKO_Text_Option_Region = 0x01, 07582 TKO_Text_Option_Character_Attributes = 0x02 07583 }; 07584 07588 enum TKO_Text_Region_Options { 07589 TKO_Text_Region_Window = 0x01, 07590 TKO_Text_Region_Relative = 0x02, 07591 TKO_Text_Region_Adjusted = 0x04, 07592 TKO_Text_Region_Center = 0x08, 07593 TKO_Text_Region_Top = 0x10, 07594 TKO_Text_Region_HFit = 0x20, 07595 TKO_Text_Region_VFit = 0x40, 07596 TKO_Text_Region_Fitting = 0x60, 07597 TKO_Text_Region_Extended = 0x80 07598 }; 07599 07603 enum TKO_Text_Region_Fit_Options { 07604 TKO_Text_Region_Fit_None = 0, 07605 TKO_Text_Region_Fit_Spacing = 1, 07606 TKO_Text_Region_Fit_Size = 2 07607 }; 07608 07609 07613 enum TKO_Character_Attributes { 07614 TKO_Character_Name = 0x0001, 07615 TKO_Character_Size = 0x0002, 07616 TKO_Character_Vertical_Offset = 0x0004, 07617 TKO_Character_Omitted = 0x0008, 07618 TKO_Character_Invisible = 0x0010, 07619 TKO_Character_Slant = 0x0020, 07620 TKO_Character_Width_Scale = 0x0040, 07621 TKO_Character_Rotation = 0x0080, 07622 TKO_Character_Rotation_Fixed = 0x0100, 07623 TKO_Character_Horizontal_Offset = 0x0200, 07624 TKO_Character_Color = 0x0400, 07625 TKO_Character_Extended = 0x8000 07626 }; 07627 07629 struct TK_Character_Attribute { 07630 char * name; 07631 07632 float color[3]; 07633 float size; 07634 float vertical_offset; 07635 float horizontal_offset; 07636 float slant; 07637 float rotation; 07638 float width_scale; 07639 07640 unsigned short mask; 07641 unsigned short value; 07642 07643 unsigned char size_units; 07644 unsigned char vertical_offset_units; 07645 unsigned char horizontal_offset_units; 07646 }; 07647 07648 07650 07656 class BBINFILETK_API TK_Text : public BBaseOpcodeHandler { 07657 protected: 07658 float m_position[3]; 07659 double m_dposition[3]; 07660 int m_length; 07661 int m_allocated; 07662 char * m_string; 07663 unsigned char m_encoding; 07664 unsigned char m_options; 07665 unsigned char m_region_options; 07666 unsigned char m_region_fit; 07667 unsigned char m_region_count; 07668 float m_region[4*3]; 07669 int m_count; 07670 TK_Character_Attribute *m_character_attributes; 07671 int m_substage; 07672 int m_tmp; 07674 void set_string (char const * string); 07675 void set_string (int length); 07676 07677 public: 07679 TK_Text (unsigned char opcode); 07680 ~TK_Text(); 07681 07682 TK_Status Read (BStreamFileToolkit & tk); 07683 TK_Status Write (BStreamFileToolkit & tk); 07684 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07685 07686 TK_Status ReadAscii (BStreamFileToolkit & tk); 07687 TK_Status WriteAscii (BStreamFileToolkit & tk); 07688 07689 void Reset (); 07690 07692 void SetString (char const * string) { set_string (string); } 07694 void SetString (unsigned short const * string); 07696 void SetString (unsigned int const * string); 07698 void SetString (int length) { set_string (length); } 07700 char const * GetString () const { return m_string; } 07702 char * GetString () { return m_string; } 07703 07705 void SetPosition (float x, float y, float z) 07706 { m_position[0] = x; m_position[1] = y; m_position[2] = z; } 07708 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 07710 float const * GetPosition () const { return &m_position[0]; } 07711 07713 void SetDPosition (double x, double y, double z) 07714 { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; } 07716 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 07718 double const * GetDPosition () const { return &m_dposition[0]; } 07719 07721 void SetEncoding (int e) { m_encoding = (unsigned char)e; } 07723 int GetEncoding () const { return (int)m_encoding; } 07724 07726 void SetTextRegion (int c, float const p[], int o=0, int f=0); 07728 int GetTextRegionCount () const { return (int)m_region_count; } 07730 float const * GetTextRegionPoints () const { return m_region; } 07732 int GetTextRegionOptions () const { return (int)m_region_options; } 07734 int GetTextRegionFitting () const { return (int)m_region_fit; } 07735 }; 07736 07738 07740 07746 enum TKO_Font_Type { 07747 TKO_Font_HOOPS_Stroked // data represents a HOOPS stroked font definition 07748 }; 07749 07750 07752 07758 class BBINFILETK_API TK_Font : public BBaseOpcodeHandler { 07759 protected: 07760 char * m_name; 07761 char * m_lookup; 07762 char * m_bytes; 07763 int m_name_length; 07764 int m_lookup_length; 07765 int m_length; 07766 unsigned char m_type; 07767 unsigned char m_encoding; 07769 07770 void set_bytes (int size, char const * bytes = 0); 07772 void set_name (char const * string); 07774 void set_name (int length); 07776 void set_lookup (char const * string); 07778 void set_lookup (int length); 07779 07780 public: 07782 TK_Font () : BBaseOpcodeHandler (TKE_Font), 07783 m_name (0), m_lookup (0), m_bytes (0), m_name_length (0), m_lookup_length (0), m_length (0), 07784 m_type (0), m_encoding (0) {} 07785 ~TK_Font(); 07786 07787 TK_Status Read (BStreamFileToolkit & tk); 07788 TK_Status Write (BStreamFileToolkit & tk); 07789 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07790 07791 TK_Status ReadAscii (BStreamFileToolkit & tk); 07792 TK_Status WriteAscii (BStreamFileToolkit & tk); 07793 07794 void Reset (); 07795 07796 07798 void SetType (int t) { m_type = (unsigned char)t;} 07800 int GetType () const { return (int)m_type; } 07801 07806 void SetBytes (int size, char const * bytes = 0) { set_bytes (size, bytes); } 07808 int GetBytesCount () const { return m_length; } 07810 char const * GetBytes () const { return m_bytes; } 07812 char * GetBytes () { return m_bytes; } 07813 07815 void SetName (char const * string) { set_name (string); } 07817 void SetName (int length) { set_name (length); } 07819 char const * GetName () const { return m_name; } 07821 char * GetName () { return m_name; } 07822 07824 void SetLookup (char const * string) { set_lookup (string); } 07826 void SetLookup (int length) { set_lookup (length); } 07828 char const * GetLookup () const { return m_lookup; } 07830 char * GetLookup () { return m_lookup; } 07831 07833 void SetEncoding (int e) { m_encoding = (unsigned char)e;} 07835 int GetEncoding () const { return (int)m_encoding; } 07836 }; 07837 07839 07843 enum TKO_Image_Formats { 07844 TKO_Image_Mapped = 0, 07845 TKO_Image_Mapped_16 = 1, 07846 TKO_Image_RGB = 2, 07847 TKO_Image_RGBA = 3, 07848 TKO_Image_BGRA = 4, 07849 TKO_Image_DEPTH = 5, 07850 TKO_Image_LUMINANCE8 = 6, 07851 TKO_Image_JPEG = 7, 07852 TKO_Image_DXT1 = 8, 07853 TKO_Image_DXT3 = 9, 07854 TKO_Image_DXT5 = 10, 07855 TKO_Image_TARGA = 11, 07856 TKO_Image_PNG = 12, 07857 TKO_Image_Format_Mask = 0x0F, 07858 07859 TKO_Image_Explicit_Size = 0x10, 07860 TKO_Image_Local_Texture = 0x20, 07861 TKO_Image_Is_Named = 0x80, 07862 07863 TKO_Image_Compression_Quality = 0x00000100, 07864 TKO_Image_Discard = 0x00000200, 07865 TKO_Image_Options_Mask = 0xFFFFFFF0, 07866 07867 TKO_Image_Invalid = 0xFF 07868 }; 07869 07870 07872 extern const int TK_Image_Bytes_Per_Pixel[]; 07873 07877 enum TKO_Compression { 07878 TKO_Compression_None = 0, 07879 TKO_Compression_RLE = 1, 07880 TKO_Compression_JPEG = 2, 07881 TKO_Compression_DXT = 3, 07882 TKO_Compression_TARGA = 4, 07883 TKO_Compression_PNG = 5, 07884 TKO_Compression_Reference = 99 07885 }; 07886 07887 #ifndef DOXYGEN_SHOULD_SKIP_THIS 07888 07889 class BBINFILETK_API2 TK_Image_Data_Buffer { 07890 protected: 07891 unsigned char * m_buffer; 07892 unsigned int m_allocated; 07893 unsigned int m_used; 07894 07895 public: 07897 TK_Image_Data_Buffer() : m_buffer (0), m_allocated (0), m_used (0) {} 07898 ~TK_Image_Data_Buffer(); 07899 07900 void Resize (unsigned int size); 07901 void Expand (unsigned int size) { Resize (Size() + size); } 07902 void Reset (); 07903 07904 unsigned int const & Size () const { return m_allocated; } 07905 unsigned int const & Used () const { return m_used; } 07906 unsigned int & Used () { return m_used; } 07907 unsigned char const * Buffer () const { return m_buffer; } 07908 unsigned char * Buffer () { return m_buffer; } 07909 }; 07910 07911 07912 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 07913 07914 07916 07922 class BBINFILETK_API2 TK_Image : public BBaseOpcodeHandler { 07923 protected: 07924 char * m_bytes; 07925 char * m_name; 07926 char * m_reference; 07927 float m_position[3]; 07928 double m_dposition[3]; 07929 int m_size[2]; 07930 int m_data_size; 07931 int m_name_length; 07932 int m_reference_length; 07933 unsigned char m_format; 07934 unsigned int m_options; 07935 unsigned char m_compression; 07936 unsigned char m_bytes_format; 07937 float m_explicit_size[2]; 07938 unsigned char m_explicit_units[2]; 07939 TK_Image_Data_Buffer m_work_area[2]; 07940 float m_compression_quality; 07942 bool m_jpeg_native; 07944 07945 void set_data (int size, char const * bytes = 0, unsigned char data_format = TKO_Compression_None); 07947 void set_name (char const * string); 07949 void set_name (int length); 07950 07952 TK_Status compress_image (BStreamFileToolkit & tk, int active_work_area = 0); 07954 TK_Status decompress_image (BStreamFileToolkit & tk, int active_work_area = 0); 07956 TK_Status read_jpeg_header (); 07957 07958 public: 07960 TK_Image (); 07961 ~TK_Image(); 07962 07963 TK_Status Read (BStreamFileToolkit & tk); 07964 TK_Status Write (BStreamFileToolkit & tk); 07965 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07966 07967 TK_Status ReadAscii (BStreamFileToolkit & tk); 07968 TK_Status WriteAscii (BStreamFileToolkit & tk); 07969 TK_Status compress_image_ascii (BStreamFileToolkit & tk); 07970 07971 07972 void Reset (); 07973 07978 void SetBytes (int size, char const * bytes = 0, 07979 unsigned char data_format = TKO_Compression_None) 07980 { set_data (size, bytes, data_format); } 07982 char const * GetBytes () const { return m_bytes; } 07984 char * GetBytes () { return m_bytes; } 07985 07987 void SetName (char const * string) { set_name (string); } 07989 void SetName (int length) { set_name (length); } 07991 char const * GetName () const { return m_name; } 07993 char * GetName () { return m_name; } 07994 07996 void SetReference (char const * string); 07998 void SetReference (int length); 08000 char const * GetReference () const { return m_reference; } 08002 char * GetReference () { return m_reference; } 08003 08005 void SetPosition (float x, float y, float z) 08006 { m_position[0] = x; m_position[1] = y; m_position[2] = z; } 08008 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 08010 float const * GetPosition () const { return &m_position[0]; } 08011 08013 void SetDPosition (double x, double y, double z) 08014 { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; } 08016 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 08018 double const * GetDPosition () const { return &m_dposition[0]; } 08019 08021 void SetSize (int w, int h) { m_size[0] = w; m_size[1] = h; } 08023 void SetSize (int const s[]) { m_size[0] = s[0]; m_size[1] = s[1]; } 08025 int const * GetSize () const { return m_size; } 08026 08028 void SetFormat (int f) { m_format = (unsigned char)(f & TKO_Image_Format_Mask); } 08030 int GetFormat () const { return (int)m_format; } 08031 08033 void SetOptions (int f) { m_options = (unsigned char)(f & TKO_Image_Options_Mask); } 08035 int GetOptions () const { return (int)m_options; } 08036 08038 void SetCompression (int c) { m_compression = (unsigned char)c; } 08040 int GetCompression () const { return (int)m_compression; } 08041 }; 08042 08043 08045 08046 08050 enum TKO_Texture_Option_Bits { 08051 TKO_Texture_Param_Source = 0x00000001, 08052 TKO_Texture_Tiling = 0x00000002, 08053 TKO_Texture_Interpolation = 0x00000004, 08054 TKO_Texture_Decimation = 0x00000008, 08055 TKO_Texture_Red_Mapping = 0x00000010, 08056 TKO_Texture_Green_Mapping = 0x00000020, 08057 TKO_Texture_Blue_Mapping = 0x00000040, 08058 TKO_Texture_Alpha_Mapping = 0x00000080, 08059 TKO_Texture_Param_Function = 0x00000100, 08060 TKO_Texture_Layout = 0x00000200, 08061 TKO_Texture_Transform = 0x00000400, 08062 TKO_Texture_Value_Scale = 0x00000800, 08063 TKO_Texture_Caching = 0x00001000, 08064 TKO_Texture_DownSample = 0x00002000, 08065 TKO_Texture_No_DownSample = 0x00004000, 08066 TKO_Texture_Extended = 0x00008000, 08067 TKO_Texture_Extended_Mask = 0xFFFF0000, // internal use, indicates bit which require TKO_Texture_Extended 08068 TKO_Texture_Extended_Shift = 16, // internal use, indicates shift of extended section 08069 TKO_Texture_Decal = 0x00010000, 08070 TKO_Texture_Modulate = 0x00020000, 08071 TKO_Texture_Param_Offset = 0x00040000, 08072 TKO_Texture_Transform_Override = 0x00080000, 08073 TKO_Texture_Shader = 0x00100000, 08074 TKO_Texture_Shader_Multitexture = 0x00200000, 08075 TKO_Texture_Camera = 0x00400000, 08076 TKO_Texture_Source_Dimensions = 0x00800000, 08077 TKO_Texture_Geometry_Shader = 0x01000000 08078 }; 08079 08083 enum TKO_Texture_Param_Sources { 08084 TKO_Texture_Param_Source_U, 08085 TKO_Texture_Param_Source_UV, 08086 TKO_Texture_Param_Source_UVW, 08087 TKO_Texture_Param_Source_Object, 08088 TKO_Texture_Param_Source_World, 08089 TKO_Texture_Param_Source_Surface_Normal, 08090 TKO_Texture_Param_Source_Reflection_Vector, 08091 TKO_Texture_Param_Source_Natural_UV, 08092 TKO_Texture_Param_Source_Local_Pixels, 08093 TKO_Texture_Param_Source_Outer_Pixels, 08094 TKO_Texture_Param_Source_Local_Window, 08095 TKO_Texture_Param_Source_Outer_Window, 08096 TKO_Texture_Param_Source_Transmission_Vector, 08097 TKO_Texture_Param_Source_Sphere_Map, 08098 TKO_Texture_Param_Source_Cylinder_Map, 08099 TKO_Texture_Param_Source_Physical_Reflection_Vector 08100 }; 08101 08102 08106 enum TKO_Texture_Param_Functions { 08107 TKO_Texture_Param_Function_None, 08108 TKO_Texture_Param_Function_Sphere, 08109 TKO_Texture_Param_Function_Cylinder, 08110 TKO_Texture_Param_Function_Box 08111 }; 08112 08113 08117 enum TKO_Texture_Layouts { 08118 TKO_Texture_Layout_Rectilinear, 08119 TKO_Texture_Layout_Spherical, 08120 TKO_Texture_Layout_Hemispherical, 08121 TKO_Texture_Layout_Cubic_Faces, 08122 TKO_Texture_Layout_Unknown 08123 }; 08124 08128 enum TKO_Texture_Tilings { 08129 TKO_Texture_Tiling_None, 08130 TKO_Texture_Tiling_Clamp, 08131 TKO_Texture_Tiling_Repeat, 08132 TKO_Texture_Tiling_Mirror, 08133 TKO_Texture_Tiling_Drop 08134 }; 08135 08136 08140 enum TKO_Texture_Filters { 08141 TKO_Texture_Filter_None, 08142 TKO_Texture_Filter_Bilinear, 08143 TKO_Texture_Filter_Trilinear, 08144 TKO_Texture_Filter_MipMap, 08145 TKO_Texture_Filter_Summed_Areas, 08146 TKO_Texture_Filter_Gaussian, 08147 TKO_Texture_Filter_Stochastic, 08148 TKO_Texture_Filter_Anisotropic 08149 }; 08150 08151 08155 enum TKO_Texture_Channel_Mappings { 08156 TKO_Texture_Channel_Mapping_Red, 08157 TKO_Texture_Channel_Mapping_Green, 08158 TKO_Texture_Channel_Mapping_Blue, 08159 TKO_Texture_Channel_Mapping_Alpha, 08160 TKO_Texture_Channel_Mapping_Zero, 08161 TKO_Texture_Channel_Mapping_One, 08162 TKO_Texture_Channel_Mapping_Luminance, 08163 TKO_Texture_Channel_Mapping_None 08164 }; 08165 08166 08170 enum TKO_Texture_Application_Modes { 08171 TKO_Texture_Modulate_Set = 0x01, 08172 TKO_Texture_Decal_Set = 0x02 08173 }; 08174 08175 08177 08183 class BBINFILETK_API2 TK_Texture : public BBaseOpcodeHandler { 08184 protected: 08185 char * m_name; 08186 char * m_shader_source; 08187 char * m_image; 08188 char * m_camera; 08189 int m_name_length; 08190 int m_shader_source_length; 08191 int m_image_length; 08192 int m_camera_length; 08193 int m_flags; 08194 int m_substage; 08196 char m_param_source; 08197 char m_interpolation; 08198 char m_decimation; 08199 char m_red_mapping; 08200 char m_green_mapping; 08201 char m_blue_mapping; 08202 char m_alpha_mapping; 08203 char m_param_function; 08204 char m_layout; 08205 char m_tiling; 08206 float m_value_scale[2]; 08207 int m_source_dimensions[3]; 08208 char * m_transform; 08209 char m_apply_mode; 08210 char m_param_offset; 08212 void set_name (int length); 08213 void set_name (char const * name); 08214 void set_image (int length); 08215 void set_image (char const * image); 08216 void set_transform (int length); 08217 void set_transform (char const * transform); 08218 08219 public: 08221 TK_Texture () : BBaseOpcodeHandler (TKE_Texture), 08222 m_name (0), m_shader_source(0), m_image (0), m_camera (0), 08223 m_name_length (0), m_shader_source_length(0), m_image_length (0), m_camera_length (0), 08224 m_transform (0) { 08225 Reset(); 08226 } 08227 ~TK_Texture(); 08228 08229 TK_Status Read (BStreamFileToolkit & tk); 08230 TK_Status Write (BStreamFileToolkit & tk); 08231 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08232 08233 TK_Status ReadAscii (BStreamFileToolkit & tk); 08234 TK_Status WriteAscii (BStreamFileToolkit & tk); 08235 08236 void Reset (); 08237 08239 void SetName (char const * name) { set_name (name); } 08241 void SetName (int length) { set_name (length); } 08243 char const * GetName () const { return m_name; } 08245 char * GetName () { return m_name; } 08246 08248 void SetShaderSource (char const * shader_source); 08250 void SetShaderSource (int length); 08252 char const * GetShaderSource () const { return m_shader_source; } 08254 char * GetShaderSource () { return m_shader_source; } 08255 08257 void SetImage (char const * image) { set_image (image); } 08259 void SetImage (int length) { set_image (length); } 08261 char const * GetImage () const { return m_image; } 08263 char * GetImage () { return m_image; } 08264 08266 void SetCamera (char const * camera); 08268 void SetCamera (int length); 08270 char const * GetCamera () const { return m_camera; } 08272 char * GetCamera () { return m_camera; } 08273 08275 void SetFlags (int f) { 08276 m_flags = f; 08277 if ((f & TKO_Texture_Extended_Mask) != 0) 08278 m_flags |= TKO_Texture_Extended; 08279 } 08281 int GetFlags () const { return m_flags; } 08282 08284 void SetParameterSource (int p) { m_param_source = (char)p; } 08286 int GetParameterSource () const { return (int)m_param_source; } 08287 08289 void SetInterpolation (int p) { m_interpolation = (char)p; } 08291 int GetInterpolation () const { return (int)m_interpolation; } 08292 08294 void SetDecimation (int p) { m_decimation = (char)p; } 08296 int GetDecimation () const { return (int)m_decimation; } 08297 08299 void SetRedMapping (int p) { m_red_mapping = (char)p; } 08301 int GetRedMapping () const { return (int)m_red_mapping; } 08302 08304 void SetGreenMapping (int p) { m_green_mapping = (char)p; } 08306 int GetGreenMapping () const { return (int)m_green_mapping; } 08307 08309 void SetBlueMapping (int p) { m_blue_mapping = (char)p; } 08311 int GetBlueMapping () const { return (int)m_blue_mapping; } 08312 08314 void SetAlphaMapping (int p) { m_alpha_mapping = (char)p; } 08316 int GetAlphaMapping () const { return (int)m_alpha_mapping; } 08317 08319 void SetParameterFunction (int p) { m_param_function = (char)p; } 08321 int GetParameterFunction () const { return (int)m_param_function; } 08322 08324 void SetLayout (int p) { m_layout = (char)p; } 08326 int GetLayout () const { return (int)m_layout; } 08327 08329 void SetTiling (int p) { m_tiling = (char)p; } 08331 int GetTiling () const { return (int)m_tiling; } 08332 08334 void SetValueScale (float v1, float v2) { m_value_scale[0] = v1; m_value_scale[1] = v2; } 08336 float const * GetValueScale () const { return m_value_scale; } 08337 08339 void SetApplicationMode (int p) { m_apply_mode = (char)p; } 08341 int GetApplicationMode () const { return (int)m_apply_mode; } 08342 08344 void SetParameterOffset (int p) { m_param_offset = (char)p; } 08346 int GetParameterOffset () const { return (int)m_param_offset; } 08347 08352 void SetTransform (char const * transform) { set_transform (transform); } 08357 void SetTransform (int length) { set_transform (length); } 08359 char const * GetTransform () const { return m_transform; } 08361 char * GetTransform () { return m_transform; } 08362 }; 08363 08364 08368 enum TKO_Thumbnail_Formats { 08369 TKO_Thumbnail_RGB = 0, 08370 TKO_Thumbnail_RGBA = 1, 08371 08372 TKO_Thumbnail_Invalid = 0xFF 08373 }; 08374 08376 08382 class BBINFILETK_API2 TK_Thumbnail : public BBaseOpcodeHandler { 08383 protected: 08384 unsigned char * m_bytes; 08385 int m_allocated; 08386 int m_size[2]; 08387 unsigned char m_format; 08389 public: 08391 TK_Thumbnail() : BBaseOpcodeHandler (TKE_Thumbnail), m_bytes (0), m_allocated (0), m_format (TKO_Thumbnail_Invalid) {} 08392 ~TK_Thumbnail(); 08393 08394 TK_Status Read (BStreamFileToolkit & tk); 08395 TK_Status Write (BStreamFileToolkit & tk); 08396 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08397 08398 TK_Status ReadAscii (BStreamFileToolkit & tk); 08399 TK_Status WriteAscii (BStreamFileToolkit & tk); 08400 08401 TK_Status Execute (BStreamFileToolkit & tk); 08402 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant); 08403 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 08404 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 08405 void Reset (); 08406 08411 void SetBytes (int size, unsigned char const * bytes = 0); 08413 unsigned char const * GetBytes () const { return m_bytes; } 08415 unsigned char * GetBytes () { return m_bytes; } 08416 08418 void SetSize (int w, int h) { m_size[0] = w; m_size[1] = h; } 08420 void SetSize (int const s[]) { m_size[0] = s[0]; m_size[1] = s[1]; } 08422 int const * GetSize () const { return m_size; } 08423 08425 void SetFormat (int f) { m_format = (unsigned char)f; } 08427 int GetFormat () const { return (int)m_format; } 08428 }; 08429 08430 08432 08434 08439 class BBINFILETK_API2 TK_Glyph_Definition : public BBaseOpcodeHandler { 08440 protected: 08441 int m_name_length; 08442 int m_size; 08443 char * m_name; 08444 char * m_data; 08446 public: 08448 TK_Glyph_Definition () : BBaseOpcodeHandler (TKE_Glyph_Definition), 08449 m_name_length (0), m_size (0), 08450 m_name (0), m_data (0) {} 08451 ~TK_Glyph_Definition(); 08452 08453 TK_Status Read (BStreamFileToolkit & tk); 08454 TK_Status Write (BStreamFileToolkit & tk); 08455 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08456 08457 TK_Status ReadAscii (BStreamFileToolkit & tk); 08458 TK_Status WriteAscii (BStreamFileToolkit & tk); 08459 08460 void Reset (); 08461 08463 void SetName (char const * name); 08465 void SetName (int length); 08467 char const * GetName () const { return m_name; } 08469 char * GetName () { return m_name; } 08470 08472 void SetDefinition (int size, char const * data = 0); 08474 int GetDefinitionSize () const { return m_size; } 08476 char const * GetDefinition () const { return m_data; } 08478 char * GetDefinition () { return m_data; } 08479 }; 08480 08481 08483 08488 class BBINFILETK_API2 TK_Named_Style_Def : public BBaseOpcodeHandler { 08489 protected: 08490 int m_name_length; 08491 char * m_name; 08493 int m_segment_length; 08494 char * m_segment; 08496 int m_cond_length; 08497 int m_cond_allocated; 08498 char * m_condition; 08500 ID_Key m_key; 08501 BBaseOpcodeHandler * m_referee; 08502 bool m_follow; 08503 08504 public: 08506 TK_Named_Style_Def () : BBaseOpcodeHandler (TKE_Named_Style_Def), 08507 m_name_length (0), m_name (0), 08508 m_segment_length (0), m_segment (0) , 08509 m_cond_length (0), m_cond_allocated (0), m_condition (0), 08510 m_key(-1), m_referee(0), m_follow(true) {} 08511 ~TK_Named_Style_Def(); 08512 08513 TK_Status Read (BStreamFileToolkit & tk); 08514 TK_Status Write (BStreamFileToolkit & tk); 08515 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08516 08517 TK_Status ReadAscii (BStreamFileToolkit & tk); 08518 TK_Status WriteAscii (BStreamFileToolkit & tk); 08519 08520 void Reset (); 08521 08523 void SetName (char const * name); 08525 void SetName (int length); 08527 char const * GetName () const { return m_name; } 08529 char * GetName () { return m_name; } 08530 08535 void SetSegment (char const * segment); 08540 void SetSegment (int length); 08544 char const * GetSegment () const { return m_segment; } 08549 char * GetSegment () { return m_segment; } 08550 }; 08551 08553 08558 class BBINFILETK_API2 TK_Line_Style : public BBaseOpcodeHandler { 08559 protected: 08560 int m_name_length; 08561 int m_definition_length; 08562 char * m_name; 08563 char * m_definition; 08565 public: 08567 TK_Line_Style () : BBaseOpcodeHandler (TKE_Line_Style), 08568 m_name_length (0), m_definition_length (0), 08569 m_name (0), m_definition (0) {} 08570 ~TK_Line_Style(); 08571 08572 TK_Status Read (BStreamFileToolkit & tk); 08573 TK_Status Write (BStreamFileToolkit & tk); 08574 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08575 08576 TK_Status ReadAscii (BStreamFileToolkit & tk); 08577 TK_Status WriteAscii (BStreamFileToolkit & tk); 08578 08579 void Reset (); 08580 08582 void SetName (char const * name); 08584 void SetName (int length); 08586 char const * GetName () const { return m_name; } 08588 char * GetName () { return m_name; } 08589 08591 void SetDefinition (char const * def); 08593 void SetDefinition (int length); 08595 char const * GetDefinition () const { return m_definition; } 08597 char * GetDefinition () { return m_definition; } 08598 }; 08599 08601 08603 08608 class BBINFILETK_API TK_Clip_Rectangle : public BBaseOpcodeHandler { 08609 protected: 08610 char m_options; 08611 float m_rect[4]; 08613 public: 08615 TK_Clip_Rectangle () 08616 : BBaseOpcodeHandler (TKE_Clip_Rectangle), m_options (0) {} 08617 08618 TK_Status Read (BStreamFileToolkit & tk); 08619 TK_Status Write (BStreamFileToolkit & tk); 08620 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08621 08622 TK_Status ReadAscii (BStreamFileToolkit & tk); 08623 TK_Status WriteAscii (BStreamFileToolkit & tk); 08624 08625 void Reset (); 08626 08628 void SetRectangle (float left, float right, float bottom, float top) 08629 { m_rect[0] = left; m_rect[1] = right; m_rect[2] = bottom; m_rect[3] = top; } 08631 void SetRectangle (float const * rect) 08632 { SetRectangle (rect[0], rect[1], rect[2], rect[3]); } 08634 float const * GetRectangle () const { return m_rect; } 08635 08637 void SetOptions (int o) { m_options = (char)o; } 08639 int GetOptions () const { return (int)m_options; } 08640 }; 08641 08643 08647 enum TKO_Clip_Region_Options { 08648 TKO_Clip_Region_World_Space = 0x01, 08649 TKO_Clip_Region_Window_Space = 0x02, 08650 TKO_Clip_Region_Object_Space = 0x10, 08651 TKO_Clip_Region_Clip = 0x04, 08652 TKO_Clip_Region_Mask = 0x08 08653 }; 08654 08656 08661 class BBINFILETK_API TK_Clip_Region : public BBaseOpcodeHandler { 08662 protected: 08663 char m_options; 08664 int m_count; 08665 float * m_points; 08666 double * m_dpoints; 08667 BBaseOpcodeHandler * m_complex; 08670 public: 08672 TK_Clip_Region () 08673 : BBaseOpcodeHandler (TKE_Clip_Region), m_options (0), m_count (0), m_points (0), m_dpoints (0), m_complex (0) {} 08674 ~TK_Clip_Region(); 08675 08676 TK_Status Read (BStreamFileToolkit & tk); 08677 TK_Status Write (BStreamFileToolkit & tk); 08678 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08679 08680 TK_Status ReadAscii (BStreamFileToolkit & tk); 08681 TK_Status WriteAscii (BStreamFileToolkit & tk); 08682 08683 void Reset (); 08684 08689 void SetPoints (int count, float const points[] = 0); 08691 float const * GetPoints () const { return m_points; } 08693 float * GetPoints () { return m_points; } 08694 08699 void SetDPoints (int count, double const points[] = 0); 08701 double const * GetDPoints () const { return m_dpoints; } 08703 double * GetDPoints () { return m_dpoints; } 08704 08705 08707 int GetCount () const { return m_count; } 08708 08709 08711 void SetOptions (int o) { m_options = (char)o; } 08713 int GetOptions () const { return (int)m_options; } 08714 }; 08715 08716 08718 08720 08725 class BBINFILETK_API TK_Complex_Clip_Region : public BBaseOpcodeHandler { 08726 protected: 08727 char m_options; 08728 int m_loops; 08729 int m_total; 08730 int * m_lengths; 08731 float * m_points; 08732 double * m_dpoints; 08734 public: 08736 TK_Complex_Clip_Region () 08737 : BBaseOpcodeHandler (TKE_Complex_Clip_Region), m_options (0), m_loops (0), m_total (0), 08738 m_lengths (0), m_points (0), m_dpoints (0) {} 08739 ~TK_Complex_Clip_Region(); 08740 08741 TK_Status Read (BStreamFileToolkit & tk); 08742 TK_Status Write (BStreamFileToolkit & tk); 08743 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08744 08745 TK_Status ReadAscii (BStreamFileToolkit & tk); 08746 TK_Status WriteAscii (BStreamFileToolkit & tk); 08747 08748 void Reset (); 08749 08754 void SetPoints (int count, float const points[] = 0); 08756 float const * GetPoints () const { return m_points; } 08758 float * GetPoints () { return m_points; } 08759 08764 void SetDPoints (int count, double const points[] = 0); 08766 double const * GetDPoints () const { return m_dpoints; } 08768 double * GetDPoints () { return m_dpoints; } 08769 08770 08775 void SetLengths (int count, int const lengths[] = 0); 08777 int const * GetLengths () const { return m_lengths; } 08779 int * GetLengths () { return m_lengths; } 08780 08781 08783 int GetTotal () const { return m_total; } 08785 int GetLoops () const { return m_loops; } 08786 08787 08789 void SetOptions (int o) { m_options = (char)o; } 08791 int GetOptions () const { return (int)m_options; } 08792 }; 08793 08794 08796 08798 08814 class BBINFILETK_API2 TK_User_Data : public BBaseOpcodeHandler { 08815 protected: 08816 int m_size; 08817 unsigned char * m_data; 08818 int m_buffer_size; 08820 08821 void set_data (int size, unsigned char const * bytes = 0); 08822 08823 public: 08825 TK_User_Data () 08826 : BBaseOpcodeHandler (TKE_Start_User_Data), m_size (0), m_data (0), m_buffer_size(0) {} 08827 ~TK_User_Data(); 08828 08829 TK_Status Read (BStreamFileToolkit & tk); 08830 TK_Status Write (BStreamFileToolkit & tk); 08831 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08832 08833 TK_Status ReadAscii (BStreamFileToolkit & tk); 08834 TK_Status WriteAscii (BStreamFileToolkit & tk); 08835 08836 TK_Status Execute (BStreamFileToolkit & tk); 08837 void Reset (); 08838 08843 void SetUserData (int size, unsigned char const * bytes = 0) { set_data (size, bytes); } 08845 unsigned char const * GetUserData () const { return m_data; } 08847 unsigned char * GetUserData () { return m_data; } 08849 int GetSize () const { return m_size; } 08850 08852 void Resize (int size); 08853 08855 void SetSize (int size); 08856 }; 08857 08858 08860 08862 08874 class BBINFILETK_API2 TK_Material : public BBaseOpcodeHandler { 08875 protected: 08876 int m_total_size; 08877 08880 struct vlist_s *m_data; 08881 08882 public: 08884 TK_Material () : BBaseOpcodeHandler (TKE_Material), m_total_size(0), m_data(0) {} 08885 ~TK_Material(); 08886 08887 TK_Status Read (BStreamFileToolkit & tk); 08888 TK_Status Write (BStreamFileToolkit & tk); 08889 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08890 void Reset (); 08891 08892 TK_Status PushUserData (char const *buffer, int buffer_size, bool tally_total_size = true); 08893 TK_Status GetBlock (char const **ptr, int *buffer_size); 08894 }; 08895 08897 08902 class BBINFILETK_API TK_XML : public BBaseOpcodeHandler { 08903 protected: 08904 int m_size; 08905 char * m_data; 08907 public: 08909 TK_XML (): BBaseOpcodeHandler (TKE_XML), m_size (0), m_data (0) {} 08910 ~TK_XML(); 08911 08912 TK_Status Read (BStreamFileToolkit & tk); 08913 TK_Status Write (BStreamFileToolkit & tk); 08914 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08915 08916 TK_Status ReadAscii (BStreamFileToolkit & tk); 08917 TK_Status WriteAscii (BStreamFileToolkit & tk); 08918 08919 TK_Status Execute (BStreamFileToolkit & tk); 08920 void Reset (); 08921 08926 void SetXML (int size, char const * data = 0); 08930 void AppendXML (int size, char const * data = 0); 08932 char const * GetXML () const { return m_data; } 08934 char * GetXML () { return m_data; } 08936 int GetSize () const { return m_size; } 08937 }; 08938 08939 08940 08942 08948 class BBINFILETK_API TK_URL : public BBaseOpcodeHandler { 08949 protected: 08950 int m_length; 08951 int m_allocated; 08952 char * m_string; 08954 public: 08956 TK_URL () : BBaseOpcodeHandler (TKE_URL), 08957 m_length (0), m_allocated (0), m_string (0) {} 08958 ~TK_URL(); 08959 08960 TK_Status Read (BStreamFileToolkit & tk); 08961 TK_Status Write (BStreamFileToolkit & tk); 08962 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08963 08964 TK_Status ReadAscii (BStreamFileToolkit & tk); 08965 TK_Status WriteAscii (BStreamFileToolkit & tk); 08966 08967 void Reset (); 08968 08970 void SetString (char const * string); 08972 void SetString (int length); 08974 char const * GetString () const { return m_string; } 08976 char * GetString () { return m_string; } 08977 }; 08978 08979 08981 08987 class BBINFILETK_API TK_External_Reference : public BBaseOpcodeHandler { 08988 protected: 08989 int m_length; 08990 int m_allocated; 08991 char * m_string; 08993 public: 08994 TK_External_Reference () : BBaseOpcodeHandler (TKE_External_Reference), 08995 m_length (0), m_allocated (0), m_string (0) {} 08996 ~TK_External_Reference(); 08997 08998 TK_Status Read (BStreamFileToolkit & tk); 08999 TK_Status Write (BStreamFileToolkit & tk); 09000 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 09001 09002 TK_Status ReadAscii (BStreamFileToolkit & tk); 09003 TK_Status WriteAscii (BStreamFileToolkit & tk); 09004 09005 TK_Status Execute (BStreamFileToolkit & tk); 09006 void Reset (); 09007 09009 void SetString (char const * string); 09011 void SetString (int length); 09013 char const * GetString () const { return m_string; } 09015 char * GetString () { return m_string; } 09016 }; 09017 09018 09020 09026 class BBINFILETK_API TK_External_Reference_Unicode : public BBaseOpcodeHandler { 09027 protected: 09028 int m_length; 09029 int m_allocated; 09030 wchar_t * m_string; 09032 public: 09033 TK_External_Reference_Unicode () : BBaseOpcodeHandler (TKE_External_Reference_Unicode), 09034 m_length (0), m_allocated (0), m_string (0) {} 09035 ~TK_External_Reference_Unicode(); 09036 09037 TK_Status Read (BStreamFileToolkit & tk); 09038 TK_Status Write (BStreamFileToolkit & tk); 09039 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 09040 09041 TK_Status Execute (BStreamFileToolkit & tk); 09042 void Reset (); 09043 09045 void SetString (__wchar_t const * string); 09046 #ifdef _MSC_VER 09047 void SetString (unsigned short const * string); 09048 #endif 09049 09050 void SetString (int length); 09052 wchar_t const * GetString () const { return m_string; } 09054 wchar_t * GetString () { return m_string; } 09055 }; 09056 09057 09058 #endif //BOPCODE_HANDLER 09059