A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
#pragma once
#include "BatchPlugin.hpp"
#include "../../resource/TextureMetadata.hpp"
namespace esengine {
class SpritePlugin : public BatchPlugin {
public:
// A Sprite parented into a UI tree is laid out and ordered by that tree
// (UIRenderOrderSystem assigns it a layer), so it is screen content when the
// tree is — and has to be drawn by the pass that owns those coordinates.
bool drawsScreenUI() const override { return true; }
void collect(RenderCollectContext& ctx) override;
const char* collectScope() const override { return "render.collect.sprite"; }
private:
// Sprite-only: tiling repeats the texture across the quad. UI has no tiled variant,
// so this stays here rather than in BatchPlugin. Emits one quad per tile via appendQuad.
void emitTiledQuads(
TransientBufferPool& buffers, DrawList& draw_list, const ClipState& clips,
const glm::vec3& position, const glm::vec2& size, const glm::vec2& pivot,
f32 angle, const glm::vec4& color,
const glm::vec2& uvOffset, const glm::vec2& uvScale,
const glm::vec2& tileSize, const glm::vec2& tileSpacing,
const BatchDrawKey& key
);
};
} // namespace esengine