22struct SCORE_PLUGIN_GFX_EXPORT
Mesh
30 HasPosition = SCORE_FLAG(1),
31 HasTexCoord = SCORE_FLAG(2),
32 HasColor = SCORE_FLAG(3),
33 HasNormals = SCORE_FLAG(4),
34 HasTangents = SCORE_FLAG(5),
36 using Flags = QFlags<Flag>;
38 [[nodiscard]]
virtual Flags flags()
const noexcept = 0;
40 [[nodiscard]]
virtual MeshBuffers init(QRhi& rhi)
const noexcept = 0;
42 virtual void update(
MeshBuffers& bufs, QRhiResourceUpdateBatch& cb)
const noexcept = 0;
43 virtual void preparePipeline(QRhiGraphicsPipeline& pip)
const noexcept = 0;
44 virtual void draw(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept = 0;
49 ossia::geometry_filter_list_ptr filters;
51 std::atomic_int64_t dirtyGeometryIndex{-1};
53 bool hasGeometryChanged(int64_t& renderer)
const noexcept
55 int64_t res = dirtyGeometryIndex.load(std::memory_order_acquire);
68 Mesh(
const Mesh&) =
delete;
69 Mesh(Mesh&&) =
delete;
70 Mesh& operator=(
const Mesh&) =
delete;
71 Mesh& operator=(Mesh&&) =
delete;
79 [[nodiscard]]
virtual MeshBuffers init(QRhi& rhi)
const noexcept override;
80 void update(
MeshBuffers& bufs, QRhiResourceUpdateBatch& cb)
const noexcept override;
81 void preparePipeline(QRhiGraphicsPipeline& pip)
const noexcept override;
82 void draw(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept override;
84 setupBindings(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept = 0;
86 using pip = QRhiGraphicsPipeline;
87 pip::Topology topology = pip::Topology::TriangleStrip;
88 pip::CullMode cullMode = pip::CullMode::None;
89 pip::FrontFace frontFace = pip::FrontFace::CW;
91 ossia::small_vector<QRhiVertexInputBinding, 2> vertexBindings;
92 ossia::small_vector<QRhiVertexInputAttribute, 2> vertexAttributes;
94 tcb::span<const float> vertexArray;
163 static const constexpr float data[] = {
164 -1, -1, +1, -1, -1, +1, +1, +1,
166 0, 0, 1, 0, 0, 1, 1, 1};
168 static const constexpr float flipped_y_data[] = {
169 -1, -1, +1, -1, -1, +1, +1, +1,
171 0, 1, 1, 1, 0, 0, 1, 0};
176 setupBindings(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept override;
A mesh with positions and texture coordinates.
Definition Mesh.hpp:114
A quad mesh with positions and texture coordinates.
Definition Mesh.hpp:162
A triangle mesh with positions and texture coordinates.
Definition Mesh.hpp:141