Small changes for the purpose of profiling.
This commit is contained in:
parent
362bf9283a
commit
6da15633e6
@ -16,7 +16,7 @@ OpenGLWidget::OpenGLWidget(QWidget *parent)
|
|||||||
{
|
{
|
||||||
m_xRotation = 0;
|
m_xRotation = 0;
|
||||||
m_yRotation = 0;
|
m_yRotation = 0;
|
||||||
m_uRegionSideLength = 16.0f;
|
m_uRegionSideLength = 32.0f;
|
||||||
|
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
@ -41,6 +41,7 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
|||||||
//This three-level for loop iterates over each region.
|
//This three-level for loop iterates over each region.
|
||||||
for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < m_uVolumeDepthInRegions; ++uRegionZ)
|
for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < m_uVolumeDepthInRegions; ++uRegionZ)
|
||||||
{
|
{
|
||||||
|
std::cout << "uRegionZ = " << uRegionZ << " of " << m_uVolumeDepthInRegions << std::endl;
|
||||||
for(PolyVox::uint16_t uRegionY = 0; uRegionY < m_uVolumeHeightInRegions; ++uRegionY)
|
for(PolyVox::uint16_t uRegionY = 0; uRegionY < m_uVolumeHeightInRegions; ++uRegionY)
|
||||||
{
|
{
|
||||||
for(PolyVox::uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
|
for(PolyVox::uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
|
||||||
@ -63,13 +64,10 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
|||||||
Vector3DInt32 regUpperCorner(regionEndX, regionEndY, regionEndZ);
|
Vector3DInt32 regUpperCorner(regionEndX, regionEndY, regionEndZ);
|
||||||
|
|
||||||
//Extract the surface for this region
|
//Extract the surface for this region
|
||||||
extractReferenceSurface(m_volData, PolyVox::Region(regLowerCorner, regUpperCorner), ispCurrent);
|
extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), ispCurrent);
|
||||||
computeNormalsForVertices(m_volData, *ispCurrent, SOBEL_SMOOTHED);
|
|
||||||
|
|
||||||
//for(int ct = 0; ct < 100; ct++)
|
//computeNormalsForVertices(m_volData, *ispCurrent, SOBEL_SMOOTHED);
|
||||||
//{
|
//*ispCurrent = getSmoothedSurface(*ispCurrent);
|
||||||
*ispCurrent = getSmoothedSurface(*ispCurrent);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ);
|
Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ);
|
||||||
@ -94,7 +92,7 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
|||||||
|
|
||||||
void OpenGLWidget::initializeGL()
|
void OpenGLWidget::initializeGL()
|
||||||
{
|
{
|
||||||
m_bUseOpenGLVertexBufferObjects = true;
|
m_bUseOpenGLVertexBufferObjects = false;
|
||||||
if(m_bUseOpenGLVertexBufferObjects)
|
if(m_bUseOpenGLVertexBufferObjects)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#include "Shapes.h"
|
#include "Shapes.h"
|
||||||
|
|
||||||
const PolyVox::uint16_t g_uVolumeSideLength = 128;
|
const PolyVox::uint16_t g_uVolumeSideLength = 128;
|
||||||
//const PolyVox::uint16_t g_uRegionSideLength = 16;
|
|
||||||
//const PolyVox::uint16_t g_uVolumeSideLengthInRegions = g_uVolumeSideLength / g_uRegionSideLength;
|
|
||||||
|
|
||||||
class OpenGLWidget : public QGLWidget
|
class OpenGLWidget : public QGLWidget
|
||||||
{
|
{
|
||||||
|
@ -53,20 +53,28 @@ int main(int argc, char *argv[])
|
|||||||
PolyVox::uint16_t minPos = 0;
|
PolyVox::uint16_t minPos = 0;
|
||||||
PolyVox::uint16_t midPos = g_uVolumeSideLength / 2;
|
PolyVox::uint16_t midPos = g_uVolumeSideLength / 2;
|
||||||
PolyVox::uint16_t maxPos = g_uVolumeSideLength - 1;
|
PolyVox::uint16_t maxPos = g_uVolumeSideLength - 1;
|
||||||
createCubeInVolume(volData, Vector3DUint16(minPos, minPos, minPos), Vector3DUint16(maxPos, maxPos, maxPos), 0);
|
//createCubeInVolume(volData, Vector3DUint16(minPos, minPos, minPos), Vector3DUint16(maxPos, maxPos, maxPos), 0);
|
||||||
|
|
||||||
createSphereInVolume(volData, 50.0f, 5);
|
cout << "Creating sphere 1" << std::endl;
|
||||||
createSphereInVolume(volData, 40.0f, 4);
|
createSphereInVolume(volData, 60.0f, 5);
|
||||||
createSphereInVolume(volData, 30.0f, 3);
|
cout << "Creating sphere 2" << std::endl;
|
||||||
createSphereInVolume(volData, 20.0f, 2);
|
createSphereInVolume(volData, 50.0f, 4);
|
||||||
createSphereInVolume(volData, 10.0f, 1);
|
cout << "Creating sphere 3" << std::endl;
|
||||||
|
createSphereInVolume(volData, 40.0f, 3);
|
||||||
|
cout << "Creating sphere 4" << std::endl;
|
||||||
|
createSphereInVolume(volData, 30.0f, 2);
|
||||||
|
cout << "Creating sphere 5" << std::endl;
|
||||||
|
createSphereInVolume(volData, 20.0f, 1);
|
||||||
|
|
||||||
|
cout << "Creating cubes" << std::endl;
|
||||||
createCubeInVolume(volData, Vector3DUint16(minPos, minPos, minPos), Vector3DUint16(midPos-1, midPos-1, midPos-1), 0);
|
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, 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(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);
|
createCubeInVolume(volData, Vector3DUint16(minPos, midPos+1, midPos+1), Vector3DUint16(midPos-1, maxPos, maxPos), 0);
|
||||||
|
|
||||||
|
cout << "Tidying memory...";
|
||||||
volData.tidyUpMemory(0);
|
volData.tidyUpMemory(0);
|
||||||
|
cout << "done." << endl;
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ namespace PolyVox
|
|||||||
void setNormal(const Vector3DFloat& normalToSet);
|
void setNormal(const Vector3DFloat& normalToSet);
|
||||||
void setPosition(const Vector3DFloat& positionToSet);
|
void setPosition(const Vector3DFloat& positionToSet);
|
||||||
|
|
||||||
std::string tostring(void) const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Vector3DFloat position;
|
Vector3DFloat position;
|
||||||
Vector3DFloat normal;
|
Vector3DFloat normal;
|
||||||
|
@ -72,11 +72,4 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
position = positionToSet;
|
position = positionToSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SurfaceVertex::tostring(void) const
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << "SurfaceVertex: Position = (" << position.getX() << "," << position.getY() << "," << position.getZ() << "), Normal = " << normal;
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user