Work on Qt version of example.

This commit is contained in:
David Williams
2009-03-28 00:27:35 +00:00
parent dc39415eb8
commit ee5e33612c
2 changed files with 61 additions and 50 deletions

View File

@ -13,14 +13,41 @@
#include <QApplication>
//Some namespaces we need
using namespace std;
using namespace PolyVox;
using namespace std;
int main(int argc, char *argv[])
{
Volume<uint8> volData(g_uVolumeSideLength);
//Make our volume contain a sphere in the center.
uint16 minPos = 0;
uint16 midPos = volData.getSideLength() / 2;
uint16 maxPos = volData.getSideLength() - 1;
createCubeInVolume(volData, Vector3DUint16(minPos, minPos, minPos), Vector3DUint16(maxPos, maxPos, maxPos), 0);
createSphereInVolume(volData, 50.0f, 5);
createSphereInVolume(volData, 40.0f, 4);
createSphereInVolume(volData, 30.0f, 3);
createSphereInVolume(volData, 20.0f, 2);
createSphereInVolume(volData, 10.0f, 1);
createCubeInVolume(volData, Vector3DUint16(minPos, minPos, minPos), Vector3DUint16(midPos-1, midPos-1, midPos-1), 0);
createCubeInVolume(volData, Vector3DUint16(midPos+1, midPos+1, minPos), Vector3DUint16(maxPos, maxPos, midPos-1), 0);
createCubeInVolume(volData, Vector3DUint16(midPos+1, minPos, midPos+1), Vector3DUint16(maxPos, midPos-1, maxPos), 0);
createCubeInVolume(volData, Vector3DUint16(minPos, midPos+1, midPos+1), Vector3DUint16(midPos-1, maxPos, maxPos), 0);
QApplication app(argc, argv);
OpenGLWidget openGLWidget(0);
openGLWidget.show();
openGLWidget.setVolume(&volData);
return app.exec();
}