From d544de6dd163d089791861fd0e9e5729054083de Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 26 Dec 2015 23:41:49 +0000 Subject: [PATCH] Removed deprecated functions. --- examples/DecodeOnGPU/main.cpp | 10 +++------- examples/common/PolyVoxExample.h | 10 +++------- include/PolyVox/CubicSurfaceExtractor.h | 2 +- include/PolyVox/Mesh.h | 2 -- include/PolyVox/Mesh.inl | 16 ++-------------- 5 files changed, 9 insertions(+), 31 deletions(-) diff --git a/examples/DecodeOnGPU/main.cpp b/examples/DecodeOnGPU/main.cpp index 738ec030..222f5a5d 100644 --- a/examples/DecodeOnGPU/main.cpp +++ b/examples/DecodeOnGPU/main.cpp @@ -116,10 +116,6 @@ protected: private: OpenGLMeshData buildOpenGLMeshData(const PolyVox::Mesh< PolyVox::MarchingCubesVertex< uint8_t > >& surfaceMesh, const PolyVox::Vector3DInt32& translation = PolyVox::Vector3DInt32(0, 0, 0), float scale = 1.0f) { - // Convienient access to the vertices and indices - const auto& vecIndices = surfaceMesh.getIndices(); - const auto& vecVertices = surfaceMesh.getVertices(); - // This struct holds the OpenGL properties (buffer handles, etc) which will be used // to render our mesh. We copy the data from the PolyVox mesh into this structure. OpenGLMeshData meshData; @@ -131,12 +127,12 @@ private: // The GL_ARRAY_BUFFER will contain the list of vertex positions glGenBuffers(1, &(meshData.vertexBuffer)); glBindBuffer(GL_ARRAY_BUFFER, meshData.vertexBuffer); - glBufferData(GL_ARRAY_BUFFER, vecVertices.size() * sizeof(MarchingCubesVertex< uint8_t >), vecVertices.data(), GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, surfaceMesh.getNoOfVertices() * sizeof(MarchingCubesVertex< uint8_t >), surfaceMesh.getRawVertexData(), GL_STATIC_DRAW); // and GL_ELEMENT_ARRAY_BUFFER will contain the indices glGenBuffers(1, &(meshData.indexBuffer)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshData.indexBuffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, vecIndices.size() * sizeof(uint32_t), vecIndices.data(), GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, surfaceMesh.getNoOfIndices() * sizeof(uint32_t), surfaceMesh.getRawIndexData(), GL_STATIC_DRAW); // Every surface extractor outputs valid positions for the vertices, so tell OpenGL how these are laid out glEnableVertexAttribArray(0); // Attrib '0' is the vertex positions @@ -159,7 +155,7 @@ private: glBindVertexArray(0); // A few additional properties can be copied across for use during rendering. - meshData.noOfIndices = vecIndices.size(); + meshData.noOfIndices = surfaceMesh.getNoOfIndices(); meshData.translation = QVector3D(translation.getX(), translation.getY(), translation.getZ()); meshData.scale = scale; diff --git a/examples/common/PolyVoxExample.h b/examples/common/PolyVoxExample.h index be1b86f7..ea2efbe9 100644 --- a/examples/common/PolyVoxExample.h +++ b/examples/common/PolyVoxExample.h @@ -63,10 +63,6 @@ public: template void addMesh(const MeshType& surfaceMesh, const PolyVox::Vector3DInt32& translation = PolyVox::Vector3DInt32(0, 0, 0), float scale = 1.0f) { - // Convienient access to the vertices and indices - const auto& vecIndices = surfaceMesh.getIndices(); - const auto& vecVertices = surfaceMesh.getVertices(); - // This struct holds the OpenGL properties (buffer handles, etc) which will be used // to render our mesh. We copy the data from the PolyVox mesh into this structure. OpenGLMeshData meshData; @@ -78,12 +74,12 @@ public: // The GL_ARRAY_BUFFER will contain the list of vertex positions glGenBuffers(1, &(meshData.vertexBuffer)); glBindBuffer(GL_ARRAY_BUFFER, meshData.vertexBuffer); - glBufferData(GL_ARRAY_BUFFER, vecVertices.size() * sizeof(typename MeshType::VertexType), vecVertices.data(), GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, surfaceMesh.getNoOfVertices() * sizeof(typename MeshType::VertexType), surfaceMesh.getRawVertexData(), GL_STATIC_DRAW); // and GL_ELEMENT_ARRAY_BUFFER will contain the indices glGenBuffers(1, &(meshData.indexBuffer)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshData.indexBuffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, vecIndices.size() * sizeof(typename MeshType::IndexType), vecIndices.data(), GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, surfaceMesh.getNoOfIndices() * sizeof(typename MeshType::IndexType), surfaceMesh.getRawIndexData(), GL_STATIC_DRAW); // Every surface extractor outputs valid positions for the vertices, so tell OpenGL how these are laid out glEnableVertexAttribArray(0); // Attrib '0' is the vertex positions @@ -106,7 +102,7 @@ public: glBindVertexArray(0); // A few additional properties can be copied across for use during rendering. - meshData.noOfIndices = vecIndices.size(); + meshData.noOfIndices = surfaceMesh.getNoOfIndices(); meshData.translation = QVector3D(translation.getX(), translation.getY(), translation.getZ()); meshData.scale = scale; diff --git a/include/PolyVox/CubicSurfaceExtractor.h b/include/PolyVox/CubicSurfaceExtractor.h index 15260a17..e1d6b249 100644 --- a/include/PolyVox/CubicSurfaceExtractor.h +++ b/include/PolyVox/CubicSurfaceExtractor.h @@ -119,7 +119,7 @@ namespace PolyVox { //All four vertices of a given quad have the same data, //so just check that the first pair of vertices match. - if (m_meshCurrent->getVertices()[q1.vertices[0]].data == m_meshCurrent->getVertices()[q2.vertices[0]].data) + if (m_meshCurrent->getVertex(q1.vertices[0]).data == m_meshCurrent->getVertex(q2.vertices[0]).data) { //Now check whether quad 2 is adjacent to quad one by comparing vertices. //Adjacent quads must share two vertices, and the second quad could be to the diff --git a/include/PolyVox/Mesh.h b/include/PolyVox/Mesh.h index 5b3dcc96..7e24f453 100644 --- a/include/PolyVox/Mesh.h +++ b/include/PolyVox/Mesh.h @@ -54,12 +54,10 @@ namespace PolyVox IndexType getNoOfVertices(void) const; const VertexType& getVertex(IndexType index) const; const VertexType* getRawVertexData(void) const; - POLYVOX_DEPRECATED const std::vector& getVertices(void) const; size_t getNoOfIndices(void) const; IndexType getIndex(uint32_t index) const; const IndexType* getRawIndexData(void) const; - POLYVOX_DEPRECATED const std::vector& getIndices(void) const; const Vector3DInt32& getOffset(void) const; void setOffset(const Vector3DInt32& offset); diff --git a/include/PolyVox/Mesh.inl b/include/PolyVox/Mesh.inl index 499f564f..61a8095b 100644 --- a/include/PolyVox/Mesh.inl +++ b/include/PolyVox/Mesh.inl @@ -49,13 +49,7 @@ namespace PolyVox template const VertexType* Mesh::getRawVertexData(void) const { - return &(m_vecVertices[0]); - } - - template - const std::vector& Mesh::getVertices(void) const - { - return m_vecVertices; + return m_vecVertices.data(); } template @@ -73,13 +67,7 @@ namespace PolyVox template const IndexType* Mesh::getRawIndexData(void) const { - return &(m_vecIndices[0]); - } - - template - const std::vector& Mesh::getIndices(void) const - { - return m_vecIndices; + return m_vecIndices.data(); } template