Helper function to create and register in renderer custom textures.
To function properly TextureClass should have method declared as static TextureClass *Create(IReleasableListener*, NativeGraphicsClass*, IRenderer*, bool)
and this function should be made a friend of TextureClass.
The first argument should be set in TextureClass constructor as release listener. It is recommended that TextureClass be derived from IReleasable/CReleasable for this purpose.
The second argument will be the native graphics class used by renderer and thus should be named by NativeGraphicsClass.
If TextureClass::Create() fails it should return nullptr.
CreateTexture() function return nullptr if "renderer" argument is missing, or renderer's native graphics isn't an instance of NativeGraphicsClass, or TextureClass::Create() returns nullptr.
In case of using with custom renderers the function should be made a friend of that renderer in order to have access to its protected methods.
template<class TextureClass, class RendererClass, class NativeGraphicsClass>
ITexture *CreateTexture(RendererClass *renderer, const bool precomputed);
Namespace: | nitisa |
Include: | Nitisa/Interfaces/IRenderer.h |