Removed deprecated functions.

This commit is contained in:
David Williams 2015-12-26 23:41:49 +00:00
parent e89a55d154
commit d544de6dd1
5 changed files with 9 additions and 31 deletions

View File

@ -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;

View File

@ -63,10 +63,6 @@ public:
template <typename MeshType>
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;

View File

@ -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

View File

@ -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<VertexType>& getVertices(void) const;
size_t getNoOfIndices(void) const;
IndexType getIndex(uint32_t index) const;
const IndexType* getRawIndexData(void) const;
POLYVOX_DEPRECATED const std::vector<IndexType>& getIndices(void) const;
const Vector3DInt32& getOffset(void) const;
void setOffset(const Vector3DInt32& offset);

View File

@ -49,13 +49,7 @@ namespace PolyVox
template <typename VertexType, typename IndexType>
const VertexType* Mesh<VertexType, IndexType>::getRawVertexData(void) const
{
return &(m_vecVertices[0]);
}
template <typename VertexType, typename IndexType>
const std::vector<VertexType>& Mesh<VertexType, IndexType>::getVertices(void) const
{
return m_vecVertices;
return m_vecVertices.data();
}
template <typename VertexType, typename IndexType>
@ -73,13 +67,7 @@ namespace PolyVox
template <typename VertexType, typename IndexType>
const IndexType* Mesh<VertexType, IndexType>::getRawIndexData(void) const
{
return &(m_vecIndices[0]);
}
template <typename VertexType, typename IndexType>
const std::vector<IndexType>& Mesh<VertexType, IndexType>::getIndices(void) const
{
return m_vecIndices;
return m_vecIndices.data();
}
template <typename VertexType, typename IndexType>