cubos::engine::ShaderBridge class

Bridge for loading shader assets.

Asynchronous loading is disabled for this bridge, as render device calls must be made from the main thread, and they're needed to create shaders.

Base classes

class FileBridge
Abstract bridge type defined to reduce boilerplate code in bridge implementations which open a single file to load and save assets.

Constructors, destructors, conversion operators

ShaderBridge(core::gl::RenderDevice& renderDevice, core::gl::Stage stage)
Constructs a bridge.

Protected functions

auto loadFromFile(Assets& assets, const AnyAsset& handle, cubos::core::memory::Stream& stream) -> bool override
Loads an asset from a file stream.
auto saveToFile(const Assets& assets, const AnyAsset& handle, cubos::core::memory::Stream& stream) -> bool override
Saves an asset to a file stream.

Function documentation

cubos::engine::ShaderBridge::ShaderBridge(core::gl::RenderDevice& renderDevice, core::gl::Stage stage)

Constructs a bridge.

Parameters
renderDevice Render device used to create the shader.
stage Shader stage to create.

bool cubos::engine::ShaderBridge::loadFromFile(Assets& assets, const AnyAsset& handle, cubos::core::memory::Stream& stream) override protected

Loads an asset from a file stream.

Parameters
assets Manager to write into.
handle Handle of the asset being loaded.
stream File stream.
Returns Whether the asset was successfully loaded.

bool cubos::engine::ShaderBridge::saveToFile(const Assets& assets, const AnyAsset& handle, cubos::core::memory::Stream& stream) override protected

Saves an asset to a file stream.

Parameters
assets Manager to read from.
handle Handle of the asset being saved.
stream File stream.
Returns Whether the asset was successfully saved.