Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
b98c56d0
宇宙模拟器
项目概览
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看板
提交
b98c56d0
编写于
12月 20, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
70b52784
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
28 deletion
+53
-28
sim_scenes/featured/look_at_sky_on_earth.py
sim_scenes/featured/look_at_sky_on_earth.py
+50
-25
sim_scenes/featured/look_at_sky_on_earth_e.py
sim_scenes/featured/look_at_sky_on_earth_e.py
+1
-1
sim_scenes/featured/look_at_sky_on_earth_n.py
sim_scenes/featured/look_at_sky_on_earth_n.py
+1
-1
sim_scenes/featured/look_at_sky_on_earth_s.py
sim_scenes/featured/look_at_sky_on_earth_s.py
+1
-1
未找到文件。
sim_scenes/featured/look_at_sky_on_earth.py
浏览文件 @
b98c56d0
...
...
@@ -36,6 +36,8 @@ class LookAtSkyOnEarth(UniverseSimScenes):
# self.sun.glows = (0, 1.005, 0.1)
self
.
sun
=
Sun
(
size_scale
=
2e1
,
texture
=
"transparent.png"
)
self
.
sun
.
glows
=
None
self
.
earth_core
=
Sun
(
size_scale
=
2e-1
,
texture
=
"sun.png"
,
rotation_speed
=
0
).
set_ignore_gravity
(
True
)
self
.
earth_core
.
glows
=
None
self
.
show_sphere_sky
=
show_sphere_sky
self
.
look_point
=
look_point
# -1:北半球, 1:南半球, 0:赤道
# self.look_at_earth = look_at_earth
...
...
@@ -66,14 +68,16 @@ class LookAtSkyOnEarth(UniverseSimScenes):
earth_cn_size_factor
=
earth_cn_size_factor
,
earth_clouds_size_factor
=
earth_clouds_size_factor
)
self
.
earth
.
set_resolution
(
200
)
self
.
earth
.
set_ignore_gravity
(
True
)
self
.
earth
.
set_light_disable
(
True
)
# # 地球立春的位置和速度
# self.earth.init_position = [-9.1507536e+07, 0.0000000e+00, 1.1907757e+08]
# self.earth.init_velocity = [-23.550875, 0., -18.05398]
self
.
earth_clouds
.
init_position
=
[
-
9.1507536e+07
,
0.0000000e+00
,
1.1907757e+08
]
self
.
earth_clouds
.
init_velocity
=
[
-
23.550875
,
0.
,
-
18.05398
]
#
#
self.earth_clouds.init_position = [-9.1507536e+07, 0.0000000e+00, 1.1907757e+08]
#
self.earth_clouds.init_velocity = [-23.550875, 0., -18.05398]
self
.
earth
.
rotate_axis_color
=
(
255
,
255
,
50
)
self
.
earth
.
rotate_axis_scale
=
0.65
...
...
@@ -82,10 +86,16 @@ class LookAtSkyOnEarth(UniverseSimScenes):
if
pos_vel
is
not
None
:
self
.
earth
.
init_position
=
pos_vel
[
"pos"
]
self
.
earth
.
init_velocity
=
pos_vel
[
"vel"
]
# self.earth.init_velocity = pos_vel["vel"]
self
.
earth
.
init_velocity
=
[
0
,
0
,
0
]
self
.
target
=
self
.
create_camera_target
()
self
.
target
.
size_scale
=
1e4
ep
=
self
.
earth
.
init_position
self
.
target
.
init_position
=
[
ep
[
0
]
+
4e7
,
ep
[
1
],
ep
[
2
]
-
4e7
]
self
.
bodies
=
[
self
.
sun
,
self
.
earth
# , self.earth_clouds
self
.
sun
,
self
.
earth
#, self.target # , self.earth_core # , self.earth_clouds
]
if
self
.
show_china
:
...
...
@@ -101,6 +111,8 @@ class LookAtSkyOnEarth(UniverseSimScenes):
from
ursina
import
Entity
,
color
r
=
0.5
scale
=
0.05
model
=
'diamond'
model
=
"sphere"
# subdivisions = 16
x_y_angle
=
math
.
pi
*
self
.
angle
/
180
xr
=
r
*
math
.
cos
(
x_y_angle
)
...
...
@@ -109,29 +121,32 @@ class LookAtSkyOnEarth(UniverseSimScenes):
x_z_angle
=
math
.
pi
*
45
/
180
x
=
r
*
math
.
cos
(
x_z_angle
)
z
=
r
*
math
.
sin
(
x_z_angle
)
watcher_e
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
"sphere"
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=
0.0
,
x
=-
x
,
z
=
z
,
color
=
color
.
red
)
if
self
.
look_point
is
None
or
self
.
look_point
==
0
:
self
.
watcher_e
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
model
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=
0.0
,
x
=-
x
,
z
=
z
,
color
=
color
.
red
)
# y=0.0, x=x-0.17, z=pow(pow(r, 2) - pow(x-0.17, 2), 0.5), color=color.green)
x
=
xr
*
math
.
cos
(
x_z_angle
)
z
=
xr
*
math
.
sin
(
x_z_angle
)
watcher_n
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
"sphere"
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=
y
,
x
=-
x
,
z
=
z
,
color
=
color
.
green
)
if
self
.
look_point
is
None
or
self
.
look_point
==
-
1
:
self
.
watcher_n
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
model
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=
y
,
x
=-
x
,
z
=
z
,
color
=
color
.
green
)
# 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
=
"sphere"
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=-
y
,
x
=-
x
,
z
=
z
,
color
=
color
.
blue
)
if
self
.
look_point
is
None
or
self
.
look_point
==
1
:
self
.
watcher_s
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
model
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=-
y
,
x
=-
x
,
z
=
z
,
color
=
color
.
blue
)
# 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
.
create_sky_watchers
()
self
.
earth
.
planet
.
rotation_y
-=
180
# 一开始就正对太阳
self
.
earth
.
planet
.
alpha
=
0.8
#
self.earth.planet.alpha = 0.8
# self.earth_cn.planet.rotation_y -= 185 # 一开始就正对太阳
if
hasattr
(
self
.
earth_clouds
,
"planet"
):
self
.
earth_clouds
.
planet
.
rotation_y
-=
50
# 一开始就正对太阳
...
...
@@ -200,12 +215,22 @@ class LookAtSkyOnEarth(UniverseSimScenes):
# camera.fov = 120 # 默认:60
# camera.parent = self.sun.planet
else
:
camera
.
parent
=
self
.
earth
.
planet
if
self
.
look_point
==
0
:
camera
.
parent
=
self
.
watcher_e
elif
self
.
look_point
==
-
1
:
camera
.
parent
=
self
.
watcher_n
elif
self
.
look_point
==
1
:
camera
.
parent
=
self
.
watcher_s
# camera.parent = self.earth.planet
camera
.
rotation_z
=
90
camera
.
fov
=
75
# 默认:60
camera
.
clip_plane_near
=
10
camera
.
clip_plane_far
=
1000000
camera
.
clip_plane_far
=
100000000
if
hasattr
(
self
.
earth_core
,
"planet"
):
self
.
earth_core
.
planet
.
parent
=
self
.
earth
.
planet
self
.
earth_core
.
planet
.
alpha
=
1
def
delay_app_start
():
import
time
...
...
@@ -221,12 +246,12 @@ class LookAtSkyOnEarth(UniverseSimScenes):
# self.sun.planet.glow_circle.look_at(camera)
create_foreground
(
f
"armazonesdusk_
{
self
.
look_point
+
2
}
.png"
)
if
self
.
look_point
is
None
:
self
.
create_sky_watchers
()
# if self.look_point is None:
def
on_timer_changed
(
self
,
time_data
:
TimeData
):
if
abs
(
self
.
earth
.
planet
.
init_rotation_y
-
self
.
earth
.
planet
.
rotation_y
)
>
380
:
exit
(
0
)
# if self.show_china and self.wait_days_count > 0:
# self.wait_days_count = self.wait_days - time_data.total_days
#
...
...
@@ -277,4 +302,4 @@ if __name__ == '__main__':
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
()
sim
.
run
(
speed_factor
=
0.
9
)
sim
.
run
(
speed_factor
=
0.
75
)
sim_scenes/featured/look_at_sky_on_earth_e.py
浏览文件 @
b98c56d0
...
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
(
look_point
=
0
)
sim
.
run
(
speed_factor
=
0.
85
)
sim
.
run
(
speed_factor
=
0.
7000
)
sim_scenes/featured/look_at_sky_on_earth_n.py
浏览文件 @
b98c56d0
...
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
(
look_point
=-
1
)
sim
.
run
(
speed_factor
=
0.
85
)
sim
.
run
(
speed_factor
=
0.
7000
)
sim_scenes/featured/look_at_sky_on_earth_s.py
浏览文件 @
b98c56d0
...
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
(
look_point
=
1
)
sim
.
run
(
speed_factor
=
0.
85
)
sim
.
run
(
speed_factor
=
0.
7000
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录