namespace GL {
OffscreenView::OffscreenView(Framebuffer &t):
- View(t)
+ target(t)
{ }
OffscreenView::OffscreenView(RenderTarget &t):
- View(t.get_framebuffer())
+ target(t.get_framebuffer())
{ }
} // namespace GL
*/
class OffscreenView: public View
{
+private:
+ Framebuffer ⌖
+
public:
OffscreenView(Framebuffer &);
OffscreenView(RenderTarget &);
+
+private:
+ virtual const Framebuffer &get_target() const { return target; }
};
} // namespace GL
namespace Msp {
namespace GL {
-View::View(Framebuffer &t):
- target(t),
+View::View():
camera(0),
content(0),
internal_renderer(0)
void View::render(Renderer &renderer)
{
Renderer::Push _push(renderer);
- renderer.set_framebuffer(&target);
+ renderer.set_framebuffer(&get_target());
if(content)
{
if(camera)
class View
{
protected:
- Framebuffer ⌖
Camera *camera;
Renderable *content;
Renderer *internal_renderer;
- View(Framebuffer &);
+ View();
public:
virtual ~View();
- virtual unsigned get_width() const { return target.get_width(); }
- virtual unsigned get_height() const { return target.get_height(); }
+ virtual unsigned get_width() const { return get_target().get_width(); }
+ virtual unsigned get_height() const { return get_target().get_height(); }
float get_aspect_ratio() const { return static_cast<float>(get_width())/get_height(); }
/** Sets the camera to render with. The camera's aspect ratio is set to
virtual void render();
virtual void render(Renderer &);
+protected:
+ virtual const Framebuffer &get_target() const = 0;
};
} // namespace GL
namespace GL {
WindowView::WindowView(Graphics::Window &w):
- View(Framebuffer::system()),
window(w),
device(Device::get_current())
{
camera->set_aspect_ratio(aspect);
}
+const Framebuffer &WindowView::get_target() const
+{
+ return Framebuffer::system();
+}
+
} // namespace GL
} // namespace Msp
private:
void window_resized(unsigned, unsigned);
+
+ virtual const Framebuffer &get_target() const;
};
} // namespace GL