-
Notifications
You must be signed in to change notification settings - Fork 36
/
scene.py
39 lines (30 loc) · 933 Bytes
/
scene.py
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
from model import *
import glm
class Scene:
def __init__(self, app):
self.app = app
self.objects = []
self.load()
# skybox
self.skybox = AdvancedSkyBox(app)
def add_object(self, obj):
self.objects.append(obj)
def load(self):
app = self.app
add = self.add_object
# floor
n, s = 20, 2
for x in range(-n, n, s):
for z in range(-n, n, s):
add(Cube(app, pos=(x, -s, z)))
# columns
for i in range(9):
add(Cube(app, pos=(15, i * s, -9 + i), tex_id=2))
add(Cube(app, pos=(15, i * s, 5 - i), tex_id=2))
# cat
add(Cat(app, pos=(0, -1, -10)))
# moving cube
self.moving_cube = MovingCube(app, pos=(0, 6, 8), scale=(3, 3, 3), tex_id=1)
add(self.moving_cube)
def update(self):
self.moving_cube.rot.xyz = self.app.time