VertexArrayObject and ElementGroup should be noncopyable

This commit is contained in:
John Firebaugh
2014-08-26 14:43:29 -07:00
parent 073d1fc9e8
commit 42d0740ef0
8 changed files with 74 additions and 69 deletions

View File

@@ -3,13 +3,14 @@
#include <mbgl/geometry/buffer.hpp>
#include <mbgl/geometry/vao.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <array>
namespace mbgl {
template <int count>
struct ElementGroup {
struct ElementGroup : public util::noncopyable {
std::array<VertexArrayObject, count> array;
uint32_t vertex_length;
uint32_t elements_length;

View File

@@ -3,13 +3,14 @@
#include <mbgl/shader/shader.hpp>
#include <mbgl/platform/gl.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <stdexcept>
namespace mbgl {
#if GL_ARB_vertex_array_object
class VertexArrayObject {
class VertexArrayObject : public util::noncopyable {
public:
template <typename Shader, typename VertexBuffer>
inline void bind(Shader& shader, VertexBuffer &vertexBuffer, char *offset) {
@@ -56,7 +57,7 @@ private:
#else
class VertexArrayObject {
class VertexArrayObject : public util::noncopyable {
public:
template <typename Shader, typename Buffers>
void bind(Shader& shader, Buffers& buffers, char *offset) {

View File

@@ -34,8 +34,9 @@ class FillBucket : public Bucket {
static void *realloc(void *data, void *ptr, unsigned int size);
static void free(void *userData, void *ptr);
typedef ElementGroup<2> triangle_group_type;
typedef ElementGroup<1> line_group_type;
typedef std::unique_ptr<ElementGroup<2>> triangle_group_type;
typedef std::unique_ptr<ElementGroup<1>> line_group_type;
public:
FillBucket(FillVertexBuffer& vertexBuffer,
TriangleElementsBuffer& triangleElementsBuffer,

View File

@@ -20,8 +20,9 @@ class LinejoinShader;
struct pbf;
class LineBucket : public Bucket {
typedef ElementGroup<1> triangle_group_type;
typedef ElementGroup<1> point_group_type;
typedef std::unique_ptr<ElementGroup<1>> triangle_group_type;
typedef std::unique_ptr<ElementGroup<1>> point_group_type;
public:
LineBucket(LineVertexBuffer& vertexBuffer,
TriangleElementsBuffer& triangleElementsBuffer,
@@ -43,7 +44,6 @@ public:
const StyleBucketLine &properties;
private:
LineVertexBuffer& vertexBuffer;
TriangleElementsBuffer& triangleElementsBuffer;
PointElementsBuffer& pointElementsBuffer;

View File

@@ -50,8 +50,8 @@ typedef std::vector<Symbol> Symbols;
class SymbolBucket : public Bucket {
typedef ElementGroup<1> TextElementGroup;
typedef ElementGroup<1> IconElementGroup;
typedef std::unique_ptr<ElementGroup<1>> TextElementGroup;
typedef std::unique_ptr<ElementGroup<1>> IconElementGroup;
public:
SymbolBucket(const StyleBucketSymbol &properties, Collision &collision);