Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
94cde2e0
宇宙模拟器
项目概览
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看板
“63ff984f49d76cd989f7f4762505d214f54037eb”上不存在“simulators/ursina/entities/timer.py”
提交
94cde2e0
编写于
7月 05, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
4145fa26
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
31 addition
and
13 deletion
+31
-13
sim_scenes/science/speed_of_light_3d.py
sim_scenes/science/speed_of_light_3d.py
+8
-6
tools/sim_video_3d_cap.bat
tools/sim_video_3d_cap.bat
+2
-2
tools/sim_video_3d_cap_ext.py
tools/sim_video_3d_cap_ext.py
+21
-5
未找到文件。
sim_scenes/science/speed_of_light_3d.py
浏览文件 @
94cde2e0
...
...
@@ -29,6 +29,8 @@ init = SpeedOfLightInit(camera_follow_light)
# 创建太阳系天体(忽略质量,引力无效,初速度全部为0)
bodies
=
create_solar_system_bodies
(
ignore_mass
=
True
,
init_velocity
=
[
0
,
0
,
0
])
earth
=
bodies
[
3
]
earth
.
rotate_angle
=
-
23.44
jupiter
,
saturn
,
uranus
,
neptune
=
bodies
[
6
:
10
]
for
big_body
in
[
jupiter
,
saturn
,
uranus
,
neptune
]:
...
...
@@ -41,13 +43,13 @@ for idx, body in enumerate(bodies):
# if idx > 0:
# body.init_position[0] = body.diameter * body.size_scale
# body.init_position[1] = -body.radius * body.size_scale / 10
body
.
rotation_speed
*=
20
body
.
rotation_speed
*=
55
if
len
(
sys
.
argv
)
>
1
:
camera_pos
=
sys
.
argv
[
1
].
replace
(
"_"
,
""
)
else
:
camera_pos
=
"left"
camera_pos
=
"right"
#
if len(sys.argv) > 1:
#
camera_pos = sys.argv[1].replace("_", "")
#
else:
#
camera_pos = "left"
camera_pos
=
"right"
print
(
"camera_pos:"
,
camera_pos
)
camera_l2r
=
0.002
*
AU
...
...
tools/sim_video_3d_cap.bat
浏览文件 @
94cde2e0
...
...
@@ -17,9 +17,9 @@ CALL conda activate %env%
%DISK%
cd
%SimFilePath%
start
python
-m
%SimFileName%
%
3
start
python
-m
%SimFileName%
cd
%SimDir%
\tools
python
-m
sim_video_3d_cap_ext
--save
_name
=
%SimFileName%
%
param3
%
.mp4
python
-m
sim_video_3d_cap_ext
--save
_name
=
%SimFileName%
.mp4
%param3
%
tools/sim_video_3d_cap_ext.py
浏览文件 @
94cde2e0
...
...
@@ -31,10 +31,15 @@ def get_args():
parser
.
add_argument
(
'--fps'
,
type
=
int
,
default
=
30
,
help
=
'frame per second'
)
parser
.
add_argument
(
'--total_time'
,
type
=
int
,
default
=
10000000
,
help
=
'video total time'
)
parser
.
add_argument
(
'--save_name'
,
type
=
str
,
default
=
'video.mp4'
,
help
=
'save file name'
)
parser
.
add_argument
(
'--start_index'
,
type
=
int
,
default
=-
1
,
help
=
'start_index'
)
# parser.add_argument('--screen_type', default=0, type=int, choices=[0, 1], help='1: full screen, 0: region screen')
args
=
parser
.
parse_args
()
print
(
"total_time:"
,
args
.
total_time
)
print
(
"fps:"
,
args
.
fps
)
print
(
"start_index:"
,
args
.
start_index
)
if
args
.
start_index
>
0
:
args
.
save_name
=
args
.
save_name
+
(
"_%s"
%
args
.
start_index
)
print
(
"save_name:"
,
args
.
save_name
)
return
args
...
...
@@ -232,13 +237,17 @@ def get_frame_temp_data():
def
press_pause_key
():
try
:
KEY_P
=
win32api
.
VkKeyScan
(
'P'
)
win32api
.
PostMessage
(
window_handle
,
win32con
.
WM_KEYDOWN
,
KEY_P
,
0x00190001
)
return
True
# win32api.PostMessage(window_handle, win32api.VkKeyScan('P'), 0x0001 | 0x0008 | 0x0010 | 0x0020, 0)
# win32api.PostMessage(0xFFFFFFF6, win32api.VkKeyScan('P'), 0x0001 | 0x0008 | 0x0010 | 0x0020, 0)
# win32api.PostMessage(window_handle, win32con.WM_KEYDOWN, win32api.VkKeyScan('P'), 0) # 发送F9键
# win32api.PostMessage(window_handle, win32con.WM_KEYUP, win32con.VK_F9, 0)
pass
except
Exception
as
e
:
print
(
str
(
e
))
return
False
def
make_3d_video
():
...
...
@@ -255,7 +264,8 @@ def make_3d_video():
video
=
create_video
(
args
,
img
.
shape
[
0
],
img
.
shape
[
1
])
imageNum
=
0
index_base
=
0
last_index
=
0
last_index
=
0
# 最后一个index
completed_index
=
0
# 最后完成的 index
r_frames
=
{}
l_frames
=
{}
print
(
"开始录屏"
)
...
...
@@ -270,6 +280,11 @@ def make_3d_video():
_3d_card_p
=
_3d_card
[
10
,
10
,]
index
=
int
(
_3d_card_p
[
1
])
+
int
(
_3d_card_p
[
0
])
if
index
<
args
.
start_index
:
if
imageNum
%
args
.
fps
==
0
:
print
(
'X'
,
end
=
''
)
continue
if
imageNum
%
100
==
0
:
press_pause_key
()
create_frame_temp_files
(
index
+
index_base
,
l_frames
,
r_frames
)
...
...
@@ -291,7 +306,7 @@ def make_3d_video():
last_index
=
index
index
=
index
+
index_base
completed_index
=
index
if
_3d_card_p
[
2
]
<
100
:
_3d_card_color
=
"b"
_3d_card_direct
=
"right"
...
...
@@ -322,6 +337,7 @@ def make_3d_video():
# # show_image(frame)
# video.write(img)
print
(
"3D视频处理(完成索引:%s)"
%
completed_index
)
handle_3d_video
(
video
,
l_frames
,
r_frames
)
print
(
"视频保存中"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录