dirty = true;
}
+bool Batch::can_append(PrimitiveType other_type)
+{
+ if(other_type!=prim_type)
+ return false;
+ else if(prim_type==LINE_STRIP || prim_type==LINE_LOOP || prim_type==TRIANGLE_FAN || prim_type==POLYGON)
+ return NV_primitive_restart;
+ else
+ return true;
+}
+
void Batch::append(const Batch &other)
{
if(other.prim_type!=prim_type)
Batch &append(unsigned);
void append(const std::vector<unsigned> &);
+ bool can_append(PrimitiveType);
void append(const Batch &);
private:
void append_index(unsigned);
#include "buffer.h"
#include "mesh.h"
-#include "nv_primitive_restart.h"
#include "renderer.h"
using namespace std;
void Mesh::add_batch(const Batch &b)
{
- bool can_append = false;
- if(!batches.empty())
- {
- PrimitiveType type = b.get_type();
- can_append = (type==batches.back().get_type() &&
- type!=LINE_STRIP && type!=LINE_LOOP && type!=POLYGON &&
- (type!=TRIANGLE_FAN || NV_primitive_restart));
- }
-
if(defer_ibuf)
{
ibuf = new Buffer(ELEMENT_ARRAY_BUFFER);
defer_ibuf = false;
}
- if(can_append)
+ if(!batches.empty() && batches.back().can_append(b.get_type()))
batches.back().append(b);
else
{