Tidying up.
This commit is contained in:
parent
6cbb2d44bf
commit
f65edddd81
@ -77,7 +77,7 @@ public:
|
|||||||
//The GL_ARRAY_BUFFER will contain the list of vertex positions
|
//The GL_ARRAY_BUFFER will contain the list of vertex positions
|
||||||
glGenBuffers(1, &(meshData.vertexBuffer));
|
glGenBuffers(1, &(meshData.vertexBuffer));
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, meshData.vertexBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, meshData.vertexBuffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, vecVertices.size() * sizeof(CubicVertex<uint8_t>), 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
|
//and GL_ELEMENT_ARRAY_BUFFER will contain the indices
|
||||||
glGenBuffers(1, &(meshData.indexBuffer));
|
glGenBuffers(1, &(meshData.indexBuffer));
|
||||||
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
//We need to tell OpenGL how to understand the format of the vertex data
|
//We need to tell OpenGL how to understand the format of the vertex data
|
||||||
glEnableVertexAttribArray(0); //We're talking about shader attribute '0'
|
glEnableVertexAttribArray(0); //We're talking about shader attribute '0'
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(CubicVertex<uint8_t>), 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);
|
glBindVertexArray(0);
|
||||||
|
|
||||||
|
@ -45,10 +45,13 @@ namespace PolyVox
|
|||||||
int endIndex; //Let's put it just past the end STL style
|
int endIndex; //Let's put it just past the end STL style
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename VertexType>
|
template <typename _VertexType>
|
||||||
class Mesh
|
class Mesh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef _VertexType VertexType;
|
||||||
|
|
||||||
Mesh();
|
Mesh();
|
||||||
~Mesh();
|
~Mesh();
|
||||||
|
|
||||||
|
@ -36,11 +36,14 @@ namespace PolyVox
|
|||||||
#ifdef SWIG
|
#ifdef SWIG
|
||||||
class CubicVertex
|
class CubicVertex
|
||||||
#else
|
#else
|
||||||
template<typename VoxelType>
|
template<typename _VoxelType>
|
||||||
class POLYVOX_API CubicVertex
|
class POLYVOX_API CubicVertex
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef _VoxelType VoxelType;
|
||||||
|
|
||||||
CubicVertex()
|
CubicVertex()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -97,11 +100,14 @@ namespace PolyVox
|
|||||||
#ifdef SWIG
|
#ifdef SWIG
|
||||||
class MarchingCubesVertex
|
class MarchingCubesVertex
|
||||||
#else
|
#else
|
||||||
template<typename VoxelType>
|
template<typename _VoxelType>
|
||||||
class POLYVOX_API MarchingCubesVertex
|
class POLYVOX_API MarchingCubesVertex
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef _VoxelType VoxelType;
|
||||||
|
|
||||||
MarchingCubesVertex()
|
MarchingCubesVertex()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user