| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #pragma once
- #include "../submitter.h"
- #include <QMatrix4x4>
- #include <QVector3D>
- #include <functional>
- #include <memory>
- #include <string>
- #include <unordered_map>
- namespace Engine::Core {
- class Entity;
- class World;
- } // namespace Engine::Core
- namespace Render::GL {
- class ResourceManager;
- class Mesh;
- class Texture;
- class Backend;
- class Camera;
- } // namespace Render::GL
- namespace Render::GL {
- enum class HumanoidLOD : uint8_t {
- Full = 0,
- Reduced = 1,
- Minimal = 2,
- Billboard = 3
- };
- enum class HorseLOD : uint8_t {
- Full = 0,
- Reduced = 1,
- Minimal = 2,
- Billboard = 3
- };
- struct DrawContext {
- ResourceManager *resources = nullptr;
- Engine::Core::Entity *entity = nullptr;
- Engine::Core::World *world = nullptr;
- QMatrix4x4 model;
- bool selected = false;
- bool hovered = false;
- float animation_time = 0.0F;
- std::string renderer_id;
- class Backend *backend = nullptr;
- const Camera *camera = nullptr;
- float alpha_multiplier = 1.0F;
- bool animation_throttled = false;
- };
- using RenderFunc = std::function<void(const DrawContext &, ISubmitter &out)>;
- class EntityRendererRegistry {
- public:
- void register_renderer(const std::string &type, RenderFunc func);
- auto get(const std::string &type) const -> RenderFunc;
- private:
- std::unordered_map<std::string, RenderFunc> m_map;
- };
- void register_built_in_entity_renderers(EntityRendererRegistry ®istry);
- } // namespace Render::GL
|