Changing the way the examples handle translation and scaling.
This commit is contained in:
parent
6738c4fc9e
commit
b63a09cab3
@ -192,7 +192,7 @@ int main(int argc, char *argv[])
|
||||
auto mesh = extractMarchingCubesMesh(&volData, regToExtract);
|
||||
|
||||
//Pass the surface to the OpenGL window
|
||||
openGLWidget.addMesh(mesh);
|
||||
openGLWidget.addMesh(mesh, Vector3DInt32(x, y, z));
|
||||
|
||||
meshCounter++;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ struct OpenGLMeshData
|
||||
GLuint vertexBuffer;
|
||||
GLuint vertexArrayObject;
|
||||
PolyVox::Vector3DInt32 translation;
|
||||
float scale;
|
||||
};
|
||||
|
||||
class OpenGLWidget : public QGLWidget
|
||||
@ -60,7 +61,7 @@ public:
|
||||
|
||||
// Convert a SurfaceMesh to OpenGL index/vertex buffers. Inlined because it's templatised.
|
||||
template <typename MeshType>
|
||||
void addMesh(const MeshType& surfaceMesh)
|
||||
void addMesh(const MeshType& surfaceMesh, const PolyVox::Vector3DInt32& translation = PolyVox::Vector3DInt32(0, 0, 0), float scale = 1.0f)
|
||||
{
|
||||
//Convienient access to the vertices and indices
|
||||
const auto& vecIndices = surfaceMesh.getIndices();
|
||||
@ -99,7 +100,8 @@ public:
|
||||
|
||||
meshData.noOfIndices = vecIndices.size(); //Save this for the call to glDrawElements later
|
||||
|
||||
meshData.translation = surfaceMesh.m_Region.getLowerCorner();
|
||||
meshData.translation = translation;
|
||||
meshData.scale = scale;
|
||||
|
||||
mMeshData.push_back(meshData);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user