2#include <Gfx/Graph/NodeRenderer.hpp>
4#include <ossia/dataflow/geometry_port.hpp>
34 virtual bool setScene(
const ossia::scene_spec& scene) = 0;
36 virtual bool active() const noexcept = 0;
38 virtual const ossia::aabb&
bounds() const noexcept = 0;
42 RenderList& renderer, QRhiResourceUpdateBatch& res, PassMap& passes,
43 QRhiBuffer* processUBO, QRhiBuffer* cameraUBO, const
ModelSceneView& view)
45 virtual
void draw(
RenderList& renderer, QRhiCommandBuffer& cb,
Edge& edge) = 0;
52 QRhiGraphicsPipeline* lines, QRhiShaderResourceBindings* srb)
64 ossia::aabb box{{1.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}};
65 using attribute = ossia::geometry::attribute;
66 const attribute* attr{};
67 for(
const auto& a : g.attributes)
68 if(a.semantic == ossia::attribute_semantic::position)
74 for(
const auto& a : g.attributes)
80 if(!attr || (attr->format != attribute::float3 && attr->format != attribute::float4)
81 || attr->binding < 0 || attr->binding >= int(g.input.size())
82 || attr->binding >= int(g.bindings.size()))
84 const auto& in = g.input[attr->binding];
85 if(in.buffer < 0 || in.buffer >=
int(g.buffers.size()))
87 const auto* cpu = ossia::get_if<ossia::geometry::cpu_buffer>(&g.buffers[in.buffer].data);
88 if(!cpu || !cpu->raw_data)
90 const int64_t element = attr->format == attribute::float3 ? 12 : 16;
91 const int64_t stride = g.bindings[attr->binding].byte_stride > 0
92 ? g.bindings[attr->binding].byte_stride
94 const int64_t first = in.byte_offset + attr->byte_offset;
95 const auto* bytes =
static_cast<const char*
>(cpu->raw_data.get());
96 for(int64_t i = 0; i < g.vertices; i++)
98 const int64_t at = first + i * stride;
99 if(at < 0 || at + 12 > cpu->byte_size)
102 std::memcpy(p, bytes + at,
sizeof(p));
103 box.expand(p[0], p[1], p[2]);
Definition ModelSceneDrawer.hpp:29
virtual void update(RenderList &renderer, QRhiResourceUpdateBatch &res, PassMap &passes, QRhiBuffer *processUBO, QRhiBuffer *cameraUBO, const ModelSceneView &view)=0
Once the passes of the renderer exist for the frame.
virtual bool hasLines() const noexcept=0
Whether there are lines to draw with the guides.
virtual bool setScene(const ossia::scene_spec &scene)=0
The scene the renderer received; returns whether it is another one.
virtual bool active() const noexcept=0
Whether it draws the scene rather than the renderer its first geometry.
virtual const ossia::aabb & bounds() const noexcept=0
The bounds of what is drawn, in the space of the scene.
virtual void drawLines(RenderList &renderer, QRhiCommandBuffer &cb, Edge &edge, QRhiGraphicsPipeline *lines, QRhiShaderResourceBindings *srb)=0
With the line pipeline of the guides: world-space positions and colours.
List of nodes to be rendered to an output.
Definition RenderList.hpp:36
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
ossia::aabb geometryPositionBounds(const ossia::geometry &g) noexcept
Definition ModelSceneDrawer.hpp:62
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:236
What a frame of a Model Display shows its scene with.
Definition ModelSceneDrawer.hpp:15
bool changed
Raised whenever one of the above changed.
Definition ModelSceneDrawer.hpp:21
QMatrix4x4 model
The model matrix of the node, applied over the transforms of the scene.
Definition ModelSceneDrawer.hpp:17
Definition Uniforms.hpp:8