Alphabetical Class Index   Class Hierarchy   Compound Members   File Members   File List  

BStream.h
Go to the documentation of this file.
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 
00011 
00016 #ifndef BBINFILETKHEADER
00017 #define BBINFILETKHEADER
00018 
00019 #ifndef _MSC_VER
00020 #define __wchar_t wchar_t
00021 #endif
00022 
00023 #ifdef __ia64
00024     #ifndef __HP_aCC
00025         #error C++ compiler required
00026     #endif
00027 #else
00028     #ifndef __cplusplus
00029         #error C++ compiler required
00030     #endif
00031 #endif
00032 
00037 #if defined(_MSC_VER) && !defined(BSTREAM_STATIC_LIB)
00038     #ifdef BBINFILETK_EXPORTS
00039         #define BBINFILETK_API2  __declspec (dllexport)
00040     #else
00041         #define BBINFILETK_API2  __declspec (dllimport)
00042     #endif
00043 #endif
00044 
00045 #if defined(LINUX_SYSTEM) && !defined(BSTREAM_STATIC_LIB)
00046     #ifdef BBINFILETK_EXPORTS
00047         #define BBINFILETK_API2  __attribute__ ((visibility ("default")))
00048     #else
00049         #define BBINFILETK_API2
00050     #endif
00051 #endif
00052 
00053 #ifndef BBINFILETK_API2
00054     #define BBINFILETK_API2
00055 #endif
00056 
00060 #ifdef TEST_RIG_1
00061     #define BBINFILETK_API
00062 #else
00063     #define BBINFILETK_API BBINFILETK_API2
00064 #endif
00065 
00066 
00070 #define TK_File_Format_Version       2005   // 20.05
00071 
00073 //    but are mentioned in the spec as test points for format changes)
00074 #ifdef CREATE_FILE_FORMAT_HISTORY_TABLE
00075     BBINFILETK_API int TK_File_Format_History[] = {
00076         //  Format   Release     Notes
00077         //------------------------------------------------------------------------------------------
00078         //  2005    //          selection culling, handling for max distance and view volume culling
00079             2000,   //          depth peeling algorithm
00080             1980,   //  1980        initial 20 release
00081         //  1975    //          double precision
00082         //  1950    //          text font layout
00083             1910,   //          mask transform "offset"
00084             1905,   //          object space clip region
00085             1900,   // 1900
00086         //  1840    //          text region fitting
00087         //  1835    //          png and texture source dimensions
00088         //  1830    //          texture camera
00089         //  1825    //          conditional actions
00090         //  1820    //          separate edge join cutoff
00091         //  1815    //          named styles
00092         //  1810    //          material shaders
00093         //  1805    //          compressed images directly supported in graphics system (jpeg, targa, dxt, luminance8)
00094             1800,   // 1800
00095         //  1790    //          hlr transparency cutoff
00096         //  1785    //          contour and isoline options, diffuse texture tint, diffuse color tint
00097         //  1780    //          new indexed user data
00098         //  1775    //          new text alignment format, explicit patterns
00099         //  1770    //          text character color & horizontal offset, vertex displacement, hlr render text, max extent level
00100         //  1765    //          force defer, vertex decimation, model type
00101         //  1760    //          transparency depth writing
00102         //  1755    //          rgba vertex colors
00103         //  1750    //          hard extent culling
00104             1715,   // 17.1         vertex displacement backport
00105             1710,   //          ignore subsegment locks
00106             1700,   // 1700
00107         //  1660    //          camera relative lights
00108         //  1655    //          reflection visibility
00109         //  1650    //          ambient up vector, separate ambient colors, gooch options, marker index interpolation
00110             1615,   //          anti-alias
00111             1610,   // 1610
00112         //  1605    //          infinite ray, zsort options, geometry options
00113             1600,   // 1600
00114         //  1555    //          fix to some color types
00115         //  1550    //          colors can now have Geo_Extended2, shadow map/simple reflection rendering options
00116         //  1520    //          geometry reference
00117         //  1515    //          shadow map options, selection level, display list levels, simple reflection, infinite line opcode
00118         //  1510    //          maximum extent mode
00119         //  1505    //          screen range, depth images
00120             1500,   // 1500
00121         //  1415    //          obscuration use octree
00122         //  1410    //          simple shadow opacity, anisotropic texture filter
00123         //  1405    //          join cutoff angle, ordered drawing heuristics
00124             1401,   // 1410     internal polyline selection limit
00125             1400,   // 1400
00126         //  1345    //          string format color maps
00127         //  1340    //          rgba image compression
00128         //  1335    //          general displacement
00129         //  1330    //          priority
00130         //  1325    //          text greeking mode, extended text renderer & text preference
00131         //  1320    //          Heuristic_Detail_Selection, nonculled edge visibility
00132         //  1315    //          distance threshold LOD option, new fallback type "bounding none"
00133         //  1310    //          depth peeling
00134         //  1305    //          cutting section, adjacent edge visibility, force grayscale
00135             1300,   // 1300
00136         //  1220    //          font bold/italic/renderer, cut geometry color locks
00137         //  1215    //          circular center
00138         //  1210    //          geometry-level attributes, text character attributes, unicode32, image tint
00139         //  1205    //          obscuration pixel threshold, subpixel culling, hard edge angle
00140             1200,   // 1200
00141         //  1175    //          explicit parameter width, uncompressed parameters
00142         //  1170    //          camera relative lights, simple shadow mode
00143         //  1165    //          extended texture definitions
00144         //  1160    //          glyph definitions & line styles
00145         //  1155    //          spheres, texture downsamping, compressed dictionary, image reference
00146         //  1150    //          conditions, new hlr options (color, weight)
00147             1105,   //          additional polyhedron attributes
00148             1100,   // 1100
00149         //  1002    //          simple shadow options, text region
00150         //  1001    //          camera near_limit, mask transform, image size/scale, new texture options
00151             1000,   // 1000
00152         //   908    //          threshold type in LOD options
00153         //   907    //          polar normals
00154         //   906    //          edgebreaker changes
00155         //   905    //          hlr silhouette cleanup, unicode_options
00156              900,   //  900
00157         //   806    //          bounding box inheritance, cut geometry options, fast hidden line,
00158         //                      hidden line render faces, depth range, gradient window patterns,
00159         //                      additional NURBS surface controls
00160         //   805    //          polycylinder attributes, ExRef, URL
00161              800,   //  800
00162              710,   //  760     new transparency controls, dictionary format 2
00163         //   705,   //          PolyCylinder, Extended Heuristics, XML, LoD collections, Shell Regions
00164         //   702,   //          PolyPolypoint
00165              700,   //  700
00166         //   652,   //          null shell
00167              651,   //  661
00168         //   650,   //          NURBS Surface, Cylinder, Extended Rendering_Options, Defined Fonts, Selectability
00169         //                      extensive polyhedron data & compression changes
00170         //   610,   //          View
00171         //   600,   //          Stream version generally synched to Hoops version
00172         //   601,   //          support longer text string
00173              105,   //  600     Generate_Dictionary changed to Suppress_Dictionary
00174              100,   //  500     Initial release
00175                0    //          [list termination]
00176     };
00177 #else
00178     extern BBINFILETK_API int TK_File_Format_History[];
00179 #endif
00180 
00181 
00182 #define TK_DEFAULT_BUFFER_SIZE     32768    //!< default amount of the internal memory buffer used for file processing
00183 
00184 
00185 
00186 #ifdef HSTREAM_READONLY
00187     #ifndef BSTREAM_READONLY
00188         #define BSTREAM_READONLY
00189     #endif
00190 #endif
00191 #ifdef BSTREAM_READONLY
00192     extern char const stream_readonly[];
00193 #endif
00194 #ifdef BSTREAM_DISABLE_QUANTIZATION
00195     extern char const stream_disable_quantization[];
00196 #endif
00197 #ifdef BSTREAM_DISABLE_EDGEBREAKER
00198     extern char const stream_disable_edgebreaker[];
00199 #endif
00200 #ifdef BSTREAM_DISABLE_REPULSE_COMPRESSION
00201     extern char const stream_disable_repulse_compression[];
00202 #endif
00203 #ifdef BSTREAM_DISABLE_ASCII
00204     extern char const stream_disable_ascii[];
00205 #endif
00206 
00207 
00208 #include <math.h>
00209 #include <string.h>
00210 #include <stdio.h>
00211 
00212 #ifdef NEED_BOOL_TYPE
00213     #undef NEED_BOOL_TYPE
00214     typedef int bool;
00215 
00216     const bool true = !0;
00217     const bool false = 0;
00218 #endif
00219 
00220 
00225 #if defined(WIN64) || defined(_WIN64)
00226 #   define  ID_Key      __int64
00227 #else
00228 #   define  ID_Key      long
00229 #endif
00230 
00231 
00232 
00233 #ifndef alter
00234 #   define alter   //!< complementary to const, indicates we thought about it instead of a forgotten "const"       
00235 #endif
00236 
00237 
00238 #ifndef HPS_CORE_BUILD
00239 template <typename T>   void Swap (T & a, T & b) { T tmp = a; a = b; b = tmp; }
00240 #endif
00241 
00242 
00247 
00248 
00252 enum TK_Status {
00253     TK_Normal   = 0, 
00254     TK_Error    = 1, 
00255     TK_Pause    = 2, 
00256     TK_Single   = 3, 
00257     TK_Pending  = 4, 
00258     TK_Revisit  = 5, 
00259     TK_Complete = 6, 
00260     TK_Version  = 7, 
00261     TK_NotFound = 8, 
00262     TK_Abort    = 9,  
00263     TK_LibraryNotFound = 10 
00264 };
00268 
00269 
00275 enum TK_File_Write_Options {
00276     TK_Suppress_LOD                = 0x00000002, 
00277     TK_Full_Resolution_Vertices    = 0x00000004, 
00278     TK_Full_Resolution_Normals     = 0x00000008, 
00279     TK_First_LOD_Is_Bounding_Box   = 0x00000010, 
00280     TK_Force_Tags                  = 0x00000020, 
00281     TK_Disable_Priority_Heuristic  = 0x00000040, 
00282     TK_Disable_Global_Compression  = 0x00000100, 
00283     TK_Disable_Instancing          = 0x00000200, 
00284     TK_Generate_Dictionary         = 0x00000400, 
00285     TK_Connectivity_Compression    = 0x00000800, 
00286     TK_Disable_Tristrips           = 0x00001000, 
00287     TK_Disable_Compound_Primitives = 0x00002000, 
00288     TK_Global_Quantization         = 0x00004000, 
00289     TK_Full_Resolution_Parameters  = 0x00008000, 
00290     TK_Full_Resolution_Colors      = 0x00010000, 
00291     TK_Full_Resolution_Index_Colors= 0x00020000, 
00292     TK_Communicator_Mode           = 0x00040000, 
00293     TK_Full_Resolution = (TK_Full_Resolution_Vertices|TK_Full_Resolution_Normals|TK_Full_Resolution_Parameters|TK_Full_Resolution_Colors|TK_Full_Resolution_Index_Colors) 
00294 };
00295 
00296 
00300 enum TK_Dictionary_Options {
00301     TK_Dictionary_Bounding_Volumes  = 0x00000001  
00302 };
00303 
00304 
00308 enum TK_File_Read_Options {
00309     TK_Flag_Unhandled_Opcodes     = 0x00000001,  
00310     TK_Ignore_Version             = 0x00000002,  
00311     TK_Skip_External_References   = 0x00000004,  
00312     TK_Ignore_Bounding_LODs       = 0x00000008,  
00313     TK_Disable_Deferal            = 0x00000010   
00314 };
00315 
00319 enum TK_Debug_Logging_Options {
00320     TK_Logging_Sequence           = 0x00000001,  
00321     TK_Logging_Tagging            = 0x00000002,  
00322     TK_Logging_Segment_Names      = 0x00000004   
00323 };
00324 
00325 
00329 enum TK_General_Flags {
00330     // for Geometryoes and some attributes
00331     TK_Double_Precision     = 0x01,     
00332 
00333     // for includes and styles
00334     TK_Has_Condition        = 0x01,     
00335     TK_Has_Filter           = 0x02      
00336 };
00337 
00338 
00339 #include "BOpcodeHandler.h"
00340 #include "BStreamFileToolkit.h"
00341 
00347 
00348 
00358 #ifndef SWIG
00359 TK_Status BBINFILETK_API TK_Read_Stream_File  (char const * filename, BStreamFileToolkit * tk);
00360 #endif
00361 
00363 
00372 #ifndef SWIG
00373 TK_Status BBINFILETK_API TK_Read_Stream_File  (char const * filename, int flags = 0);
00374 #endif
00375 
00376 
00377 
00378 
00380 TK_Status BBINFILETK_API TK_Read_Stream_File  (__wchar_t const * filename, BStreamFileToolkit * tk);
00381 #ifdef _MSC_VER
00382 TK_Status BBINFILETK_API TK_Read_Stream_File  (unsigned short const * filename, BStreamFileToolkit * tk);
00383 #endif
00384 
00386 TK_Status BBINFILETK_API TK_Read_Stream_File  (__wchar_t const * filename, int flags = 0);
00387 #ifdef _MSC_VER
00388 TK_Status BBINFILETK_API TK_Read_Stream_File  (unsigned short const * filename, int flags = 0);
00389 #endif
00390 
00391 
00393 
00400 #ifndef SWIG
00401 TK_Status BBINFILETK_API TK_Read_Stream_File  (char const * filename, int flags, BStreamFileToolkit * tk);
00402 #endif
00403 
00405 #endif
00406