Nebula
Loading...
Searching...
No Matches
im3d_config.h
Go to the documentation of this file.
1#pragma once
2
3#include "render/stdneb.h"
4#include "core/config.h"
5#include "memory/memory.h"
6#include "math/vec4.h"
7#include "math/vec2.h"
8#include "math/mat4.h"
9
10// Deprecated behavior.
11#define IM3D_USE_DEPRECATED_DRAW_CONE 1 // Enable deprecated DrawCone() and DrawConeFilled() API (deprecated v1.18).
12#include "memory/memory.h"
13
14// User-defined assertion handler (default is cassert assert()).
15#define IM3D_ASSERT(e) n_assert(e)
16
17// User-defined malloc/free. Define both or neither (default is cstdlib malloc()/free()).
18#define IM3D_MALLOC(size) Memory::Alloc(Memory::DefaultHeap, size)
19#define IM3D_FREE(ptr) Memory::Free(Memory::DefaultHeap, ptr)
20// User-defined API declaration (e.g. __declspec(dllexport)).
21//#define IM3D_API
22
23// Use a thread-local context pointer.
24//#define IM3D_THREAD_LOCAL_CONTEXT_PTR 1
25
26// Use row-major internal matrix layout.
27//#define IM3D_MATRIX_ROW_MAJOR 1
28
29// Force vertex data alignment (default is 4 bytes).
30#define IM3D_VERTEX_ALIGNMENT 4
31
32// Enable internal culling for primitives (everything drawn between Begin*()/End()). The application must set a culling frustum via AppData.
33//#define IM3D_CULL_PRIMITIVES 1
34
35// Enable internal culling for gizmos. The application must set a culling frustum via AppData.
36//#define IM3D_CULL_GIZMOS 1
37
38// Set a layer ID for all gizmos to use internally.
39//#define IM3D_GIZMO_LAYER_ID 0xD4A1B5
40
41// Conversion to/from application math types.
42#define IM3D_VEC2_APP \
43 Vec2(const Math::vec2& _v) { x = _v.x; y = _v.y; } \
44 operator Math::vec2() const { return Math::vec2(x, y); }
45#define IM3D_VEC3_APP \
46 Vec3(const Math::point& _v) { x = _v.x; y = _v.y; z = _v.z; } \
47 operator Math::point() const { return Math::point(x, y, z); } \
48 Vec3(const Math::vector& _v) { x = _v.x; y = _v.y; z = _v.z; } \
49 operator Math::vector() const { return Math::vector(x, y, z); } \
50 Vec3(const Math::vec3& _v) { x = _v.x; y = _v.y; z = _v.z; } \
51 operator Math::vec3() const { return Math::vec3(x, y, z); }
52#define IM3D_VEC4_APP \
53 Vec4(const Math::point& _v) { x = _v.x; y = _v.y; z = _v.z; w = 1.0f; } \
54 operator Math::point() const { return Math::point(x, y, z); } \
55 Vec4(const Math::vec4& _v) { x = _v.x; y = _v.y; z = _v.z; w = _v.w; } \
56 operator Math::vec4() const { return Math::vec4(x, y, z, w); }
57#define IM3D_MAT3_APP \
58 Mat3(const Math::mat4& _m) { float b[16]; _m.storeu(b); for(int j = 0 ; j < 3;++j) for (int i = 0; i < 3; ++i) m[i+j*3] = b[i + j*4]; } \
59 operator Math::mat4() const { Math::mat4 ret; float b[16]; ret.storeu(b); int k = 0; for(int j = 0 ; j < 3;++j) for (int i = 0; i < 3; ++i) b[i+4*j] = m[i+j*3]; ret.loadu(b); return ret; }
60#define IM3D_MAT4_APP \
61 Mat4(const Math::mat4& _m) { _m.storeu(m);} \
62 operator Math::mat4() const { Math::mat4 ret; ret.loadu(m); return ret; }
Nebula compiler specific defines and configuration.
Implements a memory related functions.
Precompiled header.