}
renderer.set_mesh(this);
- renderer.set_element_buffer(ibuf);
renderer.set_winding_test(winding);
for(list<Batch>::const_iterator i=batches.begin(); i!=batches.end(); ++i)
matrices_loaded(false),
shdata_applied(0),
camera(0),
- state_stack(1),
- element_buffer(0)
+ state_stack(1)
{
state_stack.reserve(16);
shdata_stack.reserve(32);
state->mesh = m;
}
-void Renderer::set_element_buffer(const Buffer *b)
-{
- element_buffer = b;
-}
-
void Renderer::set_winding_test(const WindingTest *w)
{
state->winding_test = w;
apply_state();
bool legacy_bindings = (!state->shprog || state->shprog->uses_legacy_variables());
- if(legacy_bindings)
+ if(state->mesh && legacy_bindings)
{
- if(element_buffer)
- element_buffer->bind_to(ELEMENT_ARRAY_BUFFER);
+ if(const Buffer *ibuf = state->mesh->get_index_buffer())
+ ibuf->bind_to(ELEMENT_ARRAY_BUFFER);
else
Buffer::unbind_from(ELEMENT_ARRAY_BUFFER);
}
State *state;
ProgramData standard_shdata;
std::vector<const ProgramData *> shdata_stack;
- const Buffer *element_buffer;
std::set<const Renderable *> excluded;
public:
void add_shader_data(const ProgramData &data);
void set_mesh(const Mesh *);
- void set_element_buffer(const Buffer *);
void set_winding_test(const WindingTest *);
void set_reverse_winding(bool);