Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
SpritePlugin.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
3#pragma once
4
5#include "BatchPlugin.hpp"
7
8#include <vector>
9
10namespace esengine {
11
12class SpritePlugin : public BatchPlugin {
13public:
14 // A Sprite parented into a UI tree is laid out and ordered by that tree
15 // (UIRenderOrderSystem assigns it a layer), so it is screen content when the
16 // tree is — and has to be drawn by the pass that owns those coordinates.
17 bool drawsScreenUI() const override { return true; }
18 void collect(RenderCollectContext& ctx) override;
19 const char* collectScope() const override { return "render.collect.sprite"; }
20
21private:
22 void emitTiledQuads(
23 TransientBufferPool& buffers, DrawList& draw_list, const ClipState& clips,
24 const glm::vec3& position, const glm::vec2& size, const glm::vec2& pivot,
25 f32 angle, const glm::vec4& color,
26 const glm::vec2& uvOffset, const glm::vec2& uvScale,
27 const glm::vec2& tileSize, const glm::vec2& tileSpacing,
28 const BatchDrawKey& key
29 );
30
31 std::vector<BatchVertex> tile_scratch_;
32};
33
34} // namespace esengine
Base class for render-type plugins that emit textured quads into the Batch stream.
Texture metadata structures for nine-slice and other settings.
bool drawsScreenUI() const override
Whether this plugin can draw an entity that lives in a UI tree.
const char * collectScope() const override
What this plugin's collect is called in a frame profile.
void collect(RenderCollectContext &ctx) override
static EstellaContext & ctx()
float f32
32-bit floating point
Definition Types.hpp:59
Non-geometry attributes of a batch draw — everything needed to build the sort key + DrawCommand.