Adjusting example to use non-cubic volume...
This commit is contained in:
parent
0b847eb271
commit
2b5b076b98
@ -32,6 +32,10 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
|||||||
//If we have any volume data then generate the new surface patches.
|
//If we have any volume data then generate the new surface patches.
|
||||||
if(m_volData != 0)
|
if(m_volData != 0)
|
||||||
{
|
{
|
||||||
|
m_uVolumeWidthInRegions = volData->getWidth() / m_uRegionSideLength;
|
||||||
|
m_uVolumeHeightInRegions = volData->getHeight() / m_uRegionSideLength;
|
||||||
|
m_uVolumeDepthInRegions = volData->getDepth() / m_uRegionSideLength;
|
||||||
|
|
||||||
//Our volume is broken down into cuboid regions, and we create one mesh for each region.
|
//Our volume is broken down into cuboid regions, and we create one mesh for each region.
|
||||||
//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 < g_uVolumeSideLengthInRegions; ++uRegionZ)
|
for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < g_uVolumeSideLengthInRegions; ++uRegionZ)
|
||||||
@ -81,6 +85,8 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_distance = m_volData->getLongestSideLength() / -2.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,11 @@ class OpenGLWidget : public QGLWidget
|
|||||||
//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region
|
//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region
|
||||||
std::map<PolyVox::Vector3DUint8, OpenGLSurfacePatch> m_mapOpenGLSurfacePatches;
|
std::map<PolyVox::Vector3DUint8, OpenGLSurfacePatch> m_mapOpenGLSurfacePatches;
|
||||||
std::map<PolyVox::Vector3DUint8, PolyVox::IndexedSurfacePatch*> m_mapIndexedSurfacePatches;
|
std::map<PolyVox::Vector3DUint8, PolyVox::IndexedSurfacePatch*> m_mapIndexedSurfacePatches;
|
||||||
|
|
||||||
|
unsigned int m_uRegionSideLength;
|
||||||
|
unsigned int m_uVolumeWidthInRegions;
|
||||||
|
unsigned int m_uVolumeHeightInRegions;
|
||||||
|
unsigned int m_uVolumeDepthInRegions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__PolyVox_OpenGLWidget_H__
|
#endif //__PolyVox_OpenGLWidget_H__
|
Loading…
x
Reference in New Issue
Block a user