Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Ha <jackha@gmail.com>2018-01-31 19:08:32 +0300
committerJack Ha <jackha@gmail.com>2018-01-31 19:08:32 +0300
commitc42f1868124a5c8d0b67f3235671f2c30707895f (patch)
treef1ff3318b75c12b3de2cd16c39f66e335d9e07ce /cura/PreviewPass.py
parent2fe9860bb913d2a3fd57303ec5010b81cfbbacb9 (diff)
CURA-4425 first thumbnail in UFP file; updated CuraSceneModel and PreviewPass
Diffstat (limited to 'cura/PreviewPass.py')
-rw-r--r--cura/PreviewPass.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/cura/PreviewPass.py b/cura/PreviewPass.py
index c1880e82ef..af42b59b78 100644
--- a/cura/PreviewPass.py
+++ b/cura/PreviewPass.py
@@ -1,7 +1,7 @@
-# Copyright (c) 2017 Ultimaker B.V.
-# Uranium is released under the terms of the LGPLv3 or higher.
-
+# Copyright (c) 2018 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
from UM.Application import Application
+from UM.Math.Color import Color
from UM.Resources import Resources
from UM.View.RenderPass import RenderPass
@@ -39,7 +39,11 @@ class PreviewPass(RenderPass):
def render(self) -> None:
if not self._shader:
- self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "object.shader"))
+ self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "overhang.shader"))
+ self._shader.setUniformValue("u_overhangAngle", 1.0)
+
+ self._gl.glClearColor(0.0, 0.0, 0.0, 0.0)
+ self._gl.glClear(self._gl.GL_COLOR_BUFFER_BIT | self._gl.GL_DEPTH_BUFFER_BIT)
# Create a new batch to be rendered
batch = RenderBatch(self._shader)
@@ -47,7 +51,9 @@ class PreviewPass(RenderPass):
# Fill up the batch with objects that can be sliced. `
for node in DepthFirstIterator(self._scene.getRoot()):
if node.callDecoration("isSliceable") and node.getMeshData() and node.isVisible():
- batch.addItem(node.getWorldTransformation(), node.getMeshData())
+ uniforms = {}
+ uniforms["diffuse_color"] = node.getDiffuseColor()
+ batch.addItem(node.getWorldTransformation(), node.getMeshData(), uniforms = uniforms)
self.bind()
if self._camera is None:
@@ -55,3 +61,4 @@ class PreviewPass(RenderPass):
else:
batch.render(self._camera)
self.release()
+