|
1 | | -""" |
2 | | -Followed the following guide: |
3 | | -https://pomb.us/build-your-own-react/ |
4 | | -and implemented it in Python. |
5 | | -
|
6 | | -Example 'React' code: |
7 | | -
|
8 | | -<Group name="Landmarks"> |
9 | | - <Point name="Hip" position="[1, 1, 1]" /> |
10 | | -</Group> |
11 | | -
|
12 | | -This can be transpiled to a tree of 'VNodes'. |
13 | | -Instead of JSX/Vue template, this could also be just creating |
14 | | -the tree of VNodes 'manually'. |
15 | | -VNodes are essentially a description of the to-be-displayed item. |
16 | | -
|
17 | | -1. Create tree of VNodes |
18 | | -2. Render the tree (see __init__.py) |
19 | | - - Split up the work in smaller chunks (node-by-node) |
20 | | - - Build up a 'work-in-progress' tree of 'fibers' |
21 | | - - Once it is ready, compare this tree with the 'current' tree (reconciliation) |
22 | | - - The renderer that is called during reconciliation creates the actual 'dom' nodes, |
23 | | - so a PygfxRenderer for instance would know how to reconcile a tree of pygfx |
24 | | - objects. |
25 | | -
|
26 | | -""" |
27 | 1 | from point_cloud import materials, PointCloud, sphere_geom |
28 | 2 | import pygfx as gfx |
29 | 3 | from wgpu.gui.auto import run, WgpuCanvas |
|
36 | 10 | canvas = WgpuCanvas(size=(600, 400)) |
37 | 11 | renderer = gfx.renderers.WgpuRenderer(canvas) |
38 | 12 |
|
39 | | - camera = gfx.PerspectiveCamera(60, 16 / 9) |
| 13 | + camera = gfx.PerspectiveCamera(70, 16 / 9) |
40 | 14 | camera.position.z = 15 |
41 | 15 |
|
42 | 16 | controls = gfx.OrbitController(camera.position.clone()) |
|
52 | 26 | { |
53 | 27 | "name": "Landmarks", |
54 | 28 | }, |
| 29 | + h("AmbientLight"), |
| 30 | + h("PointLight", {"position": [0, 70, 70], "cast_shadow": True}), |
55 | 31 | h( |
56 | 32 | PointCloud, |
57 | 33 | # When increasing this number, it will take longer |
|
0 commit comments