Helper function to create and register in renderer custom vertex arrays.
To function properly VertexArrayClass should have method declared as static VertexArrayClass *Create(IReleasableListener*, NativeGraphicsClass*) and this function should be made a friend of VertexArrayClass.
The first argument should be set in VertexArrayClass constructor as release listener. It is recommended that VertexArrayClass 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 VertexArrayClass::Create() fails it should return nullptr.
CreateVertexArray() function return nullptr if "renderer" argument is missing, or renderer's native graphics isn't an instance of NativeGraphicsClass, or VertexArrayClass::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 VertexArrayClass, class RendererClass, class NativeGraphicsClass>
IVertexArray *CreateVertexArray(RendererClass *renderer);
Namespace: | nitisa |
Include: | Nitisa/Interfaces/IRenderer.h |