29struct SCORE_PLUGIN_GFX_EXPORT
Mesh
37 HasPosition = SCORE_FLAG(1),
38 HasTexCoord = SCORE_FLAG(2),
39 HasColor = SCORE_FLAG(3),
40 HasNormals = SCORE_FLAG(4),
41 HasTangents = SCORE_FLAG(5),
43 using Flags = QFlags<Flag>;
45 [[nodiscard]]
virtual Flags flags()
const noexcept = 0;
47 [[nodiscard]]
virtual MeshBuffers init(QRhi& rhi)
const noexcept = 0;
50 update(QRhi& rhi,
MeshBuffers& bufs, QRhiResourceUpdateBatch& cb)
const noexcept
52 virtual void preparePipeline(QRhiGraphicsPipeline& pip)
const noexcept = 0;
53 virtual void draw(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept = 0;
58 ossia::geometry_filter_list_ptr filters;
60 std::atomic_int64_t dirtyGeometryIndex{-1};
62 bool hasGeometryChanged(int64_t& renderer)
const noexcept
64 int64_t res = dirtyGeometryIndex.load(std::memory_order_acquire);
77 Mesh(
const Mesh&) =
delete;
78 Mesh(Mesh&&) =
delete;
79 Mesh& operator=(
const Mesh&) =
delete;
80 Mesh& operator=(Mesh&&) =
delete;
88 [[nodiscard]]
virtual MeshBuffers init(QRhi& rhi)
const noexcept override;
90 QRhi& rhi,
MeshBuffers& bufs, QRhiResourceUpdateBatch& cb)
const noexcept override;
91 void preparePipeline(QRhiGraphicsPipeline& pip)
const noexcept override;
92 void draw(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept override;
94 setupBindings(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept = 0;
96 using pip = QRhiGraphicsPipeline;
97 pip::Topology topology = pip::Topology::TriangleStrip;
98 pip::CullMode cullMode = pip::CullMode::None;
99 pip::FrontFace frontFace = pip::FrontFace::CW;
101 ossia::small_vector<QRhiVertexInputBinding, 2> vertexBindings;
102 ossia::small_vector<QRhiVertexInputAttribute, 2> vertexAttributes;
104 std::span<const float> vertexArray;
185 static const constexpr float data[] = {
186 -1, -1, +1, -1, -1, +1, +1, +1,
188 0, 0, 1, 0, 0, 1, 1, 1};
190 static const constexpr float flipped_y_data[] = {
191 -1, -1, +1, -1, -1, +1, +1, +1,
193 0, 1, 1, 1, 0, 0, 1, 0};
198 setupBindings(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept override;
A mesh with positions and texture coordinates.
Definition Mesh.hpp:136
A quad mesh with positions and texture coordinates.
Definition Mesh.hpp:184
A triangle mesh with positions and texture coordinates.
Definition Mesh.hpp:163