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
path: root/docs
diff options
context:
space:
mode:
authorKostas Karmas <konskarm@gmail.com>2021-01-29 19:22:49 +0300
committerKostas Karmas <konskarm@gmail.com>2021-01-29 19:22:49 +0300
commit1db4cbe5f097b67679ef333ccd6b290cf6f815c2 (patch)
tree76fae7a35fb3266e8eca2269ad0b5e1258f031d7 /docs
parent06666bddcaf962aa8e80ea8819ee54cd0c6b736a (diff)
Add images and text about the 3D scene graph
CURA-7502
Diffstat (limited to 'docs')
-rw-r--r--docs/scene/images/components_interacting_with_scene.jpgbin0 -> 215791 bytes
-rw-r--r--docs/scene/images/components_interacting_with_scene.pngbin0 -> 177707 bytes
-rw-r--r--docs/scene/images/layer_data_scene_node.jpgbin0 -> 83599 bytes
-rw-r--r--docs/scene/images/scene_example.pngbin0 -> 505200 bytes
-rw-r--r--docs/scene/images/scene_example_scene_graph.jpgbin0 -> 335346 bytes
-rw-r--r--docs/scene/scene.md80
6 files changed, 66 insertions, 14 deletions
diff --git a/docs/scene/images/components_interacting_with_scene.jpg b/docs/scene/images/components_interacting_with_scene.jpg
new file mode 100644
index 0000000000..a78d7cffea
--- /dev/null
+++ b/docs/scene/images/components_interacting_with_scene.jpg
Binary files differ
diff --git a/docs/scene/images/components_interacting_with_scene.png b/docs/scene/images/components_interacting_with_scene.png
new file mode 100644
index 0000000000..a01a138811
--- /dev/null
+++ b/docs/scene/images/components_interacting_with_scene.png
Binary files differ
diff --git a/docs/scene/images/layer_data_scene_node.jpg b/docs/scene/images/layer_data_scene_node.jpg
new file mode 100644
index 0000000000..e153953213
--- /dev/null
+++ b/docs/scene/images/layer_data_scene_node.jpg
Binary files differ
diff --git a/docs/scene/images/scene_example.png b/docs/scene/images/scene_example.png
new file mode 100644
index 0000000000..3fee5ae8dd
--- /dev/null
+++ b/docs/scene/images/scene_example.png
Binary files differ
diff --git a/docs/scene/images/scene_example_scene_graph.jpg b/docs/scene/images/scene_example_scene_graph.jpg
new file mode 100644
index 0000000000..5ca91a1041
--- /dev/null
+++ b/docs/scene/images/scene_example_scene_graph.jpg
Binary files differ
diff --git a/docs/scene/scene.md b/docs/scene/scene.md
index 5539df4a67..70361e3786 100644
--- a/docs/scene/scene.md
+++ b/docs/scene/scene.md
@@ -2,6 +2,15 @@ Scene
====
The 3D scene in Cura is designed as a [Scene Graph](https://en.wikipedia.org/wiki/Scene_graph), which is common in many 3D graphics applications. The scene graph of Cura is usually very flat, but has the possibility to have nested objects which inherit transformations from each other.
+Class Diagram
+====
+
+The following class diagram depicts the classes that interact with the Scene
+
+![alt text](images/components_interacting_with_scene.jpg)
+
+The scene lives in the Controller of the Application, and it is primarily interacting with SceneNode objects, which are the components of the Scene Graph.
+
Scene Graph
----
Cura's scene graph is a mere tree data structure. This tree contains all scene nodes, which represent the objects in the 3D scene.
@@ -10,17 +19,60 @@ The main idea behind the scene tree is that each scene node has a transformation
A Typical Scene
----
-Cura's scene has a few nodes that are always present, and a few nodes that are repeated for every object that the user loads onto their build plate. To give an idea of how a scene normally looks, this is an overview of a typical scene tree for Cura.
-
-* Root
- * Camera
- * [Build volume](build_volume.md)
- * Platform
- * Object 1
- * Group 1
- * Object 2
- * Object 3
- * Object 1 convex hull node
- * Object 2 convex hull node
- * Object 3 convex hull node
- * Group 1 convex hull node \ No newline at end of file
+Cura's scene has a few nodes that are always present, and a few nodes that are repeated for every object that the user loads onto their build plate. The root of the scene graph is a SceneNode that lives inside the Scene and contains all the other children SceneNodes of the scene. Typically, inside the root you can find the SceneNodes that are always loaded, such as the Cameras and the [BuildVolume](build_volume.md) (which contains the Platform), and the objects that are loaded on the platform.
+
+Let's take the following example Scene:
+
+![scene_example.png](images/scene_example.png)
+
+The scene graph in this case is the following:
+
+
+![scene_example_scene_graph.png](images/scene_example_scene_graph.jpg)
+
+As it is visible, aside from the BuildVolume, the Cameras, and the objects, the root SceneNode also contains all the ConvexHullNodes, which are used to display the convex hull of each object and each group of objects. A ConvexHullNode is always loaded for each of the existing CuraSceneNodes
+
+
+Accessing SceneNodes in the Scene
+----
+
+SceneNodes can be accessed using a BreadthFirstIterator or a DepthFirstIterator. Each iterator traverses the scene graph and returns a Python iterator, which yield all the SceneNodes and their children.
+
+``` python
+for node in BreadthFirstIterator(scene.getRoot()):
+ # do stuff with the node
+```
+
+Example result when iterating the above scene graph:
+
+```python
+[i for i in BreadthFirstIterator(self._root)]
+```
+ * 00 = {SceneNode} <SceneNode object: 'Root'>
+ * 01 = {BuildVolume} <BuildVolume object '0x2e35dbce108'>
+ * 02 = {Camera} <Camera object: '3d'>
+ * 03 = {CuraSceneNode} <CuraSceneNode object: 'Torus.stl'>
+ * 04 = {CuraSceneNode} <CuraSceneNode object: 'Group #1'>
+ * 05 = {Camera} <Camera object: 'snapshot'>
+ * 06 = {CuraSceneNode} <CuraSceneNode object: 'Star.stl'>
+ * 07 = {ConvexHullNode} <ConvexHullNode object: '0x2e3000def08'>
+ * 08 = {ConvexHullNode} <ConvexHullNode object: '0x2e36861bd88'>
+ * 09 = {ConvexHullNode} <ConvexHullNode object: '0x2e3000bd4c8'>
+ * 10 = {ConvexHullNode} <ConvexHullNode object: '0x2e35fbb62c8'>
+ * 11 = {ConvexHullNode} <ConvexHullNode object: '0x2e3000a0648'>
+ * 12 = {ConvexHullNode} <ConvexHullNode object: '0x2e30019d0c8'>
+ * 13 = {ConvexHullNode} <ConvexHullNode object: '0x2e3001a2dc8'>
+ * 14 = {Platform} <Platform object '0x2e35a001948'>
+ * 15 = {CuraSceneNode} <CuraSceneNode object: 'Group #2'>
+ * 16 = {CuraSceneNode} <CuraSceneNode object: 'Sphere.stl'>
+ * 17 = {CuraSceneNode} <CuraSceneNode object: 'Cylinder.stl'>
+ * 18 = {CuraSceneNode} <CuraSceneNode object: 'Cube.stl'>
+
+Layer Data
+----
+
+Once the Slicing has completed and the CuraEngine has returned the slicing data, Cura creates a CuraSceneNode inside the BuildVolume which holds all the layer data. This CuraSceneNode can be identified via its LayerDataDecorator.
+
+<img src = "https://github.com/Ultimaker/Cura/blob/master/docs/scene/images/layer_data_scene_node.jpg" width = "250" alt="Layer Data Scene Node">
+
+**Note:** This CuraSceneNode is created once Cura has completed processing the Layer data (after the user clicks on the Preview tab after slicing). The CuraSceneNode then is destroyed once any action that changes the Scene occurs (e.g. if the user moves/rotates/scales an object or changes a setting value). \ No newline at end of file