1 #ifndef MSP_GL_RENDERER_H_
2 #define MSP_GL_RENDERER_H_
22 A class for supervising the rendering process. While many Renderables (in
23 particular, Objects and Scenes) can by rendered without a Renderer, using one
24 will often be more efficient. This is especially true for ObjectInstances.
26 The Renderer works by deferring GL state changes until something is actually
27 being drawn. This avoids many unnecessary GL calls. */
37 Push(Renderer &r): renderer(r) { renderer.push_state(); }
38 ~Push() { renderer.pop_state(); }
44 const Texture *texture;
45 const Texturing *texturing;
46 const Material *material;
47 const Program *shprog;
48 std::vector<const ProgramData *> shdata;
49 const WindingTest *winding_test;
54 class MtxStack: public MatrixStack
62 virtual void update();
68 std::list<State> state_stack;
70 const VertexArray *vertex_array;
71 bool vertex_array_changed;
72 const Buffer *element_buffer;
75 Renderer(const Camera *);
78 MatrixStack &matrix_stack() { return mtx_stack; }
80 const Camera *get_camera() const { return camera; }
82 void set_texture(const Texture *);
83 void set_texturing(const Texturing *);
84 void set_material(const Material *);
85 void set_shader(const Program *, const ProgramData *);
86 void add_shader_data(const ProgramData *);
87 void set_vertex_array(const VertexArray *);
88 void set_element_buffer(const Buffer *);
89 void set_winding_test(const WindingTest *);
94 /** Prepares for temporarily bypassing the Renderer. */
97 void draw(const Batch &);