]> git.tdb.fi Git - libs/gl.git/commitdiff
Always use buffers in Mesh
authorMikko Rasa <tdb@tdb.fi>
Wed, 23 Oct 2019 11:25:46 +0000 (14:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 23 Oct 2019 23:45:29 +0000 (02:45 +0300)
source/mesh.cpp
source/mesh.h

index a8129d9bdc70ec426519f01289f667b8ba39f58f..746b07d8e1db7d6ac29f2cd9d75eeae0c60496f6 100644 (file)
@@ -30,7 +30,6 @@ void Mesh::init(ResourceManager *rm)
        vbuf = 0;
        ibuf = 0;
        vtx_setup = 0;
-       defer_buffers = ARB_vertex_buffer_object;
        disallow_rendering = false;
        winding = 0;
 
@@ -52,25 +51,8 @@ void Mesh::clear()
        batches.clear();
 }
 
-void Mesh::use_buffers(bool b)
-{
-       defer_buffers = false;
-       if(b)
-               create_buffers();
-       else
-       {
-               vertices.use_buffer(0);
-               delete vbuf;
-               vbuf = 0;
-               delete ibuf;
-               ibuf = 0;
-       }
-}
-
 void Mesh::create_buffers()
 {
-       defer_buffers = false;
-
        if(!vbuf)
                vbuf = new Buffer(ARRAY_BUFFER);
        vertices.use_buffer(vbuf);
@@ -98,8 +80,7 @@ float *Mesh::modify_vertex(unsigned i)
 
 void Mesh::add_batch(const Batch &b)
 {
-       if(defer_buffers)
-               create_buffers();
+       create_buffers();
 
        if(!batches.empty() && batches.back().can_append(b.get_type()))
                batches.back().append(b);
@@ -237,7 +218,6 @@ void Mesh::unload()
        batches.clear();
        delete vbuf;
        delete ibuf;
-       defer_buffers = (vbuf || ibuf);
        vbuf = 0;
        ibuf = 0;
 }
@@ -290,8 +270,7 @@ Mesh::AsyncLoader::AsyncLoader(Mesh &m, IO::Seekable &i):
        phase(0)
 {
        mesh.disallow_rendering = true;
-       if(mesh.defer_buffers)
-               mesh.create_buffers();
+       mesh.create_buffers();
 }
 
 Mesh::AsyncLoader::~AsyncLoader()
index 1ee58a6227ea52427f93113bf9e631582f076467..c09fad6da74ae1ab64fd361b17bb4714d4de34f9 100644 (file)
@@ -71,7 +71,6 @@ public:
        ~Mesh();
 
        void clear();
-       void use_buffers(bool);
 private:
        void create_buffers();