diff --git a/examples/common/OpenGLWidget.h b/examples/common/OpenGLWidget.h index d80b7a70..96102a99 100644 --- a/examples/common/OpenGLWidget.h +++ b/examples/common/OpenGLWidget.h @@ -77,7 +77,7 @@ 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(CubicVertex), vecVertices.data(), GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, vecVertices.size() * sizeof(MeshType::VertexType), vecVertices.data(), GL_STATIC_DRAW); //and GL_ELEMENT_ARRAY_BUFFER will contain the indices glGenBuffers(1, &(meshData.indexBuffer)); @@ -86,7 +86,7 @@ public: //We need to tell OpenGL how to understand the format of the vertex data glEnableVertexAttribArray(0); //We're talking about shader attribute '0' - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(CubicVertex), 0); //take the first 3 floats from every sizeof(decltype(vecVertices)::value_type) + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(MeshType::VertexType), 0); //take the first 3 floats from every sizeof(decltype(vecVertices)::value_type) glBindVertexArray(0); diff --git a/library/PolyVoxCore/include/PolyVoxCore/Mesh.h b/library/PolyVoxCore/include/PolyVoxCore/Mesh.h index 90ebbfac..bcb40576 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Mesh.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Mesh.h @@ -45,10 +45,13 @@ namespace PolyVox int endIndex; //Let's put it just past the end STL style }; - template + template class Mesh { public: + + typedef _VertexType VertexType; + Mesh(); ~Mesh(); diff --git a/library/PolyVoxCore/include/PolyVoxCore/VertexTypes.h b/library/PolyVoxCore/include/PolyVoxCore/VertexTypes.h index a5a24d79..e8d938ae 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VertexTypes.h +++ b/library/PolyVoxCore/include/PolyVoxCore/VertexTypes.h @@ -36,11 +36,14 @@ namespace PolyVox #ifdef SWIG class CubicVertex #else - template + template class POLYVOX_API CubicVertex #endif { public: + + typedef _VoxelType VoxelType; + CubicVertex() { } @@ -97,11 +100,14 @@ namespace PolyVox #ifdef SWIG class MarchingCubesVertex #else - template + template class POLYVOX_API MarchingCubesVertex #endif { public: + + typedef _VoxelType VoxelType; + MarchingCubesVertex() { }