1 | #if !defined(__PYTHON_H) |
2 | #define __PYTHON_H |
3 | |
4 | #include <nanogui/nanogui.h> |
5 | #include <nanogui/opengl.h> |
6 | |
7 | #include <pybind11/stl.h> |
8 | #include <pybind11/operators.h> |
9 | #include <pybind11/eigen.h> |
10 | #include <pybind11/functional.h> |
11 | #include <nanogui/python.h> |
12 | #include "py_doc.h" |
13 | |
14 | PYBIND11_MAKE_OPAQUE(nanogui::Color) |
15 | |
16 | #define D(...) DOC(nanogui, __VA_ARGS__ ) |
17 | |
18 | #define DECLARE_LAYOUT(Name) \ |
19 | class Py##Name : public Name { \ |
20 | public: \ |
21 | using Name::Name; \ |
22 | NANOGUI_LAYOUT_OVERLOADS(Name); \ |
23 | } |
24 | |
25 | #define DECLARE_WIDGET(Name) \ |
26 | class Py##Name : public Name { \ |
27 | public: \ |
28 | using Name::Name; \ |
29 | NANOGUI_WIDGET_OVERLOADS(Name); \ |
30 | } |
31 | |
32 | #define DECLARE_SCREEN(Name) \ |
33 | class Py##Name : public Name { \ |
34 | public: \ |
35 | using Name::Name; \ |
36 | NANOGUI_WIDGET_OVERLOADS(Name); \ |
37 | NANOGUI_SCREEN_OVERLOADS(Name); \ |
38 | } |
39 | |
40 | namespace py = pybind11; |
41 | using namespace nanogui; |
42 | |
43 | /// Make pybind aware of the ref-counted wrapper type |
44 | PYBIND11_DECLARE_HOLDER_TYPE(T, ref<T>); |
45 | |
46 | #endif /* __PYTHON_H */ |
47 | |
48 | |