- Add complete BgfxRenderer module structure (24 files) - RHI abstraction layer (no bgfx:: exposed outside BgfxDevice.cpp) - Frame system with lock-free allocator - RenderGraph with ClearPass, SpritePass, DebugPass - SceneCollector for IIO message parsing (render:* topics) - ResourceCache with thread-safe texture/shader caching - Full IModule integration (config via IDataNode, comm via IIO) - CMake with FetchContent for bgfx - Windows build script (build_renderer.bat) - Documentation (README.md, USER_GUIDE.md, PLAN_BGFX_RENDERER.md) - Updated .gitignore for Windows builds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include "../Frame/FramePacket.h"
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
namespace grove {
|
|
|
|
class IIO;
|
|
class IDataNode;
|
|
class FrameAllocator;
|
|
|
|
// ============================================================================
|
|
// Scene Collector - Gathers render data from IIO messages
|
|
// ============================================================================
|
|
|
|
class SceneCollector {
|
|
public:
|
|
SceneCollector() = default;
|
|
|
|
// Configure IIO subscriptions (called in setConfiguration)
|
|
void setup(IIO* io);
|
|
|
|
// Collect all IIO messages at frame start (called in process)
|
|
// Pull-based: module controls when to read messages
|
|
void collect(IIO* io, float deltaTime);
|
|
|
|
// Generate immutable FramePacket for render passes
|
|
FramePacket finalize(FrameAllocator& allocator);
|
|
|
|
// Reset for next frame
|
|
void clear();
|
|
|
|
private:
|
|
// Staging buffers (filled during collect, copied to FramePacket in finalize)
|
|
std::vector<SpriteInstance> m_sprites;
|
|
std::vector<TilemapChunk> m_tilemaps;
|
|
std::vector<TextCommand> m_texts;
|
|
std::vector<ParticleInstance> m_particles;
|
|
std::vector<DebugLine> m_debugLines;
|
|
std::vector<DebugRect> m_debugRects;
|
|
|
|
// View state
|
|
ViewInfo m_mainView;
|
|
uint32_t m_clearColor = 0x303030FF;
|
|
uint64_t m_frameNumber = 0;
|
|
float m_deltaTime = 0.0f;
|
|
|
|
// Message parsing helpers
|
|
void parseSprite(const IDataNode& data);
|
|
void parseSpriteBatch(const IDataNode& data);
|
|
void parseTilemap(const IDataNode& data);
|
|
void parseText(const IDataNode& data);
|
|
void parseParticle(const IDataNode& data);
|
|
void parseCamera(const IDataNode& data);
|
|
void parseClear(const IDataNode& data);
|
|
void parseDebugLine(const IDataNode& data);
|
|
void parseDebugRect(const IDataNode& data);
|
|
|
|
// Initialize default view
|
|
void initDefaultView(uint16_t width, uint16_t height);
|
|
};
|
|
|
|
} // namespace grove
|