diff --git a/simulators/ursina/ui/control_handler.py b/simulators/ursina/ui/control_handler.py index b14bd260ba890e1527a96d9c730b5ad9ebfdcb60..2ac63034a462bb724548831f679724aeaef47d96 100644 --- a/simulators/ursina/ui/control_handler.py +++ b/simulators/ursina/ui/control_handler.py @@ -37,10 +37,10 @@ class ControlHandler(EventHandler): background=True) self.camera_info = Text(text="", scale=0.8, position=(0, -0.45), origin=(0, 1), - background=True) + background=False) def camera_update(self): - pos = camera.position # WS => [2] + pos = camera.position # WS => [2] w_pos = camera.world_rotation # 鼠标右键 # rot = camera.rotation wt = camera.world_transform # QE[0,1,2] AD [0 , 2] 鼠标右键 @@ -50,11 +50,12 @@ class ControlHandler(EventHandler): # print(camera.left,camera.forward,camera.back,camera.right,camera.scale,camera.aspect_ratio,camera.down,camera.up,camera.world_scale,camera.world_rotation) # fw = camera.forward # self.camera_info.text = "pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] rot:[%.2f,%.2f,%.2f] wt:[%s,%s,%s]" % \ - self.camera_info.text = "pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] wt:[%s,%s]" % \ - (pos[0], pos[1], pos[2], - w_pos[0], w_pos[1], w_pos[2], - # rot[0], rot[1], rot[2], - wt[0], wt[1]) # , wt[2] + if hasattr(self, "camera_info"): + self.camera_info.text = "pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] wt:[%s,%s]" % \ + (pos[0], pos[1], pos[2], + w_pos[0], w_pos[1], w_pos[2], + # rot[0], rot[1], rot[2], + wt[0], wt[1]) # , wt[2] def sec_per_time_switch_changed(self): """ diff --git a/simulators/ursina/ui_component.py b/simulators/ursina/ui_component.py index 2cea67548616c46626a7e63c7b99097387723763..8f666c23042f7a2c406ed7913b4dbc0059995771 100644 --- a/simulators/ursina/ui_component.py +++ b/simulators/ursina/ui_component.py @@ -29,7 +29,7 @@ class UiSlider(Slider): max=max, default=default, color=color.rgba(0.0, 0.0, 0.0, 0.5), - ignore_paused=False, + ignore_paused=True, dynamic=True) # self.label.scale *= 8/10 self.label.font = UrsinaConfig.CN_FONT @@ -88,5 +88,5 @@ class UiButton(Button): def __init__(self, text, on_click): super(UiButton, self).__init__(text=text, origin=(0, 0), y=2, on_click=on_click, color=color.rgba(0.0, 0.0, 0.0, 0.5), - ignore_paused=False) + ignore_paused=True) self.text_entity.font = UrsinaConfig.CN_FONT diff --git a/simulators/ursina_simulator.py b/simulators/ursina_simulator.py index 0bd854bb5abe40682fff9ddc2a01d32e1ff3a0ad..ad8b74441f35d2f4f2e8b68409cc3ed50b1e1769 100644 --- a/simulators/ursina_simulator.py +++ b/simulators/ursina_simulator.py @@ -164,9 +164,14 @@ class UrsinaSimulator(Simulator): :return: """ # Add skybox + + if camera.clip_plane_near >= 0.01: + sky_scale = 50000 + else: + sky_scale = 500000 * camera.clip_plane_near + from ursina import Sky - sky_scale = 50000 sky = Sky(texture=texture) sky.scale = sky_scale # sky.set_shader_input('texture_scale', Vec2(20, 20)) @@ -191,8 +196,11 @@ class UrsinaSimulator(Simulator): if view_closely: # 近距离查看 - # 设置 camera 的裁剪面和位置 - camera.clip_plane_near = 0.01 + if isinstance(view_closely, float): + camera.clip_plane_near = view_closely + else: + # 设置 camera 的裁剪面和位置 + camera.clip_plane_near = 0.01 camera.fov = 60 # interval_fator 能让更新天体运行状态(位置、速度)更精确