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: e89fb4b86076d59569690848b8c6c507d9e2cc88 $ 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 2000 // 20.00 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 // 2000 // depth peeling algorithm 00075 1980, // 1980 initial 20 release 00076 // 1975 // double precision 00077 // 1950 // text font layout 00078 1910, // mask transform "offset" 00079 1905, // object space clip region 00080 1900, // 1900 00081 // 1840 // text region fitting 00082 // 1835 // png and texture source dimensions 00083 // 1830 // texture camera 00084 // 1825 // conditional actions 00085 // 1820 // separate edge join cutoff 00086 // 1815 // named styles 00087 // 1810 // material shaders 00088 // 1805 // compressed images directly supported in graphics system (jpeg, targa, dxt, luminance8) 00089 1800, // 1800 00090 // 1790 // hlr transparency cutoff 00091 // 1785 // contour and isoline options, diffuse texture tint, diffuse color tint 00092 // 1780 // new indexed user data 00093 // 1775 // new text alignment format, explicit patterns 00094 // 1770 // text character color & horizontal offset, vertex displacement, hlr render text, max extent level 00095 // 1765 // force defer, vertex decimation, model type 00096 // 1760 // transparency depth writing 00097 // 1755 // rgba vertex colors 00098 // 1750 // hard extent culling 00099 1715, // 17.1 vertex displacement backport 00100 1710, // ignore subsegment locks 00101 1700, // 1700 00102 // 1660 // camera relative lights 00103 // 1655 // reflection visibility 00104 // 1650 // ambient up vector, separate ambient colors, gooch options, marker index interpolation 00105 1615, // anti-alias 00106 1610, // 1610 00107 // 1605 // infinite ray, zsort options, geometry options 00108 1600, // 1600 00109 // 1555 // fix to some color types 00110 // 1550 // colors can now have Geo_Extended2, shadow map/simple reflection rendering options 00111 // 1520 // geometry reference 00112 // 1515 // shadow map options, selection level, display list levels, simple reflection, infinite line opcode 00113 // 1510 // maximum extent mode 00114 // 1505 // screen range, depth images 00115 1500, // 1500 00116 // 1415 // obscuration use octree 00117 // 1410 // simple shadow opacity, anisotropic texture filter 00118 // 1405 // join cutoff angle, ordered drawing heuristics 00119 1401, // 1410 internal polyline selection limit 00120 1400, // 1400 00121 // 1345 // string format color maps 00122 // 1340 // rgba image compression 00123 // 1335 // general displacement 00124 // 1330 // priority 00125 // 1325 // text greeking mode, extended text renderer & text preference 00126 // 1320 // Heuristic_Detail_Selection, nonculled edge visibility 00127 // 1315 // distance threshold LOD option, new fallback type "bounding none" 00128 // 1310 // depth peeling 00129 // 1305 // cutting section, adjacent edge visibility, force grayscale 00130 1300, // 1300 00131 // 1220 // font bold/italic/renderer, cut geometry color locks 00132 // 1215 // circular center 00133 // 1210 // geometry-level attributes, text character attributes, unicode32, image tint 00134 // 1205 // obscuration pixel threshold, subpixel culling, hard edge angle 00135 1200, // 1200 00136 // 1175 // explicit parameter width, uncompressed parameters 00137 // 1170 // camera relative lights, simple shadow mode 00138 // 1165 // extended texture definitions 00139 // 1160 // glyph definitions & line styles 00140 // 1155 // spheres, texture downsamping, compressed dictionary, image reference 00141 // 1150 // conditions, new hlr options (color, weight) 00142 1105, // additional polyhedron attributes 00143 1100, // 1100 00144 // 1002 // simple shadow options, text region 00145 // 1001 // camera near_limit, mask transform, image size/scale, new texture options 00146 1000, // 1000 00147 // 908 // threshold type in LOD options 00148 // 907 // polar normals 00149 // 906 // edgebreaker changes 00150 // 905 // hlr silhouette cleanup, unicode_options 00151 900, // 900 00152 // 806 // bounding box inheritance, cut geometry options, fast hidden line, 00153 // hidden line render faces, depth range, gradient window patterns, 00154 // additional NURBS surface controls 00155 // 805 // polycylinder attributes, ExRef, URL 00156 800, // 800 00157 710, // 760 new transparency controls, dictionary format 2 00158 // 705, // PolyCylinder, Extended Heuristics, XML, LoD collections, Shell Regions 00159 // 702, // PolyPolypoint 00160 700, // 700 00161 // 652, // null shell 00162 651, // 661 00163 // 650, // NURBS Surface, Cylinder, Extended Rendering_Options, Defined Fonts, Selectability 00164 // extensive polyhedron data & compression changes 00165 // 610, // View 00166 // 600, // Stream version generally synched to Hoops version 00167 // 601, // support longer text string 00168 105, // 600 Generate_Dictionary changed to Suppress_Dictionary 00169 100, // 500 Initial release 00170 0 // [list termination] 00171 }; 00172 #else 00173 extern BBINFILETK_API int TK_File_Format_History[]; 00174 #endif 00175 00176 00177 #define TK_DEFAULT_BUFFER_SIZE 32768 //!< default amount of the internal memory buffer used for file processing 00178 00179 00180 00181 #ifdef HSTREAM_READONLY 00182 #ifndef BSTREAM_READONLY 00183 #define BSTREAM_READONLY 00184 #endif 00185 #endif 00186 #ifdef BSTREAM_READONLY 00187 extern char const stream_readonly[]; 00188 #endif 00189 #ifdef BSTREAM_DISABLE_QUANTIZATION 00190 extern char const stream_disable_quantization[]; 00191 #endif 00192 #ifdef BSTREAM_DISABLE_EDGEBREAKER 00193 extern char const stream_disable_edgebreaker[]; 00194 #endif 00195 #ifdef BSTREAM_DISABLE_REPULSE_COMPRESSION 00196 extern char const stream_disable_repulse_compression[]; 00197 #endif 00198 #ifdef BSTREAM_DISABLE_ASCII 00199 extern char const stream_disable_ascii[]; 00200 #endif 00201 00202 00203 #include <math.h> 00204 #include <string.h> 00205 #include <stdio.h> 00206 00207 #ifdef NEED_BOOL_TYPE 00208 #undef NEED_BOOL_TYPE 00209 typedef int bool; 00210 00211 const bool true = !0; 00212 const bool false = 0; 00213 #endif 00214 00215 00220 #if defined(WIN64) || defined(_WIN64) 00221 # define ID_Key __int64 00222 #else 00223 # define ID_Key long 00224 #endif 00225 00226 00227 00228 #ifndef alter 00229 # define alter //!< complementary to const, indicates we thought about it instead of a forgotten "const" 00230 #endif 00231 00232 00233 #ifndef HPS_CORE_BUILD 00234 template <typename T> void Swap (T & a, T & b) { T tmp = a; a = b; b = tmp; } 00235 #endif 00236 00237 00242 00243 00247 enum TK_Status { 00248 TK_Normal = 0, 00249 TK_Error = 1, 00250 TK_Pause = 2, 00251 TK_Single = 3, 00252 TK_Pending = 4, 00253 TK_Revisit = 5, 00254 TK_Complete = 6, 00255 TK_Version = 7, 00256 TK_NotFound = 8, 00257 TK_Abort = 9, 00258 TK_LibraryNotFound = 10 00259 }; 00263 00264 00270 enum TK_File_Write_Options { 00271 TK_Suppress_LOD = 0x00000002, 00272 TK_Full_Resolution_Vertices = 0x00000004, 00273 TK_Full_Resolution_Normals = 0x00000008, 00274 TK_First_LOD_Is_Bounding_Box = 0x00000010, 00275 TK_Force_Tags = 0x00000020, 00276 TK_Disable_Priority_Heuristic = 0x00000040, 00277 TK_Disable_Global_Compression = 0x00000100, 00278 TK_Disable_Instancing = 0x00000200, 00279 TK_Generate_Dictionary = 0x00000400, 00280 TK_Connectivity_Compression = 0x00000800, 00281 TK_Disable_Tristrips = 0x00001000, 00282 TK_Disable_Compound_Primitives = 0x00002000, 00283 TK_Global_Quantization = 0x00004000, 00284 TK_Full_Resolution_Parameters = 0x00008000, 00285 TK_Full_Resolution_Colors = 0x00010000, 00286 TK_Full_Resolution_Index_Colors= 0x00020000, 00287 TK_Communicator_Mode = 0x00040000, 00288 TK_Full_Resolution = (TK_Full_Resolution_Vertices|TK_Full_Resolution_Normals|TK_Full_Resolution_Parameters|TK_Full_Resolution_Colors|TK_Full_Resolution_Index_Colors) 00289 }; 00290 00291 00295 enum TK_Dictionary_Options { 00296 TK_Dictionary_Bounding_Volumes = 0x00000001 00297 }; 00298 00299 00303 enum TK_File_Read_Options { 00304 TK_Flag_Unhandled_Opcodes = 0x00000001, 00305 TK_Ignore_Version = 0x00000002, 00306 TK_Skip_External_References = 0x00000004, 00307 TK_Ignore_Bounding_LODs = 0x00000008 00308 }; 00309 00313 enum TK_Debug_Logging_Options { 00314 TK_Logging_Sequence = 0x00000001, 00315 TK_Logging_Tagging = 0x00000002, 00316 TK_Logging_Segment_Names = 0x00000004 00317 }; 00318 00319 00323 enum TK_General_Flags { 00324 // for Geometryoes and some attributes 00325 TK_Double_Precision = 0x01, 00326 00327 // for includes and styles 00328 TK_Has_Condition = 0x01, 00329 TK_Has_Filter = 0x02 00330 }; 00331 00332 00333 #include "BOpcodeHandler.h" 00334 #include "BStreamFileToolkit.h" 00335 00341 00342 00352 #ifndef SWIG 00353 TK_Status BBINFILETK_API TK_Read_Stream_File (char const * filename, BStreamFileToolkit * tk); 00354 #endif 00355 00357 00366 #ifndef SWIG 00367 TK_Status BBINFILETK_API TK_Read_Stream_File (char const * filename, int flags = 0); 00368 #endif 00369 00370 00371 00372 00374 TK_Status BBINFILETK_API TK_Read_Stream_File (__wchar_t const * filename, BStreamFileToolkit * tk); 00375 #ifdef _MSC_VER 00376 TK_Status BBINFILETK_API TK_Read_Stream_File (unsigned short const * filename, BStreamFileToolkit * tk); 00377 #endif 00378 00380 TK_Status BBINFILETK_API TK_Read_Stream_File (__wchar_t const * filename, int flags = 0); 00381 #ifdef _MSC_VER 00382 TK_Status BBINFILETK_API TK_Read_Stream_File (unsigned short const * filename, int flags = 0); 00383 #endif 00384 00385 00387 00394 #ifndef SWIG 00395 TK_Status BBINFILETK_API TK_Read_Stream_File (char const * filename, int flags, BStreamFileToolkit * tk); 00396 #endif 00397 00399 #endif 00400