Templatised code for example mesh conversion.
This commit is contained in:
parent
79acf814db
commit
37bdf8e3ac
@ -16,6 +16,17 @@ OpenGLWidget::OpenGLWidget(QWidget *parent)
|
||||
}
|
||||
|
||||
void OpenGLWidget::setMeshToRender(const PolyVox::Mesh<CubicVertex<uint8_t> >& surfaceMesh)
|
||||
{
|
||||
setMeshToRenderImpl(surfaceMesh);
|
||||
}
|
||||
|
||||
void OpenGLWidget::setMeshToRender(const PolyVox::Mesh<MarchingCubesVertex<uint8_t> >& surfaceMesh)
|
||||
{
|
||||
setMeshToRenderImpl(surfaceMesh);
|
||||
}
|
||||
|
||||
template <typename MeshType>
|
||||
void OpenGLWidget::setMeshToRenderImpl(const MeshType& surfaceMesh)
|
||||
{
|
||||
//Convienient access to the vertices and indices
|
||||
const auto& vecIndices = surfaceMesh.getIndices();
|
||||
|
@ -51,11 +51,15 @@ public:
|
||||
|
||||
// Convert a SurfaceMesh to OpenGL index/vertex buffers
|
||||
void setMeshToRender(const PolyVox::Mesh<PolyVox::CubicVertex<uint8_t> >& surfaceMesh);
|
||||
void setMeshToRender(const PolyVox::Mesh<PolyVox::MarchingCubesVertex<uint8_t> >& surfaceMesh);
|
||||
|
||||
// The viewable region can be adjusted so that this example framework can be use for different volume sizes.
|
||||
void setViewableRegion(PolyVox::Region viewableRegion);
|
||||
|
||||
protected:
|
||||
template <typename MeshType>
|
||||
void setMeshToRenderImpl(const MeshType& surfaceMesh);
|
||||
|
||||
// Qt OpenGL functions
|
||||
void initializeGL();
|
||||
void resizeGL(int w, int h);
|
||||
|
Loading…
x
Reference in New Issue
Block a user