-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrid.vroom
More file actions
executable file
·66 lines (44 loc) · 1.3 KB
/
grid.vroom
File metadata and controls
executable file
·66 lines (44 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env vroom-wrapper
from vroom import *
from random import randint
def render_cubes(button):
Global.Size = 2.0
Global.RenderFunc = cube
def render_spheres(button):
Global.Size = 1.0
Global.RenderFunc = sphere
def init():
setMainMenuTitle('grid')
addMainMenuItem('cubes', render_cubes)
addMainMenuItem('spheres', render_spheres)
Global.Size = 2.0
Global.Width = 30
Global.Height = 30
Nx = Global.Width / Global.Size
Ny = Global.Height / Global.Size
points = [[randint(0, Nx-Global.Size)*Global.Size + Global.Size/2.0,
randint(0, Ny-Global.Size)*Global.Size + Global.Size/2.0,
Global.Size/2.0] for i in range(20)]
Global.Points = point_list(points)
Global.RenderFunc = cube
def display():
# Draw grid
lighting(False)
color(0.4)
grid(Global.Width, Global.Height, 15, 15)
# Draw axes
color(1.0)
lineWidth(2.0)
axes(36.0)
# Draw solid objects
lighting(True)
material(1.0, 0.5, 0.0)
glEnable(GL_POLYGON_OFFSET_FILL)
glPolygonOffset(1.0, 1.0)
Global.Points.for_each(Global.RenderFunc, Global.Size, style='solid')
glDisable(GL_POLYGON_OFFSET_FILL)
# Draw object outlines
lighting(False)
color(0.0)
lineWidth(1.5)
Global.Points.for_each(Global.RenderFunc, Global.Size)