Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
6a288ac4
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6a288ac4
编写于
11月 15, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
f2d7524a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
18 deletion
+35
-18
objs/halley_comet.py
objs/halley_comet.py
+5
-0
sim_scenes/func.py
sim_scenes/func.py
+16
-11
sim_scenes/solar_system/halley_comet_sim.py
sim_scenes/solar_system/halley_comet_sim.py
+14
-7
未找到文件。
objs/halley_comet.py
浏览文件 @
6a288ac4
...
...
@@ -19,6 +19,11 @@ class HalleComet(RockSnow):
近日点: 0.586 AU 上次通过近日点:1986年2月9日 下次通过近日点:2061年7月28日
平均密度: 0.6(估计的范围在0.2至1.5g/cm)
均密度: 1 g/cm³ -> 1✕10³ kg/m³
重要时间点:
1986年02月09日 近日点
1986年04月11日 距离地球最近
2023年12月09日 远日点
2061年07月28日 近日点
来源:https://www.cgmodel.com/model/500318.html
"""
...
...
sim_scenes/func.py
浏览文件 @
6a288ac4
...
...
@@ -159,8 +159,9 @@ def ursina_run(bodies,
timer_enabled
=
False
,
save_as_json
=
None
,
save_cube_map
=
False
,
save_as_video
=
False
,
view_closely
=
False
):
video_recoder
=
False
,
view_closely
=
False
,
camera_smooth_follow
=
False
):
"""
ursina 模拟器运行天体
@param bodies: 天体集合
...
...
@@ -178,10 +179,16 @@ def ursina_run(bodies,
@param show_timer: 是否显示计时器
@param timer_enabled: 计时器是否有效
@param save_as_json: 将所有天体的信息保存为 json 文件
@param save_cube_map: 保存 CudeMap 视频帧
@param video_recoder: 视频录制是否开启(按5录制,按6停止录制)
@param view_closely: 是否近距离查看天体
@param camera_smooth_follow: 摄像机圆滑跟踪
@return:
"""
from
simulators.ursina.entities.video_recorder
import
CubeMapVideoRecorder
from
simulators.ursina.entities.video_recorder
import
VideoRecorder
from
ursina
import
camera
,
SmoothFollow
import
sys
from
simulators.ursina_simulator
import
UrsinaSimulator
from
simulators.ursina.entities.ursina_player
import
UrsinaPlayer
body_sys
=
System
(
bodies
)
...
...
@@ -207,18 +214,15 @@ def ursina_run(bodies,
simulator
=
UrsinaSimulator
(
body_sys
)
view_azimuth
=
0
# 暂时未用
player
=
UrsinaPlayer
(
position
,
view_azimuth
,
simulator
.
ursina_views
)
if
camera_smooth_follow
:
camera
.
add_script
(
SmoothFollow
(
target
=
player
,
offset
=
[
0
,
1
,
-
30
],
speed
=
4
))
if
save_cube_map
:
from
simulators.ursina.entities.video_recorder
import
CubeMapVideoRecorder
from
ursina
import
camera
import
sys
sys
.
modules
[
"__main__"
].
video_recorder
=
CubeMapVideoRecorder
()
camera
.
fov
=
90
if
save_as_video
:
from
simulators.ursina.entities.video_recorder
import
VideoRecorder
from
ursina
import
camera
import
sys
if
video_recoder
:
sys
.
modules
[
"__main__"
].
video_recorder
=
VideoRecorder
()
def
callback_input
(
key
):
...
...
@@ -263,7 +267,8 @@ def ursina_run(bodies,
show_exit_button
=
show_exit_button
,
timer_enabled
=
timer_enabled
,
bg_music
=
bg_music
,
view_closely
=
view_closely
)
view_closely
=
view_closely
,
camera_smooth
=
camera_smooth_follow
)
def
mpl_run
(
bodies
,
dt
=
SECONDS_PER_WEEK
,
gif_file_name
=
None
,
gif_max_frame
=
200
):
...
...
sim_scenes/solar_system/halley_comet_sim.py
浏览文件 @
6a288ac4
...
...
@@ -30,6 +30,11 @@ from simulators.ursina.ursina_mesh import create_label
class
HalleyCometSim
(
HalleyCometSimBase
):
"""
哈雷彗星场景模拟
重要时间点:
1986年02月09日 近日点
1986年04月11日 距离地球最近
2023年12月09日 远日点
2061年07月28日 近日点
"""
def
__init__
(
self
,
_params
=
None
):
...
...
@@ -71,7 +76,7 @@ class HalleyCometSim(HalleyCometSimBase):
@return:
"""
# 创建天空
create_sphere_sky
(
scale
=
20
0000
)
create_sphere_sky
(
scale
=
5
0000
)
# UrsinaConfig.trail_type = "curve_line"
# UrsinaConfig.trail_length = 300
UrsinaConfig
.
trail_type
=
"line"
...
...
@@ -83,11 +88,12 @@ class HalleyCometSim(HalleyCometSimBase):
UrsinaConfig
.
trail_factor
=
3
# camera.clip_plane_near = 0.1
camera
.
clip_plane_far
=
1000000
camera
.
clip_plane_far
=
51000
# camera.fov = 60
application
.
time_scale
=
5
# application.time_scale = 0.01
# 摄像机移动 update
camera_move_update
()
#
camera_move_update()
# camera_move_to_target_update()
def
create_orbit_lines
(
self
):
...
...
@@ -227,8 +233,8 @@ class HalleyCometSim(HalleyCometSimBase):
(
2048
,
{
"f"
:
3
}),
(
2062
,
{
"y"
:
-
3
}),
(
2063
,
{
"y"
:
-
10
,
"z"
:
2
}),
(
2
0
81
,
{}),
(
2082
,
{
"exit"
:
True
})
(
2
1
81
,
{}),
#
(2082, {"exit": True})
]
camera_move_control
(
camera_move_infos
,
...
...
@@ -391,6 +397,7 @@ class HalleyCometSim(HalleyCometSimBase):
dt
=
time_data
.
get_datetime
(
self
.
start_time
)
# 摄像机看向哈雷彗星
camera_look_at
(
self
.
halley_comet
,
rotation_z
=
0
)
# camera.look_at_2d(self.halley_comet.planet.position, axis='y')
time_total_hours
=
time_data
.
total_hours
...
...
@@ -468,7 +475,7 @@ if __name__ == '__main__':
show_trail
=
True
,
# bg_music='sounds/no_glory.mp3',
show_camera_info
=
False
,
save_as_video
=
True
,
# video_recoder
=True,
show_control_info
=
False
,
timer_enabled
=
True
,
show_grid
=
False
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录