├── .gitignore
├── README.md
├── UNLICENSE
├── assets
├── Roboto-Bold.ttf
├── cube.obj
├── simple.glsl
├── teapot.obj
├── test.scene
└── white.glsl
├── dep
├── include
│ ├── GLFW
│ │ ├── glfw3.h
│ │ └── glfw3native.h
│ ├── fontstash.h
│ ├── nanovg.h
│ ├── nanovg_gl.h
│ ├── nanovg_gl_utils.h
│ ├── stb_image.h
│ └── stb_truetype.h
├── licenses
│ ├── GLFW3.txt
│ ├── NANOVG.txt
│ └── STB.txt
└── src
│ └── nanovg.c
├── msvc
├── .gitignore
├── editor
│ ├── editor.vcxproj
│ ├── editor.vcxproj.filters
│ ├── editor.vcxproj.user
│ └── packages.config
├── engine
│ ├── engine.vcxproj
│ ├── engine.vcxproj.filters
│ └── packages.config
├── lib-Win32
│ ├── glfw3.dll
│ └── glfw3dll.lib
├── lib-x64
│ ├── glfw3.dll
│ └── glfw3dll.lib
├── packages
│ └── repositories.config
└── vs2013.sln
└── src
├── editor
├── editor.cpp
├── editor.h
├── gui.cpp
├── gui.h
├── main.cpp
├── scene.cpp
├── scene.h
├── widgets.cpp
├── widgets.h
├── window.cpp
├── window.h
├── xplat.cpp
└── xplat.h
└── engine
├── asset.cpp
├── asset.h
├── font.cpp
├── font.h
├── geometry.cpp
├── geometry.h
├── gl.cpp
├── gl.h
├── json.cpp
├── json.h
├── linalg.h
├── load.cpp
├── load.h
├── pack.h
├── transform.cpp
├── transform.h
├── utf8.cpp
└── utf8.h
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin-*
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Overview
2 | ========
3 |
4 | This project consists of some very early explorations into a 3D scene editor, of the sort that might be used to author video game levels, etc.
5 |
6 | Our example program shows a view into a 3D scene, with the ability to select objects either by clicking or by picking them from an object list, and with the ability to modify some properties either via a gizmo or through a property editor.
7 |
--------------------------------------------------------------------------------
/UNLICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
25 |
--------------------------------------------------------------------------------
/assets/Roboto-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgorsten/editor/7749421e7046255fe9861509658a92385deb57b6/assets/Roboto-Bold.ttf
--------------------------------------------------------------------------------
/assets/cube.obj:
--------------------------------------------------------------------------------
1 | v -1 -1 -1
2 | v -1 -1 1
3 | v -1 1 -1
4 | v -1 1 1
5 | v 1 -1 -1
6 | v 1 -1 1
7 | v 1 1 -1
8 | v 1 1 1
9 |
10 | vt 0 0
11 | vt 1 0
12 | vt 1 1
13 | vt 0 1
14 |
15 | vn -1 0 0
16 | vn 1 0 0
17 | vn 0 -1 0
18 | vn 0 1 0
19 | vn 0 0 -1
20 | vn 0 0 1
21 |
22 | f 1/1/1 2/2/1 4/3/1 3/4/1
23 | f 5/1/2 7/2/2 8/3/2 6/4/2
24 | f 1/1/3 5/2/3 6/3/3 2/4/3
25 | f 3/1/4 4/2/4 8/3/4 7/4/4
26 | f 1/1/5 3/2/5 7/3/5 5/4/5
27 | f 2/1/6 6/2/6 8/3/6 4/4/6
28 |
--------------------------------------------------------------------------------
/assets/simple.glsl:
--------------------------------------------------------------------------------
1 | layout(binding = 0) uniform PerObject
2 | {
3 | mat4 u_model;
4 | mat4 u_modelIT;
5 | vec3 u_emissive;
6 | vec3 u_diffuse;
7 | };
8 |
9 | #ifdef VERT_SHADER
10 | layout(location = 0) in vec3 v_position;
11 | layout(location = 1) in vec3 v_normal;
12 | out vec3 position;
13 | out vec3 normal;
14 | void main()
15 | {
16 | vec4 worldPos = u_model * vec4(v_position, 1);
17 | gl_Position = u_viewProj * worldPos;
18 | position = worldPos.xyz;
19 | normal = normalize((u_modelIT * vec4(v_normal,0)).xyz);
20 | }
21 | #endif
22 |
23 | #ifdef FRAG_SHADER
24 | in vec3 position;
25 | in vec3 normal;
26 | void main()
27 | {
28 | vec3 eyeDir = normalize(u_eye - position);
29 | vec3 light = u_emissive;
30 | for(int i=0; i<8; ++i)
31 | {
32 | vec3 lightDir = normalize(u_lights[i].position - position);
33 | light += u_lights[i].color * u_diffuse * max(dot(normal, lightDir), 0);
34 |
35 | vec3 halfDir = normalize(lightDir + eyeDir);
36 | light += u_lights[i].color * u_diffuse * pow(max(dot(normal, halfDir), 0), 128);
37 | }
38 | gl_FragColor = vec4(light,1);
39 | }
40 | #endif
41 |
--------------------------------------------------------------------------------
/assets/test.scene:
--------------------------------------------------------------------------------
1 | {
2 | "objects": [
3 | {
4 | "name": "Ground",
5 | "pose": [
6 | [0,0,-0.1],
7 | [0,0,0,1]
8 | ],
9 | "scale": [4,4,0.1],
10 | "diffuse": [0.4,0.4,0.4],
11 | "mesh": "cube",
12 | "prog": "simple"
13 | },
14 | {
15 | "name": "Red Box",
16 | "pose": [
17 | [-0.6,0,0.5],
18 | [0,0,0,1]
19 | ],
20 | "scale": [0.5,0.5,0.5],
21 | "diffuse": [1,0,0],
22 | "mesh": "cube",
23 | "prog": "simple"
24 | },
25 | {
26 | "name": "Green Box",
27 | "pose": [
28 | [0.6,0,0.5],
29 | [0,0,0,1]
30 | ],
31 | "scale": [0.5,0.5,0.5],
32 | "diffuse": [0,1,0],
33 | "mesh": "cube",
34 | "prog": "simple"
35 | },
36 | {
37 | "name": "Teapot",
38 | "pose": [
39 | [0,0,1],
40 | [0,0,0,1]
41 | ],
42 | "scale": [0.25,0.25,0.25],
43 | "diffuse": [1,1,0],
44 | "mesh": "teapot",
45 | "prog": "simple"
46 | },
47 | {
48 | "name": "Light",
49 | "pose": [
50 | [0,-1,3],
51 | [0,0,0,1]
52 | ],
53 | "scale": [0.1,0.1,0.1],
54 | "diffuse": [0,0,0],
55 | "mesh": "cube",
56 | "prog": "simple",
57 | "light": {
58 | "color": [1,1,1]
59 | }
60 | }
61 | ]
62 | }
--------------------------------------------------------------------------------
/assets/white.glsl:
--------------------------------------------------------------------------------
1 | layout(binding = 0) uniform PerObject
2 | {
3 | mat4 u_model;
4 | };
5 |
6 | #ifdef VERT_SHADER
7 | layout(location = 0) in vec3 v_position;
8 | void main()
9 | {
10 | gl_Position = u_viewProj * u_model * vec4(v_position, 1);
11 | }
12 | #endif
13 |
14 | #ifdef FRAG_SHADER
15 | void main()
16 | {
17 | gl_FragColor = vec4(1,1,1,1);
18 | }
19 | #endif
20 |
--------------------------------------------------------------------------------
/dep/include/GLFW/glfw3native.h:
--------------------------------------------------------------------------------
1 | /*************************************************************************
2 | * GLFW 3.1 - www.glfw.org
3 | * A library for OpenGL, window and input
4 | *------------------------------------------------------------------------
5 | * Copyright (c) 2002-2006 Marcus Geelnard
6 | * Copyright (c) 2006-2010 Camilla Berglund
7 | *
8 | * This software is provided 'as-is', without any express or implied
9 | * warranty. In no event will the authors be held liable for any damages
10 | * arising from the use of this software.
11 | *
12 | * Permission is granted to anyone to use this software for any purpose,
13 | * including commercial applications, and to alter it and redistribute it
14 | * freely, subject to the following restrictions:
15 | *
16 | * 1. The origin of this software must not be misrepresented; you must not
17 | * claim that you wrote the original software. If you use this software
18 | * in a product, an acknowledgment in the product documentation would
19 | * be appreciated but is not required.
20 | *
21 | * 2. Altered source versions must be plainly marked as such, and must not
22 | * be misrepresented as being the original software.
23 | *
24 | * 3. This notice may not be removed or altered from any source
25 | * distribution.
26 | *
27 | *************************************************************************/
28 |
29 | #ifndef _glfw3_native_h_
30 | #define _glfw3_native_h_
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 |
37 | /*************************************************************************
38 | * Doxygen documentation
39 | *************************************************************************/
40 |
41 | /*! @defgroup native Native access
42 | *
43 | * **By using the native API, you assert that you know what you're doing and
44 | * how to fix problems caused by using it. If you don't, you shouldn't be
45 | * using it.**
46 | *
47 | * Before the inclusion of @ref glfw3native.h, you must define exactly one
48 | * window system API macro and exactly one context creation API macro. Failure
49 | * to do this will cause a compile-time error.
50 | *
51 | * The available window API macros are:
52 | * * `GLFW_EXPOSE_NATIVE_WIN32`
53 | * * `GLFW_EXPOSE_NATIVE_COCOA`
54 | * * `GLFW_EXPOSE_NATIVE_X11`
55 | *
56 | * The available context API macros are:
57 | * * `GLFW_EXPOSE_NATIVE_WGL`
58 | * * `GLFW_EXPOSE_NATIVE_NSGL`
59 | * * `GLFW_EXPOSE_NATIVE_GLX`
60 | * * `GLFW_EXPOSE_NATIVE_EGL`
61 | *
62 | * These macros select which of the native access functions that are declared
63 | * and which platform-specific headers to include. It is then up your (by
64 | * definition platform-specific) code to handle which of these should be
65 | * defined.
66 | */
67 |
68 |
69 | /*************************************************************************
70 | * System headers and types
71 | *************************************************************************/
72 |
73 | #if defined(GLFW_EXPOSE_NATIVE_WIN32)
74 | // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
75 | // example to allow applications to correctly declare a GL_ARB_debug_output
76 | // callback) but windows.h assumes no one will define APIENTRY before it does
77 | #undef APIENTRY
78 | #include
79 | #elif defined(GLFW_EXPOSE_NATIVE_COCOA)
80 | #include
81 | #if defined(__OBJC__)
82 | #import
83 | #else
84 | typedef void* id;
85 | #endif
86 | #elif defined(GLFW_EXPOSE_NATIVE_X11)
87 | #include
88 | #include
89 | #else
90 | #error "No window API specified"
91 | #endif
92 |
93 | #if defined(GLFW_EXPOSE_NATIVE_WGL)
94 | /* WGL is declared by windows.h */
95 | #elif defined(GLFW_EXPOSE_NATIVE_NSGL)
96 | /* NSGL is declared by Cocoa.h */
97 | #elif defined(GLFW_EXPOSE_NATIVE_GLX)
98 | #include
99 | #elif defined(GLFW_EXPOSE_NATIVE_EGL)
100 | #include
101 | #else
102 | #error "No context API specified"
103 | #endif
104 |
105 |
106 | /*************************************************************************
107 | * Functions
108 | *************************************************************************/
109 |
110 | #if defined(GLFW_EXPOSE_NATIVE_WIN32)
111 | /*! @brief Returns the adapter device name of the specified monitor.
112 | *
113 | * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
114 | * of the specified monitor, or `NULL` if an [error](@ref error_handling)
115 | * occurred.
116 | *
117 | * @par Thread Safety
118 | * This function may be called from any thread. Access is not synchronized.
119 | *
120 | * @par History
121 | * Added in GLFW 3.1.
122 | *
123 | * @ingroup native
124 | */
125 | GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
126 |
127 | /*! @brief Returns the display device name of the specified monitor.
128 | *
129 | * @return The UTF-8 encoded display device name (for example
130 | * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
131 | * [error](@ref error_handling) occurred.
132 | *
133 | * @par Thread Safety
134 | * This function may be called from any thread. Access is not synchronized.
135 | *
136 | * @par History
137 | * Added in GLFW 3.1.
138 | *
139 | * @ingroup native
140 | */
141 | GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
142 |
143 | /*! @brief Returns the `HWND` of the specified window.
144 | *
145 | * @return The `HWND` of the specified window, or `NULL` if an
146 | * [error](@ref error_handling) occurred.
147 | *
148 | * @par Thread Safety
149 | * This function may be called from any thread. Access is not synchronized.
150 | *
151 | * @par History
152 | * Added in GLFW 3.0.
153 | *
154 | * @ingroup native
155 | */
156 | GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
157 | #endif
158 |
159 | #if defined(GLFW_EXPOSE_NATIVE_WGL)
160 | /*! @brief Returns the `HGLRC` of the specified window.
161 | *
162 | * @return The `HGLRC` of the specified window, or `NULL` if an
163 | * [error](@ref error_handling) occurred.
164 | *
165 | * @par Thread Safety
166 | * This function may be called from any thread. Access is not synchronized.
167 | *
168 | * @par History
169 | * Added in GLFW 3.0.
170 | *
171 | * @ingroup native
172 | */
173 | GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
174 | #endif
175 |
176 | #if defined(GLFW_EXPOSE_NATIVE_COCOA)
177 | /*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
178 | *
179 | * @return The `CGDirectDisplayID` of the specified monitor, or
180 | * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
181 | *
182 | * @par Thread Safety
183 | * This function may be called from any thread. Access is not synchronized.
184 | *
185 | * @par History
186 | * Added in GLFW 3.1.
187 | *
188 | * @ingroup native
189 | */
190 | GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
191 |
192 | /*! @brief Returns the `NSWindow` of the specified window.
193 | *
194 | * @return The `NSWindow` of the specified window, or `nil` if an
195 | * [error](@ref error_handling) occurred.
196 | *
197 | * @par Thread Safety
198 | * This function may be called from any thread. Access is not synchronized.
199 | *
200 | * @par History
201 | * Added in GLFW 3.0.
202 | *
203 | * @ingroup native
204 | */
205 | GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
206 | #endif
207 |
208 | #if defined(GLFW_EXPOSE_NATIVE_NSGL)
209 | /*! @brief Returns the `NSOpenGLContext` of the specified window.
210 | *
211 | * @return The `NSOpenGLContext` of the specified window, or `nil` if an
212 | * [error](@ref error_handling) occurred.
213 | *
214 | * @par Thread Safety
215 | * This function may be called from any thread. Access is not synchronized.
216 | *
217 | * @par History
218 | * Added in GLFW 3.0.
219 | *
220 | * @ingroup native
221 | */
222 | GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
223 | #endif
224 |
225 | #if defined(GLFW_EXPOSE_NATIVE_X11)
226 | /*! @brief Returns the `Display` used by GLFW.
227 | *
228 | * @return The `Display` used by GLFW, or `NULL` if an
229 | * [error](@ref error_handling) occurred.
230 | *
231 | * @par Thread Safety
232 | * This function may be called from any thread. Access is not synchronized.
233 | *
234 | * @par History
235 | * Added in GLFW 3.0.
236 | *
237 | * @ingroup native
238 | */
239 | GLFWAPI Display* glfwGetX11Display(void);
240 |
241 | /*! @brief Returns the `RRCrtc` of the specified monitor.
242 | *
243 | * @return The `RRCrtc` of the specified monitor, or `None` if an
244 | * [error](@ref error_handling) occurred.
245 | *
246 | * @par Thread Safety
247 | * This function may be called from any thread. Access is not synchronized.
248 | *
249 | * @par History
250 | * Added in GLFW 3.1.
251 | *
252 | * @ingroup native
253 | */
254 | GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
255 |
256 | /*! @brief Returns the `RROutput` of the specified monitor.
257 | *
258 | * @return The `RROutput` of the specified monitor, or `None` if an
259 | * [error](@ref error_handling) occurred.
260 | *
261 | * @par Thread Safety
262 | * This function may be called from any thread. Access is not synchronized.
263 | *
264 | * @par History
265 | * Added in GLFW 3.1.
266 | *
267 | * @ingroup native
268 | */
269 | GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
270 |
271 | /*! @brief Returns the `Window` of the specified window.
272 | *
273 | * @return The `Window` of the specified window, or `None` if an
274 | * [error](@ref error_handling) occurred.
275 | *
276 | * @par Thread Safety
277 | * This function may be called from any thread. Access is not synchronized.
278 | *
279 | * @par History
280 | * Added in GLFW 3.0.
281 | *
282 | * @ingroup native
283 | */
284 | GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
285 | #endif
286 |
287 | #if defined(GLFW_EXPOSE_NATIVE_GLX)
288 | /*! @brief Returns the `GLXContext` of the specified window.
289 | *
290 | * @return The `GLXContext` of the specified window, or `NULL` if an
291 | * [error](@ref error_handling) occurred.
292 | *
293 | * @par Thread Safety
294 | * This function may be called from any thread. Access is not synchronized.
295 | *
296 | * @par History
297 | * Added in GLFW 3.0.
298 | *
299 | * @ingroup native
300 | */
301 | GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
302 | #endif
303 |
304 | #if defined(GLFW_EXPOSE_NATIVE_EGL)
305 | /*! @brief Returns the `EGLDisplay` used by GLFW.
306 | *
307 | * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
308 | * [error](@ref error_handling) occurred.
309 | *
310 | * @par Thread Safety
311 | * This function may be called from any thread. Access is not synchronized.
312 | *
313 | * @par History
314 | * Added in GLFW 3.0.
315 | *
316 | * @ingroup native
317 | */
318 | GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
319 |
320 | /*! @brief Returns the `EGLContext` of the specified window.
321 | *
322 | * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
323 | * [error](@ref error_handling) occurred.
324 | *
325 | * @par Thread Safety
326 | * This function may be called from any thread. Access is not synchronized.
327 | *
328 | * @par History
329 | * Added in GLFW 3.0.
330 | *
331 | * @ingroup native
332 | */
333 | GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
334 |
335 | /*! @brief Returns the `EGLSurface` of the specified window.
336 | *
337 | * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
338 | * [error](@ref error_handling) occurred.
339 | *
340 | * @par Thread Safety
341 | * This function may be called from any thread. Access is not synchronized.
342 | *
343 | * @par History
344 | * Added in GLFW 3.0.
345 | *
346 | * @ingroup native
347 | */
348 | GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
349 | #endif
350 |
351 | #ifdef __cplusplus
352 | }
353 | #endif
354 |
355 | #endif /* _glfw3_native_h_ */
356 |
357 |
--------------------------------------------------------------------------------
/dep/include/nanovg.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Mikko Mononen memon@inside.org
3 | //
4 | // This software is provided 'as-is', without any express or implied
5 | // warranty. In no event will the authors be held liable for any damages
6 | // arising from the use of this software.
7 | // Permission is granted to anyone to use this software for any purpose,
8 | // including commercial applications, and to alter it and redistribute it
9 | // freely, subject to the following restrictions:
10 | // 1. The origin of this software must not be misrepresented; you must not
11 | // claim that you wrote the original software. If you use this software
12 | // in a product, an acknowledgment in the product documentation would be
13 | // appreciated but is not required.
14 | // 2. Altered source versions must be plainly marked as such, and must not be
15 | // misrepresented as being the original software.
16 | // 3. This notice may not be removed or altered from any source distribution.
17 | //
18 |
19 | #ifndef NANOVG_H
20 | #define NANOVG_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #define NVG_PI 3.14159265358979323846264338327f
27 |
28 | #ifdef _MSC_VER
29 | #pragma warning(push)
30 | #pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
31 | #endif
32 |
33 | typedef struct NVGcontext NVGcontext;
34 |
35 | struct NVGcolor {
36 | union {
37 | float rgba[4];
38 | struct {
39 | float r,g,b,a;
40 | };
41 | };
42 | };
43 | typedef struct NVGcolor NVGcolor;
44 |
45 | struct NVGpaint {
46 | float xform[6];
47 | float extent[2];
48 | float radius;
49 | float feather;
50 | NVGcolor innerColor;
51 | NVGcolor outerColor;
52 | int image;
53 | };
54 | typedef struct NVGpaint NVGpaint;
55 |
56 | enum NVGwinding {
57 | NVG_CCW = 1, // Winding for solid shapes
58 | NVG_CW = 2, // Winding for holes
59 | };
60 |
61 | enum NVGsolidity {
62 | NVG_SOLID = 1, // CCW
63 | NVG_HOLE = 2, // CW
64 | };
65 |
66 | enum NVGlineCap {
67 | NVG_BUTT,
68 | NVG_ROUND,
69 | NVG_SQUARE,
70 | NVG_BEVEL,
71 | NVG_MITER,
72 | };
73 |
74 | enum NVGalign {
75 | // Horizontal align
76 | NVG_ALIGN_LEFT = 1<<0, // Default, align text horizontally to left.
77 | NVG_ALIGN_CENTER = 1<<1, // Align text horizontally to center.
78 | NVG_ALIGN_RIGHT = 1<<2, // Align text horizontally to right.
79 | // Vertical align
80 | NVG_ALIGN_TOP = 1<<3, // Align text vertically to top.
81 | NVG_ALIGN_MIDDLE = 1<<4, // Align text vertically to middle.
82 | NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
83 | NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
84 | };
85 |
86 | struct NVGglyphPosition {
87 | const char* str; // Position of the glyph in the input string.
88 | float x; // The x-coordinate of the logical glyph position.
89 | float minx, maxx; // The bounds of the glyph shape.
90 | };
91 | typedef struct NVGglyphPosition NVGglyphPosition;
92 |
93 | struct NVGtextRow {
94 | const char* start; // Pointer to the input text where the row starts.
95 | const char* end; // Pointer to the input text where the row ends (one past the last character).
96 | const char* next; // Pointer to the beginning of the next row.
97 | float width; // Logical width of the row.
98 | float minx, maxx; // Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
99 | };
100 | typedef struct NVGtextRow NVGtextRow;
101 |
102 | enum NVGimageFlags {
103 | NVG_IMAGE_GENERATE_MIPMAPS = 1<<0, // Generate mipmaps during creation of the image.
104 | NVG_IMAGE_REPEATX = 1<<1, // Repeat image in X direction.
105 | NVG_IMAGE_REPEATY = 1<<2, // Repeat image in Y direction.
106 | NVG_IMAGE_FLIPY = 1<<3, // Flips (inverses) image in Y direction when rendered.
107 | NVG_IMAGE_PREMULTIPLIED = 1<<4, // Image data has premultiplied alpha.
108 | };
109 |
110 | // Begin drawing a new frame
111 | // Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame()
112 | // nvgBeginFrame() defines the size of the window to render to in relation currently
113 | // set viewport (i.e. glViewport on GL backends). Device pixel ration allows to
114 | // control the rendering on Hi-DPI devices.
115 | // For example, GLFW returns two dimension for an opened window: window size and
116 | // frame buffer size. In that case you would set windowWidth/Height to the window size
117 | // devicePixelRatio to: frameBufferWidth / windowWidth.
118 | void nvgBeginFrame(NVGcontext* ctx, int windowWidth, int windowHeight, float devicePixelRatio);
119 |
120 | // Cancels drawing the current frame.
121 | void nvgCancelFrame(NVGcontext* ctx);
122 |
123 | // Ends drawing flushing remaining render state.
124 | void nvgEndFrame(NVGcontext* ctx);
125 |
126 | //
127 | // Color utils
128 | //
129 | // Colors in NanoVG are stored as unsigned ints in ABGR format.
130 |
131 | // Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).
132 | NVGcolor nvgRGB(unsigned char r, unsigned char g, unsigned char b);
133 |
134 | // Returns a color value from red, green, blue values. Alpha will be set to 1.0f.
135 | NVGcolor nvgRGBf(float r, float g, float b);
136 |
137 |
138 | // Returns a color value from red, green, blue and alpha values.
139 | NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
140 |
141 | // Returns a color value from red, green, blue and alpha values.
142 | NVGcolor nvgRGBAf(float r, float g, float b, float a);
143 |
144 |
145 | // Linearly interpoaltes from color c0 to c1, and returns resulting color value.
146 | NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u);
147 |
148 | // Sets transparency of a color value.
149 | NVGcolor nvgTransRGBA(NVGcolor c0, unsigned char a);
150 |
151 | // Sets transparency of a color value.
152 | NVGcolor nvgTransRGBAf(NVGcolor c0, float a);
153 |
154 | // Returns color value specified by hue, saturation and lightness.
155 | // HSL values are all in range [0..1], alpha will be set to 255.
156 | NVGcolor nvgHSL(float h, float s, float l);
157 |
158 | // Returns color value specified by hue, saturation and lightness and alpha.
159 | // HSL values are all in range [0..1], alpha in range [0..255]
160 | NVGcolor nvgHSLA(float h, float s, float l, unsigned char a);
161 |
162 | //
163 | // State Handling
164 | //
165 | // NanoVG contains state which represents how paths will be rendered.
166 | // The state contains transform, fill and stroke styles, text and font styles,
167 | // and scissor clipping.
168 |
169 | // Pushes and saves the current render state into a state stack.
170 | // A matching nvgRestore() must be used to restore the state.
171 | void nvgSave(NVGcontext* ctx);
172 |
173 | // Pops and restores current render state.
174 | void nvgRestore(NVGcontext* ctx);
175 |
176 | // Resets current render state to default values. Does not affect the render state stack.
177 | void nvgReset(NVGcontext* ctx);
178 |
179 | //
180 | // Render styles
181 | //
182 | // Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern.
183 | // Solid color is simply defined as a color value, different kinds of paints can be created
184 | // using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
185 | //
186 | // Current render style can be saved and restored using nvgSave() and nvgRestore().
187 |
188 | // Sets current stroke style to a solid color.
189 | void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
190 |
191 | // Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
192 | void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint);
193 |
194 | // Sets current fill cstyle to a solid color.
195 | void nvgFillColor(NVGcontext* ctx, NVGcolor color);
196 |
197 | // Sets current fill style to a paint, which can be a one of the gradients or a pattern.
198 | void nvgFillPaint(NVGcontext* ctx, NVGpaint paint);
199 |
200 | // Sets the miter limit of the stroke style.
201 | // Miter limit controls when a sharp corner is beveled.
202 | void nvgMiterLimit(NVGcontext* ctx, float limit);
203 |
204 | // Sets the stroke witdth of the stroke style.
205 | void nvgStrokeWidth(NVGcontext* ctx, float size);
206 |
207 | // Sets how the end of the line (cap) is drawn,
208 | // Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE.
209 | void nvgLineCap(NVGcontext* ctx, int cap);
210 |
211 | // Sets how sharp path corners are drawn.
212 | // Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL.
213 | void nvgLineJoin(NVGcontext* ctx, int join);
214 |
215 | // Sets the transparency applied to all rendered shapes.
216 | // Alreade transparent paths will get proportionally more transparent as well.
217 | void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
218 |
219 | //
220 | // Transforms
221 | //
222 | // The paths, gradients, patterns and scissor region are transformed by an transformation
223 | // matrix at the time when they are passed to the API.
224 | // The current transformation matrix is a affine matrix:
225 | // [sx kx tx]
226 | // [ky sy ty]
227 | // [ 0 0 1]
228 | // Where: sx,sy define scaling, kx,ky skewing, and tx,ty translation.
229 | // The last row is assumed to be 0,0,1 and is not stored.
230 | //
231 | // Apart from nvgResetTransform(), each transformation function first creates
232 | // specific transformation matrix and pre-multiplies the current transformation by it.
233 | //
234 | // Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
235 |
236 | // Resets current transform to a identity matrix.
237 | void nvgResetTransform(NVGcontext* ctx);
238 |
239 | // Premultiplies current coordinate system by specified matrix.
240 | // The parameters are interpreted as matrix as follows:
241 | // [a c e]
242 | // [b d f]
243 | // [0 0 1]
244 | void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f);
245 |
246 | // Translates current coordinate system.
247 | void nvgTranslate(NVGcontext* ctx, float x, float y);
248 |
249 | // Rotates current coordinate system. Angle is specifid in radians.
250 | void nvgRotate(NVGcontext* ctx, float angle);
251 |
252 | // Skews the current coordinate system along X axis. Angle is specifid in radians.
253 | void nvgSkewX(NVGcontext* ctx, float angle);
254 |
255 | // Skews the current coordinate system along Y axis. Angle is specifid in radians.
256 | void nvgSkewY(NVGcontext* ctx, float angle);
257 |
258 | // Scales the current coordinat system.
259 | void nvgScale(NVGcontext* ctx, float x, float y);
260 |
261 | // Stores the top part (a-f) of the current transformation matrix in to the specified buffer.
262 | // [a c e]
263 | // [b d f]
264 | // [0 0 1]
265 | // There should be space for 6 floats in the return buffer for the values a-f.
266 | void nvgCurrentTransform(NVGcontext* ctx, float* xform);
267 |
268 |
269 | // The following functions can be used to make calculations on 2x3 transformation matrices.
270 | // A 2x3 matrix is representated as float[6].
271 |
272 | // Sets the transform to identity matrix.
273 | void nvgTransformIdentity(float* dst);
274 |
275 | // Sets the transform to translation matrix matrix.
276 | void nvgTransformTranslate(float* dst, float tx, float ty);
277 |
278 | // Sets the transform to scale matrix.
279 | void nvgTransformScale(float* dst, float sx, float sy);
280 |
281 | // Sets the transform to rotate matrix. Angle is specifid in radians.
282 | void nvgTransformRotate(float* dst, float a);
283 |
284 | // Sets the transform to skew-x matrix. Angle is specifid in radians.
285 | void nvgTransformSkewX(float* dst, float a);
286 |
287 | // Sets the transform to skew-y matrix. Angle is specifid in radians.
288 | void nvgTransformSkewY(float* dst, float a);
289 |
290 | // Sets the transform to the result of multiplication of two transforms, of A = A*B.
291 | void nvgTransformMultiply(float* dst, const float* src);
292 |
293 | // Sets the transform to the result of multiplication of two transforms, of A = B*A.
294 | void nvgTransformPremultiply(float* dst, const float* src);
295 |
296 | // Sets the destination to inverse of specified transform.
297 | // Returns 1 if the inverse could be calculated, else 0.
298 | int nvgTransformInverse(float* dst, const float* src);
299 |
300 | // Transform a point by given transform.
301 | void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy);
302 |
303 | // Converts degress to radians and vice versa.
304 | float nvgDegToRad(float deg);
305 | float nvgRadToDeg(float rad);
306 |
307 | //
308 | // Images
309 | //
310 | // NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
311 | // In addition you can upload your own image. The image loading is provided by stb_image.
312 | // The parameter imageFlags is combination of flags defined in NVGimageFlags.
313 |
314 | // Creates image by loading it from the disk from specified file name.
315 | // Returns handle to the image.
316 | int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags);
317 |
318 | // Creates image by loading it from the specified chunk of memory.
319 | // Returns handle to the image.
320 | int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata);
321 |
322 | // Creates image from specified image data.
323 | // Returns handle to the image.
324 | int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsigned char* data);
325 |
326 | // Updates image data specified by image handle.
327 | void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data);
328 |
329 | // Returns the domensions of a created image.
330 | void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h);
331 |
332 | // Deletes created image.
333 | void nvgDeleteImage(NVGcontext* ctx, int image);
334 |
335 | //
336 | // Paints
337 | //
338 | // NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern.
339 | // These can be used as paints for strokes and fills.
340 |
341 | // Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates
342 | // of the linear gradient, icol specifies the start color and ocol the end color.
343 | // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
344 | NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float ey,
345 | NVGcolor icol, NVGcolor ocol);
346 |
347 | // Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
348 | // drop shadows or hilights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
349 | // (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
350 | // the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
351 | // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
352 | NVGpaint nvgBoxGradient(NVGcontext* ctx, float x, float y, float w, float h,
353 | float r, float f, NVGcolor icol, NVGcolor ocol);
354 |
355 | // Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify
356 | // the inner and outer radius of the gradient, icol specifies the start color and ocol the end color.
357 | // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
358 | NVGpaint nvgRadialGradient(NVGcontext* ctx, float cx, float cy, float inr, float outr,
359 | NVGcolor icol, NVGcolor ocol);
360 |
361 | // Creates and returns an image patter. Parameters (ox,oy) specify the left-top location of the image pattern,
362 | // (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render.
363 | // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
364 | NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey,
365 | float angle, int image, float alpha);
366 |
367 | //
368 | // Scissoring
369 | //
370 | // Scissoring allows you to clip the rendering into a rectangle. This is useful for varius
371 | // user interface cases like rendering a text edit or a timeline.
372 |
373 | // Sets the current scissor rectangle.
374 | // The scissor rectangle is transformed by the current transform.
375 | void nvgScissor(NVGcontext* ctx, float x, float y, float w, float h);
376 |
377 | // Intersects current scissor rectangle with the specified rectangle.
378 | // The scissor rectangle is transformed by the current transform.
379 | // Note: in case the rotation of previous scissor rect differs from
380 | // the current one, the intersection will be done between the specified
381 | // rectangle and the previous scissor rectangle transformed in the current
382 | // transform space. The resulting shape is always rectangle.
383 | void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h);
384 |
385 | // Reset and disables scissoring.
386 | void nvgResetScissor(NVGcontext* ctx);
387 |
388 | //
389 | // Paths
390 | //
391 | // Drawing a new shape starts with nvgBeginPath(), it clears all the currently defined paths.
392 | // Then you define one or more paths and sub-paths which describe the shape. The are functions
393 | // to draw common shapes like rectangles and circles, and lower level step-by-step functions,
394 | // which allow to define a path curve by curve.
395 | //
396 | // NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise
397 | // winding and holes should have counter clockwise order. To specify winding of a path you can
398 | // call nvgPathWinding(). This is useful especially for the common shapes, which are drawn CCW.
399 | //
400 | // Finally you can fill the path using current fill style by calling nvgFill(), and stroke it
401 | // with current stroke style by calling nvgStroke().
402 | //
403 | // The curve segments and sub-paths are transformed by the current transform.
404 |
405 | // Clears the current path and sub-paths.
406 | void nvgBeginPath(NVGcontext* ctx);
407 |
408 | // Starts new sub-path with specified point as first point.
409 | void nvgMoveTo(NVGcontext* ctx, float x, float y);
410 |
411 | // Adds line segment from the last point in the path to the specified point.
412 | void nvgLineTo(NVGcontext* ctx, float x, float y);
413 |
414 | // Adds cubic bezier segment from last point in the path via two control points to the specified point.
415 | void nvgBezierTo(NVGcontext* ctx, float c1x, float c1y, float c2x, float c2y, float x, float y);
416 |
417 | // Adds quadratic bezier segment from last point in the path via a control point to the specified point.
418 | void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y);
419 |
420 | // Adds an arc segment at the corner defined by the last path point, and two specified points.
421 | void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float radius);
422 |
423 | // Closes current sub-path with a line segment.
424 | void nvgClosePath(NVGcontext* ctx);
425 |
426 | // Sets the current sub-path winding, see NVGwinding and NVGsolidity.
427 | void nvgPathWinding(NVGcontext* ctx, int dir);
428 |
429 | // Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
430 | // and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW).
431 | // Angles are specified in radians.
432 | void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir);
433 |
434 | // Creates new rectangle shaped sub-path.
435 | void nvgRect(NVGcontext* ctx, float x, float y, float w, float h);
436 |
437 | // Creates new rounded rectangle shaped sub-path.
438 | void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r);
439 |
440 | // Creates new ellipse shaped sub-path.
441 | void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry);
442 |
443 | // Creates new circle shaped sub-path.
444 | void nvgCircle(NVGcontext* ctx, float cx, float cy, float r);
445 |
446 | // Fills the current path with current fill style.
447 | void nvgFill(NVGcontext* ctx);
448 |
449 | // Fills the current path with current stroke style.
450 | void nvgStroke(NVGcontext* ctx);
451 |
452 |
453 | //
454 | // Text
455 | //
456 | // NanoVG allows you to load .ttf files and use the font to render text.
457 | //
458 | // The appearance of the text can be defined by setting the current text style
459 | // and by specifying the fill color. Common text and font settings such as
460 | // font size, letter spacing and text align are supported. Font blur allows you
461 | // to create simple text effects such as drop shadows.
462 | //
463 | // At render time the font face can be set based on the font handles or name.
464 | //
465 | // Font measure functions return values in local space, the calculations are
466 | // carried in the same resolution as the final rendering. This is done because
467 | // the text glyph positions are snapped to the nearest pixels sharp rendering.
468 | //
469 | // The local space means that values are not rotated or scale as per the current
470 | // transformation. For example if you set font size to 12, which would mean that
471 | // line height is 16, then regardless of the current scaling and rotation, the
472 | // returned line height is always 16. Some measures may vary because of the scaling
473 | // since aforementioned pixel snapping.
474 | //
475 | // While this may sound a little odd, the setup allows you to always render the
476 | // same way regardless of scaling. I.e. following works regardless of scaling:
477 | //
478 | // const char* txt = "Text me up.";
479 | // nvgTextBounds(vg, x,y, txt, NULL, bounds);
480 | // nvgBeginPath(vg);
481 | // nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]);
482 | // nvgFill(vg);
483 | //
484 | // Note: currently only solid color fill is supported for text.
485 |
486 | // Creates font by loading it from the disk from specified file name.
487 | // Returns handle to the font.
488 | int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename);
489 |
490 | // Creates image by loading it from the specified memory chunk.
491 | // Returns handle to the font.
492 | int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData);
493 |
494 | // Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.
495 | int nvgFindFont(NVGcontext* ctx, const char* name);
496 |
497 | // Sets the font size of current text style.
498 | void nvgFontSize(NVGcontext* ctx, float size);
499 |
500 | // Sets the blur of current text style.
501 | void nvgFontBlur(NVGcontext* ctx, float blur);
502 |
503 | // Sets the letter spacing of current text style.
504 | void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
505 |
506 | // Sets the proportional line height of current text style. The line height is specified as multiple of font size.
507 | void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);
508 |
509 | // Sets the text align of current text style, see NVGaling for options.
510 | void nvgTextAlign(NVGcontext* ctx, int align);
511 |
512 | // Sets the font face based on specified id of current text style.
513 | void nvgFontFaceId(NVGcontext* ctx, int font);
514 |
515 | // Sets the font face based on specified name of current text style.
516 | void nvgFontFace(NVGcontext* ctx, const char* font);
517 |
518 | // Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.
519 | float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* end);
520 |
521 | // Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn.
522 | // White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
523 | // Words longer than the max width are slit at nearest character (i.e. no hyphenation).
524 | void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end);
525 |
526 | // Measures the specified text string. Parameter bounds should be a pointer to float[4],
527 | // if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
528 | // Returns the horizontal advance of the measured text (i.e. where the next character should drawn).
529 | // Measured values are returned in local coordinate space.
530 | float nvgTextBounds(NVGcontext* ctx, float x, float y, const char* string, const char* end, float* bounds);
531 |
532 | // Measures the specified multi-text string. Parameter bounds should be a pointer to float[4],
533 | // if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
534 | // Measured values are returned in local coordinate space.
535 | void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds);
536 |
537 | // Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used.
538 | // Measured values are returned in local coordinate space.
539 | int nvgTextGlyphPositions(NVGcontext* ctx, float x, float y, const char* string, const char* end, NVGglyphPosition* positions, int maxPositions);
540 |
541 | // Returns the vertical metrics based on the current text style.
542 | // Measured values are returned in local coordinate space.
543 | void nvgTextMetrics(NVGcontext* ctx, float* ascender, float* descender, float* lineh);
544 |
545 | // Breaks the specified text into lines. If end is specified only the sub-string will be used.
546 | // White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
547 | // Words longer than the max width are slit at nearest character (i.e. no hyphenation).
548 | int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, float breakRowWidth, NVGtextRow* rows, int maxRows);
549 |
550 | //
551 | // Internal Render API
552 | //
553 | enum NVGtexture {
554 | NVG_TEXTURE_ALPHA = 0x01,
555 | NVG_TEXTURE_RGBA = 0x02,
556 | };
557 |
558 | struct NVGscissor {
559 | float xform[6];
560 | float extent[2];
561 | };
562 | typedef struct NVGscissor NVGscissor;
563 |
564 | struct NVGvertex {
565 | float x,y,u,v;
566 | };
567 | typedef struct NVGvertex NVGvertex;
568 |
569 | struct NVGpath {
570 | int first;
571 | int count;
572 | unsigned char closed;
573 | int nbevel;
574 | NVGvertex* fill;
575 | int nfill;
576 | NVGvertex* stroke;
577 | int nstroke;
578 | int winding;
579 | int convex;
580 | };
581 | typedef struct NVGpath NVGpath;
582 |
583 | struct NVGparams {
584 | void* userPtr;
585 | int edgeAntiAlias;
586 | int (*renderCreate)(void* uptr);
587 | int (*renderCreateTexture)(void* uptr, int type, int w, int h, int imageFlags, const unsigned char* data);
588 | int (*renderDeleteTexture)(void* uptr, int image);
589 | int (*renderUpdateTexture)(void* uptr, int image, int x, int y, int w, int h, const unsigned char* data);
590 | int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
591 | void (*renderViewport)(void* uptr, int width, int height);
592 | void (*renderCancel)(void* uptr);
593 | void (*renderFlush)(void* uptr);
594 | void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);
595 | void (*renderStroke)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths);
596 | void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGscissor* scissor, const NVGvertex* verts, int nverts);
597 | void (*renderDelete)(void* uptr);
598 | };
599 | typedef struct NVGparams NVGparams;
600 |
601 | // Contructor and destructor, called by the render back-end.
602 | NVGcontext* nvgCreateInternal(NVGparams* params);
603 | void nvgDeleteInternal(NVGcontext* ctx);
604 |
605 | NVGparams* nvgInternalParams(NVGcontext* ctx);
606 |
607 | // Debug function to dump cached path data.
608 | void nvgDebugDumpPathCache(NVGcontext* ctx);
609 |
610 | #ifdef _MSC_VER
611 | #pragma warning(pop)
612 | #endif
613 |
614 | #define NVG_NOTUSED(v) for (;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); break; }
615 |
616 | #ifdef __cplusplus
617 | }
618 | #endif
619 |
620 | #endif // NANOVG_H
621 |
--------------------------------------------------------------------------------
/dep/include/nanovg_gl_utils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org
3 | //
4 | // This software is provided 'as-is', without any express or implied
5 | // warranty. In no event will the authors be held liable for any damages
6 | // arising from the use of this software.
7 | // Permission is granted to anyone to use this software for any purpose,
8 | // including commercial applications, and to alter it and redistribute it
9 | // freely, subject to the following restrictions:
10 | // 1. The origin of this software must not be misrepresented; you must not
11 | // claim that you wrote the original software. If you use this software
12 | // in a product, an acknowledgment in the product documentation would be
13 | // appreciated but is not required.
14 | // 2. Altered source versions must be plainly marked as such, and must not be
15 | // misrepresented as being the original software.
16 | // 3. This notice may not be removed or altered from any source distribution.
17 | //
18 | #ifndef NANOVG_GL_UTILS_H
19 | #define NANOVG_GL_UTILS_H
20 |
21 | struct NVGLUframebuffer {
22 | NVGcontext* ctx;
23 | GLuint fbo;
24 | GLuint rbo;
25 | GLuint texture;
26 | int image;
27 | };
28 | typedef struct NVGLUframebuffer NVGLUframebuffer;
29 |
30 | // Helper function to create GL frame buffer to render to.
31 | void nvgluBindFramebuffer(NVGLUframebuffer* fb);
32 | NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags);
33 | void nvgluDeleteFramebuffer(NVGcontext* ctx, NVGLUframebuffer* fb);
34 |
35 | #endif // NANOVG_GL_UTILS_H
36 |
37 | #ifdef NANOVG_GL_IMPLEMENTATION
38 |
39 | #if defined(NANOVG_GL3) || defined(NANOVG_GLES2) || defined(NANOVG_GLES3)
40 | // FBO is core in OpenGL 3>.
41 | # define NANOVG_FBO_VALID 1
42 | #elif defined(NANOVG_GL2)
43 | // On OS X including glext defines FBO on GL2 too.
44 | # ifdef __APPLE__
45 | # include
46 | # define NANOVG_FBO_VALID 1
47 | # endif
48 | #endif
49 |
50 | static GLint defaultFBO = -1;
51 |
52 | NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags)
53 | {
54 | #ifdef NANOVG_FBO_VALID
55 | GLint defaultFBO;
56 | GLint defaultRBO;
57 | NVGLUframebuffer* fb = NULL;
58 |
59 | glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
60 | glGetIntegerv(GL_RENDERBUFFER_BINDING, &defaultRBO);
61 |
62 | fb = (NVGLUframebuffer*)malloc(sizeof(NVGLUframebuffer));
63 | if (fb == NULL) goto error;
64 | memset(fb, 0, sizeof(NVGLUframebuffer));
65 |
66 | fb->image = nvgCreateImageRGBA(ctx, w, h, imageFlags | NVG_IMAGE_FLIPY | NVG_IMAGE_PREMULTIPLIED, NULL);
67 | fb->texture = nvglImageHandle(ctx, fb->image);
68 |
69 | // frame buffer object
70 | glGenFramebuffers(1, &fb->fbo);
71 | glBindFramebuffer(GL_FRAMEBUFFER, fb->fbo);
72 |
73 | // render buffer object
74 | glGenRenderbuffers(1, &fb->rbo);
75 | glBindRenderbuffer(GL_RENDERBUFFER, fb->rbo);
76 | glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, w, h);
77 |
78 | // combine all
79 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb->texture, 0);
80 | glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->rbo);
81 |
82 | if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) goto error;
83 |
84 | glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
85 | glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
86 | return fb;
87 | error:
88 | glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
89 | glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
90 | nvgluDeleteFramebuffer(ctx, fb);
91 | return NULL;
92 | #else
93 | NVG_NOTUSED(ctx);
94 | NVG_NOTUSED(w);
95 | NVG_NOTUSED(h);
96 | NVG_NOTUSED(imageFlags);
97 | return NULL;
98 | #endif
99 | }
100 |
101 | void nvgluBindFramebuffer(NVGLUframebuffer* fb)
102 | {
103 | #ifdef NANOVG_FBO_VALID
104 | if (defaultFBO == -1) glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
105 | glBindFramebuffer(GL_FRAMEBUFFER, fb != NULL ? fb->fbo : defaultFBO);
106 | #else
107 | NVG_NOTUSED(fb);
108 | #endif
109 | }
110 |
111 | void nvgluDeleteFramebuffer(NVGcontext* ctx, NVGLUframebuffer* fb)
112 | {
113 | #ifdef NANOVG_FBO_VALID
114 | if (fb == NULL) return;
115 | if (fb->fbo != 0)
116 | glDeleteFramebuffers(1, &fb->fbo);
117 | if (fb->rbo != 0)
118 | glDeleteRenderbuffers(1, &fb->rbo);
119 | if (fb->image >= 0)
120 | nvgDeleteImage(ctx, fb->image);
121 | fb->fbo = 0;
122 | fb->rbo = 0;
123 | fb->texture = 0;
124 | fb->image = -1;
125 | free(fb);
126 | #else
127 | NVG_NOTUSED(ctx);
128 | NVG_NOTUSED(fb);
129 | #endif
130 | }
131 |
132 | #endif // NANOVG_GL_IMPLEMENTATION
133 |
--------------------------------------------------------------------------------
/dep/licenses/GLFW3.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2002-2006 Marcus Geelnard
2 | Copyright (c) 2006-2010 Camilla Berglund
3 |
4 | This software is provided 'as-is', without any express or implied
5 | warranty. In no event will the authors be held liable for any damages
6 | arising from the use of this software.
7 |
8 | Permission is granted to anyone to use this software for any purpose,
9 | including commercial applications, and to alter it and redistribute it
10 | freely, subject to the following restrictions:
11 |
12 | 1. The origin of this software must not be misrepresented; you must not
13 | claim that you wrote the original software. If you use this software
14 | in a product, an acknowledgment in the product documentation would
15 | be appreciated but is not required.
16 |
17 | 2. Altered source versions must be plainly marked as such, and must not
18 | be misrepresented as being the original software.
19 |
20 | 3. This notice may not be removed or altered from any source
21 | distribution.
22 |
23 |
--------------------------------------------------------------------------------
/dep/licenses/NANOVG.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 Mikko Mononen memon@inside.org
2 |
3 | This software is provided 'as-is', without any express or implied
4 | warranty. In no event will the authors be held liable for any damages
5 | arising from the use of this software.
6 |
7 | Permission is granted to anyone to use this software for any purpose,
8 | including commercial applications, and to alter it and redistribute it
9 | freely, subject to the following restrictions:
10 |
11 | 1. The origin of this software must not be misrepresented; you must not
12 | claim that you wrote the original software. If you use this software
13 | in a product, an acknowledgment in the product documentation would be
14 | appreciated but is not required.
15 | 2. Altered source versions must be plainly marked as such, and must not be
16 | misrepresented as being the original software.
17 | 3. This notice may not be removed or altered from any source distribution.
18 |
19 |
--------------------------------------------------------------------------------
/dep/licenses/STB.txt:
--------------------------------------------------------------------------------
1 | These excellent public domain single-header libraries were authored by Sean T. Barrett.
2 |
3 | They are available at http://github.com/nothings/stb
--------------------------------------------------------------------------------
/msvc/.gitignore:
--------------------------------------------------------------------------------
1 | /obj
2 | /ipch
3 | /packages
4 | /*.opensdf
5 | /*.sdf
6 | /*.suo
7 |
--------------------------------------------------------------------------------
/msvc/editor/editor.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 | Release
14 | Win32
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {B2B761F2-9090-4268-A83A-B25AA2D06452}
23 | Win32Proj
24 | Editor
25 |
26 |
27 |
28 | Application
29 | true
30 | v120
31 | Unicode
32 |
33 |
34 | Application
35 | true
36 | v120
37 | Unicode
38 |
39 |
40 | Application
41 | false
42 | v120
43 | true
44 | Unicode
45 |
46 |
47 | Application
48 | false
49 | v120
50 | true
51 | Unicode
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | true
71 | $(SolutionDir)..\bin-$(Platform)\
72 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
73 | $(ProjectName)-d
74 |
75 |
76 | true
77 | $(SolutionDir)..\bin-$(Platform)\
78 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
79 | $(ProjectName)-d
80 |
81 |
82 | false
83 | $(SolutionDir)..\bin-$(Platform)\
84 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
85 |
86 |
87 | false
88 | $(SolutionDir)..\bin-$(Platform)\
89 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
90 |
91 |
92 |
93 |
94 |
95 | Level3
96 | Disabled
97 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
98 | $(SolutionDir)..\src;$(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
99 |
100 |
101 | Console
102 | true
103 | $(SolutionDir)lib-$(Platform);%(AdditionalLibraryDirectories)
104 | glfw3dll.lib;opengl32.lib;%(AdditionalDependencies)
105 |
106 |
107 | XCOPY /Y $(SolutionDir)lib-$(Platform)\*.dll $(OutDir)
108 |
109 |
110 |
111 |
112 |
113 |
114 | Level3
115 | Disabled
116 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
117 | $(SolutionDir)..\src;$(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
118 |
119 |
120 | Console
121 | true
122 | $(SolutionDir)lib-$(Platform);%(AdditionalLibraryDirectories)
123 | glfw3dll.lib;opengl32.lib;%(AdditionalDependencies)
124 |
125 |
126 | XCOPY /Y $(SolutionDir)lib-$(Platform)\*.dll $(OutDir)
127 |
128 |
129 |
130 |
131 | Level3
132 |
133 |
134 | MaxSpeed
135 | true
136 | true
137 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
138 | $(SolutionDir)..\src;$(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
139 |
140 |
141 | Console
142 | true
143 | true
144 | true
145 | $(SolutionDir)lib-$(Platform);%(AdditionalLibraryDirectories)
146 | glfw3dll.lib;opengl32.lib;%(AdditionalDependencies)
147 |
148 |
149 | XCOPY /Y $(SolutionDir)lib-$(Platform)\*.dll $(OutDir)
150 |
151 |
152 |
153 |
154 | Level3
155 |
156 |
157 | MaxSpeed
158 | true
159 | true
160 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
161 | $(SolutionDir)..\src;$(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
162 |
163 |
164 | Console
165 | true
166 | true
167 | true
168 | $(SolutionDir)lib-$(Platform);%(AdditionalLibraryDirectories)
169 | glfw3dll.lib;opengl32.lib;%(AdditionalDependencies)
170 |
171 |
172 | XCOPY /Y $(SolutionDir)lib-$(Platform)\*.dll $(OutDir)
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 | {6b85ff49-f8b2-4703-8cfd-563500856cb8}
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
--------------------------------------------------------------------------------
/msvc/editor/editor.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | gui
8 |
9 |
10 |
11 |
12 | gui
13 |
14 |
15 |
16 |
17 |
18 | gui
19 |
20 |
21 | gui
22 |
23 |
24 |
25 |
26 | gui
27 |
28 |
29 |
30 |
31 |
32 | assets
33 |
34 |
35 | assets
36 |
37 |
38 |
39 |
40 | {7939bdf6-7f5c-43e5-bdef-5a43ee8582bd}
41 |
42 |
43 | {9b04b349-671e-4a37-88e6-63a4c226cc6b}
44 |
45 |
46 |
--------------------------------------------------------------------------------
/msvc/editor/editor.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(OutDir)
5 | WindowsLocalDebugger
6 |
7 |
8 | $(OutDir)
9 | WindowsLocalDebugger
10 |
11 |
12 | $(OutDir)
13 | WindowsLocalDebugger
14 |
15 |
16 | $(OutDir)
17 | WindowsLocalDebugger
18 |
19 |
--------------------------------------------------------------------------------
/msvc/editor/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/msvc/engine/engine.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 | Release
14 | Win32
15 |
16 |
17 | Release
18 | x64
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 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}
55 | Win32Proj
56 | engine
57 |
58 |
59 |
60 | StaticLibrary
61 | true
62 | v120
63 | Unicode
64 |
65 |
66 | StaticLibrary
67 | true
68 | v120
69 | Unicode
70 |
71 |
72 | StaticLibrary
73 | false
74 | v120
75 | true
76 | Unicode
77 |
78 |
79 | StaticLibrary
80 | false
81 | v120
82 | true
83 | Unicode
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
103 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
104 |
105 |
106 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
107 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
108 |
109 |
110 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
111 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
112 |
113 |
114 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
115 | $(SolutionDir)obj\$(ProjectName)\$(Configuration)-$(Platform)\
116 |
117 |
118 |
119 |
120 |
121 | Level3
122 | Disabled
123 | _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
124 | $(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
125 |
126 |
127 | Windows
128 | true
129 |
130 |
131 |
132 |
133 |
134 |
135 | Level3
136 | Disabled
137 | _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
138 | $(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
139 |
140 |
141 | Windows
142 | true
143 |
144 |
145 |
146 |
147 | Level3
148 |
149 |
150 | MaxSpeed
151 | true
152 | true
153 | _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
154 | $(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
155 |
156 |
157 | Windows
158 | true
159 | true
160 | true
161 |
162 |
163 |
164 |
165 | Level3
166 |
167 |
168 | MaxSpeed
169 | true
170 | true
171 | _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
172 | $(SolutionDir)..\dep\include;%(AdditionalIncludeDirectories)
173 |
174 |
175 | Windows
176 | true
177 | true
178 | true
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/msvc/engine/engine.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | include
6 |
7 |
8 | include
9 |
10 |
11 | include
12 |
13 |
14 | include
15 |
16 |
17 | include
18 |
19 |
20 | include
21 |
22 |
23 | include
24 |
25 |
26 | include
27 |
28 |
29 | include
30 |
31 |
32 | include
33 |
34 |
35 | dep
36 |
37 |
38 | dep
39 |
40 |
41 | dep
42 |
43 |
44 | dep
45 |
46 |
47 | dep
48 |
49 |
50 | dep
51 |
52 |
53 |
54 |
55 | dep
56 |
57 |
58 | src
59 |
60 |
61 | src
62 |
63 |
64 | src
65 |
66 |
67 | src
68 |
69 |
70 | src
71 |
72 |
73 | src
74 |
75 |
76 | src
77 |
78 |
79 | src
80 |
81 |
82 |
83 |
84 | {b15a68d0-8a15-42d4-a73c-94aa8fb1687d}
85 |
86 |
87 | {8fe09733-e762-45ea-8873-fa07da7fb7cb}
88 |
89 |
90 | {bdd357ed-33aa-4e7a-ae32-c6f0cdbecd87}
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/msvc/engine/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/msvc/lib-Win32/glfw3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgorsten/editor/7749421e7046255fe9861509658a92385deb57b6/msvc/lib-Win32/glfw3.dll
--------------------------------------------------------------------------------
/msvc/lib-Win32/glfw3dll.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgorsten/editor/7749421e7046255fe9861509658a92385deb57b6/msvc/lib-Win32/glfw3dll.lib
--------------------------------------------------------------------------------
/msvc/lib-x64/glfw3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgorsten/editor/7749421e7046255fe9861509658a92385deb57b6/msvc/lib-x64/glfw3.dll
--------------------------------------------------------------------------------
/msvc/lib-x64/glfw3dll.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sgorsten/editor/7749421e7046255fe9861509658a92385deb57b6/msvc/lib-x64/glfw3dll.lib
--------------------------------------------------------------------------------
/msvc/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/msvc/vs2013.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "editor", "editor\editor.vcxproj", "{B2B761F2-9090-4268-A83A-B25AA2D06452}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine", "engine\engine.vcxproj", "{6B85FF49-F8B2-4703-8CFD-563500856CB8}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Win32 = Debug|Win32
13 | Debug|x64 = Debug|x64
14 | Release|Win32 = Release|Win32
15 | Release|x64 = Release|x64
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Debug|Win32.ActiveCfg = Debug|Win32
19 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Debug|Win32.Build.0 = Debug|Win32
20 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Debug|x64.ActiveCfg = Debug|x64
21 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Debug|x64.Build.0 = Debug|x64
22 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Release|Win32.ActiveCfg = Release|Win32
23 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Release|Win32.Build.0 = Release|Win32
24 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Release|x64.ActiveCfg = Release|x64
25 | {B2B761F2-9090-4268-A83A-B25AA2D06452}.Release|x64.Build.0 = Release|x64
26 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Debug|Win32.ActiveCfg = Debug|Win32
27 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Debug|Win32.Build.0 = Debug|Win32
28 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Debug|x64.ActiveCfg = Debug|x64
29 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Debug|x64.Build.0 = Debug|x64
30 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Release|Win32.ActiveCfg = Release|Win32
31 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Release|Win32.Build.0 = Release|Win32
32 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Release|x64.ActiveCfg = Release|x64
33 | {6B85FF49-F8B2-4703-8CFD-563500856CB8}.Release|x64.Build.0 = Release|x64
34 | EndGlobalSection
35 | GlobalSection(SolutionProperties) = preSolution
36 | HideSolutionNode = FALSE
37 | EndGlobalSection
38 | EndGlobal
39 |
--------------------------------------------------------------------------------
/src/editor/editor.cpp:
--------------------------------------------------------------------------------
1 | #include "editor.h"
2 |
3 | ///////////////
4 | // Selection //
5 | ///////////////
6 |
7 | Selection::Selection() {}
8 |
9 | void Selection::Deselect()
10 | {
11 | object.reset();
12 | if(onSelectionChanged) onSelectionChanged();
13 | }
14 |
15 | void Selection::SetSelection(std::shared_ptr