+ /**
+ * Callback used to disable/enable rendering to the texture if it is not
+ * visible
+ */
+ class CameraCullCallback:
+ public osg::NodeCallback
+ {
+ public:
+ CameraCullCallback();
+
+ /**
+ * Enable rendering for the next frame
+ */
+ void enableRendering();
+
+ private:
+ bool _render;
+ unsigned int _render_frame;
+
+ virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
+ };
+ typedef osg::ref_ptr<CameraCullCallback> CameraCullCallbackPtr;
+ typedef osg::observer_ptr<CameraCullCallback> CameraCullCallbackWeakPtr;
+
+ /**
+ * This callback is installed on every placement of the canvas in the
+ * scene to only render the canvas if at least one placement is visible
+ */
+ class CullCallback:
+ public osg::NodeCallback
+ {
+ public:
+ CullCallback(CameraCullCallback* camera_cull);
+
+ private:
+ CameraCullCallbackWeakPtr _camera_cull;
+
+ virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
+ };
+ typedef osg::ref_ptr<CullCallback> CullCallbackPtr;
+
+ /**
+ * Callback for resetting the render_dirty flag after rendering a frame.
+ */
+ class DrawCallback;
+
+ Canvas(SGPropertyNode* node);