From f7186040812248010618c3ab4c301a24f35b5ef0 Mon Sep 17 00:00:00 2001 From: march3 Date: Tue, 19 Dec 2023 17:13:14 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sim_scenes/featured/look_at_sky_on_earth.py | 37 +++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/sim_scenes/featured/look_at_sky_on_earth.py b/sim_scenes/featured/look_at_sky_on_earth.py index 95aeff6..e163cee 100644 --- a/sim_scenes/featured/look_at_sky_on_earth.py +++ b/sim_scenes/featured/look_at_sky_on_earth.py @@ -50,7 +50,7 @@ class LookAtSkyOnEarth(UniverseSimScenes): clouds_texture = "transparent.png" earth_size_scale = 1 else: - earth_texture = "earth_miller_projection_sw.png" # "earth_miller_projection_SW.jpg" + earth_texture = "earth_miller_projection_sw_trans.png" # "earth_miller_projection_sw.png" # "earth_miller_projection_SW.jpg" clouds_texture = "transparent_clouds.png" earth_size_scale = 6e3 # 运动的地球 @@ -81,7 +81,7 @@ class LookAtSkyOnEarth(UniverseSimScenes): self.earth.init_velocity = pos_vel["vel"] self.bodies = [ - self.sun, self.earth #, self.earth_clouds + self.sun, self.earth # , self.earth_clouds ] if self.show_china: @@ -92,13 +92,36 @@ class LookAtSkyOnEarth(UniverseSimScenes): # 中国农历24节气表,数据为 节气名称 和 camera.rotation_y 的角度范围值 self.solar_terms_angles = get_solar_terms_angles() + def create_sky_watchers(self): + from simulators.ursina.ursina_mesh import create_sphere + from ursina import Entity, color + r = 0.5 + y = 0.4 + x = -0.26 + watcher_e = Entity(parent=self.earth.planet, + model=create_sphere(r, 32), + scale=0.05, + y=0.0, x=x-0.17, z=pow(pow(r, 2) - pow(x-0.17, 2), 0.5), color=color.green) + + watcher_n = Entity(parent=self.earth.planet, + model=create_sphere(r, 32), + scale=0.05, + y=y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.red) + + watcher_s = Entity(parent=self.earth.planet, + model=create_sphere(r, 32), + scale=0.05, + y=-y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.blue) + def on_ready(self): self.earth.planet.rotation_y -= 180 # 一开始就正对太阳 - self.earth.planet.alpha = 0.9 + # self.earth.planet.alpha = 0.2 # self.earth_cn.planet.rotation_y -= 185 # 一开始就正对太阳 if hasattr(self.earth_clouds, "planet"): self.earth_clouds.planet.rotation_y -= 50 # 一开始就正对太阳 + self.earth.planet.init_rotation_y = self.earth.planet.rotation_y + if self.show_name: font = find_file("fonts/DroidSansFallback.ttf", UrsinaConfig.CN_FONT) from ursina import color @@ -112,8 +135,6 @@ class LookAtSkyOnEarth(UniverseSimScenes): if hasattr(self.earth_clouds, "name_text"): self.earth_clouds.name_text.enabled = False - - if self.show_china: if hasattr(self.earth_cn, "name_text"): self.earth_cn.name_text.enabled = False @@ -170,7 +191,6 @@ class LookAtSkyOnEarth(UniverseSimScenes): camera.clip_plane_near = 10 camera.clip_plane_far = 1000000 - def delay_app_start(): import time # time.sleep(8.0 / self.speed_factor) @@ -185,8 +205,11 @@ class LookAtSkyOnEarth(UniverseSimScenes): # self.sun.planet.glow_circle.look_at(camera) create_foreground(f"armazonesdusk_{self.look_point + 2}.png") + self.create_sky_watchers() + def on_timer_changed(self, time_data: TimeData): - pass + if abs(self.earth.planet.init_rotation_y - self.earth.planet.rotation_y) > 365: + exit(0) # if self.show_china and self.wait_days_count > 0: # self.wait_days_count = self.wait_days - time_data.total_days # -- GitLab