]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/mesh.h
Use default member initializers for simple types
[libs/gl.git] / source / core / mesh.h
index acf2910cb7ea208f3ce2fbab9c74bc182b781928..2d56193d14a104ccc3d08bb87fd0a11f5f8bbe11 100644 (file)
@@ -1,12 +1,14 @@
 #ifndef MSP_GL_MESH_H_
 #define MSP_GL_MESH_H_
 
+#include <string>
+#include <vector>
 #include <msp/datafile/objectloader.h>
 #include "batch.h"
+#include "cullface.h"
 #include "resource.h"
 #include "vertexarray.h"
 #include "vertexsetup.h"
-#include "windingtest.h"
 
 namespace Msp {
 namespace GL {
@@ -32,9 +34,10 @@ public:
        public:
                Loader(Mesh &, bool = true);
        private:
-               void vertices(const std::vector<VertexAttribute> &);
+               void storage(const std::vector<VertexAttribute> &);
+               void vertices();
+               void vertices_with_format(const std::vector<VertexAttribute> &);
                void batch(PrimitiveType);
-               void winding(FaceWinding);
        };
 
 private:
@@ -63,22 +66,21 @@ private:
 
        VertexArray vertices;
        std::vector<Batch> batches;
-       Buffer *vbuf;
-       Buffer *ibuf;
+       Buffer *vbuf = 0;
+       Buffer *ibuf = 0;
        VertexSetup vtx_setup;
-       mutable unsigned short dirty;
-       bool disallow_rendering;
-       const WindingTest *winding;
+       mutable unsigned short dirty = 0;
+       bool disallow_rendering = false;
+       FaceWinding face_winding = NON_MANIFOLD;
        std::string debug_name;
 
 public:
-       Mesh(ResourceManager * = 0);
-       Mesh(const VertexFormat &, ResourceManager * = 0);
-private:
-       void init(ResourceManager *);
-public:
+       Mesh() = default;
+       Mesh(const VertexFormat &);
        ~Mesh();
 
+       void storage(const VertexFormat &);
+
        void clear();
 private:
        void check_buffers(unsigned);
@@ -88,12 +90,12 @@ public:
        const VertexSetup &get_vertex_setup() const { return vtx_setup; }
        const Buffer *get_index_buffer() const { return ibuf; }
        unsigned get_n_vertices() const;
-       float *modify_vertex(unsigned);
+       char *modify_vertex(unsigned);
 
        void add_batch(const Batch &b);
        const std::vector<Batch> &get_batches() const { return batches; }
 
-       void set_winding(const WindingTest *);
+       void set_winding(FaceWinding);
 
        void draw(Renderer &) const;
        void draw_instanced(Renderer &, const VertexSetup &, unsigned) const;
@@ -104,7 +106,7 @@ private:
 public:
        virtual int get_load_priority() const { return 1; }
        virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload();
 
        void set_debug_name(const std::string &);