Commit 702585c1 authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

Vizualizator centres the mesh into its view centre automatically:

even when it reads STL (not just after VTK import),
the same translation is used when loading mesh after GUI request.
parent 926f99d9
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -84,12 +84,12 @@ int main(int argc,char **argv)
			std::cout << f << ": triangles #: " << mesh.Ftree[f].ID.size()/3 << "\n";
			std::cout << f << ": normals   #: " << mesh.Ftree[f].norm.size() << "\n";
		}

		//position the mesh with its centre aligned with the scene centre
		mesh.CenterMesh();
		mesh.TranslateMesh(params.sceneCentre - (mesh.meshPlaygroundSize/2.0f - mesh.meshShift));
	}

	//position the mesh with its centre aligned with the scene centre
	mesh.CenterMesh();
	mesh.TranslateMesh(params.sceneCentre - (mesh.meshPlaygroundSize/2.0f - mesh.meshShift));

	//display all the meshes
	initializeGL();
	loopGL();
@@ -189,6 +189,10 @@ bool LoadNewMesh(const char* path,const int ID,const int fileNo)
	//remove last filopodium mesh (which is usually empty...)
	mesh.DiscardLastEmptyFilopodiumObject();

	//position the mesh with its centre aligned with the scene centre
	//keep using the same translation (which had been determined in the main() at startup)
	mesh.TranslateMesh(params.sceneCentre - (mesh.meshPlaygroundSize/2.0f - mesh.meshShift));

	std::cout << "loaded mesh #" << fileNo << " (with " << filoNo-1 << " filopodia)\n";

	//keep (by rotating) vertex positions