Loading...
Searching...
No Matches
ModelDisplayNode.hpp
1#pragma once
2
3#include <Gfx/Graph/Node.hpp>
4
5#include <score_plugin_threedim_export.h>
6
7#include <QFont>
8#include <QPen>
9
10#include <array>
11#include <memory>
12
13// clang-format off
14#if defined(_MSC_VER)
15#if !defined(WIN32_LEAN_AND_MEAN)
16#define WIN32_LEAN_AND_MEAN
17#endif
18#if !defined(NOMINMAX)
19#define NOMINMAX
20#endif
21#if !defined(UNICODE)
22#define UNICODE 1
23#endif
24#if !defined(_UNICODE)
25#define _UNICODE 1
26#endif
27#include <windows.h>
28#include <winsock2.h>
29#include <ws2tcpip.h>
30#include <inaddr.h>
31#include <in6addr.h>
32#include <mswsock.h>
33#endif
34
35#if defined(near)
36#undef near
37#undef far
38#endif
39// clang-format on
40
41namespace score::gfx
42{
43class ModelSceneDrawer;
44
48struct SCORE_PLUGIN_THREEDIM_TEST_EXPORT ModelDisplayNode : NodeModel
49{
50public:
51 explicit ModelDisplayNode();
52 virtual ~ModelDisplayNode();
53
55
56 void process(Message&& msg) override;
58 virtual void processControl(int32_t port, const ossia::value& v);
59 void process(int32_t port, const ossia::transform3d& v) override;
62 virtual bool fitBounds(const ossia::aabb& box) { return false; }
65 virtual std::unique_ptr<ModelSceneDrawer> createSceneDrawer() const;
66 class Renderer;
68
69 ossia::vec3f position, center;
71 ossia::vec3f up{0.f, 1.f, 0.f};
72 float fov{90.f}, near{0.001f}, far{1000.f};
73
74 int texture_projection{};
75 int draw_mode{};
76 int camera_mode{};
77 int blend_color_src{};
78 int blend_color_dst{};
79 int blend_color_op{};
80 int blend_alpha_src{};
81 int blend_alpha_dst{};
82 int blend_alpha_op{};
83 bool blend_enabled{};
86 int fallback_pattern{};
88 bool prefer_vertex_colors{};
90 int64_t fit_request{};
91
93 struct Guides
94 {
97 std::array<float, 4> top{}, bottom{};
99 bool plane{};
102 bool axes{};
103 ossia::vec3f origin{};
105 float spacing{1.f};
106
107 bool operator==(const Guides&) const noexcept = default;
108 bool any() const noexcept { return top[3] > 0.f || bottom[3] > 0.f || plane || axes; }
109 } guides;
110};
111
112}
Common base class for most single-pass, simple nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:329
Renderer for a given node.
Definition NodeRenderer.hpp:11
List of nodes to be rendered to an output.
Definition RenderList.hpp:36
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:60
UBO shared across all entities shown with the same camera.
Definition CommonUBOs.hpp:53
Drawn with the model, for viewers.
Definition ModelDisplayNode.hpp:94
A node that renders a model to screen.
Definition ModelDisplayNode.hpp:49
void process(Message &&msg) override
Process a message from the execution engine.
score::gfx::NodeRenderer * createRenderer(RenderList &r) const noexcept override
Create a renderer in a given context for this node.
virtual bool fitBounds(const ossia::aabb &box)
Definition ModelDisplayNode.hpp:62
virtual std::unique_ptr< ModelSceneDrawer > createSceneDrawer() const
virtual void processControl(int32_t port, const ossia::value &v)
A value arriving on input port port.