#include "material.h"
#include "program.h"
#include "programdata.h"
+#include "renderable.h"
#include "renderer.h"
#include "texture.h"
#include "texturing.h"
camera(c),
state_stack(1),
vertex_array(0),
- vertex_array_changed(false),
element_buffer(0)
{
state_stack.reserve(16);
void Renderer::set_vertex_array(const VertexArray *a)
{
- vertex_array_changed = (a!=vertex_array);
vertex_array = a;
}
Buffer::unbind_from(ELEMENT_ARRAY_BUFFER);
}
+void Renderer::exclude(const Renderable &renderable)
+{
+ excluded.insert(&renderable);
+}
+
+void Renderer::include(const Renderable &renderable)
+{
+ excluded.erase(&renderable);
+}
+
+void Renderer::render(const Renderable &renderable, const Tag &tag)
+{
+ if(!excluded.count(&renderable))
+ renderable.render(*this, tag);
+}
+
void Renderer::draw(const Batch &batch)
{
if(!vertex_array)
apply_state();
- // Until VertexArray acquires VAO support and becomes Bindable
- if(vertex_array_changed)
- {
- vertex_array->apply();
- vertex_array_changed = false;
- }
+ vertex_array->apply();
if(element_buffer)
element_buffer->bind_to(ELEMENT_ARRAY_BUFFER);
texturing(0),
material(0),
shprog(0),
+ shdata_count(0),
winding_test(0)
{ }