11#ifdef BOX3D_USER_CONFIG
12#include BOX3D_USER_CONFIG
22#if defined(_WIN32) && defined(box3d_EXPORTS)
24 #define BOX3D_EXPORT __declspec(dllexport)
25#elif defined(_WIN32) && defined(BOX3D_DLL)
27 #define BOX3D_EXPORT __declspec(dllimport)
28#elif defined(box3d_EXPORTS)
30 #define BOX3D_EXPORT __attribute__((visibility("default")))
39 #define B3_API extern "C" BOX3D_EXPORT
40 #define B3_INLINE inline
42#if defined( _MSC_VER )
43 #define B3_FORCE_INLINE __forceinline
44#elif defined( __GNUC__ ) || defined( __clang__ )
45 #define B3_FORCE_INLINE inline __attribute__((always_inline))
47 #define B3_FORCE_INLINE inline
50 #define B3_LITERAL(T) T
51 #define B3_ZERO_INIT {}
53 #define B3_API BOX3D_EXPORT
54 #define B3_INLINE static inline
56#if defined( _MSC_VER )
57 #define B3_FORCE_INLINE static __forceinline
58#elif defined( __GNUC__ ) || defined( __clang__ )
59 #define B3_FORCE_INLINE static inline __attribute__((always_inline))
61 #define B3_FORCE_INLINE static inline
65 #define B3_LITERAL(T) (T)
66 #define B3_ZERO_INIT {0}
70#if defined( BOX3D_VALIDATE ) && !defined( NDEBUG )
71#define B3_ENABLE_VALIDATION 1
73#define B3_ENABLE_VALIDATION 0
83#define B3_NULL_INDEX -1
88typedef void*
b3AllocFcn( int32_t size, int32_t alignment );
95typedef int b3AssertFcn(
const char* condition,
const char* fileName,
int lineNumber );
112#if defined( _MSC_VER )
114#define B3_BREAKPOINT __debugbreak()
115#elif defined( __GNUC__ ) || defined( __clang__ )
116#define B3_BREAKPOINT __builtin_trap()
120#define B3_BREAKPOINT assert( 0 )
123#if !defined( NDEBUG ) || defined( B3_ENABLE_ASSERT )
127#define B3_ASSERT( condition ) \
128 ( (void)( ( !!( condition ) ) || ( b3InternalAssert( #condition, __FILE__, (int)( __LINE__ ) ), 0 ) ) )
130#define B3_ASSERT( ... ) ( (void)0 )
133#if B3_ENABLE_VALIDATION
136#define B3_VALIDATE( condition ) B3_ASSERT( condition )
140#define B3_VALIDATE( ... ) ( (void)0 )
171B3_API uint64_t b3GetTicks(
void );
174B3_API
float b3GetMilliseconds( uint64_t ticks );
177B3_API
float b3GetMillisecondsAndReset( uint64_t* ticks );
180B3_API
void b3Yield(
void );
183B3_API
void b3Sleep(
int milliseconds );
186#define B3_HASH_INIT 5381
187B3_API uint32_t b3Hash( uint32_t hash,
const uint8_t* data,
int count );
190B3_API
void b3WriteBinaryFile(
void* data,
int size,
const char* fileName );
191B3_API
void* b3ReadBinaryFile(
const char* prefix,
const char* fileName,
int* memSize );
int revision
Bug fixes.
Definition base.h:157
int minor
Incremental changes.
Definition base.h:154
int major
Significant changes.
Definition base.h:151
void * b3AllocFcn(int32_t size, int32_t alignment)
Prototype for user allocation function.
Definition base.h:88
void b3FreeFcn(void *mem)
Prototype for user free function.
Definition base.h:92
int b3InternalAssert(const char *condition, const char *fileName, int lineNumber)
Internal assertion handler. Allows for host intervention.
void b3SetAssertFcn(b3AssertFcn *assertFcn)
Override the default assert callback.
void b3SetLogFcn(b3LogFcn *logFcn)
Override the default logging callback.
int32_t b3GetByteCount(void)
Total bytes allocated by Box3D.
b3Version b3GetVersion(void)
Get the current version of Box3D.
bool b3IsDoublePrecision(void)
void b3SetAllocator(b3AllocFcn *allocFcn, b3FreeFcn *freeFcn)
This allows the user to override the allocation functions.
int b3AssertFcn(const char *condition, const char *fileName, int lineNumber)
Prototype for the user assert callback. Return 0 to skip the debugger break.
Definition base.h:95
void b3LogFcn(const char *message)
Prototype for user log callback. Used to log warnings.
Definition base.h:98
Version numbering scheme.
Definition base.h:149