فهرست منبع

Merge pull request #855 from reven86/next-clean

const qualifiers on MeshBatch::add arguments
Sean Paul Taylor 13 سال پیش
والد
کامیت
8d7830b63d
3فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 2 2
      gameplay/src/MeshBatch.cpp
  2. 3 3
      gameplay/src/MeshBatch.h
  3. 1 1
      gameplay/src/MeshBatch.inl

+ 2 - 2
gameplay/src/MeshBatch.cpp

@@ -43,7 +43,7 @@ MeshBatch* MeshBatch::create(const VertexFormat& vertexFormat, Mesh::PrimitiveTy
     return batch;
 }
 
-void MeshBatch::add(void* vertices, size_t size, unsigned int vertexCount, unsigned short* indices, unsigned int indexCount)
+void MeshBatch::add(const void* vertices, size_t size, unsigned int vertexCount, const unsigned short* indices, unsigned int indexCount)
 {
     GP_ASSERT(vertices);
     
@@ -217,7 +217,7 @@ bool MeshBatch::resize(unsigned int capacity)
     return true;
 }
 
-void MeshBatch::add(float* vertices, unsigned int vertexCount, unsigned short* indices, unsigned int indexCount)
+void MeshBatch::add(const float* vertices, unsigned int vertexCount, const unsigned short* indices, unsigned int indexCount)
 {
     add(vertices, sizeof(float), vertexCount, indices, indexCount);
 }

+ 3 - 3
gameplay/src/MeshBatch.h

@@ -91,7 +91,7 @@ public:
      * @param indexCount Number of indices (should be zero for non-indexed batches).
      */
     template <class T>
-    void add(T* vertices, unsigned int vertexCount, unsigned short* indices = NULL, unsigned int indexCount = 0);
+    void add(const T* vertices, unsigned int vertexCount, const unsigned short* indices = NULL, unsigned int indexCount = 0);
 
     /**
      * Adds a group of primitives to the batch.
@@ -112,7 +112,7 @@ public:
      * @param indices Array of indices into the vertex array (should be NULL for non-indexed batches).
      * @param indexCount Number of indices (should be zero for non-indexed batches).
      */
-    void add(float* vertices, unsigned int vertexCount, unsigned short* indices = NULL, unsigned int indexCount = 0);
+    void add(const float* vertices, unsigned int vertexCount, const unsigned short* indices = NULL, unsigned int indexCount = 0);
 
     /**
      * Starts batching.
@@ -153,7 +153,7 @@ private:
      */
     MeshBatch& operator=(const MeshBatch&);
 
-    void add(void* vertices, size_t size, unsigned int vertexCount, unsigned short* indices, unsigned int indexCount);
+    void add(const void* vertices, size_t size, unsigned int vertexCount, const unsigned short* indices, unsigned int indexCount);
 
     void updateVertexAttributeBinding();
 

+ 1 - 1
gameplay/src/MeshBatch.inl

@@ -9,7 +9,7 @@ Material* MeshBatch::getMaterial() const
 }
 
 template <class T>
-void MeshBatch::add(T* vertices, unsigned int vertexCount, unsigned short* indices, unsigned int indexCount)
+void MeshBatch::add(const T* vertices, unsigned int vertexCount, const unsigned short* indices, unsigned int indexCount)
 {
     GP_ASSERT(sizeof(T) == _vertexFormat.getVertexSize());
     add(vertices, sizeof(T), vertexCount, indices, indexCount);