Repository navigation
Expand file tree
/
Copy pathDekiRenderingPackage.cpp
More file actions
118 lines (93 loc) · 3.09 KB
/
Copy pathDekiRenderingPackage.cpp
File metadata and controls
118 lines (93 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Entry point of the deki-rendering package. Registers the rendering system
// with Deki::Engine. In the editor this is a separate DLL that can be hot
// reloaded; in runtime builds its sources are linked statically into the
// engine.
#include "DekiRenderingPackage.h"
#include "DekiRenderingInit.h"
#include <deki/Engine.h>
#include <deki/LogSystem.h>
#include <deki/interop/Plugin.h>
#include "CameraComponent.h"
#include "RendererComponent.h"
#include <deki/reflection/ComponentRegistry.h>
#include <deki/reflection/ComponentFactory.h>
extern void DekiRenderingRegisterComponents();
extern int DekiRenderingGetAutoComponentCount();
extern const Deki::ComponentMeta* DekiRenderingGetAutoComponentMeta(int index);
namespace DekiRendering
{
#ifdef DEKI_EDITOR
#ifndef DEKI_PLUGIN_EXPORTS
// Registration, for the standalone DLL only.
static bool s_Registered = false;
// The exports below are C symbols at global scope; the package's own
// registration helpers and statics live in its namespace.
using namespace DekiRendering;
extern "C"
{
DEKI_RENDERING_API int DekiRenderingEnsureRegistered(void)
{
if (s_Registered)
{
return ::DekiRenderingGetAutoComponentCount();
}
s_Registered = true;
// Generated: registers the components with ComponentRegistry and ComponentFactory.
::DekiRenderingRegisterComponents();
// Safe if DekiInitPackageSystems() already started it during
// Deki::Engine::Initialize().
DekiRenderingInitSystem();
return ::DekiRenderingGetAutoComponentCount();
}
} // extern "C"
#endif // DEKI_PLUGIN_EXPORTS
// =============================================================================
// Plugin metadata, for dynamic loading
// =============================================================================
extern "C"
{
#ifndef DEKI_PLUGIN_EXPORTS
DEKI_PLUGIN_API const char* DekiPluginGetName(void)
{
return "Deki Rendering Package";
}
DEKI_PLUGIN_API const char* DekiPluginGetVersion(void)
{
#ifdef DEKI_PACKAGE_VERSION
return DEKI_PACKAGE_VERSION;
#else
return "0.0.0-dev";
#endif
}
DEKI_PLUGIN_API int DekiPluginInit(void)
{
return 0;
}
DEKI_PLUGIN_API void DekiPluginShutdown(void)
{
DekiRenderingShutdownSystem();
s_Registered = false;
}
DEKI_PLUGIN_API int DekiPluginGetComponentCount(void)
{
return ::DekiRenderingGetAutoComponentCount();
}
DEKI_PLUGIN_API const Deki::ComponentMeta* DekiPluginGetComponentMeta(int index)
{
return ::DekiRenderingGetAutoComponentMeta(index);
}
DEKI_PLUGIN_API void DekiPluginRegisterComponents(void)
{
DekiRenderingEnsureRegistered();
}
#endif // DEKI_PLUGIN_EXPORTS
} // extern "C"
// =============================================================================
// Package-specific API
// =============================================================================
DEKI_RENDERING_API const char* DekiRenderingGetName(void)
{
return "Rendering";
}
#endif // DEKI_EDITOR
} // namespace DekiRendering