Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
ada551d3
宇宙模拟器
项目概览
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看板
提交
ada551d3
编写于
7月 04, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
deadd2c8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
10 deletion
+28
-10
sim_scenes/func.py
sim_scenes/func.py
+13
-5
sim_scenes/science/speed_of_light_3d.py
sim_scenes/science/speed_of_light_3d.py
+6
-3
simulators/ursina/ui/control_handler.py
simulators/ursina/ui/control_handler.py
+6
-2
simulators/ursina/ursina_config.py
simulators/ursina/ursina_config.py
+3
-0
未找到文件。
sim_scenes/func.py
浏览文件 @
ada551d3
...
@@ -112,6 +112,8 @@ def ursina_run(bodies,
...
@@ -112,6 +112,8 @@ def ursina_run(bodies,
cosmic_bg
=
None
,
cosmic_bg
=
None
,
bg_music
=
None
,
bg_music
=
None
,
show_grid
=
True
,
show_grid
=
True
,
show_camera_info
=
True
,
show_control_info
=
True
,
grid_position
=
None
,
grid_position
=
None
,
grid_scale
=
None
,
grid_scale
=
None
,
show_trail
=
False
,
show_trail
=
False
,
...
@@ -129,6 +131,8 @@ def ursina_run(bodies,
...
@@ -129,6 +131,8 @@ def ursina_run(bodies,
@param cosmic_bg: 宇宙背景图片
@param cosmic_bg: 宇宙背景图片
@param bg_music: 背景音乐
@param bg_music: 背景音乐
@param show_grid: 是否显示空间网格
@param show_grid: 是否显示空间网格
@param show_camera_info: 是否显示摄像机信息面板
@param show_control_info: 是否显示控制信息面板
@param show_trail: 是否显示拖尾
@param show_trail: 是否显示拖尾
@param show_name: 是否显示天体名称
@param show_name: 是否显示天体名称
@param show_timer: 是否显示计时器
@param show_timer: 是否显示计时器
...
@@ -158,9 +162,9 @@ def ursina_run(bodies,
...
@@ -158,9 +162,9 @@ def ursina_run(bodies,
view_azimuth
=
0
# 暂时未用
view_azimuth
=
0
# 暂时未用
player
=
UrsinaPlayer
(
position
,
view_azimuth
,
simulator
.
ursina_views
)
player
=
UrsinaPlayer
(
position
,
view_azimuth
,
simulator
.
ursina_views
)
if
save_as_video
:
#
if save_as_video:
from
common.video_recorder
import
VideoRecorder
#
from common.video_recorder import VideoRecorder
vr
=
VideoRecorder
()
#
vr = VideoRecorder()
def
callback_update
():
def
callback_update
():
UrsinaEvent
.
on_application_run
()
UrsinaEvent
.
on_application_run
()
...
@@ -169,13 +173,17 @@ def ursina_run(bodies,
...
@@ -169,13 +173,17 @@ def ursina_run(bodies,
if
ursina_view
.
appeared
:
if
ursina_view
.
appeared
:
ursina_view
.
update
()
ursina_view
.
update
()
if
save_as_video
:
#
if save_as_video:
vr
.
screenshot
()
#
vr.screenshot()
import
sys
import
sys
from
simulators.ursina.ursina_config
import
UrsinaConfig
from
simulators.ursina.ursina_config
import
UrsinaConfig
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
simulators.ursina.ursina_event
import
UrsinaEvent
sys
.
modules
[
"__main__"
].
update
=
callback_update
sys
.
modules
[
"__main__"
].
update
=
callback_update
UrsinaConfig
.
show_camera_info
=
show_camera_info
UrsinaConfig
.
show_control_info
=
show_control_info
if
show_trail
:
if
show_trail
:
UrsinaConfig
.
show_trail
=
show_trail
UrsinaConfig
.
show_trail
=
show_trail
simulator
.
run
(
dt
,
simulator
.
run
(
dt
,
...
...
sim_scenes/science/speed_of_light_3d.py
浏览文件 @
ada551d3
...
@@ -100,8 +100,8 @@ def on_timer_changed(time_data: TimeData):
...
@@ -100,8 +100,8 @@ def on_timer_changed(time_data: TimeData):
init
.
text_panel
.
text
=
text
.
replace
(
"${speed}"
,
str
(
round
(
velocity
/
LIGHT_SPEED
,
1
))
+
"倍光速"
)
init
.
text_panel
.
text
=
text
.
replace
(
"${speed}"
,
str
(
round
(
velocity
/
LIGHT_SPEED
,
1
))
+
"倍光速"
)
init
.
_3d_card
.
switch_color
()
init
.
_3d_card
.
switch_color
()
light_ship
.
switch_position
()
light_ship
.
switch_position
()
if
time_data
.
total_seconds
>
20
:
#
if time_data.total_seconds > 20:
wait_for
(
0.
3
)
# wait_for(0.0
3)
# 订阅重新开始事件
# 订阅重新开始事件
...
@@ -153,7 +153,10 @@ init.body_arrived = body_arrived
...
@@ -153,7 +153,10 @@ init.body_arrived = body_arrived
ursina_run
(
bodies
,
10
,
ursina_run
(
bodies
,
10
,
position
=
init
.
camera_position
,
position
=
init
.
camera_position
,
# show_trail=init.show_trail,
# show_trail=init.show_trail,
show_timer
=
True
,
# show_timer=True,
show_camera_info
=
False
,
show_control_info
=
False
,
timer_enabled
=
True
,
view_closely
=
init
.
view_closely
,
view_closely
=
init
.
view_closely
,
# bg_music="sounds/interstellar.mp3"
# bg_music="sounds/interstellar.mp3"
)
)
simulators/ursina/ui/control_handler.py
浏览文件 @
ada551d3
...
@@ -33,12 +33,16 @@ class ControlHandler(EventHandler):
...
@@ -33,12 +33,16 @@ class ControlHandler(EventHandler):
self
.
settings_handler
=
Entity
(
ignore_paused
=
True
)
self
.
settings_handler
=
Entity
(
ignore_paused
=
True
)
self
.
settings_handler
.
input
=
self
.
settings_handler_input
self
.
settings_handler
.
input
=
self
.
settings_handler_input
key_info_str
=
"方位控制[键盘QWEASD]+[鼠标右键],按[空格]更多控制"
key_info_str
=
"方位控制[键盘QWEASD]+[鼠标右键],按[空格]更多控制"
key_info
=
Text
(
text
=
key_info_str
,
font
=
UrsinaConfig
.
CN_FONT
,
position
=
(
-
1
,
0.5
),
origin
=
(
-
1
,
1
),
if
UrsinaConfig
.
show_control_info
:
background
=
True
)
key_info
=
Text
(
text
=
key_info_str
,
font
=
UrsinaConfig
.
CN_FONT
,
position
=
(
-
1
,
0.5
),
origin
=
(
-
1
,
1
),
background
=
True
)
self
.
camera_info
=
Text
(
text
=
""
,
scale
=
0.8
,
position
=
(
0
,
-
0.45
),
origin
=
(
0
,
1
),
self
.
camera_info
=
Text
(
text
=
""
,
scale
=
0.8
,
position
=
(
0
,
-
0.45
),
origin
=
(
0
,
1
),
background
=
False
)
background
=
False
)
if
not
UrsinaConfig
.
show_camera_info
:
self
.
camera_info
.
enabled
=
False
def
camera_update
(
self
):
def
camera_update
(
self
):
pos
=
camera
.
position
# WS => [2]
pos
=
camera
.
position
# WS => [2]
w_pos
=
camera
.
world_rotation
# 鼠标右键
w_pos
=
camera
.
world_rotation
# 鼠标右键
...
...
simulators/ursina/ursina_config.py
浏览文件 @
ada551d3
...
@@ -35,6 +35,9 @@ class UrsinaConfig:
...
@@ -35,6 +35,9 @@ class UrsinaConfig:
__on_reset_funcs
=
[]
__on_reset_funcs
=
[]
show_trail
=
False
show_trail
=
False
show_camera_info
=
True
show_control_info
=
True
# 拖尾球体的数量
# 拖尾球体的数量
trail_length
=
100
trail_length
=
100
# 拖尾的类型(球体、线条)
# 拖尾的类型(球体、线条)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录