-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUnityPluginInterface.h
More file actions
86 lines (71 loc) · 2.41 KB
/
Copy pathUnityPluginInterface.h
File metadata and controls
86 lines (71 loc) · 2.41 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
#pragma once
// Which platform we are on?
#if _MSC_VER
#define UNITY_WIN 1
#elif defined(__APPLE__)
#if defined(__arm__)
#define UNITY_IPHONE 1
#else
#define UNITY_OSX 1
#endif
#elif defined(__linux__)
#define UNITY_LINUX 1
#elif defined(UNITY_METRO) || defined(UNITY_ANDROID)
// these are defined externally
#else
#error "Unknown platform!"
#endif
// Attribute to make function be exported from a plugin
#if UNITY_METRO
#define EXPORT_API __declspec(dllexport) __stdcall
#elif UNITY_WIN
#define EXPORT_API __declspec(dllexport)
#else
#define EXPORT_API
#endif
// Which graphics device APIs we possibly support?
#if UNITY_METRO
#define SUPPORT_D3D11 1
#elif UNITY_WIN
#define SUPPORT_D3D9 1
#define SUPPORT_D3D11 1 // comment this out if you don't have D3D11 header/library files
#define SUPPORT_OPENGL 1
#endif
#if UNITY_OSX || UNITY_LINUX
#define SUPPORT_OPENGL 1
#endif
#if UNITY_IPHONE || UNITY_ANDROID
#define SUPPORT_OPENGLES 1
#endif
// Graphics device identifiers in Unity
enum GfxDeviceRenderer
{
kGfxRendererOpenGL = 0, // OpenGL
kGfxRendererD3D9, // Direct3D 9
kGfxRendererD3D11, // Direct3D 11
kGfxRendererGCM, // Sony PlayStation 3 GCM
kGfxRendererNull, // "null" device (used in batch mode)
kGfxRendererHollywood, // Nintendo Wii
kGfxRendererXenon, // Xbox 360
kGfxRendererOpenGLES_Obsolete,
kGfxRendererOpenGLES20Mobile, // OpenGL ES 2.0
kGfxRendererMolehill_Obsolete,
kGfxRendererOpenGLES20Desktop_Obsolete,
kGfxRendererOpenGLES30, // OpenGL ES 3.0
kGfxRendererCount
};
// Event types for UnitySetGraphicsDevice
enum GfxDeviceEventType {
kGfxDeviceEventInitialize = 0,
kGfxDeviceEventShutdown,
kGfxDeviceEventBeforeReset,
kGfxDeviceEventAfterReset,
};
// If exported by a plugin, this function will be called when graphics device is created, destroyed,
// before it's being reset (i.e. resolution changed), after it's being reset, etc.
extern "C" void EXPORT_API UnitySetGraphicsDevice(void* device, int deviceType, int eventType);
// If exported by a plugin, this function will be called for GL.IssuePluginEvent script calls.
// The function will be called on a rendering thread; note that when multithreaded rendering is used,
// the rendering thread WILL BE DIFFERENT from the thread that all scripts & other game logic happens!
// You have to ensure any synchronization with other plugin script calls is properly done by you.
extern "C" void EXPORT_API UnityRenderEvent(int eventID);