MayaFlux 1.0.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,
int  desired_channels = 4,
std::optional< Kakshya::Region >  region = std::nullopt 
)
static

Load image directly into GPU texture (static utility)

Parameters
pathImage file path
desired_channelsForce channel count (0 = keep original, 4 = RGBA)
regionOptional source-pixel rectangle with inclusive end coordinates
Returns
Initialized VKImage or nullptr on failure

Definition at line 652 of file ImageReader.cpp.

655{
656 auto image_data = load(path, desired_channels, std::move(region));
657 if (!image_data) {
658 return nullptr;
659 }
660
662 auto texture = mgr.create_2d(
663 image_data->width,
664 image_data->height,
665 image_data->format,
666 image_data->data());
667
668 if (texture) {
670 "Created GPU texture from image: {}", path);
671 }
672
673 return texture;
674}
#define MF_INFO(comp, ctx,...)
static std::optional< ImageData > load(const std::string &path, int desired_channels=4, std::optional< Kakshya::Region > region=std::nullopt)
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(), and MF_INFO.

Referenced by MayaFlux::IO::Detail::make_default_resolver().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: