6#ifndef MATERIALX_IMAGEHANDLER_H
7#define MATERIALX_IMAGEHANDLER_H
22extern MX_RENDER_API
const string IMAGE_PROPERTY_SEPARATOR;
23extern MX_RENDER_API
const string UADDRESS_MODE_SUFFIX;
24extern MX_RENDER_API
const string VADDRESS_MODE_SUFFIX;
25extern MX_RENDER_API
const string FILTER_TYPE_SUFFIX;
26extern MX_RENDER_API
const string DEFAULT_COLOR_SUFFIX;
39using ImageLoaderMap = std::unordered_map< string, std::vector<ImageLoaderPtr> >;
50 void setProperties(
const string& fileNameUniform,
83 bool enableMipmaps =
true;
87 Color4 defaultColor = { 0.0f, 0.0f, 0.0f, 1.0f };
102 static const string EXR_EXTENSION;
103 static const string GIF_EXTENSION;
104 static const string HDR_EXTENSION;
105 static const string JPG_EXTENSION;
106 static const string JPEG_EXTENSION;
107 static const string PIC_EXTENSION;
108 static const string PNG_EXTENSION;
109 static const string PSD_EXTENSION;
110 static const string TGA_EXTENSION;
111 static const string TIF_EXTENSION;
112 static const string TIFF_EXTENSION;
113 static const string TXT_EXTENSION;
114 static const string TX_EXTENSION;
115 static const string TXR_EXTENSION;
129 virtual bool saveImage(
const FilePath& filePath,
131 bool verticalFlip =
false);
185 virtual bool unbindImage(
ImagePtr image);
205 _resolver = resolver;
215 virtual bool createRenderResources(
ImagePtr image,
bool generateMipMaps);
219 virtual void releaseRenderResources(
ImagePtr image =
nullptr);
225 releaseRenderResources();
239 return _invalidImage;
254 void cacheImage(
const string& filePath,
ImagePtr image);
The top-level Document class.
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:23
shared_ptr< StringResolver > StringResolverPtr
A shared pointer to a StringResolver.
Definition: Element.h:61
Cross-platform support for file and search paths.
shared_ptr< const Image > ConstImagePtr
A shared pointer to a const image.
Definition: Image.h:27
std::vector< ImagePtr > ImageVec
A vetor of images.
Definition: Image.h:33
std::unordered_map< string, ImagePtr > ImageMap
A map from strings to images.
Definition: Image.h:30
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:24
std::shared_ptr< ImageLoader > ImageLoaderPtr
Shared pointer to an ImageLoader.
Definition: ImageHandler.h:36
std::shared_ptr< ImageHandler > ImageHandlerPtr
Shared pointer to an ImageHandler.
Definition: ImageHandler.h:33
std::unordered_map< string, std::vector< ImageLoaderPtr > > ImageLoaderMap
Map from strings to vectors of image loaders.
Definition: ImageHandler.h:39
std::set< string > StringSet
A set of strings.
Definition: Library.h:60
Macros for declaring imported and exported symbols.
A four-component color value.
Definition: Types.h:389
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:28
A sequence of file paths, which may be queried to find the first instance of a given filename on the ...
Definition: File.h:213
Base image handler class.
Definition: ImageHandler.h:149
void clearImageCache()
Clear the contents of the image cache, first releasing any render resources associated with cached im...
Definition: ImageHandler.h:223
const FileSearchPath & getSearchPath() const
Return the image search path.
Definition: ImageHandler.h:197
StringResolverPtr getFilenameResolver() const
Return the filename resolver for images.
Definition: ImageHandler.h:209
void setSearchPath(const FileSearchPath &path)
Set the search path to be used for finding images on the file system.
Definition: ImageHandler.h:191
ImagePtr getInvalidImage() const
Return the sentinel invalid image, representing images that cannot be loaded and should be replaced w...
Definition: ImageHandler.h:237
ImagePtr getZeroImage() const
Return a fallback image with zeroes in all channels.
Definition: ImageHandler.h:230
void setFilenameResolver(StringResolverPtr resolver)
Set the filename resolver for images.
Definition: ImageHandler.h:203
Abstract base class for file-system image loaders.
Definition: ImageHandler.h:93
const StringSet & supportedExtensions() const
Returns a list of supported extensions.
Definition: ImageHandler.h:119
static const string BMP_EXTENSION
Standard image file extensions.
Definition: ImageHandler.h:101
Interface to describe sampling properties for images.
Definition: ImageHandler.h:44
FilterType
Filter type options.
Definition: ImageHandler.h:72
AddressMode
Address mode options.
Definition: ImageHandler.h:56
A block of variables in a shader stage.
Definition: ShaderStage.h:53