Tidying up and Linux fixes for basic example.
This commit is contained in:
parent
4478037edc
commit
248c5f72fd
@ -26,9 +26,7 @@ distribution.
|
|||||||
|
|
||||||
#include "SurfaceMesh.h"
|
#include "SurfaceMesh.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "glew/glew.h"
|
#include "glew/glew.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
@ -55,7 +53,7 @@ private:
|
|||||||
//Index/vertex buffer data
|
//Index/vertex buffer data
|
||||||
GLuint m_uBeginIndex;
|
GLuint m_uBeginIndex;
|
||||||
GLuint m_uEndIndex;
|
GLuint m_uEndIndex;
|
||||||
GLulong noOfIndices;
|
GLuint noOfIndices;
|
||||||
GLuint indexBuffer;
|
GLuint indexBuffer;
|
||||||
GLuint vertexBuffer;
|
GLuint vertexBuffer;
|
||||||
|
|
||||||
|
@ -30,10 +30,8 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
//Some namespaces we need
|
//Use the PolyVox namespace
|
||||||
using namespace std;
|
|
||||||
using namespace PolyVox;
|
using namespace PolyVox;
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
void createSphereInVolume(Volume<MaterialDensityPair44>& volData, float fRadius, uint8_t uValue)
|
void createSphereInVolume(Volume<MaterialDensityPair44>& volData, float fRadius, uint8_t uValue)
|
||||||
{
|
{
|
||||||
@ -71,28 +69,24 @@ void createSphereInVolume(Volume<MaterialDensityPair44>& volData, float fRadius,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const uint16_t g_uVolumeSideLength = 64;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
//Create and show the Qt OpenGL window
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
OpenGLWidget openGLWidget(0);
|
OpenGLWidget openGLWidget(0);
|
||||||
openGLWidget.show();
|
openGLWidget.show();
|
||||||
|
|
||||||
Volume<MaterialDensityPair44> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength);
|
//Create an empty volume and then place a sphere in it
|
||||||
|
Volume<MaterialDensityPair44> volData(64, 64, 64);
|
||||||
createSphereInVolume(volData, 30, 1);
|
createSphereInVolume(volData, 30, 1);
|
||||||
|
|
||||||
|
//Extract the surface
|
||||||
SurfaceExtractor<MaterialDensityPair44> surfaceExtractor(volData);
|
SurfaceExtractor<MaterialDensityPair44> surfaceExtractor(volData);
|
||||||
|
|
||||||
shared_ptr<SurfaceMesh> surface = surfaceExtractor.extractSurfaceForRegion(volData.getEnclosingRegion());
|
shared_ptr<SurfaceMesh> surface = surfaceExtractor.extractSurfaceForRegion(volData.getEnclosingRegion());
|
||||||
|
|
||||||
//OpenGLSurfaceMesh mesh = BuildOpenGLSurfaceMesh(*surface);
|
//Pass the surface to the OpenGL window
|
||||||
|
|
||||||
|
|
||||||
//openGLWidget.mesh = BuildOpenGLSurfaceMesh(*(surface.get()));
|
|
||||||
//openGLWidget.surfaceMesh = *surface;
|
|
||||||
openGLWidget.setSurfaceMeshToRender(*surface);
|
openGLWidget.setSurfaceMeshToRender(*surface);
|
||||||
|
|
||||||
|
//Run the message pump.
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user