]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/batch.h
Add tessellation shader support to the engine
[libs/gl.git] / source / core / batch.h
index dd07adb58b632941d0264350b783b386efd97fdc..f3495860e4b4297d072869f73082ce6f4e6a7c7b 100644 (file)
@@ -30,6 +30,7 @@ public:
                Loader(Batch &);
        private:
                void indices(const std::vector<unsigned> &);
+               void patch_size(unsigned);
        };
 
 private:
@@ -37,6 +38,7 @@ private:
        DataType index_type;
        std::vector<std::uint8_t> data;
        unsigned max_index;
+       unsigned patch_size = 3;
 
 public:
        Batch(PrimitiveType);
@@ -50,6 +52,12 @@ public:
 
        DataType get_index_type() const { return index_type; }
 
+       /** Sets the number of control points per patch.  Only available if the
+       primitive type is PATCHES. */
+       void set_patch_size(unsigned);
+
+       unsigned get_patch_size() const { return patch_size; }
+
        /** Appends a single index.  The data type is automatically adjusted if the
        index is too large for the current data type. */
        Batch &append(unsigned);
@@ -69,8 +77,8 @@ private:
        virtual std::size_t get_data_size() const { return data.size(); }
        virtual const void *get_data_pointer() const { return &data[0]; }
        virtual std::size_t get_alignment() const { return get_index_size(); }
-       std::size_t get_index_size() const;
 public:
+       std::size_t get_index_size() const { return get_type_size(index_type); }
        std::size_t size() const { return data.size()/get_index_size(); }
 
        unsigned get_index(std::size_t) const;