-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscenery_objects.py
More file actions
23 lines (19 loc) · 865 Bytes
/
scenery_objects.py
File metadata and controls
23 lines (19 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np
import random
from wavefront import *
class SceneryObject:
def __init__(self, model, pos):
self.model = model
self.pos = pos
self.orient = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
class RandomBuilding(SceneryObject):
def __init__(self, pos):
self.pos = pos
self.model = Model("cube")
rand_height = random.uniform(5, 70)
rand_width = random.uniform(0.3, 0.7) * rand_height
rand_depth = random.uniform(0.3, 0.7) * rand_height
for idx_v, v in enumerate(self.model.vertices):
self.model.vertices[idx_v] = np.array([self.model.vertices[idx_v][0] * rand_width,
self.model.vertices[idx_v][1] * rand_height,
self.model.vertices[idx_v][2] * rand_depth])