File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed
Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ from processing import *
2+ from math import sin , cos
3+ from random import gauss
4+
5+ geometry = None
6+
7+ def setup ():
8+ global geometry
9+ size (800 , 600 )
10+ mode_3d ()
11+ create_geometry ()
12+
13+ def draw ():
14+ global geometry
15+
16+ camera_position (150.0 , 150.0 , 150.0 )
17+ camera_look_at ( 0.0 , 0.0 , 0.0 )
18+ background (220 , 200 , 140 )
19+
20+ draw_geometry (geometry )
21+
22+ def create_geometry ():
23+ global geometry
24+
25+ beginGeometry ()
26+
27+ for i in range (60 ):
28+ x = gauss (400 , 200 )
29+ y = gauss (350 , 175 )
30+ z = gauss (0 , 100 )
31+
32+ push_matrix ()
33+ translate (x , y , z )
34+ sphere (10 )
35+ pop_matrix ()
36+
37+ geometry = endGeometry ()
38+
39+ # TODO: this should happen implicitly on module load somehow
40+ run ()
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ impl Topology {
6060 }
6161}
6262
63- #[ derive( Component ) ]
63+ #[ derive( Debug , Component ) ]
6464pub struct Geometry {
6565 pub handle : Handle < Mesh > ,
6666 pub layout : Entity ,
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ pub struct RenderState {
6060 pub stroke_color : Option < Color > ,
6161 pub stroke_weight : f32 ,
6262 pub transform : TransformStack ,
63+ pub running_geometry : Option < Geometry > ,
6364}
6465
6566impl Default for RenderState {
@@ -69,6 +70,7 @@ impl Default for RenderState {
6970 stroke_color : Some ( Color :: BLACK ) ,
7071 stroke_weight : 1.0 ,
7172 transform : TransformStack :: new ( ) ,
73+ running_geometry : None ,
7274 }
7375 }
7476}
You can’t perform that action at this time.
0 commit comments