Open Reality Reference Guide
 
Loading...
Searching...
No Matches
kaydara.h
1#ifndef _KAYDARA_H
2#define _KAYDARA_H
3/**************************************************************************
4Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5All Rights Reserved.
6
7The coded instructions, statements, computer programs, and/or related
8material (collectively the "Data") in these files contain unpublished
9information proprietary to Autodesk, Inc. and/or its licensors, which is
10protected by Canada and United States of America federal copyright law
11and by international treaties.
12
13The Data may not be disclosed or distributed to third parties, in whole
14or in part, without the prior written consent of Autodesk, Inc.
15("Autodesk").
16
17THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24FREE.
25
26IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36
37**************************************************************************/
38
39#define K_NO_PROJECTSETTINGS
40#define K_NO_NAMESPACE_UPGRADE // Support for NamespaceUpgradeToFileReference and NamespaceDowngradeFromFileReference
41#define K_NO_PYTHON_CODE_GENERATION // Python code generator
42#define K_NO_LIVE // No video input/output support, no fullscreen, Live camera switcher ...
43
44/* Product definitions using the Kernel */
45#if defined(FB_KERNEL)
46
47#ifndef FB_KERNEL_WITH_UI
48 #define K_NO_MANIPULATOR
49 #define K_NO_UI
50 #define K_DISABLE_UI
51 #define K_NO_HUD
52#endif
53
54 #define K_NO_RENDERER
55 #define K_NO_VIEWCUBE
56 #define K_NO_STEERINGWHEEL
57 #define K_NO_ASSETMNG
58 #define K_NO_DECK
59 #define K_NO_FOLDER
60 #define K_NO_IMAGEOPERATOR
61 #define K_NO_NOTE
62 #define K_NO_OPTICAL
63 #define K_NO_PYTHON
64 #define K_NO_UNDO
65 #define K_NO_CONSTRUCTION_HISTORY
66 #define K_NO_CIP
67 #define K_NO_STEREO
68 #define K_NO_CGFX_SHADER
69 #define K_NO_ONECLICK
70 #define K_NO_NVAPI
71// #define K_NO_STATIC_FONTS // OpenGL fonts
72// Others not used
73// #define K_NO_ACTOR
74// #define K_NO_CHARACTER
75// #define K_NO_POSE
76#else
77 // API availability
78 #ifdef K_NO_CG
79 #define K_NO_CGFX_SHADER
80 #define K_NO_STEREO
81 #endif
82 #ifdef K_NO_NVAPI
83 #endif
84#endif
85
86#ifdef _MSC_VER
87 #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
88 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
89 #endif
90 #ifndef _CRT_NONSTDC_NO_WARNINGS
91 #define _CRT_NONSTDC_NO_WARNINGS 1
92 #endif
93 #ifndef _CRT_SECURE_NO_WARNINGS
94 #define _CRT_SECURE_NO_WARNINGS 1
95 #endif
96#endif
97
98// Memory extra debugging information
99// Comment out the next line if a redefinition of the new operator is use.
100
101// Memory debug will only be available after Qt 6.0, see https://bugreports.qt.io/browse/QTBUG-86395
102//#define MEMORY_DEBUG
103
104// Profiling for the application.
105// Comment this to remove all profiling code.
106#define KPROFILING_CODE_ENABLE
107
108#if defined(MEMORY_DEBUG) && defined(_DEBUG) && !defined(NDEBUG) && !defined(__CUDACC__) && defined(_MSC_VER) && !defined(_MFC_VER)
109 #ifdef _XMEMORY_
110// #error kaydara.h should be included first for memory leak information.
111 #endif
112
113 #define _CRTDBG_MAP_ALLOC
114 #include <cstdlib>
115 #include <crtdbg.h>
116
117 #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
118 // Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the
119 // allocations to be of _CLIENT_BLOCK type
120
121 #define MEMORY_DEBUG_ACTIVE 1
122#else
123 #define DBG_NEW new
124#endif
125
126#ifndef FB_KERNEL
127 #if !defined(K_ENABLE_STREAM_FCURVE)
128 #define K_ENABLE_STREAM_FCURVE
129 #endif
130#endif
131
132#include <karch/arch.h>
133#include <karch/types.h>
134
135#ifndef K_NO_QUICKTIME
136 #if defined(KARCH_ENV_LINUX) || defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
137 #define K_NO_QUICKTIME // No QuickTime implementions for those platforms
138 #endif
139#endif
140
141#ifndef K_NO_ADVANCEDCONSTRAINTS
142 #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
143 #define K_NO_ADVANCEDCONSTRAINTS // No advance constraints
144 #endif
145#endif
146
147#ifndef K_NO_PHYSICS
148 #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
149 #define K_NO_PHYSICS
150 #endif
151#endif
152
153#ifndef NULL
154 #if defined __GNUG__
155 #define NULL (__null)
156 #else
157 #ifdef __cplusplus
158 #define NULL 0
159 #else
160 #define NULL ((void *)0)
161 #endif
162 #endif
163#endif
164
165#if !defined( _MAX_PATH ) && defined( KARCH_ENV_UNIX )
166 #define _MAX_PATH 1024
167#endif
168
169#define K_MAX_TEXT_LENGTH 1020 // Max text length, to be used when declaring fixed width char ptrs directly
170
171#define K_FORWARD( ClassName ) class ClassName; typedef ClassName *H##ClassName
172#define K_FORWARD_HI( ClassName ) class ClassName; typedef ClassName *H##ClassName; typedef H##ClassName HI##ClassName
173
174#define K_SAFE_FREE_PTR( p ) if( p ){ free( p ); (p) = NULL; }
175#define K_SAFE_DELETE_PTR( p ) if( p ){ delete (p); (p) = NULL; }
176#define K_SAFE_DELETE_ARRAY_PTR( a ) if( a ){ delete [] (a); (a) = NULL; }
177
178#define K_SAFE_DESTROY_OBJECT( p ) { if( p ){ (p)->Destroy(); (p) = NULL; } }
179
180#define K_UNUSED_ARG(x) ((void)(x))
181
182#ifdef KARCH_ENV_WIN
183 #ifndef WIN32_LEAN_AND_MEAN
184 #define WIN32_LEAN_AND_MEAN // Defined to speed up compilation
185 #endif
186 #ifndef NOMINMAX
187 #define NOMINMAX
188 #endif
189 #ifndef STRICT
190 #define STRICT
191 #endif
192#else
193 #include <cstddef>
194 #include <cstring>
195 #include <cstdarg>
196 #include <cstdio>
197#endif
198
199#if defined(KARCH_DEV_MSC)
200 #ifndef stricmp
201 #define stricmp _stricmp
202 #endif
203 #ifndef strnicmp
204 #define strnicmp _strnicmp
205 #endif
206 #ifndef getcwd
207 #define getcwd _getcwd
208 #endif
209 #ifndef getpid
210 #define getpid _getpid
211 #endif
212 #ifndef fileno
213 #define fileno _fileno
214 #endif
215 #ifndef fdopen
216 #define fdopen _fdopen
217 #endif
218
219 #ifdef __clang__
220 #define sealed // Prevents classes from being used as base classes
221 #define abstract =0 // Indicates functions or classes are abstract
222 #endif
223#else
224 #define _MSC_EMULATOR
225
226 #define sealed // Prevents classes from being used as base classes
227 #define abstract =0 // Indicates functions or classes are abstract
228
229 #if !defined(_TRUNCATE)
230 #define _TRUNCATE ((size_t)-1)
231 #endif
232 inline int strcpy_s( char* dst,size_t /*bufsize*/,const char* src )
233 {
234 strcpy( dst,src );
235 return 0;
236 }
237 template <size_t bufsize> int strcpy_s( char (&dst)[bufsize], const char *src )
238 {
239 return strcpy_s( dst,bufsize,src );
240 }
241
242 inline int strncpy_s( char* dst,size_t /*bufsize*/,const char* src,size_t count )
243 {
244 strncpy( dst,src,count );
245 return 0;
246 }
247 template <size_t bufsize> int strncpy_s( char (&dst)[bufsize], const char *src, size_t count )
248 {
249 return strncpy_s( dst,bufsize,src,count );
250 }
251
252 inline int vsprintf_s( char *buffer, size_t /*bufsize*/, const char *format, va_list args )
253 {
254 return vsprintf( buffer,format, args );
255 }
256 template <size_t bufsize> int vsprintf_s( char (&buffer)[bufsize], const char *format, va_list args )
257 {
258 return vsprintf_s( buffer,bufsize,format, args );
259 }
260
261 inline int sprintf_s( char *buffer, size_t bufsize, const char *format, ... )
262 {
263 va_list Arguments;
264 va_start( Arguments, format); /* Initialize variable arguments. */
265 int result = vsprintf_s( buffer,bufsize,format, Arguments );
266 va_end( Arguments ); /* Reset variable arguments. */
267 return result;
268 }
269 template <size_t bufsize> int sprintf_s( char (&buffer)[bufsize], const char *format, ... )
270 {
271 va_list Arguments;
272 va_start( Arguments, format); /* Initialize variable arguments. */
273 int result = vsprintf_s( buffer,bufsize,format, Arguments );
274 va_end( Arguments ); /* Reset variable arguments. */
275 return result;
276 }
277
278 #ifndef sscanf_s
279 #define sscanf_s sscanf
280 #endif
281
282 inline int strcat_s( char *dst, size_t /*bufsize*/, const char *src )
283 {
284 strcat( dst,src );
285 return 0;
286 }
287 template <size_t bufsize> int strcat_s( char (&dst)[bufsize], const char *src )
288 {
289 return strcat_s( dst,bufsize,src );
290 }
291
292 #ifndef strtok_s
293 #define strtok_s( token,sep,context ) strtok( token,sep ); K_UNUSED_ARG(context)
294 #endif
295
296 #ifndef strncat_s
297 #define strncat_s( dst,bufsize,src,len ) strncat( dst,src,len ); K_UNUSED_ARG(bufsize)
298 #endif
299
300 #ifndef localtime_s
301 #define localtime_s( _Tm,_Time ) _Tm = localtime( _Time )
302 #endif
303
304 #ifndef _strdup
305 #define _strdup strdup
306 #endif
307
308 #ifndef _stricmp
309 #define _stricmp strcasecmp
310 #endif
311 #ifndef strcmpi
312 #define strcmpi strcasecmp
313 #endif
314 #ifndef _strcmpi
315 #define _strcmpi strcasecmp
316 #endif
317 #ifndef stricmp
318 #define stricmp strcasecmp
319 #endif
320 #ifndef strncmpi
321 #define strncmpi strncasecmp
322 #endif
323 #ifndef strnicmp
324 #define strnicmp strncasecmp
325 #endif
326
327 #ifndef _atoi64
328 #define _atoi64( str ) strtoll( str,NULL,10 )
329 #endif
330
331#endif
332
333#if defined(KARCH_ENV_LINUX)
334 #include <malloc.h>
335 #pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
336#endif
337
338// Compiler specific
339#if defined(KARCH_DEV_MSC)
340 #pragma warning(disable : 4097) // warning C4097: typedef-name 'ClassType' used as synonym for class-name 'KTextTag'
341 #pragma warning(disable : 4100) // warning C4100: '?' : unreferenced formal parameter
342 #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union (Level 4) portability
343 #pragma warning(disable : 4244) // conversion from 'const double' to 'float', possible loss of data
344 #pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class
345 #pragma warning(disable : 4481) // warning C4481: nonstandard extension used: override specifier 'override'
346 #pragma warning(disable : 4514) // unreferenced inline function has been removed (Level 4) optimizer
347 #pragma warning(disable : 4660) // template-class specialization 'identifier' is already instantiated (Level 2) compiler
348 #pragma warning(disable : 4710) // function (X) not expanded ??? may be good to know
349 #pragma warning(disable : 4711) // function (X) selected for automatic inline expansion
350 #pragma warning(disable : 4725) // instruction may be inaccurate on some Pentiums
351
352 #pragma warning(error : 4002) // too many actual parameters for macro 'identifier'
353 #pragma warning(error : 4013) // warning C4013: 'function' undefined; assuming extern returning int
354 #pragma warning(error : 4018) // warning C4018: '>': signed/unsigned mismatch
355// #pragma warning(error : 4062) // warning C4062: enumerator 'identifier' in switch of enum 'enumeration' is not handled
356 #pragma warning(error : 4101) // warning C4101: 'identifier' : unreferenced local variable
357 #pragma warning(error : 4130) // warning C4130: '==' : logical operation on address of string constant
358 #pragma warning(error : 4189) // warning C4189: local variable is initialized but not referenced
359 #pragma warning(error : 4238) // warning C4238: nonstandard extension used : class rvalue used as lvalue
360 #pragma warning(error : 4265) // warning C4265: 'class': class has virtual functions, but destructor is not virtual
361 #pragma warning(error : 4289) // warning C4289: nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope
362 #pragma warning(error : 4311) // warning C4311: 'type cast' : pointer truncation from 'x *' to 'y'
363 #pragma warning(error : 4373) // warning C4373: '%$S': virtual function overrides '%$pS', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
364 #pragma warning(error : 4407) // warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
365 #pragma warning(error : 4431) // warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
366 #pragma warning(error : 4510) // warning C4510: 'class' : default constructor could not be generated
367 #pragma warning(error : 4551) // warning C4551: function call missing argument list
368 #pragma warning(error : 4553) // warning C4553: '==' : operator has no effect; did you intend '='?
369 #pragma warning(error : 4700) // warning C4700: (level 1 and 4) local variable 'name' used without having been initialized
370 #pragma warning(error : 4701) // warning C4701: (level 4) local variable 'name' may be used without having been initialized
371 #pragma warning(error : 4946) // warning C4946: reinterpret_cast used between related classes: 'class1' and 'class2'
372 #pragma warning(error : 4996) // warning C4996: 'function': was declared deprecated
373 #if !defined(_DEBUG)
374 #pragma warning(error : 5245) // warning C5245: (level 4) 'function': unreferenced function with internal linkage has been removed
375// Those are not ready, VS headers are still reporting those errors. 2023-01-02
376// #pragma warning(error : 5262) // warning C5262: implicit fall-through occurs here; are you missing a break statement? Use [[fallthrough]] when a break statement is intentionally omitted between cases".
377// #pragma warning(error : 5264) // warning C5264: 'const' variable is not used.
378 #endif
379#endif
380
381#define K_LOCAL_CLASS
382
383// Deprecated macro, to remind people to stop using certain functions / attributes.
384// Retirement policy, instead of directly remove certain functions / attributes, we
385// should declare them to be deprecated first, and then safely removed them at next
386// major release. We add major release version number suffix to the macro to indicate
387// the timing.
388
389#if(PRODUCT_VERSION>2025)
390 #error "Update the deprecated versions and removed deprecated code"
391#endif
392#if(PRODUCT_VERSION<=2025)
393 #define K_DEPRECATED_2022 [[deprecated]]
394#endif
395#if(PRODUCT_VERSION<=2026)
396 #define K_DEPRECATED_2023 [[deprecated]]
397#endif
398#if(PRODUCT_VERSION<=2027)
399 #define K_DEPRECATED_2024 [[deprecated]]
400#endif
401#if(PRODUCT_VERSION<=2028)
402 #define K_DEPRECATED_2025 [[deprecated]]
403#endif
404
405#endif // _KAYDARA_H_
406
407
408
409