vkmEngine 1.0.0
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 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.

Detailed Description

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

Asset thumbnails, GPU mirrors of textures, and the host chrome's images - none of which a shipped game asks for. Here, not in the editor, because the backend implements it. A backend opts in by inheriting this and overriding RenderBackend::editorHooks().

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.

◆ 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.

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