X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fbatch.h;h=2ac2c43c17f1eeb26c75626c2efd4064bf3d4880;hb=cdefdb4b0f94613c2b41757fb33ae155efa9a205;hp=45101d4356672950dc9439a5401ed1a3311bc307;hpb=190a7e11237351f6b730c28f7b16f183e8adc69c;p=libs%2Fgl.git diff --git a/source/core/batch.h b/source/core/batch.h index 45101d43..2ac2c43c 100644 --- a/source/core/batch.h +++ b/source/core/batch.h @@ -30,17 +30,18 @@ public: Loader(Batch &); private: void indices(const std::vector &); + void patch_size(unsigned); }; private: PrimitiveType prim_type; DataType index_type; std::vector data; - unsigned max_index; + unsigned max_index = 0; + unsigned patch_size = 3; public: Batch(PrimitiveType); - ~Batch(); PrimitiveType get_type() const { return prim_type; } @@ -51,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); @@ -70,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;