vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::EditorRenderHooks Class Referenceabstract

What a backend may offer an authoring tool beyond drawing the frame. More...

#include <editor_render_hooks.h>

Public Member Functions

virtual GpuTextureId renderPreview (const PreviewRequest &request, const ResourceManager &resources)=0
 Draw request offscreen and return the texture to display.
virtual uint64_t previewLook () const =0
 A digest of what a preview borrows from the scene: its light and grade.
virtual GpuTextureId previewTexture (uint64_t key) const =0
 The texture last rendered for key, without rendering one.
virtual void releasePreview (uint64_t key)=0
 Drop the cached target held for key.
virtual void releaseAllPreviews ()=0
 Drop every cached preview target.
virtual GpuTextureId textureId (const TextureHandle &handle) const =0
 GPU texture id already mirrored for handle, or 0 if none is.
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 chromeImage (const std::string &path)=0
 Upload an image the engine owns and return its texture id.
virtual void initImGui (GLFWwindow *window)=0
 Start ImGui's renderer on window, and the platform half that has to know it.
virtual void beginImGuiFrame ()=0
 Begin the renderer's half of an ImGui frame, before the platform's and ImGui's own.
virtual void renderImGui (ImDrawData *data)=0
 Draw ImGui's finished frame into the window.
virtual void shutdownImGui ()=0
 Stop the renderer and the platform half initImGui() started.

Detailed Description

What a backend may offer an authoring tool beyond drawing the frame.

Asset thumbnails, GPU mirrors of textures, the host chrome's images and the renderer of the editor's own ImGui - none of which a shipped game asks for. Here, not in the editor, because the backend implements it. A backend offers it by inheriting this and returning itself from RenderBackend::editorHooks() (null offers none); the editor will not start without it.

Member Function Documentation

◆ renderPreview()

virtual GpuTextureId Vkm::Engine::EditorRenderHooks::renderPreview ( const PreviewRequest & request,
const ResourceManager & resources )
pure virtual

Draw request offscreen and return the texture to display.

Parameters
requestWhat to draw.
resourcesResolves the request's handles.
Returns
The rendered preview, or 0 when it could not draw one.

◆ previewLook()

virtual uint64_t Vkm::Engine::EditorRenderHooks::previewLook ( ) const
pure virtual

A digest of what a preview borrows from the scene: its light and grade.

A preview drawn under another digest is stale, though its asset is not.

Returns
The digest; it changes when the light, sky strength, tonemap or exposure does.

◆ previewTexture()

virtual GpuTextureId Vkm::Engine::EditorRenderHooks::previewTexture ( uint64_t key) const
pure virtual

The texture last rendered for key, without rendering one.

Parameters
keyThe request key.
Returns
That preview, or 0 if there is none.

◆ releasePreview()

virtual void Vkm::Engine::EditorRenderHooks::releasePreview ( uint64_t key)
pure virtual

Drop the cached target held for key.

Parameters
keyAn unknown key is a no-op.

◆ releaseAllPreviews()

virtual void Vkm::Engine::EditorRenderHooks::releaseAllPreviews ( )
pure virtual

Drop every cached preview target.

For when the asset graph is replaced and a handle-derived key means another asset.

◆ textureId()

virtual GpuTextureId Vkm::Engine::EditorRenderHooks::textureId ( const TextureHandle & handle) const
pure virtual

GPU texture id already mirrored for handle, or 0 if none is.

Never uploads. A texture is mirrored when a material binding it draws, so 0 may mean "nothing has drawn it", which never resolves alone.

Parameters
handleAn empty handle answers 0.
Returns
The mirror, or 0.

◆ ensureTexture()

virtual GpuTextureId Vkm::Engine::EditorRenderHooks::ensureTexture ( const TextureHandle & handle,
const ResourceManager & resources )
pure virtual

Mirror handle onto the GPU if it is not already, and return it.

Idempotent and version-gated; the first call per texture pays a full upload, so a caller showing many should spread them over frames.

Parameters
handleAn empty handle answers 0.
resourcesResolves the handle to its pixels.
Returns
The mirror, or 0 when the asset has no pixels yet (failed or in-flight decode).

◆ chromeImage()

virtual GpuTextureId Vkm::Engine::EditorRenderHooks::chromeImage ( const std::string & path)
pure virtual

Upload an image the engine owns and return its texture id.

For host chrome, which is not a project asset and must not go through the ResourceManager. Cached by path. Pixels are bottom-up: a drawer with top-left UVs flips them.

Parameters
pathAbsolute path to an image on disk.
Returns
Its id, or 0 when it could not be decoded.

◆ initImGui()

virtual void Vkm::Engine::EditorRenderHooks::initImGui ( GLFWwindow * window)
pure virtual

Start ImGui's renderer on window, and the platform half that has to know it.

GLFW's ImGui backend is started for a graphics API, so it starts here with the renderer. The host draws ImGui after the scene, into the same window. Pairs with shutdownImGui().

Parameters
windowThe window the editor draws into.

◆ renderImGui()

virtual void Vkm::Engine::EditorRenderHooks::renderImGui ( ImDrawData * data)
pure virtual

Draw ImGui's finished frame into the window.

Parameters
dataImGui::GetDrawData() after ImGui::Render().

The documentation for this class was generated from the following file: