00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: 0b832a5d0a4e0d3ad20bf19089e24fc854418d08 $ 00013 // 00014 00016 00021 #ifndef BBINFILETKHEADER 00022 #define BBINFILETKHEADER 00023 00024 #ifndef _MSC_VER 00025 #define __wchar_t wchar_t 00026 #endif 00027 00028 #ifdef __ia64 00029 #ifndef __HP_aCC 00030 #error C++ compiler required 00031 #endif 00032 #else 00033 #ifndef __cplusplus 00034 #error C++ compiler required 00035 #endif 00036 #endif 00037 00042 #if defined(_MSC_VER) && !defined(BSTREAM_STATIC_LIB) 00043 #ifdef BBINFILETK_EXPORTS 00044 #define BBINFILETK_API2 __declspec (dllexport) 00045 #else 00046 #define BBINFILETK_API2 __declspec (dllimport) 00047 #endif 00048 #else 00049 #define BBINFILETK_API2 00050 #endif 00051 00052 00056 #ifdef TEST_RIG_1 00057 #define BBINFILETK_API 00058 #else 00059 #define BBINFILETK_API BBINFILETK_API2 00060 #endif 00061 00062 00066 #define TK_File_Format_Version 1910 // 19.10 00067 00069 // but are mentioned in the spec as test points for format changes) 00070 #ifdef CREATE_FILE_FORMAT_HISTORY_TABLE 00071 BBINFILETK_API int TK_File_Format_History[] = { 00072 // Format Release Notes 00073 //------------------------------------------------------------------------------------------ 00074 // 1910 // mask transform "offset" 00075 // 1905 // object space clip region 00076 1900, // 1900 00077 // 1840 // text region fitting 00078 // 1835 // png and texture source dimensions 00079 // 1830 // texture camera 00080 // 1825 // conditional actions 00081 // 1820 // separate edge join cutoff 00082 // 1815 // named styles 00083 // 1810 // material shaders 00084 // 1805 // compressed images directly supported in graphics system (jpeg, targa, dxt, luminance8) 00085 1800, // 1800 00086 // 1790 // hlr transparency cutoff 00087 // 1785 // contour and isoline options, diffuse texture tint, diffuse color tint 00088 // 1780 // new indexed user data 00089 // 1775 // new text alignment format, explicit patterns 00090 // 1770 // text character color & horizontal offset, vertex displacement, hlr render text, max extent level 00091 // 1765 // force defer, vertex decimation, model type 00092 // 1760 // transparency depth writing 00093 // 1755 // rgba vertex colors 00094 // 1750 // hard extent culling 00095 1715, // 17.1 vertex displacement backport 00096 1710, // ignore subsegment locks 00097 1700, // 1700 00098 // 1660 // camera relative lights 00099 // 1655 // reflection visibility 00100 // 1650 // ambient up vector, separate ambient colors, gooch options, marker index interpolation 00101 1615, // anti-alias 00102 1610, // 1610 00103 // 1605 // infinite ray, zsort options, geometry options 00104 1600, // 1600 00105 // 1555 // fix to some color types 00106 // 1550 // colors can now have Geo_Extended2, shadow map/simple reflection rendering options 00107 // 1520 // geometry reference 00108 // 1515 // shadow map options, selection level, display list levels, simple reflection, infinite line opcode 00109 // 1510 // maximum extent mode 00110 // 1505 // screen range, depth images 00111 1500, // 1500 00112 // 1415 // obscuration use octree 00113 // 1410 // simple shadow opacity, anisotropic texture filter 00114 // 1405 // join cutoff angle, ordered drawing heuristics 00115 1401, // 1410 internal polyline selection limit 00116 1400, // 1400 00117 // 1345 // string format color maps 00118 // 1340 // rgba image compression 00119 // 1335 // general displacement 00120 // 1330 // priority 00121 // 1325 // text greeking mode, extended text renderer & text preference 00122 // 1320 // Heuristic_Detail_Selection, nonculled edge visibility 00123 // 1315 // distance threshold LOD option, new fallback type "bounding none" 00124 // 1310 // depth peeling 00125 // 1305 // cutting section, adjacent edge visibility, force grayscale 00126 1300, // 1300 00127 // 1220 // font bold/italic/renderer, cut geometry color locks 00128 // 1215 // circular center 00129 // 1210 // geometry-level attributes, text character attributes, unicode32, image tint 00130 // 1205 // obscuration pixel threshold, subpixel culling, hard edge angle 00131 1200, // 1200 00132 // 1175 // explicit parameter width, uncompressed parameters 00133 // 1170 // camera relative lights, simple shadow mode 00134 // 1165 // extended texture definitions 00135 // 1160 // glyph definitions & line styles 00136 // 1155 // spheres, texture downsamping, compressed dictionary, image reference 00137 // 1150 // conditions, new hlr options (color, weight) 00138 1105, // additional polyhedron attributes 00139 1100, // 1100 00140 // 1002 // simple shadow options, text region 00141 // 1001 // camera near_limit, mask transform, image size/scale, new texture options 00142 1000, // 1000 00143 // 908 // threshold type in LOD options 00144 // 907 // polar normals 00145 // 906 // edgebreaker changes 00146 // 905 // hlr silhouette cleanup, unicode_options 00147 900, // 900 00148 // 806 // bounding box inheritance, cut geometry options, fast hidden line, 00149 // hidden line render faces, depth range, gradient window patterns, 00150 // additional NURBS surface controls 00151 // 805 // polycylinder attributes, ExRef, URL 00152 800, // 800 00153 710, // 760 new transparency controls, dictionary format 2 00154 // 705, // PolyCylinder, Extended Heuristics, XML, LoD collections, Shell Regions 00155 // 702, // PolyPolypoint 00156 700, // 700 00157 // 652, // null shell 00158 651, // 661 00159 // 650, // NURBS Surface, Cylinder, Extended Rendering_Options, Defined Fonts, Selectability 00160 // extensive polyhedron data & compression changes 00161 // 610, // View 00162 // 600, // Stream version generally synched to Hoops version 00163 // 601, // support longer text string 00164 105, // 600 Generate_Dictionary changed to Suppress_Dictionary 00165 100, // 500 Initial release 00166 0 // [list termination] 00167 }; 00168 #else 00169 extern BBINFILETK_API int TK_File_Format_History[]; 00170 #endif 00171 00172 00173 #define TK_DEFAULT_BUFFER_SIZE 32768 //!< default amount of the internal memory buffer used for file processing 00174 00175 00176 00177 #ifdef HSTREAM_READONLY 00178 #ifndef BSTREAM_READONLY 00179 #define BSTREAM_READONLY 00180 #endif 00181 #endif 00182 #ifdef BSTREAM_READONLY 00183 extern char const stream_readonly[]; 00184 #endif 00185 #ifdef BSTREAM_DISABLE_QUANTIZATION 00186 extern char const stream_disable_quantization[]; 00187 #endif 00188 #ifdef BSTREAM_DISABLE_EDGEBREAKER 00189 extern char const stream_disable_edgebreaker[]; 00190 #endif 00191 #ifdef BSTREAM_DISABLE_REPULSE_COMPRESSION 00192 extern char const stream_disable_repulse_compression[]; 00193 #endif 00194 #ifdef BSTREAM_DISABLE_ASCII 00195 extern char const stream_disable_ascii[]; 00196 #endif 00197 00198 00199 #include <math.h> 00200 #include <string.h> 00201 #include <stdio.h> 00202 00203 #ifdef NEED_BOOL_TYPE 00204 #undef NEED_BOOL_TYPE 00205 typedef int bool; 00206 00207 const bool true = !0; 00208 const bool false = 0; 00209 #endif 00210 00211 00216 #if defined(WIN64) || defined(_WIN64) 00217 # define ID_Key __int64 00218 #else 00219 # define ID_Key long 00220 #endif 00221 00222 00223 00224 #ifndef alter 00225 # define alter //!< complementary to const, indicates we thought about it instead of a forgotten "const" 00226 #endif 00227 00232 00233 00237 enum TK_Status { 00238 TK_Normal = 0, 00239 TK_Error = 1, 00240 TK_Pause = 2, 00241 TK_Single = 3, 00242 TK_Pending = 4, 00243 TK_Revisit = 5, 00244 TK_Complete = 6, 00245 TK_Version = 7, 00246 TK_NotFound = 8, 00247 TK_Abort = 9 00248 }; 00252 00253 00259 enum TK_File_Write_Options { 00260 TK_Suppress_LOD = 0x00000002, 00261 TK_Full_Resolution_Vertices = 0x00000004, 00262 TK_Full_Resolution_Normals = 0x00000008, 00263 TK_First_LOD_Is_Bounding_Box = 0x00000010, 00264 TK_Force_Tags = 0x00000020, 00265 TK_Disable_Priority_Heuristic = 0x00000040, 00266 TK_Disable_Global_Compression = 0x00000100, 00267 TK_Disable_Instancing = 0x00000200, 00268 TK_Generate_Dictionary = 0x00000400, 00269 TK_Connectivity_Compression = 0x00000800, 00270 TK_Disable_Tristrips = 0x00001000, 00271 TK_Disable_Compound_Primitives = 0x00002000, 00272 TK_Global_Quantization = 0x00004000, 00273 TK_Full_Resolution_Parameters = 0x00008000, 00274 TK_Full_Resolution = (TK_Full_Resolution_Vertices|TK_Full_Resolution_Normals|TK_Full_Resolution_Parameters) 00275 }; 00276 00277 00281 enum TK_Dictionary_Options { 00282 TK_Dictionary_Bounding_Volumes = 0x00000001 00283 }; 00284 00285 00289 enum TK_File_Read_Options { 00290 TK_Flag_Unhandled_Opcodes = 0x00000001, 00291 TK_Ignore_Version = 0x00000002, 00292 TK_Skip_External_References = 0x00000004, 00293 TK_Ignore_Bounding_LODs = 0x00000008 00294 }; 00295 00299 enum TK_Debug_Logging_Options { 00300 TK_Logging_Sequence = 0x00000001, 00301 TK_Logging_Tagging = 0x00000002, 00302 TK_Logging_Segment_Names = 0x00000004 00303 }; 00304 00305 00306 00307 #include "BOpcodeHandler.h" 00308 #include "BStreamFileToolkit.h" 00309 00315 00316 00326 #ifndef SWIG 00327 TK_Status BBINFILETK_API TK_Read_Stream_File (char const * filename, BStreamFileToolkit * tk); 00328 #endif 00329 00331 00340 #ifndef SWIG 00341 TK_Status BBINFILETK_API TK_Read_Stream_File (char const * filename, int flags = 0); 00342 #endif 00343 00344 00345 00346 00348 TK_Status BBINFILETK_API TK_Read_Stream_File (__wchar_t const * filename, BStreamFileToolkit * tk); 00349 #ifdef _MSC_VER 00350 TK_Status BBINFILETK_API TK_Read_Stream_File (unsigned short const * filename, BStreamFileToolkit * tk); 00351 #endif 00352 00354 TK_Status BBINFILETK_API TK_Read_Stream_File (__wchar_t const * filename, int flags = 0); 00355 #ifdef _MSC_VER 00356 TK_Status BBINFILETK_API TK_Read_Stream_File (unsigned short const * filename, int flags = 0); 00357 #endif 00358 00359 00361 00368 #ifndef SWIG 00369 TK_Status BBINFILETK_API TK_Read_Stream_File (char const * filename, int flags, BStreamFileToolkit * tk); 00370 #endif 00371 00373 #endif 00374