#include <msp/gl/lighting.h>
#include <msp/gl/mesh.h>
#include <msp/gl/object.h>
+#include <msp/gl/pipeline.h>
#include <msp/gl/renderer.h>
#include <msp/gl/resources.h>
#include <msp/gl/simplescene.h>
#include <msp/gl/technique.h>
#include <msp/gl/tests.h>
+#include <msp/gl/windowview.h>
#include <msp/input/mouse.h>
#include <msp/io/print.h>
#include <msp/time/timestamp.h>
Graphics::SimpleGLWindow window;
Input::Mouse mouse;
Resources resources;
+ GL::WindowView view;
+ GL::Pipeline pipeline;
GL::Renderable *renderable;
GL::AnimatedObject *anim_object;
GL::AnimationPlayer *anim_player;
Viewer::Viewer(int argc, char **argv):
window(1024, 768, false),
mouse(window),
+ view(window, window.get_gl_context()),
+ pipeline(view),
renderable(0),
anim_object(0),
anim_player(0),
camera.set_up_direction(GL::Vector3(0, 0, 1));
update_camera();
+
+ GL::Pipeline::Pass &pass = pipeline.add_pass(0, *renderable);
+ pass.set_lighting(&lighting);
+ pass.set_depth_test(&GL::DepthTest::lequal());
+ pass.set_blend(&GL::Blend::alpha());
+
+ view.set_content(&pipeline);
+ view.set_camera(&camera);
}
template<typename T>
}
window.tick();
-
- GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT);
-
- GL::Bind bind_depth(GL::DepthTest::lequal());
- GL::Bind bind_blend(GL::Blend::alpha());
- GL::Renderer renderer(&camera);
- renderer.set_lighting(&lighting);
- renderable->render(renderer);
-
- window.swap_buffers();
+ view.render();
}
void Viewer::button_press(unsigned btn)