Move to VS 2010.
Update to Ogre SDK 1.7.1 Removed support for compilers which don't adhere to C++0X
This commit is contained in:
@ -26,13 +26,15 @@ freely, subject to the following restrictions:
|
||||
|
||||
#include "SurfaceMesh.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
using namespace PolyVox;
|
||||
using namespace std;
|
||||
|
||||
void renderRegionImmediateMode(PolyVox::SurfaceMesh& mesh, unsigned int uLodLevel)
|
||||
{
|
||||
const vector<SurfaceVertex>& vecVertices = mesh.getVertices();
|
||||
const vector<PolyVox::uint32_t>& vecIndices = mesh.getIndices();
|
||||
const vector<uint32_t>& vecIndices = mesh.getIndices();
|
||||
|
||||
int beginIndex = mesh.m_vecLodRecords[uLodLevel].beginIndex;
|
||||
int endIndex = mesh.m_vecLodRecords[uLodLevel].endIndex;
|
||||
@ -49,7 +51,7 @@ void renderRegionImmediateMode(PolyVox::SurfaceMesh& mesh, unsigned int uLodLeve
|
||||
|
||||
|
||||
|
||||
PolyVox::uint8_t material = vertex.getMaterial() + 0.5;
|
||||
uint8_t material = vertex.getMaterial() + 0.5;
|
||||
|
||||
OpenGLColour colour = convertMaterialIDToColour(material);
|
||||
|
||||
|
@ -25,7 +25,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
using namespace PolyVox;
|
||||
|
||||
OpenGLColour convertMaterialIDToColour(PolyVox::uint8_t materialID)
|
||||
OpenGLColour convertMaterialIDToColour(uint8_t materialID)
|
||||
{
|
||||
OpenGLColour colour;
|
||||
|
||||
|
@ -35,6 +35,6 @@ struct OpenGLColour
|
||||
GLfloat blue;
|
||||
};
|
||||
|
||||
OpenGLColour convertMaterialIDToColour(PolyVox::uint8_t materialID);
|
||||
OpenGLColour convertMaterialIDToColour(uint8_t materialID);
|
||||
|
||||
#endif //__OpenGLExample_OpenGLSupport_H__
|
@ -39,7 +39,7 @@ OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const SurfaceMesh& mesh)
|
||||
|
||||
//Convienient access to the vertices and indices
|
||||
const vector<SurfaceVertex>& vecVertices = mesh.getVertices();
|
||||
const vector<PolyVox::uint32_t>& vecIndices = mesh.getIndices();
|
||||
const vector<uint32_t>& vecIndices = mesh.getIndices();
|
||||
|
||||
//If we have any indices...
|
||||
if(!vecIndices.empty())
|
||||
@ -52,7 +52,7 @@ OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const SurfaceMesh& mesh)
|
||||
GLvoid* pIndices = (GLvoid*)(&(vecIndices[0]));
|
||||
|
||||
//Fill the OpenGL index buffer with our data.
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, vecIndices.size() * sizeof(PolyVox::uint32_t), pIndices, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, vecIndices.size() * sizeof(uint32_t), pIndices, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
result.noOfIndices = vecIndices.size();
|
||||
@ -83,7 +83,7 @@ OpenGLSurfaceMesh BuildOpenGLSurfaceMesh(const SurfaceMesh& mesh)
|
||||
*ptr = vertex.getNormal().getZ();
|
||||
ptr++;
|
||||
|
||||
PolyVox::uint8_t material = vertex.getMaterial() + 0.5;
|
||||
uint8_t material = vertex.getMaterial() + 0.5;
|
||||
|
||||
OpenGLColour colour = convertMaterialIDToColour(material);
|
||||
|
||||
|
@ -48,7 +48,7 @@ OpenGLWidget::OpenGLWidget(QWidget *parent)
|
||||
timer->start(0);
|
||||
}
|
||||
|
||||
void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
||||
void OpenGLWidget::setVolume(PolyVox::Volume<uint8_t>* volData)
|
||||
{
|
||||
//First we free anything from the previous volume (if there was one).
|
||||
m_mapOpenGLSurfaceMeshes.clear();
|
||||
@ -66,30 +66,30 @@ 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.
|
||||
//This three-level for loop iterates over each region.
|
||||
for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < m_uVolumeDepthInRegions; ++uRegionZ)
|
||||
for(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(uint16_t uRegionY = 0; uRegionY < m_uVolumeHeightInRegions; ++uRegionY)
|
||||
{
|
||||
for(PolyVox::uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
|
||||
for(uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
|
||||
{
|
||||
//Compute the extents of the current region
|
||||
//FIXME - This is a little complex? PolyVox could
|
||||
//provide more functions for dealing with regions?
|
||||
PolyVox::uint16_t regionStartX = uRegionX * m_uRegionSideLength;
|
||||
PolyVox::uint16_t regionStartY = uRegionY * m_uRegionSideLength;
|
||||
PolyVox::uint16_t regionStartZ = uRegionZ * m_uRegionSideLength;
|
||||
uint16_t regionStartX = uRegionX * m_uRegionSideLength;
|
||||
uint16_t regionStartY = uRegionY * m_uRegionSideLength;
|
||||
uint16_t regionStartZ = uRegionZ * m_uRegionSideLength;
|
||||
|
||||
PolyVox::uint16_t regionEndX = regionStartX + m_uRegionSideLength;
|
||||
PolyVox::uint16_t regionEndY = regionStartY + m_uRegionSideLength;
|
||||
PolyVox::uint16_t regionEndZ = regionStartZ + m_uRegionSideLength;
|
||||
uint16_t regionEndX = regionStartX + m_uRegionSideLength;
|
||||
uint16_t regionEndY = regionStartY + m_uRegionSideLength;
|
||||
uint16_t regionEndZ = regionStartZ + m_uRegionSideLength;
|
||||
|
||||
Vector3DInt16 regLowerCorner(regionStartX, regionStartY, regionStartZ);
|
||||
Vector3DInt16 regUpperCorner(regionEndX, regionEndY, regionEndZ);
|
||||
|
||||
//Extract the surface for this region
|
||||
//extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), meshCurrent);
|
||||
POLYVOX_SHARED_PTR<SurfaceMesh> mesh = surfaceExtractor.extractSurfaceForRegion(PolyVox::Region(regLowerCorner, regUpperCorner));
|
||||
shared_ptr<SurfaceMesh> mesh = surfaceExtractor.extractSurfaceForRegion(PolyVox::Region(regLowerCorner, regUpperCorner));
|
||||
|
||||
//computeNormalsForVertices(m_volData, *(mesh.get()), SOBEL_SMOOTHED);
|
||||
//*meshCurrent = getSmoothedSurface(*meshCurrent);
|
||||
@ -218,16 +218,16 @@ void OpenGLWidget::paintGL()
|
||||
//Centre the volume on the origin
|
||||
glTranslatef(-g_uVolumeSideLength/2,-g_uVolumeSideLength/2,-g_uVolumeSideLength/2);
|
||||
|
||||
for(PolyVox::uint16_t uRegionZ = 0; uRegionZ < m_uVolumeDepthInRegions; ++uRegionZ)
|
||||
for(uint16_t uRegionZ = 0; uRegionZ < m_uVolumeDepthInRegions; ++uRegionZ)
|
||||
{
|
||||
for(PolyVox::uint16_t uRegionY = 0; uRegionY < m_uVolumeHeightInRegions; ++uRegionY)
|
||||
for(uint16_t uRegionY = 0; uRegionY < m_uVolumeHeightInRegions; ++uRegionY)
|
||||
{
|
||||
for(PolyVox::uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
|
||||
for(uint16_t uRegionX = 0; uRegionX < m_uVolumeWidthInRegions; ++uRegionX)
|
||||
{
|
||||
Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ);
|
||||
if(m_mapSurfaceMeshes.find(v3dRegPos) != m_mapSurfaceMeshes.end())
|
||||
{
|
||||
POLYVOX_SHARED_PTR<SurfaceMesh> meshCurrent = m_mapSurfaceMeshes[v3dRegPos];
|
||||
shared_ptr<SurfaceMesh> meshCurrent = m_mapSurfaceMeshes[v3dRegPos];
|
||||
unsigned int uLodLevel = 0; //meshCurrent->m_vecLodRecords.size() - 1;
|
||||
if(m_bUseOpenGLVertexBufferObjects)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ freely, subject to the following restrictions:
|
||||
#include "OpenGLVertexBufferObjectSupport.h"
|
||||
#include "Shapes.h"
|
||||
|
||||
const PolyVox::uint16_t g_uVolumeSideLength = 128;
|
||||
const uint16_t g_uVolumeSideLength = 128;
|
||||
|
||||
class OpenGLWidget : public QGLWidget
|
||||
{
|
||||
@ -45,7 +45,7 @@ class OpenGLWidget : public QGLWidget
|
||||
public:
|
||||
OpenGLWidget(QWidget *parent);
|
||||
|
||||
void setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData);
|
||||
void setVolume(PolyVox::Volume<uint8_t>* volData);
|
||||
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
@ -69,11 +69,11 @@ class OpenGLWidget : public QGLWidget
|
||||
bool m_bUseOpenGLVertexBufferObjects;
|
||||
|
||||
//Creates a volume 128x128x128
|
||||
PolyVox::Volume<PolyVox::uint8_t>* m_volData;
|
||||
PolyVox::Volume<uint8_t>* m_volData;
|
||||
|
||||
//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region
|
||||
std::map<PolyVox::Vector3DUint8, OpenGLSurfaceMesh> m_mapOpenGLSurfaceMeshes;
|
||||
std::map<PolyVox::Vector3DUint8, POLYVOX_SHARED_PTR<PolyVox::SurfaceMesh> > m_mapSurfaceMeshes;
|
||||
std::map<PolyVox::Vector3DUint8, std::shared_ptr<PolyVox::SurfaceMesh> > m_mapSurfaceMeshes;
|
||||
|
||||
unsigned int m_uRegionSideLength;
|
||||
unsigned int m_uVolumeWidthInRegions;
|
||||
|
@ -25,7 +25,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(Volume<PolyVox::uint8_t>& volData, float fRadius, PolyVox::uint8_t uValue)
|
||||
void createSphereInVolume(Volume<uint8_t>& volData, float fRadius, uint8_t uValue)
|
||||
{
|
||||
//This vector hold the position of the center of the volume
|
||||
Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
|
||||
@ -53,7 +53,7 @@ void createSphereInVolume(Volume<PolyVox::uint8_t>& volData, float fRadius, Poly
|
||||
}
|
||||
}
|
||||
|
||||
void createCubeInVolume(Volume<PolyVox::uint8_t>& volData, Vector3DUint16 lowerCorner, Vector3DUint16 upperCorner, PolyVox::uint8_t uValue)
|
||||
void createCubeInVolume(Volume<uint8_t>& volData, Vector3DUint16 lowerCorner, Vector3DUint16 upperCorner, uint8_t uValue)
|
||||
{
|
||||
//This three-level for loop iterates over every voxel between the specified corners
|
||||
for (int z = lowerCorner.getZ(); z <= upperCorner.getZ(); z++)
|
||||
|
@ -26,7 +26,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
#include "Volume.h"
|
||||
|
||||
void createSphereInVolume(PolyVox::Volume<PolyVox::uint8_t>& volData, float fRadius, PolyVox::uint8_t uValue);
|
||||
void createCubeInVolume(PolyVox::Volume<PolyVox::uint8_t>& volData, PolyVox::Vector3DUint16 lowerCorner, PolyVox::Vector3DUint16 upperCorner, PolyVox::uint8_t uValue);
|
||||
void createSphereInVolume(PolyVox::Volume<uint8_t>& volData, float fRadius, uint8_t uValue);
|
||||
void createCubeInVolume(PolyVox::Volume<uint8_t>& volData, PolyVox::Vector3DUint16 lowerCorner, PolyVox::Vector3DUint16 upperCorner, uint8_t uValue);
|
||||
|
||||
#endif //__OpenGLExample_Shapes_H__
|
@ -70,12 +70,12 @@ void exampleLog(string message, int severity)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
logHandler = &exampleLog;
|
||||
Volume<PolyVox::uint8_t> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength);
|
||||
Volume<uint8_t> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength);
|
||||
|
||||
//Make our volume contain a sphere in the center.
|
||||
PolyVox::uint16_t minPos = 0;
|
||||
PolyVox::uint16_t midPos = g_uVolumeSideLength / 2;
|
||||
PolyVox::uint16_t maxPos = g_uVolumeSideLength - 1;
|
||||
uint16_t minPos = 0;
|
||||
uint16_t midPos = g_uVolumeSideLength / 2;
|
||||
uint16_t maxPos = g_uVolumeSideLength - 1;
|
||||
//createCubeInVolume(volData, Vector3DUint16(minPos, minPos, minPos), Vector3DUint16(maxPos, maxPos, maxPos), 0);
|
||||
|
||||
cout << "Creating sphere 1" << std::endl;
|
||||
|
Reference in New Issue
Block a user