-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainPanel.sj
55 lines (49 loc) · 1.49 KB
/
mainPanel.sj
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
mainPanel #model (
children : array!heap #model()
radius : 'f32
model : mat4_identity()
_world : mat4_identity()
_childWorlds : list!mat4()
update(sceneRect : 'rect, projection : 'mat4, view : 'mat4, world : 'mat4, light : 'light)'void {
for i : 0 to children.count {
c : children[i]
childWorld : _childWorlds[i]
t : world * model * childWorld
c.update(sceneRect, projection, view, t, light)
}
void
}
getZ() { 0.0f }
getCenter() { vec3() }
getWorld() { _world * model }
renderOrQueue(zqueue : 'list!heap #model)'void {
for i : 0 to children.count {
c : children[i]
c.renderOrQueue(zqueue)
}
}
render() {
void
}
fireMouseEvent(mouseEvent : 'mouseEvent)'void {
for i : 0 to children.count {
c : children[i]
c.fireMouseEvent(mouseEvent)
}
}
) {
angleIncrement : 0.08f
angle := (-(children.count) as f32 * angleIncrement) / 2.0f
for i : 0 to children.count {
angleOffset : f32_random() * 0.01f
radiusOffset : f32_random() * 0.5f
y : (f32_random() - 0.5f) * 0.4f
x : f32_sin(angle + angleOffset) * (radius + radiusOffset)
z : f32_cos(angle + angleOffset) * (radius + radiusOffset)
_childWorlds.add(
mat4_translate(vec3(x, y, z)) * mat4_rotate(angle, vec3(0.0f, 1.0f, 0.0f))
)
angle += angleIncrement
}
this
}