1 /*
2  * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3  *           (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
4  *
5  * This file is part of lsp-plugins
6  * Created on: 12 мая 2019 г.
7  *
8  * lsp-plugins is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * any later version.
12  *
13  * lsp-plugins is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with lsp-plugins. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef UI_TK_WIDGETS_3D_LSPCAPTURE3D_H_
23 #define UI_TK_WIDGETS_3D_LSPCAPTURE3D_H_
24 
25 #include <core/3d/raytrace.h>
26 
27 namespace lsp
28 {
29     namespace tk
30     {
31         class LSPCapture3D: public LSPObject3D
32         {
33             public:
34                 static const w_class_t    metadata;
35 
36             protected:
37                 typedef struct v_capture_t: public rt_capture_settings_t
38                 {
39                     bool            bEnabled;
40                 } v_capture_t;
41 
42             protected:
43                 LSPColor        sColor;
44                 LSPColor        sAxisColor;
45 
46                 cstorage<v_capture_t> vItems;
47 
48                 point3d_t       sLines[6];
49 
50             public:
51                 explicit LSPCapture3D(LSPDisplay *dpy);
52                 virtual ~LSPCapture3D();
53 
54                 virtual status_t        init();
55                 virtual void            destroy();
56 
57             public:
color()58                 inline LSPColor            *color()                     { return &sColor;           };
axis_color()59                 inline LSPColor            *axis_color()                { return &sAxisColor;       };
60 
61                 status_t                    get_position(point3d_t *dst, size_t id);
62                 status_t                    get_direction(vector3d_t *dst, size_t id);
63                 status_t                    get_location(ray3d_t *dst, size_t id);
64                 bool                        enabled(size_t id) const;
65                 float                       radius(size_t id) const;
items()66                 inline size_t               items() const               { return vItems.size();     };
67 
68             public:
69                 void clear();
70                 status_t set_items(size_t items);
71                 status_t set_transform(size_t id, const matrix3d_t *matrix);
72                 status_t set_enabled(size_t id, bool enabled);
73                 void set_radius(size_t id, float radius);
74 
75             public:
76                 virtual void render(IR3DBackend *r3d);
77         };
78 
79     } /* namespace tk */
80 } /* namespace lsp */
81 
82 #endif /* UI_TK_WIDGETS_3D_LSPCAPTURE3D_H_ */
83