Replaced 'm_region' with 'm_offset' and demonstrated its use.
This commit is contained in:
parent
9fd52e3494
commit
31e5a6e346
@ -130,8 +130,9 @@ int main(int argc, char *argv[])
|
|||||||
// The returned mesh needs to be decoded to be appropriate for GPU rendering.
|
// The returned mesh needs to be decoded to be appropriate for GPU rendering.
|
||||||
auto decodedMesh = decode(mesh);
|
auto decodedMesh = decode(mesh);
|
||||||
|
|
||||||
//Pass the surface to the OpenGL window
|
// Pass the surface to the OpenGL window. Note that we are also passing an offset in this multi-mesh example. This is because
|
||||||
openGLWidget.addMesh(decodedMesh, Vector3DInt32(x, y, z));
|
// the surface extractors return a mesh with 'local space' positions to reduce storage requirements and precision problems.
|
||||||
|
openGLWidget.addMesh(decodedMesh, decodedMesh.getOffset());
|
||||||
|
|
||||||
meshCounter++;
|
meshCounter++;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_meshCurrent->m_Region = m_regSizeInVoxels;
|
m_meshCurrent->setOffset(m_regSizeInVoxels.getLowerCorner());
|
||||||
m_meshCurrent->removeUnusedVertices();
|
m_meshCurrent->removeUnusedVertices();
|
||||||
|
|
||||||
m_meshCurrent->m_vecLodRecords.clear();
|
m_meshCurrent->m_vecLodRecords.clear();
|
||||||
|
@ -122,7 +122,7 @@ namespace PolyVox
|
|||||||
m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
|
m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_meshCurrent->m_Region = m_regSizeInVoxels;
|
m_meshCurrent->setOffset(m_regSizeInVoxels.getLowerCorner());
|
||||||
|
|
||||||
m_meshCurrent->m_vecLodRecords.clear();
|
m_meshCurrent->m_vecLodRecords.clear();
|
||||||
LodRecord lodRecord;
|
LodRecord lodRecord;
|
||||||
|
@ -59,6 +59,9 @@ namespace PolyVox
|
|||||||
uint32_t getNoOfIndices(void) const;
|
uint32_t getNoOfIndices(void) const;
|
||||||
uint32_t getNoOfVertices(void) const;
|
uint32_t getNoOfVertices(void) const;
|
||||||
const std::vector<VertexType>& getVertices(void) const;
|
const std::vector<VertexType>& getVertices(void) const;
|
||||||
|
const Vector3DInt32& getOffset(void) const;
|
||||||
|
|
||||||
|
void setOffset(const Vector3DInt32& offset);
|
||||||
|
|
||||||
void addTriangle(uint32_t index0, uint32_t index1, uint32_t index2);
|
void addTriangle(uint32_t index0, uint32_t index1, uint32_t index2);
|
||||||
uint32_t addVertex(const VertexType& vertex);
|
uint32_t addVertex(const VertexType& vertex);
|
||||||
@ -66,7 +69,7 @@ namespace PolyVox
|
|||||||
bool isEmpty(void) const;
|
bool isEmpty(void) const;
|
||||||
void removeUnusedVertices(void);
|
void removeUnusedVertices(void);
|
||||||
|
|
||||||
Region m_Region;
|
Vector3DInt32 m_offset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<uint32_t> m_vecTriangleIndices;
|
std::vector<uint32_t> m_vecTriangleIndices;
|
||||||
@ -88,7 +91,7 @@ namespace PolyVox
|
|||||||
|
|
||||||
result.m_vecTriangleIndices = mesh.m_vecTriangleIndices;
|
result.m_vecTriangleIndices = mesh.m_vecTriangleIndices;
|
||||||
|
|
||||||
result.m_Region = mesh.m_Region;
|
result.m_offset = mesh.m_offset;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,18 @@ namespace PolyVox
|
|||||||
return m_vecVertices;
|
return m_vecVertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename VertexType>
|
||||||
|
const Vector3DInt32& Mesh<VertexType>::getOffset(void) const
|
||||||
|
{
|
||||||
|
return m_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename VertexType>
|
||||||
|
void Mesh<VertexType>::setOffset(const Vector3DInt32& offset)
|
||||||
|
{
|
||||||
|
m_offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename VertexType>
|
template <typename VertexType>
|
||||||
void Mesh<VertexType>::addTriangle(uint32_t index0, uint32_t index1, uint32_t index2)
|
void Mesh<VertexType>::addTriangle(uint32_t index0, uint32_t index1, uint32_t index2)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user