-
Notifications
You must be signed in to change notification settings - Fork 69
Config
John Chapman edited this page Mar 19, 2018
·
1 revision
Im3d may be configured by modifying im3d_config.h.
-
IM3D_ASSERT(e)
- Application-defined assertion handler (default is cassertassert()
). -
IM3D_MALLOC(size)
,IM3D_FREE(ptr)
- Application-defined malloc/free (default is cstdlibmalloc()
/free()
). -
IM3D_THREAD_LOCAL_CONTEXT_PTR
- Define to enable a thread-local context ptr. This is a prerequisite for multi threaded use of Im3d via multiple contexts. Note that although this makes Im3d's internal context ptr thread local, the application must allocate and set per-thread context instances. -
IM3D_MATRIX_ROW_MAJOR
- Use row-major internal matrix layout. -
IM3D_VERTEX_ALIGNMENT
- Force vertex data alignment (default is 4 bytes). Whether this is required depends on the graphics API and rendering method used by the application, e.g. examples/OpenGL31 requires 16 byte alignment for vertex data. -
IM3D_CULL_PRIMITIVES
- Enable internal culling for primitives (see Culling). -
IM3D_CULL_GIZMOS
- Enable internal culling for gizmos (see Culling).
Some interfaces in the API take internal math types as arguments (Im3d::Vec2
, Im3d::Vec4
, etc.). It is therefore useful to define implicit conversion between Im3d and application math types. This is done by defining an IM3D_X_APP
macro (where X
is the type name) which is injected into the Im3d type's definition. E.g.
#define IM3D_VEC2_APP \
Vec2(const linalg::vec2& _v) { x = _v.x; y = _v.y; } \
operator linalg::vec2() const { return linalg::vec2(x, y); }