More tweaks to scaling and translation.
This commit is contained in:
parent
b63a09cab3
commit
22869e4861
@ -91,15 +91,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
//Extract the surface
|
||||
auto meshLowLOD = extractMarchingCubesMesh(&volDataLowLOD, volDataLowLOD.getEnclosingRegion());
|
||||
meshLowLOD.scaleVertices(/*2.0f*/63.0f / 31.0f);
|
||||
|
||||
//Extract the surface
|
||||
auto meshHighLOD = extractMarchingCubesMesh(&volData, PolyVox::Region(Vector3DInt32(30, 0, 0), Vector3DInt32(63, 63, 63)));
|
||||
meshHighLOD.translateVertices(Vector3DFloat(30, 0, 0));
|
||||
|
||||
//Pass the surface to the OpenGL window
|
||||
openGLWidget.addMesh(meshHighLOD);
|
||||
openGLWidget.addMesh(meshLowLOD);
|
||||
openGLWidget.addMesh(meshHighLOD, Vector3DInt32(30, 0, 0));
|
||||
openGLWidget.addMesh(meshLowLOD, Vector3DInt32(0, 0, 0), 63.0f / 31.0f);
|
||||
|
||||
openGLWidget.setViewableRegion(volData.getEnclosingRegion());
|
||||
|
||||
|
@ -136,8 +136,9 @@ void OpenGLWidget::paintGL()
|
||||
for (OpenGLMeshData meshData : mMeshData)
|
||||
{
|
||||
QMatrix4x4 modelToWorldMatrix{};
|
||||
modelToWorldMatrix.translate(meshData.translation.getX(), meshData.translation.getY(), meshData.translation.getZ()); // Centre the model on the origin
|
||||
shader->setUniformValue("modelToWorldMatrix", modelToWorldMatrix); // Update to the latest camera matrix
|
||||
modelToWorldMatrix.translate(meshData.translation.getX(), meshData.translation.getY(), meshData.translation.getZ());
|
||||
modelToWorldMatrix.scale(meshData.scale);
|
||||
shader->setUniformValue("modelToWorldMatrix", modelToWorldMatrix);
|
||||
|
||||
glBindVertexArray(meshData.vertexArrayObject);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user