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