Phase 7 - Text Rendering: - Add BitmapFont with embedded 8x8 CP437 font (ASCII 32-126) - Add TextPass for instanced glyph rendering - Fix SceneCollector::parseText() to copy strings to FrameAllocator Phase 8A - Multi-texture Support: - Add numeric texture ID system in ResourceCache - SpritePass sorts by textureId and batches per texture - Flush batch on texture change for efficient rendering Phase 8B - Tilemap Rendering: - Add TilemapPass for grid-based tile rendering - Support tileData as comma-separated string - Tiles rendered as instanced quads Window Resize: - Handle window resize via process() input - Call bgfx::reset() on size change 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "../RenderGraph/RenderPass.h"
|
|
#include "../RHI/RHITypes.h"
|
|
#include "../Text/BitmapFont.h"
|
|
|
|
namespace grove {
|
|
|
|
// ============================================================================
|
|
// Text Pass - Renders 2D text with instanced quads
|
|
// ============================================================================
|
|
|
|
class TextPass : public RenderPass {
|
|
public:
|
|
/**
|
|
* @brief Construct TextPass with required shader
|
|
* @param shader The shader program to use (sprite shader works)
|
|
*/
|
|
explicit TextPass(rhi::ShaderHandle shader);
|
|
|
|
const char* getName() const override { return "Text"; }
|
|
uint32_t getSortOrder() const override { return 150; } // After sprites, before debug
|
|
std::vector<const char*> getDependencies() const override { return {"Sprites"}; }
|
|
|
|
void setup(rhi::IRHIDevice& device) override;
|
|
void shutdown(rhi::IRHIDevice& device) override;
|
|
void execute(const FramePacket& frame, rhi::IRHIDevice& device, rhi::RHICommandBuffer& cmd) override;
|
|
|
|
/**
|
|
* @brief Get the bitmap font (for external texture loading)
|
|
*/
|
|
BitmapFont& getFont() { return m_font; }
|
|
const BitmapFont& getFont() const { return m_font; }
|
|
|
|
private:
|
|
rhi::ShaderHandle m_shader;
|
|
rhi::BufferHandle m_quadVB;
|
|
rhi::BufferHandle m_quadIB;
|
|
rhi::BufferHandle m_instanceBuffer;
|
|
rhi::UniformHandle m_textureSampler;
|
|
|
|
BitmapFont m_font;
|
|
|
|
// Reusable buffer for glyph instances
|
|
std::vector<SpriteInstance> m_glyphInstances;
|
|
|
|
static constexpr uint32_t MAX_GLYPHS_PER_BATCH = 4096;
|
|
};
|
|
|
|
} // namespace grove
|