From 4572c7a9b751430bacfb04f602c39398e79ebc07 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 8 Dec 2014 17:52:17 +0100 Subject: [PATCH] Fix the cameras etc of the default setup --- PrinterApplication.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/PrinterApplication.py b/PrinterApplication.py index a5b47c9934..0e74b05ac8 100644 --- a/PrinterApplication.py +++ b/PrinterApplication.py @@ -25,38 +25,46 @@ class PrinterApplication(QtApplication): mesh.setMeshData(self.getMeshFileHandler().read(Resources.getMesh("ultimaker2_platform.stl"), self.getStorageDevice('local'))) mesh2 = SceneNode(mesh) - mesh2.setMeshData(self.getMeshFileHandler().read(Resources.getMesh("sphere.obj"), self.getStorageDevice('local'))) - mesh2.translate(Vector(0, 50, 0)) - mesh2.scale(20) + mesh2.setMeshData(self.getMeshFileHandler().read(Resources.getMesh("simplecube.stl"), self.getStorageDevice('local'))) + mesh2.translate(Vector(30, 30, 0)) + mesh2.scale(10) + + mesh3 = SceneNode(mesh) + mesh3.setMeshData(self.getMeshFileHandler().read(Resources.getMesh("sphere.obj"), self.getStorageDevice('local'))) + mesh3.translate(Vector(0, 0, 0)) + + self.getRenderer().setLightPosition(Vector(0, 150, 150)) camera = Camera('3d', root) camera.translate(Vector(0, 150, 150)) proj = Matrix() - proj.setOrtho(-200, 200, -200, 200, -500, 500) + proj.setPerspective(45, 640/480, 1, 500) camera.setProjectionMatrix(proj) - camera.rotateByAngleAxis(-45, Vector(1, 0, 0)) + camera.setPerspective(True) + camera.lookAt(Vector(0, 0, 0), Vector(0, 1, 0)) camera = Camera('left', root) - camera.translate(Vector(150, 0, 0)) - camera.rotateByAngleAxis(-90, Vector(0, 1, 0)) + camera.translate(Vector(150, 50, 0)) proj = Matrix() - proj.setOrtho(-200, 200, -200, 200, -500, 500) + proj.setOrtho(-200, 200, -200, 200, 1, 500) camera.setProjectionMatrix(proj) + camera.lookAt(Vector(0, 0, 0), Vector(0, 1, 0)) camera.setLocked(True) camera = Camera('top', root) camera.translate(Vector(0, 150, 0)) - camera.rotateByAngleAxis(-90, Vector(1, 0, 0)) proj = Matrix() - proj.setOrtho(-200, 200, -200, 200, -500, 500) + proj.setOrtho(-200, 200, -200, 200, 1, 500) camera.setProjectionMatrix(proj) + camera.lookAt(Vector(0, 0, 0), Vector(0, 1, 0)) camera.setLocked(True) camera = Camera('front', root) - camera.translate(Vector(0, 0, 150)) + camera.translate(Vector(0, 50, 150)) proj = Matrix() - proj.setOrtho(-200, 200, -200, 200, -500, 500) + proj.setOrtho(-200, 200, -200, 200, 1, 500) camera.setProjectionMatrix(proj) + camera.lookAt(Vector(0, 0, 0), Vector(0, 1, 0)) camera.setLocked(True) self.getController().getScene().setActiveCamera('3d')