Change VertexArray::use_vertex_buffer semantics to allow disabling vertex buffer
Initialize ObjectPass:use_textures in constructor
Mesh::Mesh():
vertices(NODATA)
-{
- vertices.use_vertex_buffer();
-}
+{ }
Mesh::Mesh(VertexFormat f):
vertices(f)
+{ }
+
+void Mesh::use_vertex_buffer(bool b)
{
- vertices.use_vertex_buffer();
+ if(b)
+ vertices.use_vertex_buffer();
+ else
+ vertices.use_vertex_buffer(0);
}
RefPtr<MeshBuilder> Mesh::modify()
public:
Mesh();
Mesh(VertexFormat f);
+
+ void use_vertex_buffer(bool);
RefPtr<MeshBuilder> modify();
const VertexArray &get_vertices() const { return vertices; }
void add_batch(const Batch &b);
ObjectPass::ObjectPass():
shprog(0),
- shdata(0)
+ shdata(0),
+ use_textures(true)
{ }
ObjectPass::~ObjectPass()
void VertexArray::use_vertex_buffer()
{
- if(vbuf) return;
+ if(vbuf && own_vbuf)
+ return;
vbuf=new VertexBuffer();
own_vbuf=true;
+
update_data();
}
void VertexArray::use_vertex_buffer(VertexBuffer *b)
{
- if(vbuf) return;
-
+ if(own_vbuf)
+ delete vbuf;
vbuf=b;
+ own_vbuf=false;
+
update_data();
}