Fermat
The Rendering Context

Top: Contents

A central object in Fermat is the RenderingContext, a class encapsulating all there is to know about a scene's to render, including:
  • the camera,
  • the framebuffer,
  • the scene database, including lights, geometry and textures,
  • the ray tracing context,
  • some precomputed tables to help with material simulation and such,
  • the actual renderer,
We'll now go through this list step by step.
The camera with which to render the current scene is specified by:
The framebuffer and its attributes are specified by:
// get the frame buffer
//
// get the target resolution
//
uint2 RenderingContext::get_res() const
// get the target aspect ratio
//
float RenderingContext::get_aspect_ratio() const
// get the target exposure
//
float RenderingContext::get_exposure() const
// get the target gamma
//
float RenderingContext::get_gamma() const
The mesh geometry is specified by:
// get a device-resident version of the scene's mesh
//
// get a host-resident version of the scene's mesh
//
HostMeshStorage& RenderingContext::get_host_mesh()
The light sources are specified by:
// return the number of directional lights
//
uint32 RenderingContext::get_directional_lights_count() const
// return the host-side list of directional lights
//
const DirectionalLight* RenderingContext::get_host_directional_lights() const
// return the device-side list of directional lights
//
const DirectionalLight* RenderingContext::get_device_directional_lights() const
and:
Notice that this is a host-side class holding the device-side storage needed to sample mesh emitters on the device. Its view is just a MeshLight, i.e. a class with the Light interface.
The ray tracing context is specified by:
// return the ray tracing context for the scene's geometry
//
Finally, Fermat allows plugins to register new renderers with the following call:
// register a new rendering interface type
//
uint32 register_renderer(const char* name, RendererFactoryFunction factory)
The factory is just a fuction/method returning a pointer to a new RendererInterface object:
typedef RendererInterface* (*RendererFactoryFunction)();

Next: The Renderer Interface