ya2 · news · projects · code · about

side panel
[pmachines.git] / pmachines / items / background.py
CommitLineData
4894bb48
FC
1from itertools import product
2from panda3d.core import NodePath
3
4
5class Background:
6
7 def __init__(self):
8 root = NodePath('background_root')
9 root.reparent_to(render)
a5dc83f4 10 ncols, nrows = 16, 8
4894bb48
FC
11 start_size, end_size = 5, 2.5
12 offset = 5
13 for col, row in product(range(ncols), range(nrows)):
14 model = loader.load_model('assets/gltf/background/background.gltf')
15 model.set_scale(end_size / start_size)
16 model.reparent_to(root)
17 total_width, total_height = end_size * ncols, end_size * nrows
18 left, bottom = -total_width/2, -total_height/2
1be87278 19 model.set_pos(left + end_size * col, offset, bottom + end_size * row)
4894bb48
FC
20 root.clear_model_nodes()
21 root.flatten_strong()