2 #ifndef GRAMODS_GRAPHICS_CALLBACKRENDERER 
    3 #define GRAMODS_GRAPHICS_CALLBACKRENDERER 
    5 #include <gmGraphics/Renderer.hh> 
    7 BEGIN_NAMESPACE_GMGRAPHICS;
 
   38   typedef std::function<void(
const Camera &, 
const Eigen::Affine3f &)>
 
   47   typedef std::function<void(
 
   48       const Camera &, 
const Eigen::Affine3f &, 
float &, 
float &)>
 
   54   void render(
const Camera &camera, 
const Eigen::Affine3f &Mm)
 override {
 
   55     if (!has_been_setup) {
 
   56       if (setup_function) setup_function();
 
   57       has_been_setup = 
true;
 
   59     if (render_function) render_function(camera, Mm);
 
   69                   const Eigen::Affine3f &Mm,
 
   71                   float &far)
 override {
 
   72     if (!nearfar_function) 
return;
 
   73     nearfar_function(camera, Mm, near, far);
 
   96   SetupFunction setup_function;
 
   97   RenderFunction render_function;
 
   98   NearFarFunction nearfar_function;
 
   99   bool has_been_setup = 
false;
 
  103 END_NAMESPACE_GMGRAPHICS;
 
A renderer that defers rendering to a callback function.
Definition: CallbackRenderer.hh:21
 
void setCallback(RenderFunction func)
Sets the callback that should be called upon calls to the render method.
Definition: CallbackRenderer.hh:86
 
void render(const Camera &camera, const Eigen::Affine3f &Mm) override
Performs rendering of 3D objects in the scene.
Definition: CallbackRenderer.hh:54
 
std::function< void(const Camera &, const Eigen::Affine3f &)> RenderFunction
The signature of the rendering function that provides the actual graphics.
Definition: CallbackRenderer.hh:39
 
void setCallback(NearFarFunction func)
Sets the callback that should be called to get optimal near and far plane distances.
Definition: CallbackRenderer.hh:92
 
std::function< void(void)> SetupFunction
The signature of a setup function that prepares a renderer.
Definition: CallbackRenderer.hh:30
 
void getNearFar(const Camera &camera, const Eigen::Affine3f &Mm, float &near, float &far) override
Extracts the currently optimal near and far plane distances.
Definition: CallbackRenderer.hh:68
 
void setCallback(SetupFunction func)
Sets the callback that should be called to set up GL for rendering.
Definition: CallbackRenderer.hh:80
 
std::function< void(const Camera &, const Eigen::Affine3f &, float &, float &)> NearFarFunction
The signature of an optional function that returns the currently optimal near and far plane distances...
Definition: CallbackRenderer.hh:49
 
The base of graphics Camera implementations.
Definition: Camera.hh:19
 
The base of graphics Renderer implementations.
Definition: Renderer.hh:17