From 8518cd34a547fe4a7b0307368f09197ab464ba7e Mon Sep 17 00:00:00 2001 From: march3 Date: Wed, 13 Dec 2023 18:58:42 +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 --- bodies/README.md | 13 +++++++++++++ sim_scenes/featured/the_lost_planet.py | 12 ++++++------ sim_scenes/func.py | 8 ++++++++ sim_scenes/universe_sim_scenes.py | 9 ++++++--- simulators/ursina_simulator.py | 2 +- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/bodies/README.md b/bodies/README.md index 48ecb7d..6a011da 100644 --- a/bodies/README.md +++ b/bodies/README.md @@ -8,6 +8,19 @@ #  天体质量: #  平均密度: ``` + +```text +上标文本 +参考:https://cn.piliapp.com/symbol/subscript-superscript/ +⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ ⁿ +₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ + ₐ ₑ ₒ ₓ ₔ ° ⁱ + ⁄ ² ³ +ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ + ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ + ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ + ᵋ ᵝ ᵞ ᵟ ᵠ ᵡ ᵦ ᵧ ᵨ ᵩ ᵪ ᶥ ᶿ +``` 参考: https://solarsystem.nasa.gov/solar-system/our-solar-system/overview/ https://trek.nasa.gov/mars/ diff --git a/sim_scenes/featured/the_lost_planet.py b/sim_scenes/featured/the_lost_planet.py index b2b7b5b..fdbca3b 100644 --- a/sim_scenes/featured/the_lost_planet.py +++ b/sim_scenes/featured/the_lost_planet.py @@ -317,9 +317,9 @@ class TheLostPlanetSim(UniverseSimScenes): # (self.asteroid_fade_out, 900, 1), # 第4波行星 (self.camera_back_2, 900, -1), - (self.neptune_orbit_the_sun, 900, 1), + (self.neptune_orbit_the_sun, 9000, 1), - (lambda: None, -1, -1) + (lambda: exit(0), -1, -1) ] self._steps = [] @@ -405,9 +405,9 @@ if __name__ == '__main__': ursina_run(sim.bodies, SECONDS_PER_YEAR, gravity_works=False, - show_exit_button=False, - show_control_info=False, - show_camera_info=False, + # show_exit_button=False, + # show_control_info=False, + # show_camera_info=False, # position=(0, 2 * AU, -11 * AU), # position=(0, 20 * AU, 10 * AU), # position=(4.5 * AU, AU, 5 * AU), @@ -416,4 +416,4 @@ if __name__ == '__main__': # show_timer=True, cosmic_bg='', # show_trail=True, - show_grid=False) + show_grid=True) diff --git a/sim_scenes/func.py b/sim_scenes/func.py index bb0cf4a..aea9dc2 100644 --- a/sim_scenes/func.py +++ b/sim_scenes/func.py @@ -15,6 +15,8 @@ from common.consts import LIGHT_SPEED import math import numpy as np +from sim_scenes.universe_sim_scenes import UniverseSimScenes + def calc_run(bodies, dt=SECONDS_PER_WEEK, on_init=None, **kwargs): from simulators.calc_simulator import CalcSimulator @@ -193,6 +195,12 @@ def ursina_run(bodies, from simulators.ursina.entities.ursina_player import UrsinaPlayer body_sys = System(bodies) + if UniverseSimScenes.screen_record: + show_exit_button = False + show_control_info = False + show_camera_info = False + show_grid = False + if show_name: for body in body_sys.bodies: body.show_name = True diff --git a/sim_scenes/universe_sim_scenes.py b/sim_scenes/universe_sim_scenes.py index 3107dde..5c2d157 100644 --- a/sim_scenes/universe_sim_scenes.py +++ b/sim_scenes/universe_sim_scenes.py @@ -8,6 +8,7 @@ # ============================================================================== from objs import CoreValagaClas import sys +from ursina import application class UniverseSimScenes: @@ -15,18 +16,20 @@ class UniverseSimScenes: 可以作为宇宙模拟场景的基类,但是不是必须的。 """ + screen_record = False + record_rate = 1 + def __new__(cls, *args, **kwargs): print("参数个数", len(sys.argv)) if len(sys.argv) > 1: UniverseSimScenes.set_window_size((1920, 1079), False) cls.record_rate = 2 - else: - cls.record_rate = 1 + UniverseSimScenes.screen_record = True + application.time_scale = 0.00001 instance = super().__new__(cls, *args, **kwargs) return instance - @staticmethod def create_camera_target(init_position=[0, 0, 0], size_scale=1e3): camera_target = CoreValagaClas(name="摄像机镜头", mass=1e30, color=(111, 140, 255), diff --git a/simulators/ursina_simulator.py b/simulators/ursina_simulator.py index 7065fdf..03273b7 100644 --- a/simulators/ursina_simulator.py +++ b/simulators/ursina_simulator.py @@ -322,7 +322,7 @@ class UrsinaSimulator(Simulator): window.fps_counter.enabled = False window.exit_button.enabled = show_exit_button # window.editor_ui.enabled = True - + # window.fullscreen_button.enabled = False # # 场景加入雾的效果 # scene.fog_color = color.orange # scene.fog_density = 800 * UrsinaConfig.SCALE_FACTOR -- GitLab