提交 f7186040 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 0f2062b6
......@@ -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
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册