Small linux fix

This commit is contained in:
David Williams
2009-03-30 22:01:06 +00:00
parent 73d0d9e0d6
commit c66629c1ad
4 changed files with 20 additions and 20 deletions

View File

@ -9,10 +9,10 @@ using namespace std;
void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp) void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp)
{ {
const vector<SurfaceVertex>& vecVertices = isp.getVertices(); const vector<SurfaceVertex>& vecVertices = isp.getVertices();
const vector<uint32_t>& vecIndices = isp.getIndices(); const vector<PolyVox::uint32_t>& vecIndices = isp.getIndices();
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
for(vector<uint32_t>::const_iterator iterIndex = vecIndices.begin(); iterIndex != vecIndices.end(); ++iterIndex) for(vector<PolyVox::uint32_t>::const_iterator iterIndex = vecIndices.begin(); iterIndex != vecIndices.end(); ++iterIndex)
{ {
const SurfaceVertex& vertex = vecVertices[*iterIndex]; const SurfaceVertex& vertex = vecVertices[*iterIndex];
const Vector3DFloat& v3dVertexPos = vertex.getPosition(); const Vector3DFloat& v3dVertexPos = vertex.getPosition();
@ -22,7 +22,7 @@ void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp)
uint8_t material = vertex.getMaterial() + 0.5; PolyVox::uint8_t material = vertex.getMaterial() + 0.5;
OpenGLColour colour = convertMaterialIDToColour(material); OpenGLColour colour = convertMaterialIDToColour(material);

View File

@ -13,7 +13,7 @@ OpenGLSurfacePatch BuildOpenGLSurfacePatch(const IndexedSurfacePatch& isp)
//Convienient access to the vertices and indices //Convienient access to the vertices and indices
const vector<SurfaceVertex>& vecVertices = isp.getVertices(); const vector<SurfaceVertex>& vecVertices = isp.getVertices();
const vector<uint32_t>& vecIndices = isp.getIndices(); const vector<PolyVox::uint32_t>& vecIndices = isp.getIndices();
//If we have any indices... //If we have any indices...
if(!vecIndices.empty()) if(!vecIndices.empty())
@ -26,7 +26,7 @@ OpenGLSurfacePatch BuildOpenGLSurfacePatch(const IndexedSurfacePatch& isp)
GLvoid* pIndices = (GLvoid*)(&(vecIndices[0])); GLvoid* pIndices = (GLvoid*)(&(vecIndices[0]));
//Fill the OpenGL index buffer with our data. //Fill the OpenGL index buffer with our data.
glBufferData(GL_ELEMENT_ARRAY_BUFFER, vecIndices.size() * sizeof(uint32_t), pIndices, GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, vecIndices.size() * sizeof(PolyVox::uint32_t), pIndices, GL_STATIC_DRAW);
} }
result.noOfIndices = vecIndices.size(); result.noOfIndices = vecIndices.size();
@ -57,7 +57,7 @@ OpenGLSurfacePatch BuildOpenGLSurfacePatch(const IndexedSurfacePatch& isp)
*ptr = vertex.getNormal().getZ(); *ptr = vertex.getNormal().getZ();
ptr++; ptr++;
uint8_t material = vertex.getMaterial() + 0.5; PolyVox::uint8_t material = vertex.getMaterial() + 0.5;
OpenGLColour colour = convertMaterialIDToColour(material); OpenGLColour colour = convertMaterialIDToColour(material);

View File

@ -26,11 +26,11 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
{ {
//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(uint16_t uRegionZ = 0; uRegionZ < g_uVolumeSideLengthInRegions; ++uRegionZ) for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < g_uVolumeSideLengthInRegions; ++uRegionZ)
{ {
for(uint16_t uRegionY = 0; uRegionY < g_uVolumeSideLengthInRegions; ++uRegionY) for(PolyVox::uint16_t uRegionY = 0; uRegionY < g_uVolumeSideLengthInRegions; ++uRegionY)
{ {
for(uint16_t uRegionX = 0; uRegionX < g_uVolumeSideLengthInRegions; ++uRegionX) for(PolyVox::uint16_t uRegionX = 0; uRegionX < g_uVolumeSideLengthInRegions; ++uRegionX)
{ {
//Create a new surface patch (which is basiaclly the PolyVox term for a mesh). //Create a new surface patch (which is basiaclly the PolyVox term for a mesh).
IndexedSurfacePatch* ispCurrent = new IndexedSurfacePatch(); IndexedSurfacePatch* ispCurrent = new IndexedSurfacePatch();
@ -38,13 +38,13 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
//Compute the extents of the current region //Compute the extents of the current region
//FIXME - This is a little complex? PolyVox could //FIXME - This is a little complex? PolyVox could
//provide more functions for dealing with regions? //provide more functions for dealing with regions?
uint16_t regionStartX = uRegionX * g_uRegionSideLength; PolyVox::uint16_t regionStartX = uRegionX * g_uRegionSideLength;
uint16_t regionStartY = uRegionY * g_uRegionSideLength; PolyVox::uint16_t regionStartY = uRegionY * g_uRegionSideLength;
uint16_t regionStartZ = uRegionZ * g_uRegionSideLength; PolyVox::uint16_t regionStartZ = uRegionZ * g_uRegionSideLength;
uint16_t regionEndX = regionStartX + g_uRegionSideLength + 1; //Why do we need the '+1' here? PolyVox::uint16_t regionEndX = regionStartX + g_uRegionSideLength + 1; //Why do we need the '+1' here?
uint16_t regionEndY = regionStartY + g_uRegionSideLength + 1; //Why do we need the '+1' here? PolyVox::uint16_t regionEndY = regionStartY + g_uRegionSideLength + 1; //Why do we need the '+1' here?
uint16_t regionEndZ = regionStartZ + g_uRegionSideLength + 1; //Why do we need the '+1' here? PolyVox::uint16_t regionEndZ = regionStartZ + g_uRegionSideLength + 1; //Why do we need the '+1' here?
Vector3DInt32 regLowerCorner(regionStartX, regionStartY, regionStartZ); Vector3DInt32 regLowerCorner(regionStartX, regionStartY, regionStartZ);
Vector3DInt32 regUpperCorner(regionEndX, regionEndY, regionEndZ); Vector3DInt32 regUpperCorner(regionEndX, regionEndY, regionEndZ);
@ -131,11 +131,11 @@ void OpenGLWidget::paintGL()
//Centre the volume on the origin //Centre the volume on the origin
glTranslatef(-g_uVolumeSideLength/2,-g_uVolumeSideLength/2,-g_uVolumeSideLength/2); glTranslatef(-g_uVolumeSideLength/2,-g_uVolumeSideLength/2,-g_uVolumeSideLength/2);
for(uint16_t uRegionZ = 0; uRegionZ < g_uVolumeSideLengthInRegions; ++uRegionZ) for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < g_uVolumeSideLengthInRegions; ++uRegionZ)
{ {
for(uint16_t uRegionY = 0; uRegionY < g_uVolumeSideLengthInRegions; ++uRegionY) for(PolyVox::uint16_t uRegionY = 0; uRegionY < g_uVolumeSideLengthInRegions; ++uRegionY)
{ {
for(uint16_t uRegionX = 0; uRegionX < g_uVolumeSideLengthInRegions; ++uRegionX) for(PolyVox::uint16_t uRegionX = 0; uRegionX < g_uVolumeSideLengthInRegions; ++uRegionX)
{ {
Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ); Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ);
if(m_bUseOpenGLVertexBufferObjects) if(m_bUseOpenGLVertexBufferObjects)

View File

@ -2,7 +2,7 @@
using namespace PolyVox; using namespace PolyVox;
void createSphereInVolume(Volume<uint8_t>& volData, float fRadius, uint8_t uValue) void createSphereInVolume(Volume<PolyVox::uint8_t>& volData, float fRadius, uint8_t uValue)
{ {
//This vector hold the position of the center of the volume //This vector hold the position of the center of the volume
Vector3DFloat v3dVolCenter(volData.getSideLength() / 2, volData.getSideLength() / 2, volData.getSideLength() / 2); Vector3DFloat v3dVolCenter(volData.getSideLength() / 2, volData.getSideLength() / 2, volData.getSideLength() / 2);
@ -30,7 +30,7 @@ void createSphereInVolume(Volume<uint8_t>& volData, float fRadius, uint8_t uValu
} }
} }
void createCubeInVolume(Volume<uint8_t>& volData, Vector3DUint16 lowerCorner, Vector3DUint16 upperCorner, uint8_t uValue) void createCubeInVolume(Volume<PolyVox::uint8_t>& volData, Vector3DUint16 lowerCorner, Vector3DUint16 upperCorner, uint8_t uValue)
{ {
//This three-level for loop iterates over every voxel between the specified corners //This three-level for loop iterates over every voxel between the specified corners
for (int z = lowerCorner.getZ(); z <= upperCorner.getZ(); z++) for (int z = lowerCorner.getZ(); z <= upperCorner.getZ(); z++)