def __init__(self, app, engine): self.app = app self.engine = engine self.scene = s = Scene.empty() # Global state stuff self.shaders = () self.objects = () self.debug = 0 self.light = {"rot": -95, "pitch": 40} # Camera width, height = engine.window.dimensions() self.camera = cam = Camera(45, width, height) self.camera_view = LookAtView(cam, position=[0, 0, -3.5], bounds_zoom=(-7.0, -0.2)) # Assets self._setup_assets() # Callbacks s.on_initialized = self.init_scene s.on_window_resized = self.update_perspective s.on_key_pressed = self.handle_keypress s.on_mouse_move = s.on_mouse_click = s.on_mouse_scroll = self.handle_mouse
def __init__(self, app, engine): self.app = app self.engine = engine self.scene = s = Scene.empty() # Global state stuff self.visible_index = None self.objects = [] self.mouse_state = { btn: evt.MouseClickState.Up for btn in evt.MouseClickButton } self.mouse_state["pos"] = (0,0) # Camera width, height = engine.window.dimensions() self.camera = cam = Camera(60, width, height) self.camera_view = LookAtView(cam, position = [0,0,-2.5], bounds_zoom=(-7.0, -0.2)) # Assets self._setup_assets() # Callbacks s.on_initialized = self.init_scene s.on_window_resized = self.update_perspective s.on_key_pressed = self.handle_keypress s.on_mouse_move = s.on_mouse_click = s.on_mouse_scroll = self.handle_mouse
def __init__(self, app, engine): self.app = app self.engine = engine self.scene = s = Scene.empty() # Global state stuff self.shaders = () self.objects = () self.heightmap_seed = (1, 1) self.heightmap_size = (256, 256) self.compute_local_size = self._compute_local_size() self.compute_heightmap = None self.heightmap_texture = None self.heightmap_sampler = None self.heightmap_preview = None # Camera width, height = engine.window.dimensions() self.camera = cam = Camera(45, width, height) self.camera_view = LookAtView(cam, position = [0,0,-1.9], bounds_zoom=(-3.0, -0.2)) # Assets self._setup_assets() # Callbacks s.on_initialized = self.init_scene s.on_window_resized = self.update_perspective s.on_key_pressed = self.handle_keypress s.on_mouse_move = s.on_mouse_click = s.on_mouse_scroll = self.handle_mouse
def __init__(self, app, engine): self.app = app self.engine = engine self.scene = s = Scene.empty() self.shader = None self.objects = [] # Global state stuff self.mouse_state = { btn: evt.MouseClickState.Up for btn in evt.MouseClickButton } self.mouse_state["pos"] = (0, 0) width, height = engine.window.dimensions() cam_pos = [0, 0, -5.5] self.camera = { "pos_vec": cam_pos, "pos": Mat4.from_translation(*cam_pos), "proj": Mat4.perspective(radians(60), width / height, 0.001, 1000.0) } # Callbacks s.on_initialized = self.init_scene s.on_window_resized = self.update_perspective s.on_mouse_move = self.move_camera s.on_mouse_click = self.move_camera s.on_key_pressed = self.handle_keypress