45struct SCORE_PLUGIN_GFX_EXPORT
Mesh
53 HasPosition = SCORE_FLAG(1),
54 HasTexCoord = SCORE_FLAG(2),
55 HasColor = SCORE_FLAG(3),
56 HasNormals = SCORE_FLAG(4),
57 HasTangents = SCORE_FLAG(5),
59 using Flags = QFlags<Flag>;
61 [[nodiscard]]
virtual Flags flags()
const noexcept = 0;
63 [[nodiscard]]
virtual MeshBuffers init(QRhi& rhi)
const noexcept = 0;
66 update(QRhi& rhi,
MeshBuffers& bufs, QRhiResourceUpdateBatch& cb)
const noexcept
68 virtual void preparePipeline(QRhiGraphicsPipeline& pip)
const noexcept = 0;
69 virtual void draw(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept = 0;
80 virtual const ossia::
geometry* semanticGeometry() const noexcept {
return nullptr; }
82 ossia::geometry_filter_list_ptr filters;
84 std::atomic_int64_t dirtyGeometryIndex{-1};
86 bool hasGeometryChanged(int64_t& renderer)
const noexcept
88 int64_t res = dirtyGeometryIndex.load(std::memory_order_acquire);
101 Mesh(
const Mesh&) =
delete;
102 Mesh(Mesh&&) =
delete;
103 Mesh& operator=(
const Mesh&) =
delete;
104 Mesh& operator=(Mesh&&) =
delete;
112 [[nodiscard]]
virtual MeshBuffers init(QRhi& rhi)
const noexcept override;
114 QRhi& rhi,
MeshBuffers& bufs, QRhiResourceUpdateBatch& cb)
const noexcept override;
115 void preparePipeline(QRhiGraphicsPipeline& pip)
const noexcept override;
116 void draw(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept override;
118 setupBindings(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept = 0;
120 using pip = QRhiGraphicsPipeline;
121 pip::Topology topology = pip::Topology::TriangleStrip;
122 pip::CullMode cullMode = pip::CullMode::None;
123 pip::FrontFace frontFace = pip::FrontFace::CW;
125 ossia::small_vector<QRhiVertexInputBinding, 2> vertexBindings;
126 ossia::small_vector<QRhiVertexInputAttribute, 2> vertexAttributes;
128 std::span<const float> vertexArray;
209 static const constexpr float data[] = {
210 -1, -1, +1, -1, -1, +1, +1, +1,
212 0, 0, 1, 0, 0, 1, 1, 1};
214 static const constexpr float flipped_y_data[] = {
215 -1, -1, +1, -1, -1, +1, +1, +1,
217 0, 1, 1, 1, 0, 0, 1, 0};
222 setupBindings(
const MeshBuffers& bufs, QRhiCommandBuffer& cb)
const noexcept override;
A mesh with positions and texture coordinates.
Definition Mesh.hpp:160
A quad mesh with positions and texture coordinates.
Definition Mesh.hpp:208
A triangle mesh with positions and texture coordinates.
Definition Mesh.hpp:187