6#include "core/reflect.h"
8#include "resource/asset/mesh_asset.h"
9#include "resource/asset/material_asset.h"
10#include "system/render/render_backend.h"
15namespace Vkm::Engine {
22enum class PreviewBackground : uint8_t {
39 MaterialHandle material;
41 float pitchDeg = 20.0f;
43 PreviewBackground background = PreviewBackground::Dark;
53using GpuTextureId = uint64_t;
64class EditorRenderHooks {
66 EditorRenderHooks() =
default;
67 virtual ~EditorRenderHooks() =
default;
69 EditorRenderHooks(
const EditorRenderHooks& other) =
delete;
70 EditorRenderHooks& operator=(
const EditorRenderHooks& other) =
delete;
72 EditorRenderHooks(EditorRenderHooks && other) =
delete;
73 EditorRenderHooks& operator=(EditorRenderHooks && other) =
delete;
128 virtual GpuTextureId
textureId(
const TextureHandle& handle)
const = 0;
190VKM_ENUM_NAMES(::Vkm::Engine::PreviewBackground,
"Dark",
"Grey",
"Sky")
What a backend may offer an authoring tool beyond drawing the frame.
Definition editor_render_hooks.h:64
virtual void releaseAllPreviews()=0
Drop every cached preview target.
virtual void initImGui(GLFWwindow *window)=0
Start ImGui's renderer on window, and the platform half that has to know it.
virtual GpuTextureId previewTexture(uint64_t key) const =0
The texture last rendered for key, without rendering one.
virtual GpuTextureId ensureTexture(const TextureHandle &handle, const ResourceManager &resources)=0
Mirror handle onto the GPU if it is not already, and return it.
virtual GpuTextureId textureId(const TextureHandle &handle) const =0
GPU texture id already mirrored for handle, or 0 if none is.
virtual GpuTextureId chromeImage(const std::string &path)=0
Upload an image the engine owns and return its texture id.
virtual void releasePreview(uint64_t key)=0
Drop the cached target held for key.
virtual void shutdownImGui()=0
Stop the renderer and the platform half initImGui() started.
virtual uint64_t previewLook() const =0
A digest of what a preview borrows from the scene: its light and grade.
virtual void renderImGui(ImDrawData *data)=0
Draw ImGui's finished frame into the window.
virtual void beginImGuiFrame()=0
Begin the renderer's half of an ImGui frame, before the platform's and ImGui's own.
virtual GpuTextureId renderPreview(const PreviewRequest &request, const ResourceManager &resources)=0
Draw request offscreen and return the texture to display.
The frame's seam between the engine and the graphics API.
Definition render_backend.h:39
virtual EditorRenderHooks * editorHooks()=0
The backend's authoring-only hooks, or null when it offers none.
Type-erased resource registry with typed handles and generational lifetimes.
Definition resource_manager.h:46
One editor preview: a mesh with a material under the scene's light, from an orbit camera.
Definition editor_render_hooks.h:35
float distance
In mesh bounding radii.
Definition editor_render_hooks.h:42
uint32_t size
Square edge, pixels.
Definition editor_render_hooks.h:37
float lightYawDeg
The light's rotation around Y, degrees.
Definition editor_render_hooks.h:44
uint64_t key
Identifies the cached target.
Definition editor_render_hooks.h:36