LightsprintSDK 2021.08.08
|
#include <Renderer.h>
Public Member Functions | |
virtual void | render (const class PluginParams *pp, const struct PluginParamsShared &sp)=0 |
virtual TextureRenderer * | getTextureRenderer ()=0 |
virtual class RendererOfMesh * | getMeshRenderer (const rr::RRMesh *mesh)=0 |
virtual class NamedCounter * | getCounters ()=0 |
virtual | ~Renderer () |
Public Member Functions inherited from rr::RRUniformlyAllocated | |
void * | operator new (std::size_t n) |
void * | operator new[] (std::size_t n) |
void | operator delete (void *p, std::size_t n) |
void | operator delete[] (void *p, std::size_t n) |
Static Public Member Functions | |
static Renderer * | create (const rr::RRString &pathToShaders, const rr::RRString &pathToMaps) |
Additional Inherited Members | |
Protected Member Functions inherited from rr::RRUniformlyAllocatedNonCopyable | |
RRUniformlyAllocatedNonCopyable () | |
~RRUniformlyAllocatedNonCopyable () | |
Modern plugin based renderer.
Renderer itself does not issue any rendering commands, it just calls plugins. Plugins can directly render and/or recursively call renderer with modified set of plugins or parameters. You can easily add custom plugins to add functionality. For a complete list of our plugins, see PluginParams.
Plugin capabilities
With our plugins, you can render
Plugin requirements
Minimal requirements for existing plugins: OpenGL 2.0 or OpenGL ES 2.0. 3.x and 4.x functions are used when available, for higher quality and speed.
How plugins call each other
Each plugin is expected to call next plugin in chain at some point, but it is free to decide when to call it, how many times to call it, and what plugin parameters to modify. So for example
Plugin order
When creating plugin chain, you are free to change order of plugins to create various effects. If not sure, use this order of standard plugins:
Using plugins
Example of calling renderer with plugin chain (see samples for complete code):
Creating plugins
Creating new plugins is easy as well. Plugins contain virtually no boilerplate code, they are just constructor, render() function and destructor. For source code licensee, it is recommended to take source code of one of plugins and modify it.
|
inlinevirtual |
|
static |
Creates renderer.
pathToShaders | Path to directory with shaders. It is passed to plugins later, renderer itself does not use it. Must be terminated with slash (or be empty for current dir). |
pathToMaps | Path to directory with maps. It is passed to plugins later, renderer itself does not use it. Must be terminated with slash (or be empty for current dir). |
|
pure virtual |
Runs given plugins to do their work.
Existing plugins (all but PluginCube) render into current render target and current viewport.
Existing plugins do not clear automatically, so you might want to glClear() both color and depth before calling render().
To render to texture, set render target with FBO::setRenderTarget(). When rendering sRGB correctly, target texture must be sRGB, make it sRGB with Texture::reset(,,true) before FBO::setRenderTarget().
For correct results with existing plugins, render target must contain at least depth and RGB channels. When rendering with mirror reflections, render target must contain also alpha channel. Stencil buffer is not used.
To render to rectangle within render target, use glViewport(). (Note that when rendering with nondefault viewport, mirrors and mono camera, render target's alpha channel is cleared by glClear(). If you don't want it to be cleared outside viewport, enable scissor test with scissor area identical to viewport.)
|
pure virtual |
Helper function, provides plugins with single preallocated texture renderer.
|
pure virtual |
Helper function, for internal use.
|
pure virtual |
Returns named counters exposed by plugins. You can freely modify counts, e.g. zero them at the beginning of frame.