MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ load_texture()

std::shared_ptr< Core::VKImage > MayaFlux::IO::ImageReader::load_texture ( const std::string &  path)
static

Load image directly into GPU texture (static utility)

Parameters
pathImage file path
Returns
Initialized VKImage or nullptr on failure

Definition at line 637 of file ImageReader.cpp.

638{
639 auto image_data = load(resolve_path(path), 4);
640 if (!image_data) {
641 return nullptr;
642 }
643
645 auto texture = mgr.create_2d(
646 image_data->width,
647 image_data->height,
648 image_data->format,
649 image_data->data());
650
651 if (texture) {
653 "Created GPU texture from image: {}", path);
654 }
655
656 return texture;
657}
#define MF_INFO(comp, ctx,...)
static std::string resolve_path(const std::string &filepath)
Resolve a filepath against the project source root if not found as-is.
static std::optional< ImageData > load(const std::string &path, int desired_channels=4)
Load image from file (static utility)
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.
MAYAFLUX_API TextureLoom & get_texture_manager()
Get the global texture manager instance.

References MayaFlux::Journal::FileIO, MayaFlux::Portal::Graphics::get_texture_manager(), MayaFlux::Journal::IO, load(), MF_INFO, and MayaFlux::IO::FileReader::resolve_path().

+ Here is the call graph for this function: