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; } 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 02780 TKO_Technology_Standard = 0x01, 02781 TKO_Technology_Soft_Frame_Buffer = 0x02, 02782 TKO_Technology_Radiosity = 0x04, 02783 TKO_Technology_Ray_Trace = 0x08, 02784 TKO_Technology_Mask = 0x0F, 02785 02786 TKO_Quantization_Threshold = 0x10, 02787 TKO_Quantization_Dither = 0x20, 02788 TKO_Quantization_Error_Diffusion = 0x40, 02789 TKO_Quantization_Mask = 0xF0, 02790 02791 TKO_Buffer_Size_Limit = 0x01, 02792 TKO_Buffer_Retention = 0x02, 02793 TKO_Buffer_Color_Depth_Match = 0x04, 02794 TKO_Buffer_Color_Depth_Full = 0x08, 02795 02796 TKO_Antialias_Screen_On = 0x01, 02797 TKO_Antialias_Lines_On = 0x02, 02798 TKO_Antialias_Text_On = 0x04, 02799 TKO_Antialias_All_On = 0x07, 02800 TKO_Antialias_Screen_Off = 0x10, 02801 TKO_Antialias_Lines_Off = 0x20, 02802 TKO_Antialias_Text_Off = 0x40, 02803 TKO_Antialias_All_Off = 0x70, 02804 02805 TKO_Hidden_Line_Visibility_On = 0x00000001, 02806 TKO_Hidden_Line_Visibility_Off = 0x00000002, 02807 TKO_Hidden_Line_Pattern = 0x00000004, 02808 TKO_Hidden_Line_Face_Displacement = 0x00000008, 02809 TKO_Hidden_Line_Dim_Factor = 0x00000010, 02810 TKO_Hidden_Line_Render_Faces_On = 0x00000020, 02811 TKO_Hidden_Line_Render_Faces_Off = 0x00000040, 02812 TKO_Hidden_Line_Extended = 0x00000080, 02813 TKO_Hidden_Line_Extended_Mask = 0xFFFFFF00, 02814 TKO_Hidden_Line_Extended_Shift = 8, 02815 TKO_Hidden_Line_Silhouette_Cleanup_On = 0x00000100, 02816 TKO_Hidden_Line_Silhouette_Cleanup_Off = 0x00000200, 02817 TKO_Hidden_Line_Extended2 = 0x00008000, 02818 TKO_Hidden_Line_Extended2_Mask = 0xFFFF0000, 02819 TKO_Hidden_Line_Extended2_Shift = 16, 02820 TKO_Hidden_Line_Color = 0x00010000, 02821 TKO_Hidden_Line_Weight = 0x00020000, 02822 TKO_Hidden_Line_Image_Outline_On = 0x00040000, 02823 TKO_Hidden_Line_Image_Outline_Off = 0x00080000, 02824 TKO_Hidden_Line_HSR_Algorithm = 0x00100000, 02825 TKO_Hidden_Line_Render_Text_On = 0x00200000, 02826 TKO_Hidden_Line_Render_Text_Off = 0x00400000, 02827 TKO_Hidden_Line_Transparency_Cutoff = 0x00800000, 02828 TKO_Hidden_Line_Remove_Duplicates_On = 0x01000000, 02829 TKO_Hidden_Line_Remove_Duplicates_Off = 0x02000000, 02830 02831 TKO_Contour_Face_Visibility_On = 0x0001, 02832 TKO_Contour_Face_Visibility_Off = 0x0002, 02833 TKO_Contour_Isoline_Visibility_On = 0x0004, 02834 TKO_Contour_Isoline_Visibility_Off = 0x0008, 02835 TKO_Contour_Visibility_Mask = 0x000F, 02836 TKO_Contour_Value_Adjustment = 0x0010, 02837 02838 TKO_Contour_Adjustment_None = 0, 02839 TKO_Contour_Adjustment_Normalized = 1, 02840 TKO_Contour_Adjustment_Explicit = 2, 02841 02842 TKO_Isoline_Positions = 0x0001, 02843 TKO_Isoline_Colors = 0x0002, 02844 TKO_Isoline_Patterns = 0x0004, 02845 TKO_Isoline_Weights = 0x0008, 02846 TKO_Isoline_Lighting_On = 0x0010, 02847 TKO_Isoline_Lighting_Off = 0x0020, 02848 02849 TKO_Isoline_Positions_Default = 0, 02850 TKO_Isoline_Positions_Repeat = 1, 02851 TKO_Isoline_Positions_Explicit = 2, 02852 02853 TKO_Tint_On = 0x0001, 02854 TKO_Tint_Off = 0x0002, 02855 TKO_Tint_Range = 0x0004, 02856 TKO_Tint_Color = 0x0008, 02857 TKO_Tint_Effect = 0x0010, 02858 02859 TKO_Tint_Effect_Grayscale = 1, 02860 TKO_Tint_Effect_Modulate = 2, 02861 TKO_Tint_Effect_Modulate_Gray = 3, 02862 TKO_Tint_Effect_Tone = 4, 02863 02864 TKO_LOD_Conserve_Memory = 0x00000001, 02865 TKO_LOD_Screen_Space = 0x00000002, 02866 TKO_LOD_Physical = 0x00000004, 02867 TKO_LOD_Tolerance_FRU = 0x00000008, 02868 TKO_LOD_Tolerance_ORU = 0x00000010, 02869 TKO_LOD_Preprocess = 0x00000020, 02870 TKO_LOD_Bounding_Current = 0x00000040, 02871 TKO_LOD_Bounding_Explicit = 0x00000080, 02872 TKO_LOD_Ratio = 0x00000100, 02873 TKO_LOD_Threshold = 0x00000200, 02874 TKO_LOD_Min_Triangle_Count = 0x00000400, 02875 TKO_LOD_Clamp = 0x00000800, 02876 TKO_LOD_Num_Levels = 0x00001000, 02877 TKO_LOD_Max_Degree = 0x00002000, 02878 TKO_LOD_Tolerance = 0x00004000, 02879 TKO_LOD_Usefulness_Heuristic = 0x00008000, 02880 TKO_LOD_Calculation_Cutoff = 0x00010000, 02881 TKO_LOD_Fallback = 0x00020000, 02882 TKO_LOD_Collapse_Vertices = 0x00040000, 02883 TKO_LOD_Algorithm = 0x00080000, 02884 TKO_LOD_Mode_Segment = 0x00100000, 02885 02886 TKO_LOD_Threshold_Tris_Per_Pix_Sq = 1, 02887 TKO_LOD_Threshold_Tris_Per_CM_Sq = 2, 02888 TKO_LOD_Threshold_Percent_Area = 3, 02889 TKO_LOD_Threshold_Distance = 4, 02890 02891 TKO_LOD_Algorithm_Fast = 1, 02892 TKO_LOD_Algorithm_Nice = 2, 02893 02894 TKO_LOD_Heur_Is_Diagonal = 0x00, 02895 TKO_LOD_Heur_Is_Per_Triangle = 0x01, 02896 TKO_LOD_Heur_Is_Ratio = 0x02, 02897 TKO_LOD_Heur_Is_Volume = 0x04, 02898 TKO_LOD_Heur_Triangle_Size = 0x08, 02899 02900 TKO_LOD_Heur_Diag = 0, 02901 TKO_LOD_Heur_Tri_Diag = 1, 02902 TKO_LOD_Heur_Diag_Ratio = 2, 02903 TKO_LOD_Heur_Tri_Diag_Ratio = 3, 02904 TKO_LOD_Heur_Vol = 4, 02905 TKO_LOD_Heur_Tri_Vol = 5, 02906 TKO_LOD_Heur_Vol_Ratio = 6, 02907 TKO_LOD_Heur_Tri_Vol_Ratio = 7, 02908 02909 TKO_LOD_Fallback_None = 0, 02910 TKO_LOD_Fallback_Bounding = 1, 02911 TKO_LOD_Fallback_Coarsest = 2, 02912 TKO_LOD_Fallback_Coarsest_None = 3, 02913 TKO_LOD_Fallback_Coarsest_Bounding = 4, 02914 TKO_LOD_Fallback_Bounding_None = 5, 02915 02916 TKO_NURBS_Curve_Budget = 0x0001, 02917 TKO_NURBS_Curve_Continued_Budget = 0x0002, 02918 TKO_NURBS_Curve_View_Dependent = 0x0004, 02919 TKO_NURBS_Curve_Max_Deviation = 0x0008, 02920 TKO_NURBS_Surface_Budget = 0x0010, 02921 TKO_NURBS_Surface_Trim_Budget = 0x0020, 02922 TKO_NURBS_Surface_Max_Facet_Width = 0x0040, 02923 TKO_NURBS_Curve_Max_Angle = 0x1000, 02924 TKO_NURBS_Curve_Max_Length = 0x2000, 02925 02926 TKO_NURBS_Extended = 0x0080, 02927 TKO_NURBS_Extended_Mask = 0xFF00, 02928 TKO_NURBS_Extended_Shift = 8, 02929 02930 TKO_NURBS_Surface_Max_Facet_Angle = 0x0100, 02931 TKO_NURBS_Surface_Max_Facet_Deviation 02932 = 0x0200, 02933 TKO_NURBS_Surface_Max_Trim_Curve_Deviation 02934 = 0x0400, 02935 02936 TKO_NURBS_Curve_Mask = 0xF00F, 02937 TKO_NURBS_Surface_Mask = 0x0FF0, 02938 02939 TKO_Tessellation_Cylinder = 0x01, 02940 TKO_Tessellation_Sphere = 0x02, 02941 02942 TKO_Geometry_Options_Dihedral = 0x01, 02943 TKO_Geometry_Options_Reverse_PolyCylinder_Radii = 0x02, 02944 TKO_Geometry_Options_No_Reverse_PolyCylinder_Radii = 0x04, 02945 TKO_Geometry_Options_Reverse_PolyCylinder_Colors = 0x08, 02946 TKO_Geometry_Options_No_Reverse_PolyCylinder_Colors = 0x10 02947 }; 02948 02949 02950 #if 0 02951 class BBINFILETK_API TK_Radiosity_RayTrace_Options : public BBaseOpcodeHandler { 02952 protected: 02953 02954 public: 02955 TK_Radiosity_RayTrace_Options () : BBaseOpcodeHandler (TKE_Radiosity_RayTrace_Options) {} 02956 ~TK_Radiosity_RayTrace_Options () {} 02957 02958 TK_Status Read (BStreamFileToolkit & tk); 02959 TK_Status Write (BStreamFileToolkit & tk); 02960 02961 TK_Status ReadAscii (BStreamFileToolkit & tk); 02962 TK_Status WriteAscii (BStreamFileToolkit & tk); 02963 }; 02964 #endif 02965 02966 02968 02974 class BBINFILETK_API TK_Rendering_Options : public BBaseOpcodeHandler { 02975 protected: 02976 int m_mask[3]; 02977 int m_value[3]; 02978 02979 unsigned char m_hsr; 02980 unsigned char m_tq; 02981 int m_debug; 02982 int m_face_displacement; 02983 int m_vertex_displacement; 02984 02985 float m_fog_limits[2]; 02986 02987 Lock_Masks m_lock; 02988 Lock_Masks m_forced; 02989 02990 unsigned char m_buffer_options_mask; 02991 unsigned char m_buffer_options_value; 02992 int m_buffer_size_limit; 02993 02994 int m_hlr_options; 02995 float m_hlr_dim_factor; 02996 float m_hlr_face_displacement; 02997 float m_hlr_transparency_cutoff; 02998 int m_hlr_line_pattern; 02999 float m_hlr_color[3]; 03000 float m_hlr_weight; 03001 unsigned char m_hlr_weight_units; 03002 unsigned char m_hlr_hsr_algorithm; 03003 03004 unsigned short m_contour_options; 03005 unsigned short m_isoline_options; 03006 char m_contour_value_adjustment; 03007 float m_contour_value_scale; 03008 float m_contour_value_translate; 03009 char m_isoline_position_type; 03010 int m_isoline_position_count; 03011 float * m_isoline_positions; 03012 int m_isoline_color_count; 03013 float * m_isoline_colors; 03014 int m_isoline_pattern_count; 03015 char ** m_isoline_patterns; 03016 int m_isoline_weight_count; 03017 float * m_isoline_weights_value; 03018 unsigned char * m_isoline_weights_unit; 03019 03020 unsigned short m_tint_options; 03021 float m_tint_color[3]; 03022 float m_tint_range[2]; 03023 char m_tint_effect; 03024 03025 int m_lod_options_mask; 03026 int m_lod_options_value; 03027 char m_lod_algorithm; 03028 char m_num_ratios; 03029 float m_ratio[8]; 03030 char m_num_thresholds; 03031 float m_threshold[8]; 03032 char m_threshold_type; 03033 int m_min_triangle_count; 03034 unsigned char m_clamp; 03035 unsigned char m_num_levels; 03036 int m_max_degree; 03037 float m_tolerance; 03038 float m_bounding[6]; 03039 char m_num_cutoffs; 03040 float m_cutoff[8]; 03041 unsigned char m_heuristic; 03042 unsigned char m_fallback; 03043 03044 int m_nurbs_options_mask; 03045 int m_nurbs_options_value; 03046 int m_curve_budget; 03047 int m_curve_continued_budget; 03048 int m_surface_budget; 03049 int m_surface_trim_budget; 03050 float m_surface_max_trim_curve_deviation; 03051 float m_surface_max_facet_angle; 03052 float m_surface_max_facet_deviation; 03053 float m_surface_max_facet_width; 03054 float m_curve_max_angle; 03055 float m_curve_max_deviation; 03056 float m_curve_max_length; 03057 03058 float m_stereo_separation; 03059 float m_stereo_distance; 03060 03061 unsigned char m_tessellations; 03062 char m_num_cylinder; 03063 char m_cylinder[8]; 03064 char m_num_sphere; 03065 char m_sphere[8]; 03066 03067 float m_gooch_color_range[2]; 03068 float m_gooch_diffuse_weight; 03069 char * m_gooch_color_map_segment; 03070 int m_gooch_color_map_segment_length; 03071 unsigned short m_transparency_options; 03072 03073 unsigned char m_cut_geometry; 03074 unsigned char m_cut_geometry_level; 03075 unsigned char m_cut_geometry_match; 03076 float m_cut_geometry_tolerance; 03077 03078 unsigned short m_simple_shadow; 03079 unsigned char m_simple_shadow_blur; 03080 unsigned short m_simple_shadow_resolution; 03081 float m_simple_shadow_plane[4]; 03082 float m_simple_shadow_light[3]; 03083 float m_simple_shadow_color[3]; 03084 float m_simple_shadow_opacity; 03085 03086 unsigned short m_shadow_map; 03087 unsigned short m_shadow_map_resolution; 03088 unsigned char m_shadow_map_samples; 03089 03090 unsigned short m_simple_reflection; 03091 float m_simple_reflection_plane[4]; 03092 float m_simple_reflection_opacity; 03093 int m_simple_reflection_blur; 03094 float m_simple_reflection_hither; 03095 float m_simple_reflection_yon; 03096 int m_simple_reflection_visibility_mask; 03097 int m_simple_reflection_visibility_value; 03098 03099 float m_depth_range[2]; 03100 float m_screen_range[4]; 03101 float m_ambient_up_vector[3]; 03102 float m_image_scale[2]; 03103 unsigned short m_mask_transform; 03104 03105 unsigned char m_geometry_options; 03106 float m_dihedral; 03107 03108 float m_image_tint_color[3]; 03109 float m_texture_tint_color[3]; 03110 unsigned char m_depth_peeling_layers; 03111 float m_depth_peeling_min_area; 03112 unsigned char m_depth_peeling_algorithm; 03113 03114 int m_general_displacement; 03115 int m_join_cutoff_angle; 03116 int m_edge_join_cutoff_angle; 03117 float m_vertex_decimation; 03118 unsigned char m_display_list_level; 03119 unsigned char m_antialias; 03120 03121 int m_extra; 03122 03123 #if 0 03124 TK_Radiosity_RayTrace_Options *m_rrt; 03125 #endif 03126 03127 public: 03129 TK_Rendering_Options (); 03130 ~TK_Rendering_Options (); 03131 03132 TK_Status Read (BStreamFileToolkit & tk); 03133 TK_Status Write (BStreamFileToolkit & tk); 03134 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 03135 03136 TK_Status ReadAscii (BStreamFileToolkit & tk); 03137 TK_Status WriteAscii (BStreamFileToolkit & tk); 03138 03139 void Reset (); 03140 03142 void SetMask (int m0, int m1=0, int m2=0) { 03143 m_mask[0] = m0; 03144 m_mask[1] = m1; 03145 m_mask[2] = m2; 03146 if (m2 != 0) 03147 m_mask[1] |= TKO_Rendo_Extended; 03148 if (m1 != 0) 03149 m_mask[0] |= TKO_Rendo_Extended; 03150 } 03152 int GetMask (int index=0) const { return m_mask[index]; } 03153 03155 void SetValue (int v0, int v1=0, int v2=0) { m_value[0] = v0; m_value[1] = v1; m_value[2] = v2; } 03157 int GetValue (int index=0) const { return m_value[index]; } 03158 03160 void SetHSR (int h) { m_hsr &= 0xF0; m_hsr |= (unsigned char)h & 0x0F; } 03162 int GetHSR () const { return (int)(m_hsr & 0x0F); } 03163 03165 void SetTransparentHSR (int t) { m_hsr &= 0x0F; m_hsr |= (unsigned char)t << 4; } 03167 int GetTransparentHSR () const { return (int)(m_hsr >> 4); } 03168 03170 void SetTransparentStyle (int s) { m_transparency_options = (unsigned short)s; } 03172 int GetTransparentStyle () const { return (int)m_transparency_options; } 03173 03175 void SetTechnology (int t) { m_tq &= 0xF0; m_tq |= (unsigned char)t & 0x0F; } 03177 int GetTechnology () const { return (int)(m_tq & 0x0F); } 03178 03180 void SetQuantization (int q) { m_tq &= 0x0F; m_tq |= (unsigned char)q << 4; } 03182 int GetQuantization () const { return (int)(m_tq >> 4); } 03183 03185 void SetDebug (int d) { m_debug = d; } 03187 int GetDebug () const { return m_debug; } 03188 03190 void SetFaceDisplacement (int d) { m_face_displacement = d; } 03192 int GetFaceDisplacement () const { return m_face_displacement; } 03193 03195 void SetVertexDisplacement (int d) { m_vertex_displacement = d; } 03197 int GetVertexDisplacement () const { return m_vertex_displacement; } 03198 03200 void SetGeneralDisplacement (int d) { m_general_displacement = d; } 03202 int GetGeneralDisplacement () const { return m_general_displacement; } 03203 03205 void SetJoinCutoffAngle (int d) { m_join_cutoff_angle = d; } 03207 int GetJoinCutoffAngle () const { return m_join_cutoff_angle; } 03208 03210 void SetFogLimits (float n, float f) { m_fog_limits[0] = n; m_fog_limits[1] = f; } 03212 void SetFogLimits (float const l[]) { SetFogLimits (l[0], l[1]); } 03214 float const * GetFogLimits () const { return m_fog_limits; } 03215 03216 03218 void SetLockMask (int m) { m_lock.mask = m; } 03220 int GetLockMask () const { return m_lock.mask; } 03221 03223 void SetLockValue (int v) { m_lock.value = v; } 03225 int GetLockValue () const { return m_lock.value; } 03226 03231 void SetVisibilityLockMask (int m) { m_lock.visibility_mask = m; } 03236 int GetVisibilityLockMask () const { return m_lock.visibility_mask; } 03237 03242 void SetVisibilityLockValue (int v) { m_lock.visibility_value = v; } 03247 int GetVisibilityLockValue () const { return m_lock.visibility_value; } 03248 03249 03254 void SetColorLockMask (int m) { m_lock.color_mask = m; } 03259 int GetColorLockMask () const { return m_lock.color_mask; } 03260 03265 void SetColorLockValue (int v) { m_lock.color_value = v; } 03270 int GetColorLockValue () const { return m_lock.color_value; } 03271 03272 03277 void SetColorFaceLockMask (int m) { m_lock.color_face_mask = (short)m; } 03282 int GetColorFaceLockMask () const { return m_lock.color_face_mask; } 03283 03288 void SetColorFaceLockValue (int v) { m_lock.color_face_value = (short)v; } 03293 int GetColorFaceLockValue () const { return m_lock.color_face_value; } 03294 03295 03300 void SetColorEdgeLockMask (int m) { m_lock.color_edge_mask = (short)m; } 03305 int GetColorEdgeLockMask () const { return m_lock.color_edge_mask; } 03306 03311 void SetColorEdgeLockValue (int v) { m_lock.color_edge_value = (short)v; } 03316 int GetColorEdgeLockValue () const { return m_lock.color_edge_value; } 03317 03318 03323 void SetColorLineLockMask (int m) { m_lock.color_line_mask = (short)m; } 03328 int GetColorLineLockMask () const { return m_lock.color_line_mask; } 03329 03334 void SetColorLineLockValue (int v) { m_lock.color_line_value = (short)v; } 03339 int GetColorLineLockValue () const { return m_lock.color_line_value; } 03340 03341 03346 void SetColorMarkerLockMask (int m) { m_lock.color_marker_mask = (short)m; } 03351 int GetColorMarkerLockMask () const { return m_lock.color_marker_mask; } 03352 03357 void SetColorMarkerLockValue (int v) { m_lock.color_marker_value = (short)v; } 03362 int GetColorMarkerLockValue () const { return m_lock.color_marker_value; } 03363 03364 03369 void SetColorTextLockMask (int m) { m_lock.color_text_mask = (short)m; } 03374 int GetColorTextLockMask () const { return m_lock.color_text_mask; } 03375 03380 void SetColorTextLockValue (int v) { m_lock.color_text_value = (short)v; } 03385 int GetColorTextLockValue () const { return m_lock.color_text_value; } 03386 03387 03392 void SetColorWindowLockMask (int m) { m_lock.color_window_mask = (short)m; } 03397 int GetColorWindowLockMask () const { return m_lock.color_window_mask; } 03398 03403 void SetColorWindowLockValue (int v) { m_lock.color_window_value = (short)v; } 03408 int GetColorWindowLockValue () const { return m_lock.color_window_value; } 03409 03410 03415 void SetColorFaceContrastLockMask (int m) { m_lock.color_face_contrast_mask = (short)m; } 03420 int GetColorFaceContrastLockMask () const { return m_lock.color_face_contrast_mask; } 03421 03426 void SetColorFaceContrastLockValue (int v) { m_lock.color_face_contrast_value = (short)v; } 03431 int GetColorFaceContrastLockValue () const { return m_lock.color_face_contrast_value; } 03432 03433 03438 void SetColorWindowContrastLockMask (int m) { m_lock.color_window_contrast_mask = (short)m; } 03443 int GetColorWindowContrastLockMask () const { return m_lock.color_window_contrast_mask; } 03444 03449 void SetColorWindowContrastLockValue (int v) { m_lock.color_window_contrast_value = (short)v; } 03454 int GetColorWindowContrastLockValue () const { return m_lock.color_window_contrast_value; } 03455 03456 03461 void SetColorBackLockMask (int m) { m_lock.color_back_mask = (short)m; } 03466 int GetColorBackLockMask () const { return m_lock.color_back_mask; } 03467 03472 void SetColorBackLockValue (int v) { m_lock.color_back_value = (short)v; } 03477 int GetColorBackLockValue () const { return m_lock.color_back_value; } 03478 03479 03484 void SetColorVertexLockMask (int m) { m_lock.color_vertex_mask = (short)m; } 03489 int GetColorVertexLockMask () const { return m_lock.color_vertex_mask; } 03490 03495 void SetColorVertexLockValue (int v) { m_lock.color_vertex_value = (short)v; } 03500 int GetColorVertexLockValue () const { return m_lock.color_vertex_value; } 03501 03502 03507 void SetColorEdgeContrastLockMask (int m) { m_lock.color_edge_contrast_mask = (short)m; } 03512 int GetColorEdgeContrastLockMask () const { return m_lock.color_edge_contrast_mask; } 03513 03518 void SetColorEdgeContrastLockValue (int v) { m_lock.color_edge_contrast_value = (short)v; } 03523 int GetColorEdgeContrastLockValue () const { return m_lock.color_edge_contrast_value; } 03524 03525 03530 void SetColorLineContrastLockMask (int m) { m_lock.color_line_contrast_mask = (short)m; } 03535 int GetColorLineContrastLockMask () const { return m_lock.color_line_contrast_mask; } 03536 03541 void SetColorLineContrastLockValue (int v) { m_lock.color_line_contrast_value = (short)v; } 03546 int GetColorLineContrastLockValue () const { return m_lock.color_line_contrast_value; } 03547 03548 03553 void SetColorMarkerContrastLockMask (int m) { m_lock.color_marker_contrast_mask = (short)m; } 03558 int GetColorMarkerContrastLockMask () const { return m_lock.color_marker_contrast_mask; } 03559 03564 void SetColorMarkerContrastLockValue (int v) { m_lock.color_marker_contrast_value = (short)v; } 03569 int GetColorMarkerContrastLockValue () const { return m_lock.color_marker_contrast_value; } 03570 03571 03576 void SetColorVertexContrastLockMask (int m) { m_lock.color_vertex_contrast_mask = (short)m; } 03581 int GetColorVertexContrastLockMask () const { return m_lock.color_vertex_contrast_mask; } 03582 03587 void SetColorVertexContrastLockValue (int v) { m_lock.color_vertex_contrast_value = (short)v; } 03592 int GetColorVertexContrastLockValue () const { return m_lock.color_vertex_contrast_value; } 03593 03594 03599 void SetColorTextContrastLockMask (int m) { m_lock.color_text_contrast_mask = (short)m; } 03604 int GetColorTextContrastLockMask () const { return m_lock.color_text_contrast_mask; } 03605 03610 void SetColorTextContrastLockValue (int v) { m_lock.color_text_contrast_value = (short)v; } 03615 int GetColorTextContrastLockValue () const { return m_lock.color_text_contrast_value; } 03616 03617 03618 03619 03621 void SetForcedLockMask (int m) { m_forced.mask = m; } 03623 int GetForcedLockMask () const { return m_forced.mask; } 03624 03626 void SetForcedLockValue (int v) { m_forced.value = v; } 03628 int GetForcedLockValue () const { return m_forced.value; } 03629 03634 void SetVisibilityForcedLockMask (int m) { m_forced.visibility_mask = m; } 03639 int GetVisibilityForcedLockMask () const { return m_forced.visibility_mask; } 03640 03645 void SetVisibilityForcedLockValue (int v) { m_forced.visibility_value = v; } 03650 int GetVisibilityForcedLockValue () const { return m_forced.visibility_value; } 03651 03652 03657 void SetColorForcedLockMask (int m) { m_forced.color_mask = m; } 03662 int GetColorForcedLockMask () const { return m_forced.color_mask; } 03663 03668 void SetColorForcedLockValue (int v) { m_forced.color_value = v; } 03673 int GetColorForcedLockValue () const { return m_forced.color_value; } 03674 03675 03680 void SetColorFaceForcedLockMask (int m) { m_forced.color_face_mask = (short)m; } 03685 int GetColorFaceForcedLockMask () const { return m_forced.color_face_mask; } 03686 03691 void SetColorFaceForcedLockValue (int v) { m_forced.color_face_value = (short)v; } 03696 int GetColorFaceForcedLockValue () const { return m_forced.color_face_value; } 03697 03698 03703 void SetColorEdgeForcedLockMask (int m) { m_forced.color_edge_mask = (short)m; } 03708 int GetColorEdgeForcedLockMask () const { return m_forced.color_edge_mask; } 03709 03714 void SetColorEdgeForcedLockValue (int v) { m_forced.color_edge_value = (short)v; } 03719 int GetColorEdgeForcedLockValue () const { return m_forced.color_edge_value; } 03720 03721 03726 void SetColorLineForcedLockMask (int m) { m_forced.color_line_mask = (short)m; } 03731 int GetColorLineForcedLockMask () const { return m_forced.color_line_mask; } 03732 03737 void SetColorLineForcedLockValue (int v) { m_forced.color_line_value = (short)v; } 03742 int GetColorLineForcedLockValue () const { return m_forced.color_line_value; } 03743 03744 03749 void SetColorMarkerForcedLockMask (int m) { m_forced.color_marker_mask = (short)m; } 03754 int GetColorMarkerForcedLockMask () const { return m_forced.color_marker_mask; } 03755 03760 void SetColorMarkerForcedLockValue (int v) { m_forced.color_marker_value = (short)v; } 03765 int GetColorMarkerForcedLockValue () const { return m_forced.color_marker_value; } 03766 03767 03772 void SetColorTextForcedLockMask (int m) { m_forced.color_text_mask = (short)m; } 03777 int GetColorTextForcedLockMask () const { return m_forced.color_text_mask; } 03778 03783 void SetColorTextForcedLockValue (int v) { m_forced.color_text_value = (short)v; } 03788 int GetColorTextForcedLockValue () const { return m_forced.color_text_value; } 03789 03790 03795 void SetColorWindowForcedLockMask (int m) { m_forced.color_window_mask = (short)m; } 03800 int GetColorWindowForcedLockMask () const { return m_forced.color_window_mask; } 03801 03806 void SetColorWindowForcedLockValue (int v) { m_forced.color_window_value = (short)v; } 03811 int GetColorWindowForcedLockValue () const { return m_forced.color_window_value; } 03812 03813 03818 void SetColorFaceContrastForcedLockMask (int m) { m_forced.color_face_contrast_mask = (short)m; } 03823 int GetColorFaceContrastForcedLockMask () const { return m_forced.color_face_contrast_mask; } 03824 03829 void SetColorFaceContrastForcedLockValue (int v) { m_forced.color_face_contrast_value = (short)v; } 03834 int GetColorFaceContrastForcedLockValue () const { return m_forced.color_face_contrast_value; } 03835 03836 03841 void SetColorWindowContrastForcedLockMask (int m) { m_forced.color_window_contrast_mask = (short)m; } 03846 int GetColorWindowContrastForcedLockMask () const { return m_forced.color_window_contrast_mask; } 03847 03852 void SetColorWindowContrastForcedLockValue (int v) { m_forced.color_window_contrast_value = (short)v; } 03857 int GetColorWindowContrastForcedLockValue () const { return m_forced.color_window_contrast_value; } 03858 03859 03864 void SetColorBackForcedLockMask (int m) { m_forced.color_back_mask = (short)m; } 03869 int GetColorBackForcedLockMask () const { return m_forced.color_back_mask; } 03870 03875 void SetColorBackForcedLockValue (int v) { m_forced.color_back_value = (short)v; } 03880 int GetColorBackForcedLockValue () const { return m_forced.color_back_value; } 03881 03882 03887 void SetColorVertexForcedLockMask (int m) { m_forced.color_vertex_mask = (short)m; } 03892 int GetColorVertexForcedLockMask () const { return m_forced.color_vertex_mask; } 03893 03898 void SetColorVertexForcedLockValue (int v) { m_forced.color_vertex_value = (short)v; } 03903 int GetColorVertexForcedLockValue () const { return m_forced.color_vertex_value; } 03904 03905 03910 void SetColorEdgeContrastForcedLockMask (int m) { m_forced.color_edge_contrast_mask = (short)m; } 03915 int GetColorEdgeContrastForcedLockMask () const { return m_forced.color_edge_contrast_mask; } 03916 03921 void SetColorEdgeContrastForcedLockValue (int v) { m_forced.color_edge_contrast_value = (short)v; } 03926 int GetColorEdgeContrastForcedLockValue () const { return m_forced.color_edge_contrast_value; } 03927 03928 03933 void SetColorLineContrastForcedLockMask (int m) { m_forced.color_line_contrast_mask = (short)m; } 03938 int GetColorLineContrastForcedLockMask () const { return m_forced.color_line_contrast_mask; } 03939 03944 void SetColorLineContrastForcedLockValue (int v) { m_forced.color_line_contrast_value = (short)v; } 03949 int GetColorLineContrastForcedLockValue () const { return m_forced.color_line_contrast_value; } 03950 03951 03956 void SetColorMarkerContrastForcedLockMask (int m) { m_forced.color_marker_contrast_mask = (short)m; } 03961 int GetColorMarkerContrastForcedLockMask () const { return m_forced.color_marker_contrast_mask; } 03962 03967 void SetColorMarkerContrastForcedLockValue (int v) { m_forced.color_marker_contrast_value = (short)v; } 03972 int GetColorMarkerContrastForcedLockValue () const { return m_forced.color_marker_contrast_value; } 03973 03974 03979 void SetColorVertexContrastForcedLockMask (int m) { m_forced.color_vertex_contrast_mask = (short)m; } 03984 int GetColorVertexContrastForcedLockMask () const { return m_forced.color_vertex_contrast_mask; } 03985 03990 void SetColorVertexContrastForcedLockValue (int v) { m_forced.color_vertex_contrast_value = (short)v; } 03995 int GetColorVertexContrastForcedLockValue () const { return m_forced.color_vertex_contrast_value; } 03996 03997 04002 void SetColorTextContrastForcedLockMask (int m) { m_forced.color_text_contrast_mask = (short)m; } 04007 int GetColorTextContrastForcedLockMask () const { return m_forced.color_text_contrast_mask; } 04008 04013 void SetColorTextContrastForcedLockValue (int v) { m_forced.color_text_contrast_value = (short)v; } 04018 int GetColorTextContrastForcedLockValue () const { return m_forced.color_text_contrast_value; } 04019 04020 04021 04022 04024 void SetBufferOptionsMask (int v) { m_buffer_options_mask = (unsigned char)v; } 04026 int GetBufferOptionsMask () const { return m_buffer_options_mask; } 04028 void SetBufferOptionsValue (int v) { m_buffer_options_value = (unsigned char) v; } 04030 int GetBufferOptionsValue () const { return m_buffer_options_value; } 04032 void SetBufferSizeLimit (int l) { m_buffer_size_limit = l; } 04034 int GetBufferSizeLimit () const { return m_buffer_size_limit; } 04035 04036 04038 void SetStereoSeparation (float s) { m_stereo_separation = s; } 04040 float GetStereoSeparation () const { return m_stereo_separation; } 04042 void SetStereoDistance (float d) { m_stereo_distance = d; } 04044 float GetStereoDistance () const { return m_stereo_distance; } 04045 04046 04048 void SetHlrOptions (int o) { 04049 m_hlr_options = o; 04050 if ((o & TKO_Hidden_Line_Extended_Mask) != 0) { 04051 m_hlr_options |= TKO_Hidden_Line_Extended; 04052 if ((o & TKO_Hidden_Line_Extended2_Mask) != 0) 04053 m_hlr_options |= TKO_Hidden_Line_Extended2; 04054 } 04055 } 04057 int GetHlrOptions () const { return m_hlr_options; } 04059 void SetHlrDimFactor (float d) { m_hlr_dim_factor = d; } 04061 float GetHlrDimFactor () const { return m_hlr_dim_factor; } 04063 void SetHlrFaceDisplacement (float d) { m_hlr_face_displacement = d; } 04065 float GetHlrFaceDisplacement () const { return m_hlr_face_displacement; } 04067 void SetHlrLinePattern (int p) { m_hlr_line_pattern = p; } 04069 int GetHlrLinePattern () const { return m_hlr_line_pattern; } 04071 void SetHlrFaceSortingAlgorithm (int a) { m_hlr_hsr_algorithm = (unsigned char)a; } 04073 float GetHlrFaceSortingAlgorithm () const { return m_hlr_hsr_algorithm; } 04074 04075 04077 void SetNURBSOptionsMask (int m) { 04078 m_nurbs_options_mask = m; 04079 if ((m & TKO_NURBS_Extended_Mask) != 0) 04080 m_nurbs_options_mask |= TKO_NURBS_Extended; 04081 } 04083 int GetNURBSOptionsMask () const { return m_nurbs_options_mask; } 04085 void SetNURBSOptionsValue (int v) { m_nurbs_options_value = v; } 04087 int GetNURBSOptionsValue () const { return m_nurbs_options_value; } 04089 void SetNURBSCurveBudget (int b) { m_curve_budget = b; } 04091 int GetNURBSCurveBudget () const { return m_curve_budget; } 04093 void SetNURBSCurveContinuedBudget (int b) { m_curve_continued_budget = b; } 04095 int GetNURBSCurveContinuedBudget () const { return m_curve_continued_budget; } 04097 void SetNURBSSurfaceBudget (int b) { m_surface_budget = b; } 04099 int GetNURBSSurfaceBudget () const { return m_surface_budget; } 04101 void SetNURBSSurfaceTrimBudget (int b) { m_surface_trim_budget = b; } 04103 int GetNURBSSurfaceTrimBudget () const { return m_surface_trim_budget; } 04104 04105 04107 void SetLodOptionsMask (int v) { m_lod_options_mask = v; } 04109 int GetLodOptionsMask () const { return m_lod_options_mask; } 04111 void SetLodOptionsValue (int v) { m_lod_options_value = v; } 04113 int GetLodOptionsValue () const { return m_lod_options_value; } 04115 void SetLodAlgorithm (int v) { m_lod_algorithm = (char)v; } 04117 int GetLodAlgorithm () const { return m_lod_algorithm; } 04119 void SetLodMinimumTriangleCount (int v) { m_min_triangle_count = v; } 04121 int GetLodMinimumTriangleCount () const { return m_min_triangle_count; } 04123 void SetLodNumLevels (int v) { m_num_levels = (unsigned char)v; } 04125 int GetLodNumLevels () const { return m_num_levels; } 04127 void SetLodClamp (int v) { m_clamp = (unsigned char)v; } 04129 int GetLodClamp () const { return m_clamp; } 04131 void SetLodMaxDegree (int v) { m_max_degree = v; } 04133 int GetLodMaxDegree () const { return m_max_degree; } 04135 void SetLodTolerance (float v) { m_tolerance = v; } 04137 float GetLodTolerance () const { return m_tolerance; } 04139 void SetLodFallback (int v) { m_fallback = (char)v; } 04141 int GetLodFallback () const { return m_fallback; } 04142 04144 void SetLodBounding (float x1, float y1, float z1, float x2, float y2, float z2) { 04145 m_bounding[0] = x1; m_bounding[1] = y1; m_bounding[2] = z1; 04146 m_bounding[3] = x2; m_bounding[4] = y2; m_bounding[5] = z2; 04147 } 04149 void SetLodBounding (float const s[], float const e[]) { 04150 SetLodBounding (s[0], s[1], s[2], e[0], e[1], e[2]); 04151 } 04153 void SetLodBounding (float const p[]) { SetLodBounding (&p[0], &p[3]); } 04155 float const * GetLodBounding () const { return m_bounding; } 04156 04158 void SetLodRatio (float r) { m_num_ratios = 1; m_ratio[0] = r; } 04160 void SetLodRatios (int c, float const r[] = 0) { 04161 m_num_ratios = (char)c; 04162 if (r != 0) { 04163 int i; 04164 for (i=0; i<c; ++i) 04165 m_ratio[i] = r[i]; 04166 } 04167 } 04169 int GetLodNumRatios () const { return m_num_ratios; } 04171 float const * GetLodRatios () const { return m_ratio; } 04173 float * GetLodRatios () { return m_ratio; } 04174 04176 void SetLodThresholdType (int v) { m_threshold_type = (char)v; } 04178 int GetLodThresholdType () const { return m_threshold_type; } 04180 void SetLodThreshold (float r) { m_num_thresholds = 1; m_threshold[0] = r; } 04182 void SetLodThresholds (int c, float const r[] = 0) { 04183 m_num_thresholds = (char)c; 04184 if (r != 0) { 04185 int i; 04186 for (i=0; i<c; ++i) 04187 m_threshold[i] = r[i]; 04188 } 04189 } 04191 int GetLodNumThresholds () const { return m_num_thresholds; } 04193 float const * GetLodThresholds () const { return m_threshold; } 04195 float * GetLodThresholds () { return m_threshold; } 04196 04198 void SetLodCutoff (float r) { m_num_cutoffs = 1; m_cutoff[0] = r; } 04200 void SetLodCutoffs (int c, float const r[] = 0) { 04201 m_num_cutoffs = (char)c; 04202 if (r != 0) { 04203 int i; 04204 for (i=0; i<c; ++i) 04205 m_cutoff[i] = r[i]; 04206 } 04207 } 04209 int GetLodNumCutoffs () const { return m_num_cutoffs; } 04211 float const * GetLodCutoffs () const { return m_cutoff; } 04213 float * GetLodCutoffs () { return m_cutoff; } 04214 04215 04217 void SetTessellationMask (int m) { m_tessellations = (unsigned char)m; } 04219 int GetTessellationMask () const { return m_tessellations; } 04221 void SetCylinderTessellation (int n) { m_num_cylinder = (char)1; m_cylinder[0] = (char)n; } 04223 void SetCylinderTessellations (int c, char const * n = 0) { 04224 m_num_cylinder = (char)c; 04225 if (n != 0) { 04226 int i; 04227 for (i=0; i<c; ++i) 04228 m_cylinder[i] = n[i]; 04229 } 04230 } 04232 int GetNumCylinderTessellations () const { return m_num_cylinder; } 04234 char const * GetCylinderTessellations () const { return m_cylinder; } 04236 char * GetCylinderTessellations () { return m_cylinder; } 04238 void SetSphereTessellation (int n) { m_num_sphere = (char)1; m_sphere[0] = (char)n; } 04240 void SetSphereTessellations (int c, char const * n = 0) { 04241 m_num_sphere = (char)c; 04242 if (n != 0) { 04243 int i; 04244 for (i=0; i<c; ++i) 04245 m_sphere[i] = n[i]; 04246 } 04247 } 04249 int GetNumSphereTessellations () const { return m_num_sphere; } 04251 char const * GetSphereTessellations () const { return m_sphere; } 04253 char * GetSphereTessellations () { return m_sphere; } 04254 04256 void SetGeometryOptionsMask (int m) { m_geometry_options = (unsigned char)m; } 04258 int GetGeometryOptionsMask () const { return m_geometry_options; } 04259 04261 void SetHardEdgeAngle (int m) { m_dihedral = (unsigned char)m; } 04263 float GetHardEdgeAngle () const { return m_dihedral; } 04264 04266 void SetMaskTransform (int m) { m_mask_transform = (unsigned short)m; } 04268 int GetMaskTransform () const { return (int)m_mask_transform; } 04269 04270 04272 void SetCutGeometry (int m) { m_cut_geometry = (unsigned char)m; } 04274 int GetCutGeometry () const { return (int)m_cut_geometry; } 04275 04277 void SetCutGeometryLevel (int m) { m_cut_geometry_level = (unsigned char)m; } 04279 int GetCutGeometryLevel () const { return (int)m_cut_geometry_level; } 04280 04282 void SetCutGeometryColorMatch (int m) { m_cut_geometry_match = (unsigned char)m; } 04284 int GetCutGeometryColorMatch () const { return (int)m_cut_geometry_match; } 04285 04287 void SetCutGeometryTolerance (float m) { m_cut_geometry_tolerance = m; } 04289 float GetCutGeometryTolerance () const { return m_cut_geometry_tolerance; } 04290 04291 04293 void SetDisplayListLevel (int m) { m_display_list_level = (unsigned char)m; } 04295 int GetDisplayListLevel () const { return (int)m_display_list_level; } 04296 04298 void SetSimpleShadow (int m) { 04299 m_simple_shadow = (unsigned short)m; 04300 if ((m & TKO_Simple_Shadow_Extended_Mask) != 0) 04301 m_simple_shadow |= TKO_Simple_Shadow_Extended; 04302 } 04304 int GetSimpleShadow () const { return (int)m_simple_shadow; } 04305 04307 void SetSimpleShadowBlur (int m) { m_simple_shadow_blur = (unsigned char)m; } 04309 int GetSimpleShadowBlur () const { return (int)m_simple_shadow_blur; } 04310 04312 void SetSimpleShadowResolution (int m) { m_simple_shadow_resolution = (unsigned short)m; } 04314 int GetSimpleShadowResolution () const { return (int)m_simple_shadow_resolution; } 04315 04317 void SetSimpleShadowLight (float x, float y, float z) { 04318 m_simple_shadow_light[0] = x; 04319 m_simple_shadow_light[1] = y; 04320 m_simple_shadow_light[2] = z; 04321 } 04323 void SetSimpleShadowLight (float const l[]) { SetSimpleShadowLight (l[0], l[1], l[2]); } 04325 float const * getSimpleShadowLight () const { return m_simple_shadow_light; } 04326 04328 void SetSimpleShadowPlane (float a, float b, float c, float d) { 04329 m_simple_shadow_plane[0] = a; 04330 m_simple_shadow_plane[1] = b; 04331 m_simple_shadow_plane[2] = c; 04332 m_simple_shadow_plane[3] = d; 04333 } 04335 void SetSimpleShadowPlane (float const p[]) { SetSimpleShadowPlane (p[0], p[1], p[2], p[3]); } 04337 float const * GetSimpleShadowPlane () const { return m_simple_shadow_plane; } 04338 04340 void SetSimpleShadowColor (float r, float g, float b) 04341 { m_simple_shadow_color[0] = r; m_simple_shadow_color[1] = g; m_simple_shadow_color[2] = b; } 04343 void SetSimpleShadowColor (float const rgb[]) { SetSimpleShadowColor (rgb[0], rgb[1], rgb[2]); } 04345 float const * GetSimpleShadowColor () const { return m_simple_shadow_color; } 04346 04348 void SetSimpleShadowOpacity (float o) { m_simple_shadow_opacity = o; } 04350 float GetSimpleShadowOpacity () const { return m_simple_shadow_opacity; } 04351 04352 04354 void SetShadowMap (int m) { m_shadow_map = (unsigned char)m; } 04356 int GetShadowMap () const { return (int)m_shadow_map; } 04357 04359 void SetShadowMapResolution (int m) { m_shadow_map_resolution = (unsigned short)m; } 04361 int GetShadowMapResolution () const { return (int)m_shadow_map_resolution; } 04362 04364 void SetShadowMapSamples (int m) { m_shadow_map_samples = (unsigned char)m; } 04366 int GetShadowMapSamples () const { return (int)m_shadow_map_samples; } 04367 04368 04370 void SetSimpleReflection (int m) { m_simple_reflection = (unsigned short)m; } 04372 int GetSimpleReflection () const { return (int)m_simple_reflection; } 04373 04375 void SetSimpleReflectionPlane (float a, float b, float c, float d) { 04376 m_simple_reflection_plane[0] = a; 04377 m_simple_reflection_plane[1] = b; 04378 m_simple_reflection_plane[2] = c; 04379 m_simple_reflection_plane[3] = d; 04380 } 04382 void SetSimpleReflectionPlane (float const p[]) { SetSimpleReflectionPlane (p[0], p[1], p[2], p[3]); } 04384 float const * GetSimpleReflectionPlane () const { return m_simple_reflection_plane; } 04385 04387 void SetSimpleReflectionOpacity (float o) { m_simple_reflection_opacity = o; } 04389 float GetSimpleReflectionOpacity () const { return m_simple_reflection_opacity; } 04390 04392 void SetSimpleReflectionVisibilityMask (int m) { m_simple_reflection_visibility_mask = m; } 04394 int GetSimpleReflectionVisibilityValue () const { return m_simple_reflection_visibility_value; } 04395 04396 04398 void SetDepthRange (float n, float f) { m_depth_range[0] = n; m_depth_range[1] = f; } 04400 void SetDepthRange (float const l[]) { SetDepthRange (l[0], l[1]); } 04402 float const * GetDepthRange () const { return m_depth_range; } 04403 04404 04406 void SetScreenRange (float l, float r, float b, float t) 04407 { m_screen_range[0] = l; m_screen_range[1] = r; m_screen_range[2] = b; m_screen_range[3] = t; } 04409 void SetScreenRange (float const l[]) { SetScreenRange (l[0], l[1], l[2], l[3]); } 04411 float const * GetScreenRange () const { return m_screen_range; } 04412 04416 void SetAmbientUpVector (float x, float y, float z) 04417 { m_ambient_up_vector[0] = x; m_ambient_up_vector[1] = y; m_ambient_up_vector[2] = z; } 04419 void SetAmbientUpVector (float const v[]) { SetAmbientUpVector (v[0], v[1], v[2]); } 04421 float const * GetAmbientUpVector () const { return m_ambient_up_vector; } 04422 04424 void SetImageScale (float x, float y) { m_image_scale[0] = x; m_image_scale[1] = y; } 04426 void SetImageScale (float const s[]) { SetImageScale (s[0], s[1]); } 04428 float const * GetImageScale () const { return m_image_scale; } 04429 04430 04432 void SetImageTintColor (float r, float g, float b) 04433 { m_image_tint_color[0] = r; m_image_tint_color[1] = g; m_image_tint_color[2] = b; } 04435 void SetImageTintColor (float const rgb[]) { SetImageTintColor (rgb[0], rgb[1], rgb[2]); } 04437 float const * GetImageTintColor () const { return m_image_tint_color; } 04438 04440 void SetDiffuseTextureTintColor (float r, float g, float b) 04441 { m_texture_tint_color[0] = r; m_texture_tint_color[1] = g; m_texture_tint_color[2] = b; } 04443 void SetDiffuseTextureTintColor (float const rgb[]) { SetDiffuseTextureTintColor (rgb[0], rgb[1], rgb[2]); } 04445 float const * GetDiffuseTextureTintColor () const { return m_texture_tint_color; } 04446 04448 void SetAntiAlias (int m) { m_antialias = (unsigned char)m; } 04450 int GetAntiAlias () const { return (int)m_antialias; } 04451 04453 void SetVertexDecimation (float f) { m_vertex_decimation = f; } 04455 float GetVertexDecimation () const { return m_vertex_decimation; } 04456 }; 04457 04459 04463 enum TKO_Heuristic_Bits { 04464 TKO_Heuristic_Hidden_Surfaces = 0x00000001, 04465 TKO_Heuristic_Backplane_Cull = 0x00000002, 04466 TKO_Heuristic_Polygon_Handedness = 0x00000004, 04467 TKO_Heuristic_Quick_Moves = 0x00000008, 04468 TKO_Heuristic_Partial_Erase = 0x00000010, 04469 TKO_Heuristic_Memory_Purge = 0x00000020, 04470 TKO_Heuristic_Related_Select_Limit = 0x00000040, 04471 TKO_Heuristic_Internal_Shell_Limit = 0x00000080, 04472 TKO_Heuristic_Clipping = 0x00000100, 04473 TKO_Heuristic_Transformations = 0x00000200, 04474 TKO_Heuristic_Intersecting_Polygons = 0x00000400, 04475 TKO_Heuristic_Polygon_Crossings = 0x00000800, 04476 TKO_Heuristic_Concave_Polygons = 0x00001000, 04477 TKO_Heuristic_Incremental_Updates = 0x00002000, 04478 TKO_Heuristic_Selection_Sorting = 0x00004000, 04479 04480 TKO_Heuristic_Extended = 0x00008000, 04481 TKO_Heuristic_Extended_Mask = 0xFFFF0000, 04482 TKO_Heuristic_Extended_Shift = 16, 04483 04484 TKO_Heuristic_Culling = 0x00010000, 04485 TKO_Heuristic_Exclude_Bounding = 0x00020000, 04486 TKO_Heuristic_Detail_Selection = 0x00040000, 04487 TKO_Heuristic_Ordered_Drawing = 0x00080000, 04488 TKO_Heuristic_Ordered_Unit = 0x00100000, 04489 TKO_Heuristic_Ordered_Weights = 0x00200000, 04490 TKO_Heuristic_Internal_Polyline_Limit = 0x00400000, 04491 TKO_Heuristic_Ordered_Grid = 0x00800000, 04492 04493 TKO_Heuristic_Selection_Level = 0x01000000, 04494 TKO_Heuristic_Static = 0x02000000, 04495 TKO_Heuristic_Force_Defer = 0x04000000, 04496 TKO_Heuristic_Model_Type = 0x08000000, 04497 TKO_Heuristic_Selection_Culling = 0x10000000, 04498 04499 TKO_Heuristic_Internal_Select_Limit = TKO_Heuristic_Internal_Shell_Limit | TKO_Heuristic_Internal_Polyline_Limit, 04500 TKO_Heuristic_Extras = TKO_Heuristic_Polygon_Handedness | TKO_Heuristic_Quick_Moves, 04501 04502 TKO_Heur_Extra_Left_Handed_Polys = 0x01, 04503 TKO_Heur_Extra_Quick_Move_Spriting = 0x02, 04504 04505 TKO_Heur_View_Frustum_Culling = 0x00000001, 04506 TKO_Heur_Obscuration_Culling = 0x00000002, 04507 TKO_Heur_Extent_Culling = 0x00000004, 04508 TKO_Heur_View_Frustum_Culling_Off = 0x00000010, 04509 TKO_Heur_Obscuration_Culling_Off = 0x00000020, 04510 TKO_Heur_Extent_Culling_Off = 0x00000040, 04511 TKO_Heur_Culling_Extended = 0x00000080, 04512 TKO_Heur_Culling_Extended_Mask = 0xFFFFFF00, 04513 TKO_Heur_Culling_Extended_Shift = 8, 04514 TKO_Heur_Obscuration_Use_Octree = 0x00000100, 04515 TKO_Heur_Maximum_Extent_Mode = 0x00000200, 04516 TKO_Heur_Vector_Culling = 0x00000400, 04517 TKO_Heur_Vector_Tolerance = 0x00000800, 04518 TKO_Heur_Vector_Culling_Off = 0x00001000, 04519 TKO_Heur_Vector_Tolerance_Off = 0x00002000, 04520 TKO_Heur_Hard_Extent_Culling = 0x00004000, 04521 TKO_Heur_Culling_Extended2 = 0x00008000, 04522 TKO_Heur_Culling_Extended2_Mask = 0xFFFF0000, 04523 TKO_Heur_Culling_Extended2_Shift = 16, 04524 TKO_Heur_Maximum_Extent_Level = 0x00010000, 04525 TKO_Heur_Hard_Extent_Culling_Off = 0x00020000, 04526 TKO_Heur_Extent_Culling_Detail_On = 0x00040000, 04527 TKO_Heur_Extent_Culling_Detail_Off = 0x00080000, 04528 TKO_Heur_Max_Distance_Culling = 0x00100000, 04529 TKO_Heur_Max_Distance_Culling_Off = 0x00200000, 04530 TKO_Heur_View_Volume_Culling = 0x00400000, 04531 TKO_Heur_View_Volume_Culling_Off = 0x00800000, 04532 04533 04534 TKO_Heur_Max_Extent_Mode_None = 0, 04535 TKO_Heur_Max_Extent_Mode_Dot = 1, 04536 TKO_Heur_Max_Extent_Mode_Bounding = 2, 04537 TKO_Heur_Max_Extent_Mode_Defer = 3, 04538 04539 TKO_Heur_Max_Extent_Level_None = 0x00, 04540 TKO_Heur_Max_Extent_Level_Segment = 0x01, 04541 TKO_Heur_Max_Extent_Level_Geometry = 0x02, 04542 TKO_Heur_Max_Extent_Level_Primitive = 0x04, 04543 TKO_Heur_Max_Extent_Level_All = 0x07, 04544 04545 TKO_Heur_Order_World_Volume = 0, 04546 TKO_Heur_Order_Screen_Extent = 1, 04547 TKO_Heur_Order_Distance = 2, 04548 TKO_Heur_Order_Divergence = 3, 04549 TKO_Heur_Order_Density = 4, 04550 TKO_Heur_Order_Priority = 5, 04551 TKO_Heur_Order_Count = 6, 04552 04553 TKO_Heur_Selection_Level_Entity = 0, 04554 TKO_Heur_Selection_Level_Segment = 1, 04555 TKO_Heur_Selection_Level_Segment_Tree = 2, 04556 04557 TKO_Heur_Model_Type_Default = 0, 04558 TKO_Heur_Model_Type_LMV = 1 04559 }; 04560 04561 04562 04564 04570 class BBINFILETK_API TK_Heuristics : public BBaseOpcodeHandler { 04571 protected: 04572 int m_mask; 04573 int m_value; 04574 04575 int m_related; 04576 int m_internal_shell; 04577 int m_internal_polyline; 04578 04579 unsigned char m_extras; 04580 int m_culling; 04581 int m_selection_culling; 04582 int m_pixel_threshold; 04583 int m_maximum_extent; 04584 int m_maximum_extent_mode; 04585 char m_maximum_extent_level; 04586 int m_hard_extent; 04587 int m_force_defer; 04588 float m_vector[3]; 04589 float m_vector_tolerance; 04590 float m_max_distance; 04591 float m_view_volume[6]; 04592 04593 unsigned char m_ordered_weights_mask; 04594 float m_ordered_weights[TKO_Heur_Order_Count]; 04595 unsigned char m_selection_level; 04596 unsigned char m_model_type; 04597 04598 public: 04600 TK_Heuristics () : BBaseOpcodeHandler (TKE_Heuristics), 04601 m_mask (0), m_value (0), m_culling(0), m_selection_culling(0), m_pixel_threshold (0), 04602 m_maximum_extent (0), m_maximum_extent_mode(0) {} 04603 ~TK_Heuristics (); 04604 04605 TK_Status Read (BStreamFileToolkit & tk); 04606 TK_Status Write (BStreamFileToolkit & tk); 04607 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04608 04609 TK_Status ReadAscii (BStreamFileToolkit & tk); 04610 TK_Status WriteAscii (BStreamFileToolkit & tk); 04611 04613 void SetMask (int m) { 04614 m_mask = m; 04615 if ((m & TKO_Heuristic_Extended_Mask) != 0) 04616 m_mask |= TKO_Heuristic_Extended; 04617 } 04619 int GetMask () const { return m_mask; } 04620 04622 void SetValue (int v) { m_value = v; } 04624 int GetValue () const { return m_value; } 04625 04627 void SetRelatedSelectionLimit (int r) { m_related = r; } 04629 int GetRelatedSelectionLimit () const { return m_related; } 04630 04632 void SetInternalSelectionLimit (int i) { m_internal_shell = m_internal_polyline = i; } 04634 int GetInternalSelectionLimit () const { return m_internal_shell; } 04635 04637 void SetInternalShellSelectionLimit (int i) { m_internal_shell = i; } 04639 int GetInternalShellSelectionLimit () const { return m_internal_shell; } 04640 04642 void SetInternalPolylineSelectionLimit (int i) { m_internal_polyline = i; } 04644 int GetInternalPolylineSelectionLimit () const { return m_internal_polyline; } 04645 04647 void SetExtras (int e) { m_extras = (unsigned char)e; } 04649 int GetExtras () const { return (int)m_extras; } 04650 04652 void SetCulling (int c) { m_culling = (unsigned short)c; } 04654 int GetCulling () const { return (int)m_culling; } 04656 void SetSelectionCulling (int c) { m_selection_culling = (unsigned short)c; } 04658 int GetSelectionCulling () const { return (int)m_selection_culling; } 04660 void SetPixelThreshold (int c) { m_pixel_threshold = c; } 04662 int GetPixelThreshold () const { return m_pixel_threshold; } 04664 void SetMaximumExtent (int c) { m_maximum_extent = c; } 04666 int GetMaximumExtent () const { return m_maximum_extent; } 04668 int GetMaximumExtentMode () const { return m_maximum_extent_mode; } 04670 void SetMaximumExtentMode (int c) { m_maximum_extent_mode = c; } 04672 int GetMaximumExtentLevel () const { return m_maximum_extent_level; } 04674 void SetMaximumExtentLevel (int c) { m_maximum_extent_level = (unsigned char)c; } 04676 void SetHardExtent (int c) { m_hard_extent = c; } 04678 int GetHardExtent () const { return m_hard_extent; } 04680 float const * GetVector () const { return m_vector; } 04682 void SetVector (float x, float y, float z) { 04683 m_vector[0] = x; 04684 m_vector[1] = y; 04685 m_vector[2] = z; 04686 } 04688 void SetVector (float const v[]) { SetVector(v[0], v[1], v[2]); } 04690 float GetVectorTolerance () const { return m_vector_tolerance; } 04692 void SetVectorTolerance (float tol) { m_vector_tolerance = tol; } 04693 04694 void SetMaxDistance (float m) { m_max_distance = m; } 04696 float GetMaxDistance () const { return m_max_distance; } 04697 04699 float const * GetViewVolume () const { return m_view_volume; } 04701 void SetViewVolume (float ax, float ay, float az, float bx, float by, float bz) { 04702 m_view_volume[0] = ax; 04703 m_view_volume[1] = ay; 04704 m_view_volume[2] = az; 04705 m_view_volume[3] = bx; 04706 m_view_volume[4] = by; 04707 m_view_volume[5] = bz; 04708 } 04710 void SetViewVolume (float const v[]) { SetViewVolume(v[0], v[1], v[2], v[3], v[4], v[5]); } 04711 04713 void SetOrderedWeightsMask (int c) { m_ordered_weights_mask = (unsigned char)c; } 04715 int GetOrderedWeightsMask () const { return (int)m_ordered_weights_mask; } 04716 04718 void SetOrderedWeight (int index, float weight) { 04719 m_ordered_weights[index] = weight; 04720 m_ordered_weights_mask |= 1<<index; 04721 } 04723 float GetOrderedWeight (int index) const { return m_ordered_weights[index]; } 04725 float const * GetOrderedWeights () const { return m_ordered_weights; } 04727 float * GetOrderedWeights () { return m_ordered_weights; } 04728 04730 void SetSelectionLevel (int l) { m_selection_level = (unsigned char)l; } 04732 int GetSelectionLevel () const { return (int)m_selection_level; } 04733 04735 void SetForceDefer (int l) { m_force_defer = l; } 04737 int GetForceDefer () const { return m_force_defer; } 04738 04739 }; 04740 04742 04746 enum TKO_Geometry_Options { 04747 TKO_Geometry_Options_Orientation = 0x0001, 04748 TKO_Geometry_Options_Camera_Relative = 0x0002 04749 }; 04750 04751 04753 04759 class BBINFILETK_API TK_Geometry_Options : public BBaseOpcodeHandler { 04760 protected: 04761 unsigned short m_mask; 04762 unsigned short m_value; 04763 04764 char m_orientation_count; 04765 float m_orientation[6]; 04766 04767 public: 04769 TK_Geometry_Options () : BBaseOpcodeHandler (TKE_Geometry_Options), 04770 m_mask (0), m_value (0), m_orientation_count (0) {} 04771 ~TK_Geometry_Options (); 04772 04773 TK_Status Read (BStreamFileToolkit & tk); 04774 TK_Status Write (BStreamFileToolkit & tk); 04775 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04776 04777 TK_Status ReadAscii (BStreamFileToolkit & tk); 04778 TK_Status WriteAscii (BStreamFileToolkit & tk); 04779 04781 void SetMask (int m) { m_mask = (unsigned short)m; } 04783 int GetMask () const { return (int)m_mask; } 04784 04786 void SetOrientation (int count, float const o[]) { 04787 if (count != 3 && count != 6) 04788 return; 04789 m_orientation_count = (unsigned char)count; 04790 while (count-- > 0) 04791 m_orientation[count] = o[count]; 04792 } 04794 int GetOrientationCount () const { return (int) m_orientation_count; } 04796 float const * GetOrientation () const { return m_orientation; } 04797 }; 04798 04801 04806 class BBINFILETK_API TK_Visibility : public BBaseOpcodeHandler { 04807 protected: 04808 int m_mask; 04809 int m_value; 04810 04811 public: 04813 TK_Visibility (void) 04814 : BBaseOpcodeHandler (TKE_Visibility), m_mask (0), m_value (0) {} 04815 04816 TK_Status Read (BStreamFileToolkit & tk); 04817 TK_Status Write (BStreamFileToolkit & tk); 04818 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04819 04820 TK_Status ReadAscii (BStreamFileToolkit & tk); 04821 TK_Status WriteAscii (BStreamFileToolkit & tk); 04822 04826 void SetGeometry (int m) { 04827 m_mask = m & TKO_Geo_All_Visibles; 04828 if ((m & TKO_Geo_Extended_Mask) != 0) { 04829 m_mask |= TKO_Geo_Extended; 04830 if ((m & TKO_Geo_Extended2_Mask) != 0) 04831 m_mask |= TKO_Geo_Extended2; 04832 } 04833 } 04838 int GetGeometry () const { return m_mask; } 04839 04844 void SetValue (int m) { m_value = m; } 04849 int GetValue () const { return m_value; } 04850 }; 04851 04854 04861 class BBINFILETK_API TK_Selectability : public BBaseOpcodeHandler { 04862 protected: 04863 int m_mask; 04864 int m_down; 04865 int m_up; 04866 int m_move_down; 04867 int m_move_up; 04868 int m_invisible; 04869 04870 public: 04872 TK_Selectability (void) 04873 : BBaseOpcodeHandler (TKE_Selectability), 04874 m_mask (0), m_down (0), m_up (0), m_move_down (0), m_move_up (0), m_invisible (0) {} 04875 04876 TK_Status Read (BStreamFileToolkit & tk); 04877 TK_Status Write (BStreamFileToolkit & tk); 04878 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04879 04880 TK_Status ReadAscii (BStreamFileToolkit & tk); 04881 TK_Status WriteAscii (BStreamFileToolkit & tk); 04882 04886 void SetGeometry (int m) { 04887 m_mask = m & TKO_Geo_All_Selects; 04888 if ((m & TKO_Geo_Extended_Mask) != 0) 04889 m_mask |= TKO_Geo_Extended; 04890 } 04895 int GetGeometry () const { return m_mask; } 04896 04901 void SetDown (int m) { m_down = m; } 04906 int GetDown () const { return m_down; } 04907 04912 void SetUp (int m) { m_up = m; } 04917 int GetUp () const { return m_up; } 04918 04923 void SetMoveDown (int m) { m_move_down = m; } 04928 int GetMoveDown () const { return m_move_down; } 04929 04934 void SetMoveUp (int m) { m_move_up = m; } 04939 int GetMoveUp () const { return m_move_up; } 04940 04945 void SetWhenInvisible (int m) { m_invisible = m; } 04950 int GetWhenInvisible () const { return m_invisible; } 04951 }; 04952 04954 04960 class BBINFILETK_API TK_Matrix : public BBaseOpcodeHandler { 04961 protected: 04962 float m_matrix[16]; 04963 double m_dmatrix[16]; 04964 04965 public: 04967 TK_Matrix (unsigned char opcode) 04968 : BBaseOpcodeHandler (opcode) {} 04969 04970 TK_Status Read (BStreamFileToolkit & tk); 04971 TK_Status Write (BStreamFileToolkit & tk); 04972 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 04973 04974 TK_Status ReadAscii (BStreamFileToolkit & tk); 04975 TK_Status WriteAscii (BStreamFileToolkit & tk); 04976 04978 void SetMatrix (float const m[]) { 04979 int i; for (i=0; i<16; i++) m_matrix[i] = m[i]; 04980 } 04982 void SetDMatrix (double const m[]) { 04983 int i; for (i=0; i<16; i++) m_dmatrix[i] = m[i]; 04984 } 04986 float const * GetMatrix () const { return m_matrix; } 04988 float * GetMatrix () { return m_matrix; } 04990 double const * GetDMatrix () const { return m_dmatrix; } 04992 double * GetDMatrix () { return m_dmatrix; } 04993 }; 04994 04995 04999 enum TKO_Enumerations { 05000 TKO_Line_Pattern_Solid = 0, 05001 TKO_Line_Pattern_Dash_Dot = 1, 05002 TKO_Line_Pattern_Dashed = 2, 05003 TKO_Line_Pattern_Dotted = 3, 05004 TKO_Line_Pattern_Dash_2Dot = 4, 05005 TKO_Line_Pattern_Dash_3Dot = 5, 05006 TKO_Line_Pattern_Long_Dash = 6, 05007 TKO_Line_Pattern_Center = 7, 05008 TKO_Line_Pattern_Phantom = 8, 05009 TKO_Line_Pattern_Find_Dots = 9, 05010 05011 TKO_Fill_Pattern_Hash = 0, 05012 TKO_Fill_Pattern_Vertical = 1, 05013 TKO_Fill_Pattern_Horizontal = 2, 05014 TKO_Fill_Pattern_Right = 3, 05015 TKO_Fill_Pattern_Left = 4, 05016 TKO_Fill_Pattern_Diamond = 5, 05017 TKO_Fill_Pattern_Dots = 6, 05018 TKO_Fill_Pattern_Boxes = 7, 05019 TKO_Fill_Pattern_Solid = 8, 05020 TKO_Fill_Pattern_Clear = 9, 05021 TKO_Fill_Pattern_Gradient_N = 10, 05022 TKO_Fill_Pattern_Gradient_NE= 11, 05023 TKO_Fill_Pattern_Gradient_E = 12, 05024 TKO_Fill_Pattern_Gradient_SE= 13, 05025 TKO_Fill_Pattern_Gradient_S = 14, 05026 TKO_Fill_Pattern_Gradient_SW= 15, 05027 TKO_Fill_Pattern_Gradient_W = 16, 05028 TKO_Fill_Pattern_Gradient_NW= 17, 05029 TKO_Fill_Pattern_Blend = 18, 05030 TKO_Fill_Pattern_Invisible = 19, 05031 05032 TKO_Marker_Circle = 0, 05033 TKO_Marker_Circle_Dot = 1, 05034 TKO_Marker_Circle_Plus = 2, 05035 TKO_Marker_Circle_X = 3, 05036 TKO_Marker_Circle_Circle = 4, 05037 TKO_Marker_Circle_Filled = 5, 05038 TKO_Marker_Dot = 6, 05039 TKO_Marker_Plus = 7, 05040 TKO_Marker_X = 8, 05041 TKO_Marker_Star = 9, 05042 TKO_Marker_Box = 10, 05043 TKO_Marker_Box_Dot = 11, 05044 TKO_Marker_Box_X = 12, 05045 TKO_Marker_Box_Filled = 13, 05046 TKO_Marker_Diamond = 14, 05047 TKO_Marker_Diamond_Dot = 15, 05048 TKO_Marker_Diamond_Plus = 16, 05049 TKO_Marker_Diamond_Filled = 17, 05050 TKO_Marker_Triangle_Up = 18, 05051 TKO_Marker_Triangle_Up_Vertex = 19, 05052 TKO_Marker_Triangle_Up_Dot = 20, 05053 TKO_Marker_Triangle_Up_Filled = 21, 05054 TKO_Marker_Triangle_Up_Filled_Vertex = 22, 05055 TKO_Marker_Triangle_Down = 23, 05056 TKO_Marker_Triangle_Down_Vertex = 24, 05057 TKO_Marker_Triangle_Down_Dot = 25, 05058 TKO_Marker_Triangle_Down_Filled = 26, 05059 TKO_Marker_Triangle_Down_Filled_Vertex = 27, 05060 TKO_Marker_Triangle_Right = 28, 05061 TKO_Marker_Triangle_Right_Vertex = 29, 05062 TKO_Marker_Triangle_Right_Dot = 30, 05063 TKO_Marker_Triangle_Right_Filled = 31, 05064 TKO_Marker_Triangle_Right_Filled_Vertex = 32, 05065 TKO_Marker_Triangle_Left = 33, 05066 TKO_Marker_Triangle_Left_Vertex = 34, 05067 TKO_Marker_Triangle_Left_Dot = 35, 05068 TKO_Marker_Triangle_Left_Filled = 36, 05069 TKO_Marker_Triangle_Left_Filled_Vertex = 37, 05070 TKO_Marker_Hash = 38, 05071 TKO_Marker_Wide_Plus = 39, 05072 TKO_Marker_Open_Arrow = 40, 05073 TKO_Marker_Closed_Arrow = 41, 05074 TKO_Marker_Vertical_Bar = 42, 05075 TKO_Marker_Half_Arrow_Left = 43, 05076 TKO_Marker_Half_Arrow_Right = 44, 05077 TKO_Marker_Wide_Arrow = 45, 05078 TKO_Marker_Double_Arrow = 46, 05079 TKO_Marker_Y = 47, 05080 TKO_Marker_Z = 48, 05081 05082 // alignment format change in 17.80. 05083 05084 // old alignment enum choices in lower nibble 05085 TKO_Text_Alignment_Lower_Left = 0, 05086 TKO_Text_Alignment_Upper_Left = 1, 05087 TKO_Text_Alignment_Middle_Left = 2, 05088 TKO_Text_Alignment_Lower_Right = 3, 05089 TKO_Text_Alignment_Upper_Right = 4, 05090 TKO_Text_Alignment_Middle_Right = 5, 05091 TKO_Text_Alignment_Lower_Center = 6, 05092 TKO_Text_Alignment_Upper_Center = 7, 05093 TKO_Text_Alignment_Middle_Center = 8, 05094 TKO_Text_Alignment_Insertion_Left = 9, 05095 TKO_Text_Alignment_Insertion_Right = 10, 05096 TKO_Text_Alignment_Insertion_Center = 11, 05097 TKO_Text_Alignment_Insertion = 9, 05098 // and justification in higher nibble 05099 TKO_Text_Justification_Unspecified = 0, 05100 TKO_Text_Justification_Left = 1, 05101 TKO_Text_Justification_Center = 2, 05102 TKO_Text_Justification_Right = 3, 05103 05104 // new format defines bits for "building" alignment setting 05105 TKO_Text_Alignment_Center = 0x00, 05106 TKO_Text_Alignment_Left = 0x01, 05107 TKO_Text_Alignment_Right = 0x02, 05108 TKO_Text_Alignment_Bottom = 0x04, 05109 TKO_Text_Alignment_Top = 0x08, 05110 TKO_Text_Alignment_Point = 0x10, 05111 // can't have left & right, or bottom & top, so all bits is good as an "unset" placeholder 05112 TKO_Text_Alignment_Unspecified = 0x1F, 05113 // and uses same justification but shifted a bit higher 05114 TKO_Text_Justification_Mask = 0x60, 05115 TKO_Text_Justification_Shift = 5, 05116 // and the high bit will be set 05117 TKO_Text_Alignment_New_Format = 0x80, 05118 05119 05120 05121 TKO_Window_Frame_Off = 0, 05122 TKO_Window_Frame_On = 1, 05123 05124 TKO_Handedness_Left = 0, 05125 TKO_Handedness_Right = 1 05126 }; 05127 05133 class BBINFILETK_API TK_Enumerated : public BBaseOpcodeHandler { 05134 protected: 05135 char m_index; 05136 05137 public: 05139 TK_Enumerated (unsigned char opcode) 05140 : BBaseOpcodeHandler (opcode), m_index (0) {} 05141 05142 TK_Status Read (BStreamFileToolkit & tk); 05143 TK_Status Write (BStreamFileToolkit & tk); 05144 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05145 05146 TK_Status ReadAscii (BStreamFileToolkit & tk); 05147 TK_Status WriteAscii (BStreamFileToolkit & tk); 05148 05149 void SetIndex (int i) { m_index = (char)i; } 05151 int GetIndex () const { return (int)m_index; } 05152 }; 05153 05157 enum TKO_Generic_Size_Units { 05158 TKO_Generic_Size_Object, 05159 TKO_Generic_Size_Screen, 05160 TKO_Generic_Size_Window, 05161 TKO_Generic_Size_Points, 05162 TKO_Generic_Size_Pixels, 05163 TKO_Generic_Size_Percent, 05164 TKO_Generic_Size_World, 05165 05166 TKO_Generic_Size_Unspecified 05167 }; 05168 // NOTE: any changes to this need to be reflected in generic_units_table in parse.cpp & HOpcodeHandler.cpp 05169 05170 05176 class BBINFILETK_API TK_Size : public BBaseOpcodeHandler { 05177 protected: 05178 float m_value; 05179 unsigned char m_units; 05180 05181 public: 05183 TK_Size (unsigned char opcode) 05184 : BBaseOpcodeHandler (opcode), m_value (0.0f), m_units (TKO_Generic_Size_Unspecified) {} 05185 05186 TK_Status Read (BStreamFileToolkit & tk); 05187 TK_Status Write (BStreamFileToolkit & tk); 05188 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05189 05190 TK_Status ReadAscii (BStreamFileToolkit & tk); 05191 TK_Status WriteAscii (BStreamFileToolkit & tk); 05192 05194 void SetSize (float value, int units = TKO_Generic_Size_Unspecified) { 05195 m_value = (value > 0.0f) ? value : 0.0f; 05196 m_units = (m_value > 0.0f) ? (unsigned char) units : (unsigned char) TKO_Generic_Size_Unspecified; 05197 } 05199 float GetSize () const { return m_value; } 05201 int GetUnits () const { return m_units; } 05202 }; 05203 05208 class BBINFILETK_API TK_Linear_Pattern : public BBaseOpcodeHandler { 05209 protected: 05210 unsigned short m_pattern; 05211 05212 public: 05214 TK_Linear_Pattern (unsigned char opcode) 05215 : BBaseOpcodeHandler (opcode), m_pattern (0) {} 05216 05217 TK_Status Read (BStreamFileToolkit & tk); 05218 TK_Status Write (BStreamFileToolkit & tk); 05219 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05220 05221 TK_Status ReadAscii (BStreamFileToolkit & tk); 05222 TK_Status WriteAscii (BStreamFileToolkit & tk); 05223 05225 void SetPattern (int p) { m_pattern = (unsigned short)p; } 05227 int GetPattern () const { return (int)m_pattern; } 05228 }; 05229 05235 class BBINFILETK_API TK_Named : public BBaseOpcodeHandler { 05236 protected: 05237 int m_name_length; 05238 char * m_name; 05239 int m_index; 05240 05241 public: 05243 TK_Named (unsigned char opcode) 05244 : BBaseOpcodeHandler (opcode), m_name_length (0), m_name (0), m_index (0) {} 05245 ~TK_Named(); 05246 05247 TK_Status Read (BStreamFileToolkit & tk); 05248 TK_Status Write (BStreamFileToolkit & tk); 05249 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05250 05251 TK_Status ReadAscii (BStreamFileToolkit & tk); 05252 TK_Status WriteAscii (BStreamFileToolkit & tk); 05253 05254 void Reset (); 05255 05257 void SetName (char const * name); 05259 void SetName (int length); 05261 char const * GetName () const { return m_name; } 05263 char * GetName () { return m_name; } 05264 05266 void SetIndex (int i) { Reset(); m_index = i; } 05268 int GetIndex () const { return (int)m_index; } 05269 }; 05270 05271 05272 05279 class BBINFILETK_API TK_Streaming : public BBaseOpcodeHandler { 05280 protected: 05281 bool m_flag; 05282 05283 public: 05285 TK_Streaming () : BBaseOpcodeHandler (TKE_Streaming_Mode) {} 05286 05287 TK_Status Read (BStreamFileToolkit & tk); 05288 TK_Status Write (BStreamFileToolkit & tk); 05289 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05290 05291 TK_Status ReadAscii (BStreamFileToolkit & tk); 05292 TK_Status WriteAscii (BStreamFileToolkit & tk); 05293 05294 void SetStreaming (bool s) { m_flag = s; } 05296 bool GetStreaming () const { return m_flag; } 05297 }; 05298 05301 05307 class BBINFILETK_API TK_Conditions : public BBaseOpcodeHandler { 05308 protected: 05309 int m_length; 05310 char * m_string; 05312 public: 05314 TK_Conditions () : BBaseOpcodeHandler (TKE_Conditions), m_length (0), m_string (0) {} 05315 ~TK_Conditions(); 05316 05317 TK_Status Read (BStreamFileToolkit & tk); 05318 TK_Status Write (BStreamFileToolkit & tk); 05319 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05320 05321 TK_Status ReadAscii (BStreamFileToolkit & tk); 05322 TK_Status WriteAscii (BStreamFileToolkit & tk); 05323 05324 void Reset (); 05325 05327 void SetConditions (char const * options); 05329 void SetConditions (int length); 05331 char const * GetConditions () const { return m_string; } 05333 char * GetConditions () { return m_string; } 05335 int GetLength() { return m_length; } 05336 }; 05337 05338 05342 enum TKO_Actions { 05343 TKO_Action_Type_Prune_Segment = 1, 05344 05345 TKO_Action_Option_Segment_Tree = 0x0001 05346 }; 05347 05348 05351 05356 class BBINFILETK_API TK_Conditional_Action : public BBaseOpcodeHandler { 05357 protected: 05358 short m_type; 05359 short m_options; 05360 int m_length; 05361 char * m_string; 05363 public: 05365 TK_Conditional_Action () : BBaseOpcodeHandler (TKE_Conditional_Action), m_length (0), m_string (0) {} 05366 ~TK_Conditional_Action(); 05367 05368 TK_Status Read (BStreamFileToolkit & tk); 05369 TK_Status Write (BStreamFileToolkit & tk); 05370 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05371 05372 TK_Status ReadAscii (BStreamFileToolkit & tk); 05373 TK_Status WriteAscii (BStreamFileToolkit & tk); 05374 05375 void Reset (); 05376 05378 void SetCondition (char const * options); 05380 void SetCondition (int length); 05382 char const * GetCondition () const { return m_string; } 05384 char * GetCondition () { return m_string; } 05386 int GetLength() { return m_length; } 05387 05389 void SetAction (int at) { m_type = (short)at; } 05391 int GetAction () const { return (int)m_type; } 05393 void SetOptions (int at) { m_options = (short)at; } 05395 int GetOptions () const { return (int)m_options; } 05396 }; 05397 05400 05406 class BBINFILETK_API TK_User_Options : public BBaseOpcodeHandler { 05407 protected: 05408 int m_length; 05409 char * m_string; 05410 BBaseOpcodeHandler * m_indices; 05411 BBaseOpcodeHandler * m_unicode; 05412 BBaseOpcodeHandler * m_index_data; 05414 void set_options (char const * options); 05415 void set_options (int length); 05416 05417 public: 05419 TK_User_Options () : BBaseOpcodeHandler (TKE_User_Options), m_length (0), m_string (0), 05420 m_indices (0), m_unicode (0), m_index_data(0) {} 05421 ~TK_User_Options(); 05422 05423 TK_Status Read (BStreamFileToolkit & tk); 05424 TK_Status Write (BStreamFileToolkit & tk); 05425 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05426 05427 TK_Status ReadAscii (BStreamFileToolkit & tk); 05428 TK_Status WriteAscii (BStreamFileToolkit & tk); 05429 05430 void Reset (); 05431 05433 void SetOptions (char const * options) { set_options (options); } 05435 void SetOptions (int length) { set_options (length); } 05437 char const * GetOptions () const { return m_string; } 05439 char * GetOptions () { return m_string; } 05441 int GetLength() { return m_length; } 05442 }; 05443 05446 05452 class BBINFILETK_API TK_Unicode_Options : public BBaseOpcodeHandler { 05453 protected: 05454 int m_length; 05455 unsigned short * m_string; 05457 public: 05459 TK_Unicode_Options () : BBaseOpcodeHandler (TKE_Unicode_Options), m_length (0), m_string (0) {} 05460 ~TK_Unicode_Options(); 05461 05462 TK_Status Read (BStreamFileToolkit & tk); 05463 TK_Status Write (BStreamFileToolkit & tk); 05464 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05465 05466 TK_Status ReadAscii (BStreamFileToolkit & tk); 05467 TK_Status WriteAscii (BStreamFileToolkit & tk); 05468 05469 void Reset (); 05470 05472 void SetOptions (unsigned short const * options); 05474 void SetOptions (int length); 05476 unsigned short const * GetOptions () const { return m_string; } 05478 unsigned short * GetOptions () { return m_string; } 05480 int GetLength() { return m_length; } 05481 }; 05482 05484 05490 class BBINFILETK_API TK_User_Index : public BBaseOpcodeHandler { 05491 protected: 05492 int m_count; 05493 int * m_indices; 05494 HLONG * m_values; 05495 int m_current_value; 05496 void set_indices (int count, int const indices[], POINTER_SIZED_INT const values[]); 05497 void set_indices (int count); 05498 05499 public: 05501 TK_User_Index () 05502 : BBaseOpcodeHandler (TKE_User_Index), m_count (0), m_indices (0), m_values (0), m_current_value(0) {} 05503 ~TK_User_Index(); 05504 05505 TK_Status Read (BStreamFileToolkit & tk); 05506 TK_Status Write (BStreamFileToolkit & tk); 05507 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05508 05509 TK_Status ReadAscii (BStreamFileToolkit & tk); 05510 TK_Status WriteAscii (BStreamFileToolkit & tk); 05511 05512 void Reset (); 05513 05515 void SetIndices (int count, int const indices[], POINTER_SIZED_INT const values[]) 05516 { set_indices (count, indices, values); } 05518 void SetIndices (int count) { set_indices (count); } 05520 int GetCount () const { return m_count; } 05522 int const * GetIndices () const { return m_indices; } 05524 int * GetIndices () { return m_indices; } 05526 HLONG const * GetValues () const { return m_values; } 05528 HLONG * GetValues () { return m_values; } 05529 }; 05530 05532 05538 class BBINFILETK_API TK_User_Index_Data : public BBaseOpcodeHandler { 05539 protected: 05540 int m_count; 05541 int * m_indices; 05542 void ** m_values; 05543 int * m_sizes; 05544 05545 int m_current_value; 05546 void set_indices (int count, int const indices[], void const * values[], int const sizes[]); 05547 void set_indices (int count); 05548 void FreeMem (); 05549 05550 public: 05552 TK_User_Index_Data () 05553 : BBaseOpcodeHandler (TKE_User_Index_Data), m_count (0), m_indices (0), m_values (0), m_sizes(0), m_current_value(0) {} 05554 ~TK_User_Index_Data(); 05555 05556 TK_Status Read (BStreamFileToolkit & tk); 05557 TK_Status Write (BStreamFileToolkit & tk); 05558 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05559 05560 void Reset (); 05561 05563 void SetIndices (int count, int const indices[], void const * values[], int const sizes[]) { 05564 set_indices (count, indices, values, sizes); 05565 } 05566 05568 void SetIndices (int count) { set_indices (count);} 05569 05571 int GetCount () const { return m_count;} 05572 05574 int const * GetIndices () const { return m_indices;} 05575 05577 int * GetIndices () { return m_indices;} 05578 05580 void ** const GetValues () const { return m_values;} 05581 05583 void ** const GetValues () { return m_values;} 05584 05586 int const * GetSizes () const { return m_sizes;} 05587 05589 int * GetSizes () { return m_sizes;} 05590 }; 05591 05592 05594 05599 class BBINFILETK_API TK_User_Value : public BBaseOpcodeHandler { 05600 protected: 05601 HLONG m_value; 05602 05603 public: 05605 TK_User_Value () 05606 : BBaseOpcodeHandler (TKE_User_Value), m_value (0) {} 05607 05608 TK_Status Read (BStreamFileToolkit & tk); 05609 TK_Status Write (BStreamFileToolkit & tk); 05610 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05611 05612 TK_Status ReadAscii (BStreamFileToolkit & tk); 05613 TK_Status WriteAscii (BStreamFileToolkit & tk); 05614 05616 void SetValue (HLONG v) { m_value = v; } 05618 HLONG GetValue () const { return m_value; } 05619 }; 05620 05624 enum TKO_Camera_Projection { 05625 TKO_Camera_Perspective_Bit = 0x01, 05626 TKO_Camera_Stretched_Bit = 0x02, 05627 TKO_Camera_Projection_Mask = 0x03, 05628 05629 TKO_Camera_Orthographic = 0x00, 05630 TKO_Camera_Perspective = 0x01, 05631 TKO_Camera_Stretched = 0x02, 05632 05633 TKO_Camera_Oblique_Y = 0x04, 05634 TKO_Camera_Oblique_X = 0x08, 05635 TKO_Camera_Oblique_Mask = 0x0C, 05636 05637 TKO_Camera_Near_Limit = 0x10, 05638 05639 TKO_Camera_Thumbnail = 0x80 05640 }; 05641 05643 05648 class BBINFILETK_API2 TK_Camera : public BBaseOpcodeHandler { 05649 protected: 05653 float m_settings[14]; 05655 double m_dsettings[14]; 05657 float m_details[3]; 05658 unsigned char m_projection; 05659 int m_length; 05660 char * m_name; 05663 void set_name (char const * name); 05664 05665 void set_name (int length); 05666 05667 public: 05669 TK_Camera (unsigned char opcode = TKE_Camera) 05670 : BBaseOpcodeHandler (opcode), m_length (0), m_name (0) { 05671 int i; 05672 int count = (int)(sizeof(m_settings) / sizeof(m_settings[0])); 05673 for (i = 0; i < count; i++) { 05674 m_settings[i] = 0; 05675 m_dsettings[i] = 0; 05676 } 05677 } 05678 ~TK_Camera(); 05679 05680 TK_Status Read (BStreamFileToolkit & tk); 05681 TK_Status Write (BStreamFileToolkit & tk); 05682 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05683 05684 TK_Status ReadAscii (BStreamFileToolkit & tk); 05685 TK_Status WriteAscii (BStreamFileToolkit & tk); 05686 05688 void SetPosition (float x, float y, float z) 05689 { m_settings[0] = x; m_settings[1] = y; m_settings[2] = z; } 05691 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 05693 float const * GetPosition () const { return &m_settings[0]; } 05695 void GetPosition (float p[]) const { memcpy(p, GetPosition(), 3*sizeof(float)); } 05696 05698 void SetDPosition (double x, double y, double z) 05699 { m_dsettings[0] = x; m_dsettings[1] = y; m_dsettings[2] = z; } 05701 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 05703 double const * GetDPosition () const { return &m_dsettings[0]; } 05705 void GetDPosition (double p[]) const { memcpy(p, GetDPosition(), 3*sizeof(double)); } 05706 05708 void SetTarget (float x, float y, float z) 05709 { m_settings[3] = x; m_settings[4] = y; m_settings[5] = z; } 05711 void SetTarget (float const t[]) { SetTarget (t[0], t[1], t[2]); } 05713 float const * GetTarget () const { return &m_settings[3]; } 05715 void GetTarget (float t[]) const { memcpy(t, GetTarget(), 3*sizeof(float)); } 05716 05718 void SetDTarget (double x, double y, double z) 05719 { m_dsettings[3] = x; m_dsettings[4] = y; m_dsettings[5] = z; } 05721 void SetDTarget (double const t[]) { SetDTarget (t[0], t[1], t[2]); } 05723 double const * GetDTarget () const { return &m_dsettings[3]; } 05725 void GetDTarget (double t[]) const { memcpy(t, GetDTarget(), 3*sizeof(double)); } 05726 05728 void SetUpVector (float x, float y, float z) 05729 { m_settings[6] = x; m_settings[7] = y; m_settings[8] = z; } 05731 void SetUpVector (float const u[]) { SetUpVector (u[0], u[1], u[2]); } 05733 float const * GetUpVector () const { return &m_settings[6]; } 05735 void GetUpVector (float u[]) const { memcpy(u,GetUpVector(),3*sizeof(float)); } 05736 05738 void SetDUpVector (double x, double y, double z) 05739 { m_dsettings[6] = x; m_dsettings[7] = y; m_dsettings[8] = z; } 05741 void SetDUpVector (double const u[]) { SetDUpVector (u[0], u[1], u[2]); } 05743 double const * GetDUpVector () const { return &m_dsettings[6]; } 05745 void GetDUpVector (double u[]) const { memcpy(u, GetDUpVector(), 3*sizeof(double)); } 05746 05748 void SetField (float w, float h) { m_settings[9] = w; m_settings[10] = h; } 05750 void SetField (float const f[]) { SetField (f[0], f[1]); } 05752 float const * GetField () const { return &m_settings[9]; } 05754 void GetField (float f[]) const { memcpy(f,GetField(),2*sizeof(float)); } 05755 05757 void SetDField (double w, double h) { m_dsettings[9] = w; m_dsettings[10] = h; } 05759 void SetDField (double const f[]) { SetDField (f[0], f[1]); } 05761 double const * GetDField () const { return &m_dsettings[9]; } 05763 void GetDField (double f[]) const { memcpy(f, GetDField(), 2*sizeof(double)); } 05764 05765 05767 void SetOblique (float h, float v) { m_details[0] = h; m_details[1] = v; 05768 m_projection &= ~TKO_Camera_Oblique_Mask; 05769 if (h != 0.0f) m_projection |= TKO_Camera_Oblique_Y; 05770 if (v != 0.0f) m_projection |= TKO_Camera_Oblique_Mask; 05771 } 05773 void SetOblique (float const o[]) { SetOblique (o[0], o[1]); } 05775 float const * GetOblique () const { return m_details; } 05777 void GetOblique (float o[]) const { memcpy(o, GetOblique(), 2*sizeof(float)); } 05778 05780 void SetNearLimit (float l) { m_details[2] = l; 05781 m_projection &= ~TKO_Camera_Near_Limit; 05782 if (l != 0.0f) m_projection |= TKO_Camera_Near_Limit; 05783 } 05785 float GetNearLimit () const { return m_details[2]; } 05786 05787 05789 void SetProjection (int p) { m_projection = (char)p; } 05791 int GetProjection () const { return (int)m_projection; } 05792 05793 05795 void SetView (char const * name) { set_name (name); } 05797 void SetView (int length) { set_name (length); } 05799 char const * GetView () const { return m_name; } 05801 char * GetView () { return m_name; } 05802 }; 05803 05805 05810 class BBINFILETK_API TK_Window : public BBaseOpcodeHandler { 05811 protected: 05812 float m_window[4]; 05813 05814 public: 05816 TK_Window () 05817 : BBaseOpcodeHandler (TKE_Window) {} 05818 05819 TK_Status Read (BStreamFileToolkit & tk); 05820 TK_Status Write (BStreamFileToolkit & tk); 05821 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05822 05823 TK_Status ReadAscii (BStreamFileToolkit & tk); 05824 TK_Status WriteAscii (BStreamFileToolkit & tk); 05825 05827 void SetWindow (float l, float r, float b, float t) 05828 { m_window[0] = l; m_window[1] = r; m_window[2] = b; m_window[3] = t; } 05830 void SetWindow (float const w[]) { SetWindow (w[0], w[1], w[2], w[3]); } 05832 float const * GetWindow () const { return m_window; } 05833 }; 05834 05835 05840 enum TKO_Font_Options { 05841 TKO_Font_Names = 0x00000001, 05842 TKO_Font_Size = 0x00000002, 05843 TKO_Font_Size_Tolerance = 0x00000004, 05844 TKO_Font_Transforms = 0x00000008, 05845 TKO_Font_Rotation = 0x00000010, 05846 TKO_Font_Slant = 0x00000020, 05847 TKO_Font_Width_Scale = 0x00000040, 05848 TKO_Font_Extended = 0x00000080, 05849 TKO_Font_Extended_Mask = 0xFFFFFF00, // internal use, indicates bits which require TKO_Font_Extended 05850 TKO_Font_Extended_Shift = 8, // internal use, indicatesshift of extended section 05851 TKO_Font_Extra_Space = 0x00000100, 05852 TKO_Font_Line_Spacing = 0x00000200, 05853 TKO_Font_Outline = 0x00000400, 05854 TKO_Font_Underline = 0x00000800, 05855 TKO_Font_Strikethrough = 0x00001000, 05856 TKO_Font_Overline = 0x00002000, 05857 TKO_Font_Uniform_Spacing = 0x00004000, 05858 TKO_Font_Extended2 = 0x00008000, 05859 TKO_Font_Extended2_Mask = 0xFFFF0000, 05860 TKO_Font_Extended2_Shift = 16, 05861 TKO_Font_Greeking_Limit = 0x00010000, 05862 TKO_Font_Fill_Edges = 0x00020000, 05863 TKO_Font_Bold = 0x00040000, 05864 TKO_Font_Italic = 0x00080000, 05865 TKO_Font_Renderer = 0x00100000, 05866 TKO_Font_Greeking_Mode = 0x00200000, 05867 TKO_Font_Preference = 0x00400000, 05868 TKO_Font_Layout = 0x00800000 05869 }; 05870 05871 05872 05876 enum TKO_Font_Layout { 05877 TKO_Font_Layout_Default = 0, 05878 TKO_Font_Layout_Unicode = 1 05879 }; 05880 05881 05882 #define TKO_Font_Size_Units TKO_Generic_Size_Units 05883 #define TKO_Font_Size_Object TKO_Generic_Size_Object 05884 #define TKO_Font_Size_Screen TKO_Generic_Size_Screen 05885 #define TKO_Font_Size_Window TKO_Generic_Size_Window 05886 #define TKO_Font_Size_Points TKO_Generic_Size_Points 05887 #define TKO_Font_Size_Pixels TKO_Generic_Size_Pixels 05888 #define TKO_Font_Size_Percent TKO_Generic_Size_Percent 05889 #define TKO_Font_Size_World TKO_Generic_Size_World 05890 05891 05897 enum TKO_Font_Transforms { 05898 TKO_Font_Transform_Position_Only = 0, 05899 TKO_Font_Transform_Full = 1, 05900 TKO_Font_Transform_Position_Adjusted = 2, 05901 }; 05902 05903 05907 enum TKO_Font_Renderers { 05908 TKO_Font_Renderer_Undefined = -1, 05909 TKO_Font_Renderer_Default = 0, 05910 TKO_Font_Renderer_Driver = 1, 05911 TKO_Font_Renderer_Truetype = 2, 05912 TKO_Font_Renderer_Defined = 3 05913 }; 05914 05918 enum TKO_Font_Preferences { 05919 TKO_Font_Preference_Undefined = -1, 05920 TKO_Font_Preference_Default = 0, 05921 TKO_Font_Preference_Bitmap = 1, 05922 TKO_Font_Preference_Outline = 2, 05923 TKO_Font_Preference_Exterior = 3 05924 }; 05925 05929 enum TKO_Font_Greeking_Modes { 05930 TKO_Font_Greeking_Mode_None = 0, 05931 TKO_Font_Greeking_Mode_Lines = 1, 05932 TKO_Font_Greeking_Mode_Box = 2 05933 }; 05934 05936 05943 class BBINFILETK_API TK_Text_Font : public BBaseOpcodeHandler { 05944 protected: 05945 int m_mask; 05946 int m_value; 05947 int m_names_length; 05948 char * m_names; 05949 float m_size; 05950 float m_tolerance; 05951 float m_rotation; 05952 float m_slant; 05953 float m_width_scale; 05954 float m_extra_space; 05955 float m_line_spacing; 05956 float m_greeking_limit; 05957 float m_renderer_cutoff; 05958 float m_preference_cutoff; 05959 int m_renderers[2]; 05960 int m_preferences[2]; 05961 unsigned char m_size_units; 05962 unsigned char m_tolerance_units; 05963 unsigned char m_space_units; 05964 unsigned char m_greeking_units; 05965 unsigned char m_greeking_mode; 05966 unsigned char m_transforms; 05967 unsigned char m_renderer_cutoff_units; 05968 unsigned char m_preference_cutoff_units; 05969 unsigned char m_layout; 05970 05971 void set_names (int length); 05972 void set_names (char const * names); 05973 05974 public: 05976 TK_Text_Font () 05977 : BBaseOpcodeHandler (TKE_Text_Font), m_names_length (0), m_names (0) {} 05978 ~TK_Text_Font (); 05979 05980 TK_Status Read (BStreamFileToolkit & tk); 05981 TK_Status Write (BStreamFileToolkit & tk); 05982 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 05983 05984 TK_Status ReadAscii (BStreamFileToolkit & tk); 05985 TK_Status WriteAscii (BStreamFileToolkit & tk); 05986 05987 void Reset (); 05988 05990 void SetMask (int m) { 05991 m_mask = m; 05992 if ((m & TKO_Font_Extended2_Mask) != 0) 05993 m_mask |= TKO_Font_Extended2; 05994 if ((m & TKO_Font_Extended_Mask) != 0) 05995 m_mask |= TKO_Font_Extended; 05996 } 05998 int GetMask () const { return m_mask; } 05999 06001 void SetValue (int v) { m_value = v; } 06003 int GetValue () const { return m_value; } 06004 06006 void SetNames (char const * names) { set_names (names); } 06008 void SetNames (int length) { set_names (length); } 06010 char const * GetNames () const { return m_names; } 06012 char * GetNames () { return m_names; } 06013 06015 void SetSize (float s) { m_size = s; } 06017 float GetSize () const { return m_size; } 06018 06020 void SetSizeUnits (int u) { m_size_units = (unsigned char)u; } 06022 int GetSizeUnits () const { return (int)m_size_units; } 06023 06025 void SetTolerance (float t) { m_tolerance = t; } 06027 float GetTolerance () const { return m_tolerance; } 06028 06030 void SetToleranceUnits (int u) { m_tolerance_units = (unsigned char)u; } 06032 int GetToleranceUnits () const { return (int)m_tolerance_units; } 06033 06035 void SetRotation (float r) { m_rotation = r; } 06037 float GetRotation () const { return m_rotation; } 06038 06040 void SetSlant (float s) { m_slant = s; } 06042 float GetSlant () const { return m_slant; } 06043 06045 void SetWidthScale (float s) { m_width_scale = s; } 06047 float GetWidthScale () const { return m_width_scale; } 06048 06050 void SetExtraSpace (float s) { m_extra_space = s; } 06052 float GetExtraSpace () const { return m_extra_space; } 06053 06055 void SetExtraSpaceUnits (int u) { m_space_units = (unsigned char)u; } 06057 int GetExtraSpaceUnits () const { return (int)m_space_units; } 06058 06060 void SetLineSpacing (float s) { m_line_spacing = s; } 06062 float GetLineSpacing () const { return m_line_spacing; } 06063 06065 void SetTransforms (int t) { m_transforms = (unsigned char)t; } 06067 int GetTransforms () const { return (int)m_transforms; } 06068 06070 void SetGreekingLimit (float s) { m_greeking_limit = s; } 06072 float GetGreekingLimit () const { return m_greeking_limit; } 06073 06075 void SetGreekingLimitUnits (int u) { m_greeking_units = (unsigned char)u; } 06077 int GetGreekingLimitUnits () const { return (int)m_greeking_units; } 06078 06080 void SetGreekingMode (int m) { m_greeking_mode = (unsigned char)m; } 06082 int GetGreekingMode () const { return (int)m_greeking_mode; } 06083 06084 06086 void SetRenderer (int r) { m_renderers[0] = m_renderers[1] = r; } 06088 int GetRenderer () const { return m_renderers[0]; } 06089 06091 void SetRenderers (int r1, int r2) { m_renderers[0] = r1; m_renderers[1] = r2; } 06093 int const * GetRenderers () const { return m_renderers; } 06094 06096 void SetRendererCutoff (float s) { m_renderer_cutoff = s; } 06098 float GetRendererCutoff () const { return m_renderer_cutoff; } 06099 06101 void SetRendererCutoffUnits (int u) { m_renderer_cutoff_units = (unsigned char)u; } 06103 int GetRendererCutoffUnits () const { return (int)m_renderer_cutoff_units; } 06104 06105 06107 void SetPreference (int r) { m_preferences[0] = m_preferences[1] = r; } 06109 int GetPreference () const { return m_preferences[0]; } 06110 06112 void SetPreferences (int r1, int r2) { m_preferences[0] = r1; m_preferences[1] = r2; } 06114 int const * GetPreferences () const { return m_preferences; } 06115 06117 void SetPreferenceCutoff (float s) { m_preference_cutoff = s; } 06119 float GetPreferenceCutoff () const { return m_preference_cutoff; } 06120 06122 void SetPreferenceCutoffUnits (int u) { m_preference_cutoff_units = (unsigned char)u; } 06124 int GetPreferenceCutoffUnits () const { return (int)m_preference_cutoff_units; } 06125 06127 void SetLayout (int l) {m_layout = (unsigned char)l;} 06129 int GetLayout () const {return (int)m_layout;} 06130 }; 06131 06133 06135 06147 enum TKO_Bounding_Type_Options { 06148 TKO_Bounding_Type_Cuboid = 0, 06149 TKO_Bounding_Type_Sphere = 1 06150 }; 06151 06152 06153 06155 06166 class BBINFILETK_API2 TK_Bounding : public BBaseOpcodeHandler { 06167 protected: 06168 double m_dvalues[6]; 06169 float m_values[6]; 06170 char m_type; 06171 bool m_is_valid; 06172 public: 06174 TK_Bounding (unsigned char opcode) 06175 : BBaseOpcodeHandler (opcode) {} 06177 TK_Bounding (unsigned char opcode, float min[], float max[]) 06178 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) { 06179 m_values[0] = min[0]; m_values[1] = min[1]; m_values[2] = min[2]; 06180 m_values[3] = max[0]; m_values[4] = max[1]; m_values[5] = max[2]; 06181 } 06183 TK_Bounding (unsigned char opcode, float center[], float radius) 06184 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) { 06185 m_values[0] = center[0]; m_values[1] = center[1]; m_values[2] = center[2]; 06186 m_values[3] = radius; 06187 } 06189 TK_Bounding (unsigned char opcode, double min[], double max[]) 06190 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Cuboid), m_is_valid (true) { 06191 m_dvalues[0] = min[0]; m_dvalues[1] = min[1]; m_dvalues[2] = min[2]; 06192 m_dvalues[3] = max[0]; m_dvalues[4] = max[1]; m_dvalues[5] = max[2]; 06193 Set_General_Flags (TK_Double_Precision); 06194 } 06196 TK_Bounding (unsigned char opcode, double center[], double radius) 06197 : BBaseOpcodeHandler (opcode), m_type (TKO_Bounding_Type_Sphere), m_is_valid (true) { 06198 m_dvalues[0] = center[0]; m_dvalues[1] = center[1]; m_dvalues[2] = center[2]; 06199 m_dvalues[3] = radius; 06200 Set_General_Flags (TK_Double_Precision); 06201 } 06202 06203 TK_Status Read (BStreamFileToolkit & tk); 06204 TK_Status Write (BStreamFileToolkit & tk); 06205 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06206 06207 TK_Status ReadAscii (BStreamFileToolkit & tk); 06208 TK_Status WriteAscii (BStreamFileToolkit & tk); 06209 }; 06210 06212 06216 enum TKO_Light_Options { 06217 TKO_Light_Camera_Relative = 0x1 06218 }; 06219 06220 06222 06224 06230 class BBINFILETK_API TK_Point : public BBaseOpcodeHandler { 06231 protected: 06232 float m_point[3]; 06233 double m_dpoint[3]; 06234 char m_options; 06235 06236 public: 06238 TK_Point (unsigned char opcode) 06239 : BBaseOpcodeHandler (opcode) { 06240 m_point[0] = m_point[1] = m_point[2] = 0; 06241 m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 06242 m_options = 0; 06243 }; 06244 06245 TK_Status Read (BStreamFileToolkit & tk); 06246 TK_Status Write (BStreamFileToolkit & tk); 06247 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06248 06249 TK_Status ReadAscii (BStreamFileToolkit & tk); 06250 TK_Status WriteAscii (BStreamFileToolkit & tk); 06251 06252 void Reset(void) { 06253 m_point[0] = m_point[1] = m_point[2] = 0; 06254 m_dpoint[0] = m_dpoint[1] = m_dpoint[2] = 0; 06255 m_options = 0; 06256 BBaseOpcodeHandler::Reset(); 06257 }; 06258 06259 06260 06262 void SetPoint (float x, float y, float z) { m_point[0] = x; m_point[1] = y; m_point[2] = z; } 06264 void SetPoint (float const p[]) { SetPoint (p[0], p[1], p[2]); } 06266 float const * GetPoint () const { return m_point; } 06267 06269 void SetDPoint (double x, double y, double z) { m_dpoint[0] = x; m_dpoint[1] = y; m_dpoint[2] = z; } 06271 void SetDPoint (double const p[]) { SetDPoint (p[0], p[1], p[2]); } 06273 double const * GetDPoint () const { return m_dpoint; } 06274 06276 void SetOptions (int o) { m_options = (char)o; } 06278 int GetOptions () const { return (int)m_options; } 06279 06280 }; 06281 06282 06283 06285 06290 class BBINFILETK_API TK_Line : public BBaseOpcodeHandler { 06291 protected: 06293 float m_points[6]; 06295 double m_dpoints[6]; 06296 06297 public: 06299 TK_Line (unsigned char opcode = TKE_Line) 06300 : BBaseOpcodeHandler (opcode) {} 06301 06302 TK_Status Read (BStreamFileToolkit & tk); 06303 TK_Status Write (BStreamFileToolkit & tk); 06304 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06305 06306 TK_Status ReadAscii (BStreamFileToolkit & tk); 06307 TK_Status WriteAscii (BStreamFileToolkit & tk); 06308 06310 void SetPoints (float x1, float y1, float z1, float x2, float y2, float z2) { 06311 m_points[0] = x1; m_points[1] = y1; m_points[2] = z1; 06312 m_points[3] = x2; m_points[4] = y2; m_points[5] = z2; 06313 } 06315 void SetPoints (float const s[], float const e[]) { 06316 SetPoints (s[0], s[1], s[2], e[0], e[1], e[2]); 06317 } 06319 void SetPoints (float const p[]) { SetPoints (&p[0], &p[3]); } 06321 float const * GetPoints () const { return m_points; } 06322 06324 void SetDPoints (double x1, double y1, double z1, double x2, double y2, double z2) { 06325 m_dpoints[0] = x1; m_dpoints[1] = y1; m_dpoints[2] = z1; 06326 m_dpoints[3] = x2; m_dpoints[4] = y2; m_dpoints[5] = z2; 06327 } 06329 void SetDPoints (double const s[], double const e[]) { 06330 SetDPoints (s[0], s[1], s[2], e[0], e[1], e[2]); 06331 } 06333 void SetDPoints (double const p[]) { SetDPoints (&p[0], &p[3]); } 06335 double const * GetDPoints () const { return m_dpoints; } 06336 06337 }; 06338 06339 06340 06342 06349 class BBINFILETK_API TK_Polypoint : public BBaseOpcodeHandler { 06350 protected: 06351 int m_count; 06352 int m_allocated; 06353 float * m_points; 06354 double * m_dpoints; 06357 void set_points (int count, float const points[] = 0) { SetPoints (count, points); } 06358 public: 06362 TK_Polypoint (unsigned char opcode) 06363 : BBaseOpcodeHandler (opcode), m_count (0), m_allocated (0), m_points (0), m_dpoints (0) {} 06364 ~TK_Polypoint(); 06365 06366 TK_Status Read (BStreamFileToolkit & tk); 06367 TK_Status Write (BStreamFileToolkit & tk); 06368 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06369 06370 TK_Status ReadAscii (BStreamFileToolkit & tk); 06371 TK_Status WriteAscii (BStreamFileToolkit & tk); 06372 06373 void Reset (); 06374 06377 void SetPoints (int count, float const points[] = 0); 06379 float const * GetPoints () const { return m_points; } 06381 float * GetPoints () { return m_points; } 06382 06385 void SetDPoints (int count, double const points[] = 0); 06387 double const * GetDPoints () const { return m_dpoints; } 06389 double * GetDPoints () { return m_dpoints; } 06390 06392 int GetCount () const { return m_count; } 06393 06394 }; 06395 06396 06397 06398 06399 #define NC_HAS_WEIGHTS 0x01 //!< an array of floats for the weights is specified with the TK_NURBS_Curve 06400 #define NC_HAS_KNOTS 0x02 //!< an array of floats for the knots is specified with the TK_NURBS_Curve 06401 #define NC_HAS_START 0x04 //!< a float is specified for where the TK_NURBS_Curve starts in parametric [0,1] space 06402 #define NC_HAS_END 0x08 //!< a float is specified for where the TK_NURBS_Curve ends in parametric [0,1] space 06403 06405 06410 class BBINFILETK_API TK_NURBS_Curve : public BBaseOpcodeHandler { 06411 protected: 06412 unsigned char m_optionals; 06413 unsigned char m_degree; 06414 int m_control_point_count; 06415 int m_knot_count_implicit; 06416 float *m_control_points; 06417 double *m_dcontrol_points; 06418 float *m_weights; 06419 float *m_knots; 06420 float m_start; 06421 float m_end; 06423 06424 void set_curve (int degree, int control_count, float const points[] = 0, 06425 float const weights[] = 0, float const knots[] = 0, 06426 float start = 0.0f, float end = 1.0f); 06427 public: 06428 TK_NURBS_Curve(); 06429 ~TK_NURBS_Curve(); 06430 06431 TK_Status Read (BStreamFileToolkit & tk); 06432 TK_Status Write (BStreamFileToolkit & tk); 06433 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06434 06435 TK_Status ReadAscii (BStreamFileToolkit & tk); 06436 TK_Status WriteAscii (BStreamFileToolkit & tk); 06437 06438 void Reset (); 06439 06441 void SetCurve (int degree, int control_count, float const points[] = 0, 06442 float const weights[] = 0, float const knots[] = 0, 06443 float start = 0.0f, float end = 1.0f) { 06444 set_curve (degree, control_count, points, weights, knots, start, end); 06445 } 06446 void SetDCurve (int degree, int control_count, double const points[] = 0, 06447 float const weights[] = 0, float const knots[] = 0, 06448 float start = 0.0f, float end = 1.0f); 06449 06450 float const * GetPoints () const { return m_control_points; } 06451 float * GetPoints () { return m_control_points; } 06452 double const * GetDPoints () const { return m_dcontrol_points; } 06453 double * GetDPoints () { return m_dcontrol_points; } 06455 int GetDegree () const { return m_degree; } 06456 int GetCount () const { return m_control_point_count; } 06457 float const * GetWeights () const { return m_weights; } 06458 float * GetWeights () { return m_weights; } 06459 float const * GetKnots () const { return m_knots; } 06460 float * GetKnots () { return m_knots; } 06462 void SetStart (float s) { m_start = s; } 06463 float GetStart () const { return m_start; } 06464 void SetEnd (float e) { m_end = e; } 06465 float GetEnd () const { return m_end; } 06467 void SetOptions (int o) { m_optionals = (unsigned char)o; } 06468 int GetOptions () const { return m_optionals; } 06470 }; 06471 06472 06473 06474 06475 06476 #define NS_HAS_WEIGHTS 0x01 //!< an array of floats for the weights is specified with the TK_NURBS_Surface 06477 #define NS_HAS_KNOTS 0x02 //!< an array of floats for the knots is specified with the TK_NURBS_Surface 06478 #define NS_HAS_TRIMS 0x04 //!< the TK_NURBS_Surface contains a list of trims 06479 06480 #define NS_TRIM_END 0 //!< terminates an NS_TRIM_COLLECTION if one is active, otherwise terminates the list of trims 06481 #define NS_TRIM_POLY 1 //!< the next trim is a polyline (closed automatically if not already a closed loop) 06482 #define NS_TRIM_CURVE 2 //!< the next trim is a nurbs curve in parametric space 06483 #define NS_TRIM_COLLECTION 3 //!< all trim objects up to the next NS_TRIM_END should be combined as one. 06484 #define NS_TRIM_LAST_KNOWN_TYPE 3 //!< the last known trim type defined as of the current version of the toolkit 06485 06486 #define NS_TRIM_KEEP 0x01 //!< instead of the usual cutting away the enclosed area, cut away everything but 06487 #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 06488 #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 06489 06491 06497 class BBINFILETK_API HT_NURBS_Trim : public BBaseOpcodeHandler { 06498 friend class TK_NURBS_Surface; 06499 protected: 06500 //first 5 are relevant to polys and curves 06501 int m_substage; 06502 HT_NURBS_Trim * m_next; 06503 unsigned char m_type; 06504 int m_count; 06505 float * m_points; 06506 //next 6 are specific to curves 06507 unsigned char m_degree; 06508 unsigned char m_options; 06509 float * m_weights; 06510 float * m_knots; 06511 float m_start_u; 06512 float m_end_u; 06513 HT_NURBS_Trim * m_list; 06514 HT_NURBS_Trim * m_current_trim; 06516 HT_NURBS_Trim(); 06517 TK_Status read_collection(BStreamFileToolkit & tk); 06518 TK_Status write_collection(BStreamFileToolkit & tk); 06521 public: 06522 ~HT_NURBS_Trim(); 06523 void SetPoly (int count, float const points[] = 0); 06524 void SetCurve (int degree, int control_count, float const points[] = 0, 06525 float const weights[] = 0, float const knots[] = 0, float start_u = 0, float end_u = 1); 06526 void SetCollection (); 06527 void SetOptions (int o) { m_options = (unsigned char)o; } 06528 void SetList (HT_NURBS_Trim *node) { m_list = node; } 06529 void SetNext (HT_NURBS_Trim *next) { m_next = next; } 06531 TK_Status Read (BStreamFileToolkit & tk); 06532 TK_Status Write (BStreamFileToolkit & tk); 06533 06534 TK_Status ReadAscii (BStreamFileToolkit & tk); 06535 TK_Status WriteAscii (BStreamFileToolkit & tk); 06536 06537 TK_Status read_collection_ascii(BStreamFileToolkit & tk); 06538 TK_Status write_collection_ascii(BStreamFileToolkit & tk); 06539 06541 HT_NURBS_Trim * GetNext (void) { return m_next; } 06543 int GetType () const { return m_type; } 06545 int GetCount () const { return m_count; } 06547 float const * GetPoints () const { return m_points; } 06549 float * GetPoints () { return m_points; } 06551 int GetDegree () const { return m_degree; } 06553 int GetOptions () const { return m_options; } 06555 float const * GetWeights () const { return m_weights; } 06557 float * GetWeights () { return m_weights; } 06559 float const * GetKnots () const { return m_knots; } 06561 float * GetKnots () { return m_knots; } 06563 HT_NURBS_Trim const *GetList () const { return m_list; } 06565 HT_NURBS_Trim * GetList () { return m_list; } 06566 06567 }; 06568 06570 06575 class BBINFILETK_API TK_NURBS_Surface : public BBaseOpcodeHandler { 06576 protected: 06577 unsigned char m_optionals; 06578 unsigned char m_degree[2]; 06579 int m_size[2]; 06580 float * m_control_points; 06581 double * m_dcontrol_points; 06582 float * m_weights; 06583 float * m_u_knots; 06584 float * m_v_knots; 06586 HT_NURBS_Trim * m_trims; 06587 HT_NURBS_Trim * m_current_trim; 06590 public: 06591 TK_NURBS_Surface(); 06592 ~TK_NURBS_Surface(); 06593 06594 TK_Status Read (BStreamFileToolkit & tk); 06595 TK_Status Write (BStreamFileToolkit & tk); 06596 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06597 06598 TK_Status ReadAscii (BStreamFileToolkit & tk); 06599 TK_Status WriteAscii (BStreamFileToolkit & tk); 06600 06601 void Reset (); 06603 void SetSurface (int u_degree, int v_degree, int u_size, int v_size, 06604 float const points[] = 0, float const weights[] = 0, 06605 float const u_knots[] = 0, float const v_knots[] = 0); 06606 void SetDSurface (int u_degree, int v_degree, int u_size, int v_size, 06607 double const points[] = 0, float const weights[] = 0, 06608 float const u_knots[] = 0, float const v_knots[] = 0); 06611 float const * GetPoints () const { return m_control_points; } 06613 float * GetPoints () { return m_control_points; } 06615 double const * GetDPoints () const { return m_dcontrol_points; } 06617 double * GetDPoints () { return m_dcontrol_points; } 06618 06620 int GetUDegree () const { return m_degree[0]; } 06622 int GetVDegree () const { return m_degree[1]; } 06624 int GetUSize () const { return m_size[0]; } 06626 int GetVSize () const { return m_size[1]; } 06628 float const * GetWeights () const { return m_weights; } 06630 float * GetWeights () { return m_weights; } 06632 float const * GetUKnots () const { return m_u_knots; } 06634 float * GetUKnots () { return m_u_knots; } 06636 float const * GetVKnots () const { return m_v_knots; } 06638 float * GetVKnots () { return m_v_knots; } 06639 06641 void SetOptions (int o) { m_optionals = (unsigned char)o; } 06643 int GetOptions () const { return m_optionals; } 06644 06646 HT_NURBS_Trim * NewTrim (int type = NS_TRIM_END); 06648 HT_NURBS_Trim * GetTrims () { return m_trims; } 06649 06650 06651 }; 06652 06654 06659 class BBINFILETK_API TK_Area_Light : public BBaseOpcodeHandler { 06660 protected: 06661 int m_count; 06662 float * m_points; 06663 double * m_dpoints; 06664 char m_options; 06665 06667 void set_points (int count, float const points[] = 0); 06668 06669 public: 06671 TK_Area_Light () 06672 : BBaseOpcodeHandler (TKE_Area_Light), m_count (0), m_points (0), m_dpoints (0), m_options (0) {} 06673 ~TK_Area_Light(); 06674 06675 TK_Status Read (BStreamFileToolkit & tk); 06676 TK_Status Write (BStreamFileToolkit & tk); 06677 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06678 06679 TK_Status ReadAscii (BStreamFileToolkit & tk); 06680 TK_Status WriteAscii (BStreamFileToolkit & tk); 06681 06682 void Reset (); 06683 06688 void SetPoints (int count, float const points[] = 0) { set_points (count, points); } 06690 float const * GetPoints () const { return m_points; } 06692 float * GetPoints () { return m_points; } 06693 06698 void SetDPoints (int count, double const points[] = 0) ; 06700 double const * GetDPoints () const { return m_dpoints; } 06702 double * GetDPoints () { return m_dpoints; } 06703 06705 int GetCount () const { return m_count; } 06706 06708 void SetOptions (int o) { m_options = (char)o; } 06710 int GetOptions () const { return (int)m_options; } 06711 }; 06712 06713 06717 enum TKO_Spot_Light_Options { 06718 TKO_Spot_Outer_Degrees = 0x01, 06719 TKO_Spot_Outer_Field = 0x02, 06720 06721 TKO_Spot_Inner_Degrees = 0x04, 06722 TKO_Spot_Inner_Field = 0x08, 06723 TKO_Spot_Inner_Percent = 0x0C, 06724 06725 TKO_Spot_Outer_Mask = 0x03, 06726 TKO_Spot_Inner_Mask = 0x0C, 06727 06728 TKO_Spot_Camera_Relative = 0x10, 06729 06730 TKO_Spot_Concentration = 0x20 06731 }; 06732 06733 06735 06740 class BBINFILETK_API TK_Spot_Light : public BBaseOpcodeHandler { 06741 protected: 06742 float m_position[3]; 06743 float m_target[3]; 06744 double m_dposition[3]; 06745 double m_dtarget[3]; 06746 float m_outer; 06747 float m_inner; 06748 float m_concentration; 06749 char m_options; 06750 06751 public: 06753 TK_Spot_Light () 06754 : BBaseOpcodeHandler (TKE_Spot_Light), m_options (0) {} 06755 06756 TK_Status Read (BStreamFileToolkit & tk); 06757 TK_Status Write (BStreamFileToolkit & tk); 06758 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06759 06760 TK_Status ReadAscii (BStreamFileToolkit & tk); 06761 TK_Status WriteAscii (BStreamFileToolkit & tk); 06762 06764 void SetPosition (float x, float y, float z) 06765 { m_position[0] = x; m_position[1] = y; m_position[2] = z; } 06767 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 06769 float const * GetPosition () const { return m_position; } 06770 06772 void SetDPosition (double x, double y, double z) 06773 { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; } 06775 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 06777 double const * GetDPosition () const { return m_dposition; } 06778 06780 void SetTarget (float x, float y, float z) 06781 { m_target[0] = x; m_target[1] = y; m_target[2] = z; } 06783 void SetTarget (float const t[]) { SetTarget (t[0], t[1], t[2]); } 06785 float const * GetTarget () const { return m_target; } 06786 06788 void SetDTarget (double x, double y, double z) 06789 { m_dtarget[0] = x; m_dtarget[1] = y; m_dtarget[2] = z; } 06791 void SetDTarget (double const t[]) { SetDTarget (t[0], t[1], t[2]); } 06793 double const * GetDTarget () const { return m_dtarget; } 06794 06796 void SetOuter (float o) { m_outer = o; } 06798 float GetOuter () const { return m_outer; } 06799 06801 void SetInner (float i) { m_inner = i; } 06803 float GetInner () const { return m_inner; } 06804 06806 void SetConcentration (float c) { m_concentration = c; } 06808 float GetConcentration () const { return m_concentration; } 06809 06811 void SetOptions (int o) { m_options = (char)o; } 06813 int GetOptions () const { return (int)m_options; } 06814 }; 06815 06816 06818 06823 class BBINFILETK_API TK_Cutting_Plane : public BBaseOpcodeHandler { 06824 protected: 06825 float * m_planes; 06826 double * m_dplanes; 06827 int m_count; 06828 06829 public: 06831 TK_Cutting_Plane () 06832 : BBaseOpcodeHandler (TKE_Cutting_Plane), m_planes (0), m_dplanes (0), m_count (0) {} 06833 ~TK_Cutting_Plane (); 06834 06835 TK_Status Read (BStreamFileToolkit & tk); 06836 TK_Status Write (BStreamFileToolkit & tk); 06837 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06838 06839 TK_Status ReadAscii (BStreamFileToolkit & tk); 06840 TK_Status WriteAscii (BStreamFileToolkit & tk); 06841 06842 void Reset (); 06843 06845 void SetPlanes (int count, float const p[]=0); 06847 void SetDPlanes (int count, double const p[]=0); 06848 06850 void SetPlane (float a, float b, float c, float d) 06851 { SetPlanes(1); 06852 m_planes[0] = a; m_planes[1] = b; m_planes[2] = c; m_planes[3] = d; } 06854 void SetDPlane (double a, double b, double c, double d) 06855 { SetDPlanes(1); 06856 m_dplanes[0] = a; m_dplanes[1] = b; m_dplanes[2] = c; m_dplanes[3] = d; } 06857 06859 void SetPlane (float const p[]) { SetPlanes (1, p); } 06861 void SetDPlane (double const p[]) { SetDPlanes (1, p); } 06862 06864 float const * GetPlane () const { return m_planes; } 06866 double const * GetDPlane () const { return m_dplanes; } 06867 06869 float const * GetPlanes () const { return m_planes; } 06871 double const * GetDPlanes () const { return m_dplanes; } 06872 06874 int GetCount () const { return m_count; } 06875 }; 06876 06877 06881 enum TKO_Circular_Options { 06882 TKO_Circular_Center = 0x01 06883 }; 06884 06886 06893 class BBINFILETK_API TK_Circle : public BBaseOpcodeHandler { 06894 protected: 06895 float m_points[9]; 06896 float m_center[3]; 06897 double m_dpoints[9]; 06898 double m_dcenter[3]; 06899 unsigned char m_flags; 06902 public: 06904 TK_Circle (unsigned char opcode) 06905 : BBaseOpcodeHandler (opcode), m_flags (0) {} 06906 06907 TK_Status Read (BStreamFileToolkit & tk); 06908 TK_Status Write (BStreamFileToolkit & tk); 06909 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 06910 06911 TK_Status ReadAscii (BStreamFileToolkit & tk); 06912 TK_Status WriteAscii (BStreamFileToolkit & tk); 06913 06914 void Reset (); 06915 06917 void SetStart (float x, float y, float z) { 06918 m_points[0] = x; m_points[1] = y; m_points[2] = z; 06919 } 06921 void SetStart (float const s[]) { 06922 SetStart (s[0], s[1], s[2]); 06923 } 06925 void SetMiddle (float x, float y, float z) { 06926 m_points[3] = x; m_points[4] = y; m_points[5] = z; 06927 } 06929 void SetMiddle (float const m[]) { 06930 SetMiddle (m[0], m[1], m[2]); 06931 } 06933 void SetEnd (float x, float y, float z) { 06934 m_points[6] = x; m_points[7] = y; m_points[8] = z; 06935 } 06937 void SetEnd (float const e[]) { 06938 SetEnd (e[0], e[1], e[2]); 06939 } 06941 void SetCenter (float x, float y, float z) { 06942 m_center[0] = x; m_center[1] = y; m_center[2] = z; 06943 m_flags = TKO_Circular_Center; 06944 } 06946 void SetCenter (float const c[]) { 06947 if (c) SetCenter (c[0], c[1], c[2]); 06948 else m_flags = 0; 06949 } 06951 void SetPoints (float const s[], float const m[], float const e[], 06952 float const c[] = 0) { 06953 SetStart (s); SetMiddle (m); SetEnd (e); SetCenter (c); 06954 } 06955 06957 float const * GetStart () const { return &m_points[0]; } 06959 float const * GetMiddle () const { return &m_points[3]; } 06961 float const * GetEnd () const { return &m_points[6]; } 06963 float const * GetCenter () const { return (m_flags & TKO_Circular_Center) ? m_center : 0; } 06964 06966 void SetDStart (double x, double y, double z) { 06967 m_dpoints[0] = x; m_dpoints[1] = y; m_dpoints[2] = z; 06968 } 06970 void SetDStart (double const s[]) { 06971 SetDStart (s[0], s[1], s[2]); 06972 } 06974 void SetDMiddle (double x, double y, double z) { 06975 m_dpoints[3] = x; m_dpoints[4] = y; m_dpoints[5] = z; 06976 } 06978 void SetDMiddle (double const m[]) { 06979 SetDMiddle (m[0], m[1], m[2]); 06980 } 06982 void SetDEnd (double x, double y, double z) { 06983 m_dpoints[6] = x; m_dpoints[7] = y; m_dpoints[8] = z; 06984 } 06986 void SetDEnd (double const e[]) { 06987 SetDEnd (e[0], e[1], e[2]); 06988 } 06990 void SetDCenter (double x, double y, double z) { 06991 m_dcenter[0] = x; m_dcenter[1] = y; m_dcenter[2] = z; 06992 m_flags = TKO_Circular_Center; 06993 } 06995 void SetDCenter (double const c[]) { 06996 if (c) SetDCenter (c[0], c[1], c[2]); 06997 else m_flags = 0; 06998 } 07000 void SetDPoints (double const s[], double const m[], double const e[], 07001 double const c[] = 0) { 07002 SetDStart (s); SetDMiddle (m); SetDEnd (e); SetDCenter (c); 07003 } 07004 07006 double const * GetDStart () const { return &m_dpoints[0]; } 07008 double const * GetDMiddle () const { return &m_dpoints[3]; } 07010 double const * GetDEnd () const { return &m_dpoints[6]; } 07012 double const * GetDCenter () const { return (m_flags & TKO_Circular_Center) ? m_dcenter : 0; } 07013 }; 07014 07015 07017 07024 class BBINFILETK_API TK_Ellipse : public BBaseOpcodeHandler { 07025 protected: 07026 float m_points[9]; 07027 double m_dpoints[9]; 07028 float m_limits[2]; 07030 public: 07032 TK_Ellipse (unsigned char opcode) 07033 : BBaseOpcodeHandler (opcode) {} 07034 07035 TK_Status Read (BStreamFileToolkit & tk); 07036 TK_Status Write (BStreamFileToolkit & tk); 07037 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07038 07039 TK_Status ReadAscii (BStreamFileToolkit & tk); 07040 TK_Status WriteAscii (BStreamFileToolkit & tk); 07041 07043 void SetCenter (float x, float y, float z) { 07044 m_points[0] = x; m_points[1] = y; m_points[2] = z; 07045 } 07047 void SetCenter (float const s[]) { SetCenter (s[0], s[1], s[2]); } 07049 float const * GetCenter () const { return &m_points[0]; } 07050 07052 void SetMajor (float x, float y, float z) { 07053 m_points[3] = x; m_points[4] = y; m_points[5] = z; 07054 } 07056 void SetMajor (float const m[]) { SetMajor (m[0], m[1], m[2]); } 07058 float const * GetMajor () const { return &m_points[3]; } 07059 07061 void SetMinor (float x, float y, float z) { 07062 m_points[6] = x; m_points[7] = y; m_points[8] = z; 07063 } 07065 void SetMinor (float const m[]) { SetMinor (m[0], m[1], m[2]); } 07067 float const * GetMinor () const { return &m_points[6]; } 07068 07069 07071 void SetDCenter (double x, double y, double z) { 07072 m_dpoints[0] = x; m_dpoints[1] = y; m_dpoints[2] = z; 07073 } 07075 void SetDCenter (double const s[]) { SetDCenter (s[0], s[1], s[2]);} 07077 double const * GetDCenter () const { return &m_dpoints[0]; } 07078 07080 void SetDMajor (double x, double y, double z) { 07081 m_dpoints[3] = x; m_dpoints[4] = y; m_dpoints[5] = z; 07082 } 07084 void SetDMajor (double const m[]) { SetDMajor (m[0], m[1], m[2]); } 07086 double const * GetDMajor () const { return &m_dpoints[3]; } 07087 07089 void SetDMinor (double x, double y, double z) { 07090 m_dpoints[6] = x; m_dpoints[7] = y; m_dpoints[8] = z; 07091 } 07093 void SetDMinor (double const m[]) { SetDMinor (m[0], m[1], m[2]); } 07095 double const * GetDMinor () const { return &m_dpoints[6]; } 07096 07098 void SetLimits (float s, float e) { 07099 m_limits[0] = s; m_limits[1] = e; 07100 } 07102 float const * GetLimits () const { return m_limits; } 07103 }; 07104 07105 07107 07114 class BBINFILETK_API TK_Sphere : public BBaseOpcodeHandler { 07115 protected: 07116 unsigned char m_flags; 07117 float m_center[3]; 07118 float m_radius; 07119 float m_axis[3]; 07120 float m_ortho[3]; 07121 double m_dcenter[3]; 07122 double m_dradius; 07123 double m_daxis[3]; 07124 double m_dortho[3]; 07126 public: 07128 TK_Sphere () 07129 : BBaseOpcodeHandler (TKE_Sphere) { Reset(); } 07130 07131 TK_Status Read (BStreamFileToolkit & tk); 07132 TK_Status Write (BStreamFileToolkit & tk); 07133 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07134 07135 TK_Status ReadAscii (BStreamFileToolkit & tk); 07136 TK_Status WriteAscii (BStreamFileToolkit & tk); 07137 07138 void Reset (); 07139 07141 void SetCenter (float x, float y, float z) { 07142 m_center[0] = x; m_center[1] = y; m_center[2] = z; 07143 } 07145 void SetCenter (float const s[]) { SetCenter (s[0], s[1], s[2]); } 07147 float const * GetCenter () const { return m_center; } 07148 07149 07151 void SetRadius (float r) { m_radius = r; } 07153 float GetRadius () const { return m_radius; } 07154 07156 void SetAxis (float x, float y, float z) { 07157 m_axis[0] = x; m_axis[1] = y; m_axis[2] = z; 07158 if (x != 0.0f || y != 1.0f || z != 0.0f) 07159 m_flags &= ~TKSPH_NULL_AXIS; 07160 } 07162 void SetAxis (float const s[]) { SetAxis (s[0], s[1], s[2]); } 07164 float const * GetAxis () const { return m_axis; } 07165 07167 void SetOrtho (float x, float y, float z) { 07168 m_ortho[0] = x; m_ortho[1] = y; m_ortho[2] = z; 07169 if (x != 1.0f || y != 0.0f || z != 0.0f) 07170 m_flags &= ~TKSPH_NULL_AXIS; 07171 } 07173 void SetOrtho (float const s[]) { SetOrtho (s[0], s[1], s[2]); } 07175 float const * GetOrtho () const { return m_ortho; } 07176 07177 07179 void SetDCenter (double x, double y, double z) { 07180 m_dcenter[0] = x; m_dcenter[1] = y; m_dcenter[2] = z; 07181 } 07183 void SetDCenter (double const s[]) { SetDCenter (s[0], s[1], s[2]);} 07185 double const * GetDCenter () const { return m_dcenter; } 07186 07187 07189 void SetDRadius (double r) { m_dradius = r; } 07191 double GetDRadius () const { return m_dradius; } 07192 07194 void SetDAxis (double x, double y, double z) { 07195 m_daxis[0] = x; m_daxis[1] = y; m_daxis[2] = z; 07196 if (x != 0.0f || y != 1.0f || z != 0.0f) 07197 m_flags &= ~TKSPH_NULL_AXIS; 07198 } 07200 void SetDAxis (double const s[]) { SetDAxis (s[0], s[1], s[2]); } 07202 double const * GetDAxis () const { return m_daxis; } 07203 07205 void SetDOrtho (double x, double y, double z) { 07206 m_dortho[0] = x; m_dortho[1] = y; m_dortho[2] = z; 07207 if (x != 1.0f || y != 0.0f || z != 0.0f) 07208 m_flags &= ~TKSPH_NULL_AXIS; 07209 } 07211 void SetDOrtho (double const s[]) { SetDOrtho (s[0], s[1], s[2]); } 07213 double const * GetDOrtho () const { return m_dortho; } 07214 07215 07219 enum Flags { 07220 TKSPH_NONE = 0x0, 07221 TKSPH_NULL_AXIS = 0x1 07222 }; 07223 07224 }; 07225 07226 07228 07235 class BBINFILETK_API TK_Cylinder : public BBaseOpcodeHandler { 07236 protected: 07237 float m_axis[6]; 07238 float m_radius; 07239 double m_daxis[6]; 07240 double m_dradius; 07241 unsigned char m_flags; 07243 public: 07245 TK_Cylinder () 07246 : BBaseOpcodeHandler (TKE_Cylinder) {} 07247 07248 TK_Status Read (BStreamFileToolkit & tk); 07249 TK_Status Write (BStreamFileToolkit & tk); 07250 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07251 07252 TK_Status ReadAscii (BStreamFileToolkit & tk); 07253 TK_Status WriteAscii (BStreamFileToolkit & tk); 07254 07256 void SetAxis (float x1, float y1, float z1, float x2, float y2, float z2) { 07257 m_axis[0] = x1; m_axis[1] = y1; m_axis[2] = z1; 07258 m_axis[3] = x2; m_axis[4] = y2; m_axis[5] = z2; 07259 } 07261 void SetAxis (float const s[], float const e[]) { SetAxis (s[0], s[1], s[2], e[0], e[1], e[2]); } 07263 void SetAxis (float const a[]) { SetAxis (&a[0], &a[3]); } 07265 float const * GetAxis () const { return m_axis; } 07267 float const * GetStart () const { return &m_axis[0]; } 07269 float const * GetEnd () const { return &m_axis[3]; } 07270 07272 void SetRadius (float r) { m_radius = r; } 07274 float GetRadius () const { return m_radius; } 07275 07276 07278 void SetDAxis (double x1, double y1, double z1, double x2, double y2, double z2) { 07279 m_daxis[0] = x1; m_daxis[1] = y1; m_daxis[2] = z1; 07280 m_daxis[3] = x2; m_daxis[4] = y2; m_daxis[5] = z2; 07281 } 07283 void SetDAxis (double const s[], double const e[]) { SetDAxis (s[0], s[1], s[2], e[0], e[1], e[2]); } 07285 void SetDAxis (double const a[]) { SetDAxis (&a[0], &a[3]); } 07287 double const * GetDAxis () const { return m_daxis; } 07289 double const * GetDStart () const { return &m_daxis[0]; } 07291 double const * GetDEnd () const { return &m_daxis[3]; } 07292 07294 void SetDRadius (double r) { m_dradius = r; } 07296 double GetDRadius () const { return m_dradius; } 07297 07298 07300 void SetCaps (int f) { m_flags = (unsigned char)f; } 07302 int GetCaps () const { return m_flags; } 07303 07307 enum Capping_Options { 07308 TKCYL_NONE = 0, 07309 TKCYL_FIRST = 1, 07310 TKCYL_SECOND = 2, 07311 TKCYL_BOTH = 3 07312 }; 07313 07314 }; 07315 07316 07318 07325 #include "BPolyhedron.h" 07326 07327 class BBINFILETK_API TK_PolyCylinder : public TK_Polyhedron { 07328 protected: 07329 int m_count; 07330 float * m_points; 07331 double * m_dpoints; 07332 int m_radius_count; 07333 float * m_radii; 07334 double * m_dradii; 07335 unsigned char m_flags; 07336 float m_normals[6]; 07338 public: 07340 TK_PolyCylinder () 07341 : TK_Polyhedron (TKE_PolyCylinder), m_count (0), m_points (0), m_dpoints (0), 07342 m_radius_count (0), m_radii (0), m_dradii (0) {} 07343 ~TK_PolyCylinder(); 07344 07345 TK_Status Read (BStreamFileToolkit & tk); 07346 TK_Status Write (BStreamFileToolkit & tk); 07347 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07348 07349 TK_Status ReadAscii (BStreamFileToolkit & tk); 07350 TK_Status WriteAscii (BStreamFileToolkit & tk); 07351 07352 virtual void Reset (); 07353 07357 enum Capping_Options { 07358 TKCYL_NORMAL_FIRST = 0x04, 07359 TKCYL_NORMAL_SECOND = 0x08, 07360 TKCYL_OPTIONALS = 0x10 07361 }; 07362 07367 void SetPoints (int count, float const points[] = 0); 07369 float const * GetPoints () const { return m_points; } 07371 float * GetPoints () { return m_points; } 07372 07377 void SetRadii (int count, float const radii[] = 0); 07379 void SetRadius (float radius) { SetRadii (1, &radius); } 07381 float const * GetRadii () const { return m_radii; } 07383 float * GetRadii () { return m_radii; } 07384 07385 07390 void SetDPoints (int count, double const points[] = 0); 07392 double const * GetDPoints () const { return m_dpoints; } 07394 double * GetDPoints () { return m_dpoints; } 07395 07400 void SetDRadii (int count, double const radii[] = 0); 07402 void SetDRadius (double radius) { SetDRadii (1, &radius); } 07404 double const * GetDRadii () const { return m_dradii; } 07406 double * GetDRadii () { return m_dradii; } 07407 07408 07410 int GetCount () const { return m_count; } 07412 int GetRadiusCount () const { return m_radius_count; } 07413 07414 07415 07416 07418 void SetCaps (int f) { m_flags &= ~0x03; m_flags |= f; } 07420 int GetCaps () const { return m_flags & 0x03; } 07421 07423 void SetEndNormal (int index, float const normal[] = 0) { 07424 int mask = 0x40 << index; 07425 if (normal == 0) 07426 m_flags &= ~mask; 07427 else { 07428 m_flags |= mask; 07429 m_normals[3*index+0] = normal[0]; 07430 m_normals[3*index+1] = normal[1]; 07431 m_normals[3*index+2] = normal[2]; 07432 } 07433 } 07435 float const * GetEndNormal (int index) const { 07436 int mask = 0x40 << index; 07437 if (m_flags & mask) 07438 return &m_normals[3*index]; 07439 else 07440 return 0; 07441 } 07442 }; 07443 07444 07446 07452 class BBINFILETK_API TK_Grid : public BBaseOpcodeHandler { 07453 protected: 07454 char m_type; 07455 float m_points[9]; 07456 double m_dpoints[9]; 07457 int m_counts[2]; 07459 public: 07461 TK_Grid () 07462 : BBaseOpcodeHandler (TKE_Grid) {} 07463 07464 TK_Status Read (BStreamFileToolkit & tk); 07465 TK_Status Write (BStreamFileToolkit & tk); 07466 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07467 07468 TK_Status ReadAscii (BStreamFileToolkit & tk); 07469 TK_Status WriteAscii (BStreamFileToolkit & tk); 07470 07472 void SetOrigin (float x, float y, float z) { 07473 m_points[0] = x; m_points[1] = y; m_points[2] = z; 07474 } 07476 void SetOrigin (float const o[]) { SetOrigin (o[0], o[1], o[2]); } 07478 float const * GetOrigin () const { return &m_points[0]; } 07480 float * GetOrigin () { return &m_points[0]; } 07481 07483 void SetRef1 (float x, float y, float z) { 07484 m_points[3] = x; m_points[4] = y; m_points[5] = z; 07485 } 07487 void SetRef1 (float const r[]) { SetRef1 (r[0], r[1], r[2]); } 07489 float const * GetRef1 () const { return &m_points[3]; } 07491 float * GetRef1 () { return &m_points[3]; } 07492 07494 void SetRef2 (float x, float y, float z) { 07495 m_points[6] = x; m_points[7] = y; m_points[8] = z; 07496 } 07498 void SetRef2 (float const r[]) { SetRef2 (r[0], r[1], r[2]); } 07500 float const * GetRef2 () const { return &m_points[6]; } 07502 float * GetRef2 () { return &m_points[6]; } 07503 07504 07506 void SetDOrigin (double x, double y, double z) { 07507 m_dpoints[0] = x; m_dpoints[1] = y; m_dpoints[2] = z; 07508 } 07510 void SetDOrigin (double const o[]) { SetDOrigin (o[0], o[1], o[2]);} 07512 double const * GetDOrigin () const { return &m_dpoints[0]; } 07514 double * GetDOrigin () { return &m_dpoints[0]; } 07515 07517 void SetDRef1 (double x, double y, double z) { 07518 m_dpoints[3] = x; m_dpoints[4] = y; m_dpoints[5] = z; 07519 } 07521 void SetDRef1 (double const r[]) { SetDRef1 (r[0], r[1], r[2]); } 07523 double const * GetDRef1 () const { return &m_dpoints[3]; } 07525 double * GetDRef1 () { return &m_dpoints[3]; } 07526 07528 void SetDRef2 (double x, double y, double z) { 07529 m_dpoints[6] = x; m_dpoints[7] = y; m_dpoints[8] = z; 07530 } 07532 void SetDRef2 (double const r[]) { SetDRef2 (r[0], r[1], r[2]); } 07534 double const * GetDRef2 () const { return &m_dpoints[6]; } 07536 double * GetDRef2 () { return &m_dpoints[6]; } 07537 07538 07540 void SetCounts (int c1, int c2) { 07541 m_counts[0] = c1; m_counts[1] = c2; 07542 } 07544 int const * GetCounts () const { return m_counts; } 07546 int * GetCounts () { return m_counts; } 07547 07549 void SetType (int t) { m_type = (char)t; } 07551 int GetType () const { return (int)m_type; } 07552 }; 07553 07555 07559 enum TKO_Text_Encodings { 07560 TKO_Enc_ISO_Latin_One, 07561 TKO_Enc_ISO_Latin, 07562 TKO_Enc_JEC, 07563 TKO_Enc_EUC, 07564 TKO_Enc_Raw_16, 07565 TKO_Enc_Unicode, 07566 TKO_Enc_Unicode32, 07567 TKO_Enc_UTF8, 07568 TKO_Enc_UTF16, 07569 TKO_Enc_UTF32, 07570 TKO_Enc_WCS 07571 }; 07572 07576 enum TKO_Text_Options { 07577 TKO_Text_Option_Region = 0x01, 07578 TKO_Text_Option_Character_Attributes = 0x02 07579 }; 07580 07584 enum TKO_Text_Region_Options { 07585 TKO_Text_Region_Window = 0x01, 07586 TKO_Text_Region_Relative = 0x02, 07587 TKO_Text_Region_Adjusted = 0x04, 07588 TKO_Text_Region_Center = 0x08, 07589 TKO_Text_Region_Top = 0x10, 07590 TKO_Text_Region_HFit = 0x20, 07591 TKO_Text_Region_VFit = 0x40, 07592 TKO_Text_Region_Fitting = 0x60, 07593 TKO_Text_Region_Extended = 0x80 07594 }; 07595 07599 enum TKO_Text_Region_Fit_Options { 07600 TKO_Text_Region_Fit_None = 0, 07601 TKO_Text_Region_Fit_Spacing = 1, 07602 TKO_Text_Region_Fit_Size = 2 07603 }; 07604 07605 07609 enum TKO_Character_Attributes { 07610 TKO_Character_Name = 0x0001, 07611 TKO_Character_Size = 0x0002, 07612 TKO_Character_Vertical_Offset = 0x0004, 07613 TKO_Character_Omitted = 0x0008, 07614 TKO_Character_Invisible = 0x0010, 07615 TKO_Character_Slant = 0x0020, 07616 TKO_Character_Width_Scale = 0x0040, 07617 TKO_Character_Rotation = 0x0080, 07618 TKO_Character_Rotation_Fixed = 0x0100, 07619 TKO_Character_Horizontal_Offset = 0x0200, 07620 TKO_Character_Color = 0x0400, 07621 TKO_Character_Extended = 0x8000 07622 }; 07623 07625 struct TK_Character_Attribute { 07626 char * name; 07627 07628 float color[3]; 07629 float size; 07630 float vertical_offset; 07631 float horizontal_offset; 07632 float slant; 07633 float rotation; 07634 float width_scale; 07635 07636 unsigned short mask; 07637 unsigned short value; 07638 07639 unsigned char size_units; 07640 unsigned char vertical_offset_units; 07641 unsigned char horizontal_offset_units; 07642 }; 07643 07644 07646 07652 class BBINFILETK_API TK_Text : public BBaseOpcodeHandler { 07653 protected: 07654 float m_position[3]; 07655 double m_dposition[3]; 07656 int m_length; 07657 int m_allocated; 07658 char * m_string; 07659 unsigned char m_encoding; 07660 unsigned char m_options; 07661 unsigned char m_region_options; 07662 unsigned char m_region_fit; 07663 unsigned char m_region_count; 07664 float m_region[4*3]; 07665 int m_count; 07666 TK_Character_Attribute *m_character_attributes; 07667 int m_substage; 07668 int m_tmp; 07670 void set_string (char const * string); 07671 void set_string (int length); 07672 07673 public: 07675 TK_Text (unsigned char opcode); 07676 ~TK_Text(); 07677 07678 TK_Status Read (BStreamFileToolkit & tk); 07679 TK_Status Write (BStreamFileToolkit & tk); 07680 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07681 07682 TK_Status ReadAscii (BStreamFileToolkit & tk); 07683 TK_Status WriteAscii (BStreamFileToolkit & tk); 07684 07685 void Reset (); 07686 07688 void SetString (char const * string) { set_string (string); } 07690 void SetString (unsigned short const * string); 07692 void SetString (unsigned int const * string); 07694 void SetString (int length) { set_string (length); } 07696 char const * GetString () const { return m_string; } 07698 char * GetString () { return m_string; } 07699 07701 void SetPosition (float x, float y, float z) 07702 { m_position[0] = x; m_position[1] = y; m_position[2] = z; } 07704 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 07706 float const * GetPosition () const { return &m_position[0]; } 07707 07709 void SetDPosition (double x, double y, double z) 07710 { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; } 07712 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 07714 double const * GetDPosition () const { return &m_dposition[0]; } 07715 07717 void SetEncoding (int e) { m_encoding = (unsigned char)e; } 07719 int GetEncoding () const { return (int)m_encoding; } 07720 07722 void SetTextRegion (int c, float const p[], int o=0, int f=0); 07724 int GetTextRegionCount () const { return (int)m_region_count; } 07726 float const * GetTextRegionPoints () const { return m_region; } 07728 int GetTextRegionOptions () const { return (int)m_region_options; } 07730 int GetTextRegionFitting () const { return (int)m_region_fit; } 07731 }; 07732 07734 07736 07742 enum TKO_Font_Type { 07743 TKO_Font_HOOPS_Stroked // data represents a HOOPS stroked font definition 07744 }; 07745 07746 07748 07754 class BBINFILETK_API TK_Font : public BBaseOpcodeHandler { 07755 protected: 07756 char * m_name; 07757 char * m_lookup; 07758 char * m_bytes; 07759 int m_name_length; 07760 int m_lookup_length; 07761 int m_length; 07762 unsigned char m_type; 07763 unsigned char m_encoding; 07765 07766 void set_bytes (int size, char const * bytes = 0); 07768 void set_name (char const * string); 07770 void set_name (int length); 07772 void set_lookup (char const * string); 07774 void set_lookup (int length); 07775 07776 public: 07778 TK_Font () : BBaseOpcodeHandler (TKE_Font), 07779 m_name (0), m_lookup (0), m_bytes (0), m_name_length (0), m_lookup_length (0), m_length (0), 07780 m_type (0), m_encoding (0) {} 07781 ~TK_Font(); 07782 07783 TK_Status Read (BStreamFileToolkit & tk); 07784 TK_Status Write (BStreamFileToolkit & tk); 07785 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07786 07787 TK_Status ReadAscii (BStreamFileToolkit & tk); 07788 TK_Status WriteAscii (BStreamFileToolkit & tk); 07789 07790 void Reset (); 07791 07792 07794 void SetType (int t) { m_type = (unsigned char)t;} 07796 int GetType () const { return (int)m_type; } 07797 07802 void SetBytes (int size, char const * bytes = 0) { set_bytes (size, bytes); } 07804 int GetBytesCount () const { return m_length; } 07806 char const * GetBytes () const { return m_bytes; } 07808 char * GetBytes () { return m_bytes; } 07809 07811 void SetName (char const * string) { set_name (string); } 07813 void SetName (int length) { set_name (length); } 07815 char const * GetName () const { return m_name; } 07817 char * GetName () { return m_name; } 07818 07820 void SetLookup (char const * string) { set_lookup (string); } 07822 void SetLookup (int length) { set_lookup (length); } 07824 char const * GetLookup () const { return m_lookup; } 07826 char * GetLookup () { return m_lookup; } 07827 07829 void SetEncoding (int e) { m_encoding = (unsigned char)e;} 07831 int GetEncoding () const { return (int)m_encoding; } 07832 }; 07833 07835 07839 enum TKO_Image_Formats { 07840 TKO_Image_Mapped = 0, 07841 TKO_Image_Mapped_16 = 1, 07842 TKO_Image_RGB = 2, 07843 TKO_Image_RGBA = 3, 07844 TKO_Image_BGRA = 4, 07845 TKO_Image_DEPTH = 5, 07846 TKO_Image_LUMINANCE8 = 6, 07847 TKO_Image_JPEG = 7, 07848 TKO_Image_DXT1 = 8, 07849 TKO_Image_DXT3 = 9, 07850 TKO_Image_DXT5 = 10, 07851 TKO_Image_TARGA = 11, 07852 TKO_Image_PNG = 12, 07853 TKO_Image_Format_Mask = 0x0F, 07854 07855 TKO_Image_Explicit_Size = 0x10, 07856 TKO_Image_Local_Texture = 0x20, 07857 TKO_Image_Is_Named = 0x80, 07858 07859 TKO_Image_Compression_Quality = 0x00000100, 07860 TKO_Image_Discard = 0x00000200, 07861 TKO_Image_Options_Mask = 0xFFFFFFF0, 07862 07863 TKO_Image_Invalid = 0xFF 07864 }; 07865 07866 07868 extern const int TK_Image_Bytes_Per_Pixel[]; 07869 07873 enum TKO_Compression { 07874 TKO_Compression_None = 0, 07875 TKO_Compression_RLE = 1, 07876 TKO_Compression_JPEG = 2, 07877 TKO_Compression_DXT = 3, 07878 TKO_Compression_TARGA = 4, 07879 TKO_Compression_PNG = 5, 07880 TKO_Compression_Reference = 99 07881 }; 07882 07883 #ifndef DOXYGEN_SHOULD_SKIP_THIS 07884 07885 class BBINFILETK_API2 TK_Image_Data_Buffer { 07886 protected: 07887 unsigned char * m_buffer; 07888 unsigned int m_allocated; 07889 unsigned int m_used; 07890 07891 public: 07893 TK_Image_Data_Buffer() : m_buffer (0), m_allocated (0), m_used (0) {} 07894 ~TK_Image_Data_Buffer(); 07895 07896 void Resize (unsigned int size); 07897 void Expand (unsigned int size) { Resize (Size() + size); } 07898 void Reset (); 07899 07900 unsigned int const & Size () const { return m_allocated; } 07901 unsigned int const & Used () const { return m_used; } 07902 unsigned int & Used () { return m_used; } 07903 unsigned char const * Buffer () const { return m_buffer; } 07904 unsigned char * Buffer () { return m_buffer; } 07905 }; 07906 07907 07908 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 07909 07910 07912 07918 class BBINFILETK_API2 TK_Image : public BBaseOpcodeHandler { 07919 protected: 07920 char * m_bytes; 07921 char * m_name; 07922 char * m_reference; 07923 float m_position[3]; 07924 double m_dposition[3]; 07925 int m_size[2]; 07926 int m_data_size; 07927 int m_name_length; 07928 int m_reference_length; 07929 unsigned char m_format; 07930 unsigned int m_options; 07931 unsigned char m_compression; 07932 unsigned char m_bytes_format; 07933 float m_explicit_size[2]; 07934 unsigned char m_explicit_units[2]; 07935 TK_Image_Data_Buffer m_work_area[2]; 07936 float m_compression_quality; 07938 bool m_jpeg_native; 07940 07941 void set_data (int size, char const * bytes = 0, unsigned char data_format = TKO_Compression_None); 07943 void set_name (char const * string); 07945 void set_name (int length); 07946 07948 TK_Status compress_image (BStreamFileToolkit & tk, int active_work_area = 0); 07950 TK_Status decompress_image (BStreamFileToolkit & tk, int active_work_area = 0); 07952 TK_Status read_jpeg_header (); 07953 07954 public: 07956 TK_Image (); 07957 ~TK_Image(); 07958 07959 TK_Status Read (BStreamFileToolkit & tk); 07960 TK_Status Write (BStreamFileToolkit & tk); 07961 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 07962 07963 TK_Status ReadAscii (BStreamFileToolkit & tk); 07964 TK_Status WriteAscii (BStreamFileToolkit & tk); 07965 TK_Status compress_image_ascii (BStreamFileToolkit & tk); 07966 07967 07968 void Reset (); 07969 07974 void SetBytes (int size, char const * bytes = 0, 07975 unsigned char data_format = TKO_Compression_None) 07976 { set_data (size, bytes, data_format); } 07978 char const * GetBytes () const { return m_bytes; } 07980 char * GetBytes () { return m_bytes; } 07981 07983 void SetName (char const * string) { set_name (string); } 07985 void SetName (int length) { set_name (length); } 07987 char const * GetName () const { return m_name; } 07989 char * GetName () { return m_name; } 07990 07992 void SetReference (char const * string); 07994 void SetReference (int length); 07996 char const * GetReference () const { return m_reference; } 07998 char * GetReference () { return m_reference; } 07999 08001 void SetPosition (float x, float y, float z) 08002 { m_position[0] = x; m_position[1] = y; m_position[2] = z; } 08004 void SetPosition (float const p[]) { SetPosition (p[0], p[1], p[2]); } 08006 float const * GetPosition () const { return &m_position[0]; } 08007 08009 void SetDPosition (double x, double y, double z) 08010 { m_dposition[0] = x; m_dposition[1] = y; m_dposition[2] = z; } 08012 void SetDPosition (double const p[]) { SetDPosition (p[0], p[1], p[2]); } 08014 double const * GetDPosition () const { return &m_dposition[0]; } 08015 08017 void SetSize (int w, int h) { m_size[0] = w; m_size[1] = h; } 08019 void SetSize (int const s[]) { m_size[0] = s[0]; m_size[1] = s[1]; } 08021 int const * GetSize () const { return m_size; } 08022 08024 void SetFormat (int f) { m_format = (unsigned char)(f & TKO_Image_Format_Mask); } 08026 int GetFormat () const { return (int)m_format; } 08027 08029 void SetOptions (int f) { m_options = (unsigned char)(f & TKO_Image_Options_Mask); } 08031 int GetOptions () const { return (int)m_options; } 08032 08034 void SetCompression (int c) { m_compression = (unsigned char)c; } 08036 int GetCompression () const { return (int)m_compression; } 08037 }; 08038 08039 08041 08042 08046 enum TKO_Texture_Option_Bits { 08047 TKO_Texture_Param_Source = 0x00000001, 08048 TKO_Texture_Tiling = 0x00000002, 08049 TKO_Texture_Interpolation = 0x00000004, 08050 TKO_Texture_Decimation = 0x00000008, 08051 TKO_Texture_Red_Mapping = 0x00000010, 08052 TKO_Texture_Green_Mapping = 0x00000020, 08053 TKO_Texture_Blue_Mapping = 0x00000040, 08054 TKO_Texture_Alpha_Mapping = 0x00000080, 08055 TKO_Texture_Param_Function = 0x00000100, 08056 TKO_Texture_Layout = 0x00000200, 08057 TKO_Texture_Transform = 0x00000400, 08058 TKO_Texture_Value_Scale = 0x00000800, 08059 TKO_Texture_Caching = 0x00001000, 08060 TKO_Texture_DownSample = 0x00002000, 08061 TKO_Texture_No_DownSample = 0x00004000, 08062 TKO_Texture_Extended = 0x00008000, 08063 TKO_Texture_Extended_Mask = 0xFFFF0000, // internal use, indicates bit which require TKO_Texture_Extended 08064 TKO_Texture_Extended_Shift = 16, // internal use, indicates shift of extended section 08065 TKO_Texture_Decal = 0x00010000, 08066 TKO_Texture_Modulate = 0x00020000, 08067 TKO_Texture_Param_Offset = 0x00040000, 08068 TKO_Texture_Transform_Override = 0x00080000, 08069 TKO_Texture_Shader = 0x00100000, 08070 TKO_Texture_Shader_Multitexture = 0x00200000, 08071 TKO_Texture_Camera = 0x00400000, 08072 TKO_Texture_Source_Dimensions = 0x00800000, 08073 TKO_Texture_Geometry_Shader = 0x01000000 08074 }; 08075 08079 enum TKO_Texture_Param_Sources { 08080 TKO_Texture_Param_Source_U, 08081 TKO_Texture_Param_Source_UV, 08082 TKO_Texture_Param_Source_UVW, 08083 TKO_Texture_Param_Source_Object, 08084 TKO_Texture_Param_Source_World, 08085 TKO_Texture_Param_Source_Surface_Normal, 08086 TKO_Texture_Param_Source_Reflection_Vector, 08087 TKO_Texture_Param_Source_Natural_UV, 08088 TKO_Texture_Param_Source_Local_Pixels, 08089 TKO_Texture_Param_Source_Outer_Pixels, 08090 TKO_Texture_Param_Source_Local_Window, 08091 TKO_Texture_Param_Source_Outer_Window, 08092 TKO_Texture_Param_Source_Transmission_Vector, 08093 TKO_Texture_Param_Source_Sphere_Map, 08094 TKO_Texture_Param_Source_Cylinder_Map, 08095 TKO_Texture_Param_Source_Physical_Reflection_Vector 08096 }; 08097 08098 08102 enum TKO_Texture_Param_Functions { 08103 TKO_Texture_Param_Function_None, 08104 TKO_Texture_Param_Function_Sphere, 08105 TKO_Texture_Param_Function_Cylinder, 08106 TKO_Texture_Param_Function_Box 08107 }; 08108 08109 08113 enum TKO_Texture_Layouts { 08114 TKO_Texture_Layout_Rectilinear, 08115 TKO_Texture_Layout_Spherical, 08116 TKO_Texture_Layout_Hemispherical, 08117 TKO_Texture_Layout_Cubic_Faces, 08118 TKO_Texture_Layout_Unknown 08119 }; 08120 08124 enum TKO_Texture_Tilings { 08125 TKO_Texture_Tiling_None, 08126 TKO_Texture_Tiling_Clamp, 08127 TKO_Texture_Tiling_Repeat, 08128 TKO_Texture_Tiling_Mirror, 08129 TKO_Texture_Tiling_Drop 08130 }; 08131 08132 08136 enum TKO_Texture_Filters { 08137 TKO_Texture_Filter_None, 08138 TKO_Texture_Filter_Bilinear, 08139 TKO_Texture_Filter_Trilinear, 08140 TKO_Texture_Filter_MipMap, 08141 TKO_Texture_Filter_Summed_Areas, 08142 TKO_Texture_Filter_Gaussian, 08143 TKO_Texture_Filter_Stochastic, 08144 TKO_Texture_Filter_Anisotropic 08145 }; 08146 08147 08151 enum TKO_Texture_Channel_Mappings { 08152 TKO_Texture_Channel_Mapping_Red, 08153 TKO_Texture_Channel_Mapping_Green, 08154 TKO_Texture_Channel_Mapping_Blue, 08155 TKO_Texture_Channel_Mapping_Alpha, 08156 TKO_Texture_Channel_Mapping_Zero, 08157 TKO_Texture_Channel_Mapping_One, 08158 TKO_Texture_Channel_Mapping_Luminance, 08159 TKO_Texture_Channel_Mapping_None 08160 }; 08161 08162 08166 enum TKO_Texture_Application_Modes { 08167 TKO_Texture_Modulate_Set = 0x01, 08168 TKO_Texture_Decal_Set = 0x02 08169 }; 08170 08171 08173 08179 class BBINFILETK_API2 TK_Texture : public BBaseOpcodeHandler { 08180 protected: 08181 char * m_name; 08182 char * m_shader_source; 08183 char * m_image; 08184 char * m_camera; 08185 int m_name_length; 08186 int m_shader_source_length; 08187 int m_image_length; 08188 int m_camera_length; 08189 int m_flags; 08190 int m_substage; 08192 char m_param_source; 08193 char m_interpolation; 08194 char m_decimation; 08195 char m_red_mapping; 08196 char m_green_mapping; 08197 char m_blue_mapping; 08198 char m_alpha_mapping; 08199 char m_param_function; 08200 char m_layout; 08201 char m_tiling; 08202 float m_value_scale[2]; 08203 int m_source_dimensions[3]; 08204 char * m_transform; 08205 char m_apply_mode; 08206 char m_param_offset; 08208 void set_name (int length); 08209 void set_name (char const * name); 08210 void set_image (int length); 08211 void set_image (char const * image); 08212 void set_transform (int length); 08213 void set_transform (char const * transform); 08214 08215 public: 08217 TK_Texture () : BBaseOpcodeHandler (TKE_Texture), 08218 m_name (0), m_shader_source(0), m_image (0), m_camera (0), 08219 m_name_length (0), m_shader_source_length(0), m_image_length (0), m_camera_length (0), 08220 m_transform (0) { 08221 Reset(); 08222 } 08223 ~TK_Texture(); 08224 08225 TK_Status Read (BStreamFileToolkit & tk); 08226 TK_Status Write (BStreamFileToolkit & tk); 08227 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08228 08229 TK_Status ReadAscii (BStreamFileToolkit & tk); 08230 TK_Status WriteAscii (BStreamFileToolkit & tk); 08231 08232 void Reset (); 08233 08235 void SetName (char const * name) { set_name (name); } 08237 void SetName (int length) { set_name (length); } 08239 char const * GetName () const { return m_name; } 08241 char * GetName () { return m_name; } 08242 08244 void SetShaderSource (char const * shader_source); 08246 void SetShaderSource (int length); 08248 char const * GetShaderSource () const { return m_shader_source; } 08250 char * GetShaderSource () { return m_shader_source; } 08251 08253 void SetImage (char const * image) { set_image (image); } 08255 void SetImage (int length) { set_image (length); } 08257 char const * GetImage () const { return m_image; } 08259 char * GetImage () { return m_image; } 08260 08262 void SetCamera (char const * camera); 08264 void SetCamera (int length); 08266 char const * GetCamera () const { return m_camera; } 08268 char * GetCamera () { return m_camera; } 08269 08271 void SetFlags (int f) { 08272 m_flags = f; 08273 if ((f & TKO_Texture_Extended_Mask) != 0) 08274 m_flags |= TKO_Texture_Extended; 08275 } 08277 int GetFlags () const { return m_flags; } 08278 08280 void SetParameterSource (int p) { m_param_source = (char)p; } 08282 int GetParameterSource () const { return (int)m_param_source; } 08283 08285 void SetInterpolation (int p) { m_interpolation = (char)p; } 08287 int GetInterpolation () const { return (int)m_interpolation; } 08288 08290 void SetDecimation (int p) { m_decimation = (char)p; } 08292 int GetDecimation () const { return (int)m_decimation; } 08293 08295 void SetRedMapping (int p) { m_red_mapping = (char)p; } 08297 int GetRedMapping () const { return (int)m_red_mapping; } 08298 08300 void SetGreenMapping (int p) { m_green_mapping = (char)p; } 08302 int GetGreenMapping () const { return (int)m_green_mapping; } 08303 08305 void SetBlueMapping (int p) { m_blue_mapping = (char)p; } 08307 int GetBlueMapping () const { return (int)m_blue_mapping; } 08308 08310 void SetAlphaMapping (int p) { m_alpha_mapping = (char)p; } 08312 int GetAlphaMapping () const { return (int)m_alpha_mapping; } 08313 08315 void SetParameterFunction (int p) { m_param_function = (char)p; } 08317 int GetParameterFunction () const { return (int)m_param_function; } 08318 08320 void SetLayout (int p) { m_layout = (char)p; } 08322 int GetLayout () const { return (int)m_layout; } 08323 08325 void SetTiling (int p) { m_tiling = (char)p; } 08327 int GetTiling () const { return (int)m_tiling; } 08328 08330 void SetValueScale (float v1, float v2) { m_value_scale[0] = v1; m_value_scale[1] = v2; } 08332 float const * GetValueScale () const { return m_value_scale; } 08333 08335 void SetApplicationMode (int p) { m_apply_mode = (char)p; } 08337 int GetApplicationMode () const { return (int)m_apply_mode; } 08338 08340 void SetParameterOffset (int p) { m_param_offset = (char)p; } 08342 int GetParameterOffset () const { return (int)m_param_offset; } 08343 08348 void SetTransform (char const * transform) { set_transform (transform); } 08353 void SetTransform (int length) { set_transform (length); } 08355 char const * GetTransform () const { return m_transform; } 08357 char * GetTransform () { return m_transform; } 08358 }; 08359 08360 08364 enum TKO_Thumbnail_Formats { 08365 TKO_Thumbnail_RGB = 0, 08366 TKO_Thumbnail_RGBA = 1, 08367 08368 TKO_Thumbnail_Invalid = 0xFF 08369 }; 08370 08372 08378 class BBINFILETK_API2 TK_Thumbnail : public BBaseOpcodeHandler { 08379 protected: 08380 unsigned char * m_bytes; 08381 int m_allocated; 08382 int m_size[2]; 08383 unsigned char m_format; 08385 public: 08387 TK_Thumbnail() : BBaseOpcodeHandler (TKE_Thumbnail), m_bytes (0), m_allocated (0), m_format (TKO_Thumbnail_Invalid) {} 08388 ~TK_Thumbnail(); 08389 08390 TK_Status Read (BStreamFileToolkit & tk); 08391 TK_Status Write (BStreamFileToolkit & tk); 08392 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08393 08394 TK_Status ReadAscii (BStreamFileToolkit & tk); 08395 TK_Status WriteAscii (BStreamFileToolkit & tk); 08396 08397 TK_Status Execute (BStreamFileToolkit & tk); 08398 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, int variant); 08399 TK_Status Interpret (BStreamFileToolkit & tk, ID_Key key, char const * special) 08400 { return BBaseOpcodeHandler::Interpret(tk, key, special); } 08401 void Reset (); 08402 08407 void SetBytes (int size, unsigned char const * bytes = 0); 08409 unsigned char const * GetBytes () const { return m_bytes; } 08411 unsigned char * GetBytes () { return m_bytes; } 08412 08414 void SetSize (int w, int h) { m_size[0] = w; m_size[1] = h; } 08416 void SetSize (int const s[]) { m_size[0] = s[0]; m_size[1] = s[1]; } 08418 int const * GetSize () const { return m_size; } 08419 08421 void SetFormat (int f) { m_format = (unsigned char)f; } 08423 int GetFormat () const { return (int)m_format; } 08424 }; 08425 08426 08428 08430 08435 class BBINFILETK_API2 TK_Glyph_Definition : public BBaseOpcodeHandler { 08436 protected: 08437 int m_name_length; 08438 int m_size; 08439 char * m_name; 08440 char * m_data; 08442 public: 08444 TK_Glyph_Definition () : BBaseOpcodeHandler (TKE_Glyph_Definition), 08445 m_name_length (0), m_size (0), 08446 m_name (0), m_data (0) {} 08447 ~TK_Glyph_Definition(); 08448 08449 TK_Status Read (BStreamFileToolkit & tk); 08450 TK_Status Write (BStreamFileToolkit & tk); 08451 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08452 08453 TK_Status ReadAscii (BStreamFileToolkit & tk); 08454 TK_Status WriteAscii (BStreamFileToolkit & tk); 08455 08456 void Reset (); 08457 08459 void SetName (char const * name); 08461 void SetName (int length); 08463 char const * GetName () const { return m_name; } 08465 char * GetName () { return m_name; } 08466 08468 void SetDefinition (int size, char const * data = 0); 08470 int GetDefinitionSize () const { return m_size; } 08472 char const * GetDefinition () const { return m_data; } 08474 char * GetDefinition () { return m_data; } 08475 }; 08476 08477 08479 08484 class BBINFILETK_API2 TK_Named_Style_Def : public BBaseOpcodeHandler { 08485 protected: 08486 int m_name_length; 08487 char * m_name; 08489 int m_segment_length; 08490 char * m_segment; 08492 int m_cond_length; 08493 int m_cond_allocated; 08494 char * m_condition; 08496 ID_Key m_key; 08497 BBaseOpcodeHandler * m_referee; 08498 bool m_follow; 08499 08500 public: 08502 TK_Named_Style_Def () : BBaseOpcodeHandler (TKE_Named_Style_Def), 08503 m_name_length (0), m_name (0), 08504 m_segment_length (0), m_segment (0) , 08505 m_cond_length (0), m_cond_allocated (0), m_condition (0), 08506 m_key(-1), m_referee(0), m_follow(true) {} 08507 ~TK_Named_Style_Def(); 08508 08509 TK_Status Read (BStreamFileToolkit & tk); 08510 TK_Status Write (BStreamFileToolkit & tk); 08511 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08512 08513 TK_Status ReadAscii (BStreamFileToolkit & tk); 08514 TK_Status WriteAscii (BStreamFileToolkit & tk); 08515 08516 void Reset (); 08517 08519 void SetName (char const * name); 08521 void SetName (int length); 08523 char const * GetName () const { return m_name; } 08525 char * GetName () { return m_name; } 08526 08531 void SetSegment (char const * segment); 08536 void SetSegment (int length); 08540 char const * GetSegment () const { return m_segment; } 08545 char * GetSegment () { return m_segment; } 08546 }; 08547 08549 08554 class BBINFILETK_API2 TK_Line_Style : public BBaseOpcodeHandler { 08555 protected: 08556 int m_name_length; 08557 int m_definition_length; 08558 char * m_name; 08559 char * m_definition; 08561 public: 08563 TK_Line_Style () : BBaseOpcodeHandler (TKE_Line_Style), 08564 m_name_length (0), m_definition_length (0), 08565 m_name (0), m_definition (0) {} 08566 ~TK_Line_Style(); 08567 08568 TK_Status Read (BStreamFileToolkit & tk); 08569 TK_Status Write (BStreamFileToolkit & tk); 08570 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08571 08572 TK_Status ReadAscii (BStreamFileToolkit & tk); 08573 TK_Status WriteAscii (BStreamFileToolkit & tk); 08574 08575 void Reset (); 08576 08578 void SetName (char const * name); 08580 void SetName (int length); 08582 char const * GetName () const { return m_name; } 08584 char * GetName () { return m_name; } 08585 08587 void SetDefinition (char const * def); 08589 void SetDefinition (int length); 08591 char const * GetDefinition () const { return m_definition; } 08593 char * GetDefinition () { return m_definition; } 08594 }; 08595 08597 08599 08604 class BBINFILETK_API TK_Clip_Rectangle : public BBaseOpcodeHandler { 08605 protected: 08606 char m_options; 08607 float m_rect[4]; 08609 public: 08611 TK_Clip_Rectangle () 08612 : BBaseOpcodeHandler (TKE_Clip_Rectangle), m_options (0) {} 08613 08614 TK_Status Read (BStreamFileToolkit & tk); 08615 TK_Status Write (BStreamFileToolkit & tk); 08616 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08617 08618 TK_Status ReadAscii (BStreamFileToolkit & tk); 08619 TK_Status WriteAscii (BStreamFileToolkit & tk); 08620 08621 void Reset (); 08622 08624 void SetRectangle (float left, float right, float bottom, float top) 08625 { m_rect[0] = left; m_rect[1] = right; m_rect[2] = bottom; m_rect[3] = top; } 08627 void SetRectangle (float const * rect) 08628 { SetRectangle (rect[0], rect[1], rect[2], rect[3]); } 08630 float const * GetRectangle () const { return m_rect; } 08631 08633 void SetOptions (int o) { m_options = (char)o; } 08635 int GetOptions () const { return (int)m_options; } 08636 }; 08637 08639 08643 enum TKO_Clip_Region_Options { 08644 TKO_Clip_Region_World_Space = 0x01, 08645 TKO_Clip_Region_Window_Space = 0x02, 08646 TKO_Clip_Region_Object_Space = 0x10, 08647 TKO_Clip_Region_Clip = 0x04, 08648 TKO_Clip_Region_Mask = 0x08 08649 }; 08650 08652 08657 class BBINFILETK_API TK_Clip_Region : public BBaseOpcodeHandler { 08658 protected: 08659 char m_options; 08660 int m_count; 08661 float * m_points; 08662 double * m_dpoints; 08664 public: 08666 TK_Clip_Region () 08667 : BBaseOpcodeHandler (TKE_Clip_Region), m_options (0), m_count (0), m_points (0), m_dpoints (0) {} 08668 ~TK_Clip_Region(); 08669 08670 TK_Status Read (BStreamFileToolkit & tk); 08671 TK_Status Write (BStreamFileToolkit & tk); 08672 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08673 08674 TK_Status ReadAscii (BStreamFileToolkit & tk); 08675 TK_Status WriteAscii (BStreamFileToolkit & tk); 08676 08677 void Reset (); 08678 08683 void SetPoints (int count, float const points[] = 0); 08685 float const * GetPoints () const { return m_points; } 08687 float * GetPoints () { return m_points; } 08688 08693 void SetDPoints (int count, double const points[] = 0); 08695 double const * GetDPoints () const { return m_dpoints; } 08697 double * GetDPoints () { return m_dpoints; } 08698 08699 08701 int GetCount () const { return m_count; } 08702 08703 08705 void SetOptions (int o) { m_options = (char)o; } 08707 int GetOptions () const { return (int)m_options; } 08708 }; 08709 08710 08712 08714 08730 class BBINFILETK_API2 TK_User_Data : public BBaseOpcodeHandler { 08731 protected: 08732 int m_size; 08733 unsigned char * m_data; 08734 int m_buffer_size; 08736 08737 void set_data (int size, unsigned char const * bytes = 0); 08738 08739 public: 08741 TK_User_Data () 08742 : BBaseOpcodeHandler (TKE_Start_User_Data), m_size (0), m_data (0), m_buffer_size(0) {} 08743 ~TK_User_Data(); 08744 08745 TK_Status Read (BStreamFileToolkit & tk); 08746 TK_Status Write (BStreamFileToolkit & tk); 08747 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08748 08749 TK_Status ReadAscii (BStreamFileToolkit & tk); 08750 TK_Status WriteAscii (BStreamFileToolkit & tk); 08751 08752 TK_Status Execute (BStreamFileToolkit & tk); 08753 void Reset (); 08754 08759 void SetUserData (int size, unsigned char const * bytes = 0) { set_data (size, bytes); } 08761 unsigned char const * GetUserData () const { return m_data; } 08763 unsigned char * GetUserData () { return m_data; } 08765 int GetSize () const { return m_size; } 08766 08768 void Resize (int size); 08769 08771 void SetSize (int size); 08772 }; 08773 08774 08776 08778 08790 class BBINFILETK_API2 TK_Material : public BBaseOpcodeHandler { 08791 protected: 08792 int m_total_size; 08793 08796 struct vlist_s *m_data; 08797 08798 public: 08800 TK_Material () : BBaseOpcodeHandler (TKE_Material), m_total_size(0), m_data(0) {} 08801 ~TK_Material(); 08802 08803 TK_Status Read (BStreamFileToolkit & tk); 08804 TK_Status Write (BStreamFileToolkit & tk); 08805 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08806 void Reset (); 08807 08808 TK_Status PushUserData (char const *buffer, int buffer_size, bool tally_total_size = true); 08809 TK_Status GetBlock (char const **ptr, int *buffer_size); 08810 }; 08811 08813 08818 class BBINFILETK_API TK_XML : public BBaseOpcodeHandler { 08819 protected: 08820 int m_size; 08821 char * m_data; 08823 public: 08825 TK_XML (): BBaseOpcodeHandler (TKE_XML), m_size (0), m_data (0) {} 08826 ~TK_XML(); 08827 08828 TK_Status Read (BStreamFileToolkit & tk); 08829 TK_Status Write (BStreamFileToolkit & tk); 08830 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08831 08832 TK_Status ReadAscii (BStreamFileToolkit & tk); 08833 TK_Status WriteAscii (BStreamFileToolkit & tk); 08834 08835 TK_Status Execute (BStreamFileToolkit & tk); 08836 void Reset (); 08837 08842 void SetXML (int size, char const * data = 0); 08846 void AppendXML (int size, char const * data = 0); 08848 char const * GetXML () const { return m_data; } 08850 char * GetXML () { return m_data; } 08852 int GetSize () const { return m_size; } 08853 }; 08854 08855 08856 08858 08864 class BBINFILETK_API TK_URL : public BBaseOpcodeHandler { 08865 protected: 08866 int m_length; 08867 int m_allocated; 08868 char * m_string; 08870 public: 08872 TK_URL () : BBaseOpcodeHandler (TKE_URL), 08873 m_length (0), m_allocated (0), m_string (0) {} 08874 ~TK_URL(); 08875 08876 TK_Status Read (BStreamFileToolkit & tk); 08877 TK_Status Write (BStreamFileToolkit & tk); 08878 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08879 08880 TK_Status ReadAscii (BStreamFileToolkit & tk); 08881 TK_Status WriteAscii (BStreamFileToolkit & tk); 08882 08883 void Reset (); 08884 08886 void SetString (char const * string); 08888 void SetString (int length); 08890 char const * GetString () const { return m_string; } 08892 char * GetString () { return m_string; } 08893 }; 08894 08895 08897 08903 class BBINFILETK_API TK_External_Reference : public BBaseOpcodeHandler { 08904 protected: 08905 int m_length; 08906 int m_allocated; 08907 char * m_string; 08909 public: 08910 TK_External_Reference () : BBaseOpcodeHandler (TKE_External_Reference), 08911 m_length (0), m_allocated (0), m_string (0) {} 08912 ~TK_External_Reference(); 08913 08914 TK_Status Read (BStreamFileToolkit & tk); 08915 TK_Status Write (BStreamFileToolkit & tk); 08916 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08917 08918 TK_Status ReadAscii (BStreamFileToolkit & tk); 08919 TK_Status WriteAscii (BStreamFileToolkit & tk); 08920 08921 TK_Status Execute (BStreamFileToolkit & tk); 08922 void Reset (); 08923 08925 void SetString (char const * string); 08927 void SetString (int length); 08929 char const * GetString () const { return m_string; } 08931 char * GetString () { return m_string; } 08932 }; 08933 08934 08936 08942 class BBINFILETK_API TK_External_Reference_Unicode : public BBaseOpcodeHandler { 08943 protected: 08944 int m_length; 08945 int m_allocated; 08946 wchar_t * m_string; 08948 public: 08949 TK_External_Reference_Unicode () : BBaseOpcodeHandler (TKE_External_Reference_Unicode), 08950 m_length (0), m_allocated (0), m_string (0) {} 08951 ~TK_External_Reference_Unicode(); 08952 08953 TK_Status Read (BStreamFileToolkit & tk); 08954 TK_Status Write (BStreamFileToolkit & tk); 08955 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 08956 08957 TK_Status Execute (BStreamFileToolkit & tk); 08958 void Reset (); 08959 08961 void SetString (__wchar_t const * string); 08962 #ifdef _MSC_VER 08963 void SetString (unsigned short const * string); 08964 #endif 08965 08966 void SetString (int length); 08968 wchar_t const * GetString () const { return m_string; } 08970 wchar_t * GetString () { return m_string; } 08971 }; 08972 08973 08974 #endif //BOPCODE_HANDLER 08975