Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
太阳系三体模拟器
提交
21ae8251
太阳系三体模拟器
项目概览
Python_超人
/
太阳系三体模拟器
通知
1103
Star
131
Fork
129
代码
文件
提交
分支
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看板
提交
21ae8251
编写于
3月 21, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
太阳系三体模拟器
上级
7208388e
变更
36
显示空白变更内容
内联
并排
Showing
36 changed file
with
246 addition
and
98 deletion
+246
-98
bodies/__init__.py
bodies/__init__.py
+7
-2
bodies/asteroid.py
bodies/asteroid.py
+1
-1
bodies/asteroids.py
bodies/asteroids.py
+1
-1
bodies/body.py
bodies/body.py
+8
-0
bodies/dysen_sphere.py
bodies/dysen_sphere.py
+1
-1
bodies/earth.py
bodies/earth.py
+1
-1
bodies/fixed_stars/alcyone.py
bodies/fixed_stars/alcyone.py
+19
-8
bodies/fixed_stars/antares.py
bodies/fixed_stars/antares.py
+25
-9
bodies/fixed_stars/arcturus.py
bodies/fixed_stars/arcturus.py
+21
-7
bodies/fixed_stars/betelgeuse.py
bodies/fixed_stars/betelgeuse.py
+18
-7
bodies/fixed_stars/canis_majoris_vy.py
bodies/fixed_stars/canis_majoris_vy.py
+2
-1
bodies/fixed_stars/carinae_v382.py
bodies/fixed_stars/carinae_v382.py
+8
-5
bodies/fixed_stars/eta_carinae.py
bodies/fixed_stars/eta_carinae.py
+8
-2
bodies/fixed_stars/fixed_star.py
bodies/fixed_stars/fixed_star.py
+6
-0
bodies/fixed_stars/pollux.py
bodies/fixed_stars/pollux.py
+15
-2
bodies/fixed_stars/pollux_b.py
bodies/fixed_stars/pollux_b.py
+2
-1
bodies/fixed_stars/procyon.py
bodies/fixed_stars/procyon.py
+18
-2
bodies/fixed_stars/rigel.py
bodies/fixed_stars/rigel.py
+4
-2
bodies/fixed_stars/sirius.py
bodies/fixed_stars/sirius.py
+3
-2
bodies/fixed_stars/stephenson_2_18.py
bodies/fixed_stars/stephenson_2_18.py
+4
-2
bodies/fixed_stars/wr21a.py
bodies/fixed_stars/wr21a.py
+2
-1
bodies/jupiter.py
bodies/jupiter.py
+1
-1
bodies/mars.py
bodies/mars.py
+1
-1
bodies/mercury.py
bodies/mercury.py
+1
-1
bodies/moon.py
bodies/moon.py
+1
-1
bodies/neptune.py
bodies/neptune.py
+1
-1
bodies/pluto.py
bodies/pluto.py
+1
-1
bodies/saturn.py
bodies/saturn.py
+1
-1
bodies/sun.py
bodies/sun.py
+3
-3
bodies/uranus.py
bodies/uranus.py
+1
-1
bodies/venus.py
bodies/venus.py
+1
-1
common/system.py
common/system.py
+2
-5
scenes/fixed_stars.py
scenes/fixed_stars.py
+23
-7
scenes/func.py
scenes/func.py
+3
-4
scenes/sun_earth.py
scenes/sun_earth.py
+4
-3
simulators/views/ursina_view.py
simulators/views/ursina_view.py
+28
-10
未找到文件。
bodies/__init__.py
浏览文件 @
21ae8251
# 太阳系中的天体(不含太阳)
from
bodies.body
import
Body
from
bodies.earth
import
Earth
from
bodies.sun
import
Sun
from
bodies.jupiter
import
Jupiter
from
bodies.mars
import
Mars
from
bodies.mercury
import
Mercury
...
...
@@ -16,8 +16,13 @@ from bodies.asteroids import Asteroids
# 戴森球
from
bodies.dysen_sphere
import
DysenSphere
# 恒星
# 恒星
(含太阳)
from
bodies.fixed_stars.fixed_star
import
FixedStar
from
bodies.sun
import
Sun
from
bodies.fixed_stars.sirius
import
Sirius
from
bodies.fixed_stars.stephenson_2_18
import
Stephenson_2_18
from
bodies.fixed_stars.rigel
import
Rigel
from
bodies.fixed_stars.alcyone
import
Alcyone
from
bodies.fixed_stars.antares
import
Antares
from
bodies.fixed_stars.arcturus
import
Arcturus
from
bodies.fixed_stars.betelgeuse
import
Betelgeuse
bodies/asteroid.py
浏览文件 @
21ae8251
...
...
@@ -26,7 +26,7 @@ class Asteroid(Body):
平均密度: 2.3✕10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Asteroid
"
,
mass
=
4.1e10
,
def
__init__
(
self
,
name
=
"
小行星
"
,
mass
=
4.1e10
,
init_position
=
[
1.6
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
25.37
,
0
],
texture
=
""
,
size_scale
=
1.0
,
distance_scale
=
1.0
):
...
...
bodies/asteroids.py
浏览文件 @
21ae8251
...
...
@@ -26,7 +26,7 @@ class Asteroids(Body):
平均密度: 2.3✕10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Asteroids
"
,
mass
=
1.9891e30
,
def
__init__
(
self
,
name
=
"
小行星群
"
,
mass
=
1.9891e30
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
texture
=
"asteroids.png"
,
size_scale
=
1.0
,
...
...
bodies/body.py
浏览文件 @
21ae8251
...
...
@@ -257,6 +257,14 @@ class Body(metaclass=ABCMeta):
"""
return
self
.
__rotation_speed
@
rotation_speed
.
setter
def
rotation_speed
(
self
,
value
):
"""
自旋速度(度/小时)
:return:
"""
self
.
__rotation_speed
=
value
@
property
def
density
(
self
):
"""
...
...
bodies/dysen_sphere.py
浏览文件 @
21ae8251
...
...
@@ -18,7 +18,7 @@ class DysenSphere(Body):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
DysenSphere
"
,
mass
=
2e28
,
def
__init__
(
self
,
name
=
"
戴森球
"
,
mass
=
2e28
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
170
,
98
,
25
),
...
...
bodies/earth.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Earth(Body):
平均密度: 5507.85 kg/m³
"""
def
__init__
(
self
,
name
=
"
Earth
"
,
mass
=
5.97237e24
,
def
__init__
(
self
,
name
=
"
地球
"
,
mass
=
5.97237e24
,
init_position
=
[
1.12
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
29.79
,
0
],
texture
=
"earth1.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/fixed_stars/alcyone.py
浏览文件 @
21ae8251
...
...
@@ -6,19 +6,29 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
class
Alcyone
(
FixedStar
):
"""
TODO:
昴宿六 (Alcyone)
质量:
5
太阳质量
昴宿六 (Alcyone)
质量:
7个
太阳质量
密度:不详
颜色值:#EFF6FF
直径:6.12倍太阳直径
中文名昴宿六外文名Alcyone表面温度13000K;总光度太阳的2,400倍半 径太阳的10倍质 量太阳的7倍视星等2.87自转周期3天光谱型B7III绝对星等-2.76
中文名: 昴宿六
外文名: Alcyone
表面温度: 13000K;
总光度: 太阳的2,400倍
半径: 太阳的10倍
质量: 太阳的7倍
视星等: 2.87
自转周期: 3天
光谱型: B7III
绝对星等: -2.76
------------------------
== 太阳参数 ==
自转周期: 24.47 地球日,自转角速度约为 0.6130 度/小时 = 360/(24.47*24)
...
...
@@ -26,10 +36,10 @@ class Alcyone(FixedStar):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"昴宿六"
,
mass
=
5
*
MO
,
def
__init__
(
self
,
name
=
"昴宿六"
,
mass
=
7
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0x
EF
,
0xF6
,
0xFF
),
color
=
(
0x
BB
,
0xAA
,
0xFF
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -37,7 +47,7 @@ class Alcyone(FixedStar):
"mass"
:
mass
,
"init_position"
:
init_position
,
"init_velocity"
:
init_velocity
,
"density"
:
1.408e3
,
"density"
:
9.854
,
# 10.000676498446115
"color"
:
color
,
"texture"
:
texture
,
"size_scale"
:
size_scale
,
...
...
@@ -49,6 +59,7 @@ class Alcyone(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Alcyone
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/antares.py
浏览文件 @
21ae8251
...
...
@@ -6,23 +6,37 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
class
Antares
(
FixedStar
):
"""
TODO:
心宿二,英文名为Antares
心宿二,英文名为Antares
质 量A:12 ± 0.2 M⊙ B:7.2 M⊙
半 径A:680–800 R☉;B:5.2 R☉
A:红超巨星 B:蓝矮星
质量:为1
8.6
太阳质量
大小:为
883
太阳半径
质量:为1
2
太阳质量
大小:为
680–800
太阳半径
颜色:为0xFF, 0x44, 0x00
密度:为0.0037 g/cm³。
中文名心宿二外文名Antares别 名Alpha Scorpii分 类A:红超巨星 B:蓝矮星质 量A:12 ± 0.2 M⊙ B:7.2 M⊙表面温度A:3570 K B:18500 K视星等A:0.6 ~ 1.6 B:5.5绝对星等-5.28 等 [9] 赤 经16时29分24.46秒赤 纬-26°25′55.21″距地距离550 ly(170 pc)U-B 色指数A:M1.5Iab-Ib B:B2.5VB-V 色指数+1.83光 度A:75,900 L☉ (44,700 – 128,900 L☉);B:2754 L☉ [9] 变星类型Lc半 径A:680–800 R☉;B:5.2 R☉ [9] 拼 音xīn xiù èr
中文名: 心宿二
外文名: Antares
别名: Alpha Scorpii
分类: A:红超巨星 B:蓝矮星
质量: A:12 ± 0.2 M⊙ B:7.2 M⊙
表面温度: A:3570 K B:18500 K
视星等: A:0.6 ~ 1.6 B:5.5
绝对星等: -5.28 等 [9]
赤经: 16时29分24.46秒
赤纬: -26°25′55.21″
距地距离: 550 ly(170 pc)U-B
色指数: A:M1.5Iab-Ib B:B2.5VB-V
色指数: +1.83
光度: A:75,900 L☉ (44,700 – 128,900 L☉);B:2754 L☉ [9]
变星类型: Lc
半径: A:680–800 R☉;B:5.2 R☉
------------------------
== 太阳参数 ==
...
...
@@ -31,10 +45,10 @@ class Antares(FixedStar):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"心宿二"
,
mass
=
1
8.6
*
MO
,
def
__init__
(
self
,
name
=
"心宿二"
,
mass
=
1
2
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xFF
,
0x44
,
0x00
),
color
=
(
249
,
198
,
83
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -42,7 +56,7 @@ class Antares(FixedStar):
"mass"
:
mass
,
"init_position"
:
init_position
,
"init_velocity"
:
init_velocity
,
"density"
:
0.00
37e3
,
"density"
:
0.00
0037
,
"color"
:
color
,
"texture"
:
texture
,
"size_scale"
:
size_scale
,
...
...
@@ -51,9 +65,11 @@ class Antares(FixedStar):
"ignore_mass"
:
ignore_mass
}
super
().
__init__
(
**
params
)
self
.
glow_num
=
6
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Antares
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/arcturus.py
浏览文件 @
21ae8251
...
...
@@ -6,20 +6,33 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
class
Arcturus
(
FixedStar
):
"""
TODO:
大角星 (Arcturus)
质量:
20
太阳质量
大角星 (Arcturus)
质量:太阳质量
密度:1.16×10⁻⁴ g/cm³
颜色值:#FF9100
直径:1,180倍太阳直径
中文名大角星外文名Arcturus别 名牧夫座α,牧夫座16 [2] 、α Boötis、天栋分 类恒星(橙巨星)质 量约 1.08 M⊙ [4] 表面温度约 4286 K [4] 视星等-0.05 等 [3] 绝对星等-0.38 等赤 经14时15分39.7秒赤 纬+19°10′56″距地距离36.7 光年半 径25.4±0.2 R☉ [4] 光 度170 L☉ [5] 光谱类型K0III [2]
中文名大角星
外文名Arcturus
别 名牧夫座α,牧夫座16 [2] 、α Boötis、天栋
分 类恒星(橙巨星)
质 量约 1.08 M⊙ [4]
表面温度约 4286 K [4]
视星等-0.05 等 [3]
绝对星等-0.38 等
赤 经14时15分39.7秒
赤 纬+19°10′56″
距地距离36.7 光年
半 径25.4±0.2 R☉ [4]
光 度170 L☉ [5]
光谱类型K0III [2]
------------------------
== 太阳参数 ==
...
...
@@ -28,10 +41,10 @@ class Arcturus(FixedStar):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"大角星"
,
mass
=
20
*
MO
,
def
__init__
(
self
,
name
=
"大角星"
,
mass
=
1.08
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xFF
,
0xF0
,
0xE4
),
color
=
(
254
,
218
,
185
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -39,7 +52,7 @@ class Arcturus(FixedStar):
"mass"
:
mass
,
"init_position"
:
init_position
,
"init_velocity"
:
init_velocity
,
"density"
:
1.408e3
,
"density"
:
0.0925
,
"color"
:
color
,
"texture"
:
texture
,
"size_scale"
:
size_scale
,
...
...
@@ -51,6 +64,7 @@ class Arcturus(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Arcturus
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/betelgeuse.py
浏览文件 @
21ae8251
...
...
@@ -6,19 +6,29 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
class
Betelgeuse
(
FixedStar
):
"""
TODO: 参宿四 (Betelgeuse)
质量:
20
太阳质量
质量:
11.6
太阳质量
密度:1.16×10⁻⁴ g/cm³
颜色值:#FF9100
直径:
1,180
倍太阳直径
直径:
887
倍太阳直径
中文名参宿四外文名Betelgeuse别 名α Orionis分 类红超巨星质 量11.6,11.6 + 5.0 或 11.6 - 3.9 M⊙直 径887 ± 203 或955 ± 217 D⊙表面温度3590 K视星等+0.50(0.0 ~ +1.3)绝对星等-5.85赤 经5时55分10.30秒赤 纬+7°24′25.43″距地距离640 光年光谱型M1-M2Ia-abU-B 色指数+2.06B-V 色指数+1.85光 度90000 ~ 1.5 × 10^5 L⊙变星类型SRc
中文名参宿四外文名Betelgeuse
别 名α Orionis
分 类红超巨星
质 量11.6,11.6 + 5.0 或 11.6 - 3.9 M⊙
直 径887 ± 203 或955 ± 217 D⊙
表面温度3590 K视星等+0.50(0.0 ~ +1.3)绝对星等-5.85
赤 经5时55分10.30秒
赤 纬+7°24′25.43″
距地距离640 光年
光谱型M1-M2Ia-abU-B 色指数+2.06B-V 色指数+1.85
光 度90000 ~ 1.5 × 10^5 L⊙变星类型SRc
------------------------
== 太阳参数 ==
...
...
@@ -27,10 +37,10 @@ class Betelgeuse(FixedStar):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"参宿四"
,
mass
=
20
*
MO
,
def
__init__
(
self
,
name
=
"参宿四"
,
mass
=
11.6
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xFF
,
0xF0
,
0xE4
),
color
=
(
254
,
162
,
1
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -38,7 +48,7 @@ class Betelgeuse(FixedStar):
"mass"
:
mass
,
"init_position"
:
init_position
,
"init_velocity"
:
init_velocity
,
"density"
:
1.408e3
,
"density"
:
0.0000234
,
"color"
:
color
,
"texture"
:
texture
,
"size_scale"
:
size_scale
,
...
...
@@ -50,6 +60,7 @@ class Betelgeuse(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Betelgeuse
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/canis_majoris_vy.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -66,6 +66,7 @@ class CanisMajorisVY(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
CanisMajorisVY
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/carinae_v382.py
浏览文件 @
21ae8251
...
...
@@ -6,21 +6,23 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
class
CarinaeV382
(
FixedStar
):
"""
TODO: 船底座V382(CarinaeV382)
质量:为
14.3
太阳质量 质 量20 M⊙ [2]
质量:为
20
太阳质量 质 量20 M⊙ [2]
大小:为350太阳半径 半 径700 ± 250 R☉
颜色:为0xFF, 0xBF, 0x00
密度:为0.008 g/cm³
中文名船底座V382外文名V382 Carinae别
名船底座x、海石增四分 类黄特超巨星质 量20 M⊙ [2]
表面温度5200 K [2] 视星等3.93 等绝对星等-9 等 [1] 赤 经11时08分35.39秒 [3] 赤 纬-58°58′30.14″ [3] 距地距离约 8900 光年 [1] 半 径700 ± 250 R☉ [4] 光 度316,000 L☉ [1]
名船底座x、海石增四分 类黄特超巨星
质 量20 M⊙ [2]
表面温度5200 K [2] 视星等3.93 等绝对星等-9 等 [1] 赤 经11时08分35.39秒 [3] 赤 纬-58°58′30.14″ [3] 距地距离约 8900 光年 [1]
半 径700 ± 250 R☉ [4] 光 度316,000 L☉ [1]
------------------------
== 太阳参数 ==
自转周期: 24.47 地球日,自转角速度约为 0.6130 度/小时 = 360/(24.47*24)
...
...
@@ -28,7 +30,7 @@ class CarinaeV382(FixedStar):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"船底座V382"
,
mass
=
14.3
*
MO
,
def
__init__
(
self
,
name
=
"船底座V382"
,
mass
=
20
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xFF
,
0xBF
,
0x00
),
...
...
@@ -51,6 +53,7 @@ class CarinaeV382(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
CarinaeV382
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/eta_carinae.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -18,7 +18,12 @@ class EtaCarinae(FixedStar):
颜色:0xFF, 0xD7, 0x00
密度:0.002 g/cm³
中文名海山二/船底座 η 星外文名Eta Carinae别 名Eta Car / η Carinae / η Car分 类A:高光度蓝变星 B:主序星发现者爱德蒙·哈雷发现时间1677年质 量100 M⊙(B:50-80M)直 径386809200 km(B:33 393 600Km)表面温度A:9400 ~ 35200 K B:37200 K视星等约 4.3 等(-0.8至7.9)绝对星等-8.6 等赤 经10时45分03.59秒赤 纬-59°41′04.26″距地距离7500 ly(2300 pc)半长轴15.4 AU离心率0.9公转周期2,022.7 ± 1.3 days(5.54 yr)轨道倾角130 ~ 145°光谱型A:LBV B:OU-B 色指数-0.45B-V 色指数+0.61光 度A:5 × 10^6 L☉ B:10^6 L☉
中文名海山二/船底座 η 星外文名Eta Carinae别 名Eta Car / η Carinae / η Car
分 类A:高光度蓝变星 B:主序星发现者爱德蒙·哈雷发现时间1677年
质 量100 M⊙(B:50-80M)
直 径386809200 km(B:33 393 600Km)
表面温度A:9400 ~ 35200 K B:37200 K视星等约 4.3 等(-0.8至7.9)
绝对星等-8.6 等赤 经10时45分03.59秒赤 纬-59°41′04.26″距地距离7500 ly(2300 pc)半长轴15.4 AU离心率0.9公转周期2,022.7 ± 1.3 days(5.54 yr)轨道倾角130 ~ 145°光谱型A:LBV B:OU-B 色指数-0.45B-V 色指数+0.61光 度A:5 × 10^6 L☉ B:10^6 L☉
------------------------
== 太阳参数 ==
...
...
@@ -50,6 +55,7 @@ class EtaCarinae(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
EtaCarinae
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/fixed_star.py
浏览文件 @
21ae8251
...
...
@@ -45,13 +45,19 @@ class FixedStar(Body):
"ignore_mass"
:
ignore_mass
}
super
().
__init__
(
**
params
)
self
.
light_on
=
True
self
.
glow_num
=
10
def
gen_texture
(
self
,
texture
):
if
texture
is
None
:
return
None
texture_path
=
find_texture_root_path
()
if
texture_path
is
None
:
err_msg
=
"未找到纹理图片目录"
raise
Exception
(
err_msg
)
save_file
=
os
.
path
.
join
(
texture_path
,
"fixed_star_%s.png"
%
str
(
self
.
__class__
.
__name__
).
lower
())
if
os
.
path
.
exists
(
save_file
):
return
save_file
fixed_star_img
=
os
.
path
.
join
(
texture_path
,
texture
)
gen_fixed_star_texture
(
self
.
color
,
save_file
=
save_file
,
fixed_star_img
=
fixed_star_img
)
return
save_file
...
...
bodies/fixed_stars/pollux.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -18,7 +18,19 @@ class Pollux(FixedStar):
颜色值:#F5E8D5
直径:1.84倍太阳直径
中文名北河三外文名Pollux别 名双子座β星分 类恒星,橙巨星质 量1.86 M⊙表面温度4770 K视星等1.14 等绝对星等1.08 等自转周期558天赤 经7时45分18.94秒赤 纬+28°01′34.31″距地距离33.78 光年B-V色指数1U-B色指数0.86光 度39L⊙位 置双子座
中文名北河三外文名Pollux别 名双子座β星分 类恒星,橙巨星
质 量1.86 M⊙
表面温度4770 K
视星等1.14 等
绝对星等1.08 等自
转周期558天
赤 经7时45分18.94秒
赤 纬+28°01′34.31″
距地距离33.78 光年B-V
色指数1U-B
色指数0.86
光 度39L⊙
位 置双子座
一、北河三比太阳大多少,77.4个太阳
...
...
@@ -57,6 +69,7 @@ class Pollux(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Pollux
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/pollux_b.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -57,6 +57,7 @@ class PolluxB(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
PolluxB
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/procyon.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -18,7 +18,22 @@ class Procyon(FixedStar):
颜色值:#F5E8D5
直径:1.84倍太阳直径
中文名南河三外文名Procyon别 名小犬座α分 类恒星发现者未知发现时间史前视星等约0.34绝对星等约2.67赤 经7时39分18.1秒赤 纬+5°13′29″距地距离约 11.46 光年半长轴1.18"离心率0.36轨道倾角31.9 度年 龄约1.7×1000000000年星表编号HIP 37279光谱类型F5 IV-V星 座小犬座星 官南河(井宿,朱雀)
中文名: 南河三
外文名: Procyon
别名: 小犬座α
分类: 恒星
发现者: 未知发现时间史前视星等约0.34绝对星等约2.67
赤经: 7时39分18.1秒
赤纬: +5°13′29″
距地距离: 约 11.46 光年
半长轴: 1.18"
离心率: 0.36
轨道倾角: 31.9 度
年龄: 约1.7×1000000000年
星表编号: IP 37279
光谱类型: F5 IV-V
星座: 小犬座
星官: 南河(井宿,朱雀)
------------------------
== 太阳参数 ==
自转周期: 24.47 地球日,自转角速度约为 0.6130 度/小时 = 360/(24.47*24)
...
...
@@ -49,6 +64,7 @@ class Procyon(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Procyon
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/rigel.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -39,7 +39,7 @@ class Rigel(FixedStar):
def
__init__
(
self
,
name
=
"参宿七"
,
mass
=
21
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0x90
,
0x90
,
0xFF
),
color
=
(
141
,
213
,
227
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -56,9 +56,11 @@ class Rigel(FixedStar):
"ignore_mass"
:
ignore_mass
}
super
().
__init__
(
**
params
)
self
.
glow_num
=
7
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Rigel
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/sirius.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -52,7 +52,7 @@ class Sirius(FixedStar):
def
__init__
(
self
,
name
=
"天狼星A"
,
mass
=
2.06
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xFF
,
0xF
0
,
0xE4
),
color
=
(
0xFF
,
0xF
F
,
0xFF
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -72,6 +72,7 @@ class Sirius(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Sirius
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/stephenson_2_18.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -48,7 +48,7 @@ class Stephenson_2_18(FixedStar):
def
__init__
(
self
,
name
=
"史蒂文森2-18"
,
mass
=
14.28e5
*
MO
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
((
0xFF
,
60
,
0
)),
color
=
((
198
,
29
,
3
)),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
params
=
{
...
...
@@ -65,9 +65,11 @@ class Stephenson_2_18(FixedStar):
"ignore_mass"
:
ignore_mass
}
super
().
__init__
(
**
params
)
self
.
glow_num
=
5
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
Stephenson_2_18
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/fixed_stars/wr21a.py
浏览文件 @
21ae8251
...
...
@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
FixedStar
,
Sun
from
bodies
import
FixedStar
from
common.consts
import
MO
...
...
@@ -47,6 +47,7 @@ class WR21a(FixedStar):
if
__name__
==
'__main__'
:
from
bodies
import
Sun
fixed_star
=
WR21a
()
sun
=
Sun
()
print
(
fixed_star
)
...
...
bodies/jupiter.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Jupiter(Body):
平均密度: 1.326 g/cm³ -> -> 1.326✕10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Jupiter
"
,
mass
=
1.8982e27
,
def
__init__
(
self
,
name
=
"
木星
"
,
mass
=
1.8982e27
,
init_position
=
[
5.2
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
13.06
,
0
],
texture
=
"jupiter1.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/mars.py
浏览文件 @
21ae8251
...
...
@@ -22,7 +22,7 @@ class Mars(Body):
天体质量: 6.4171✕10²³
平均密度: 3.9335 g/cm³ -> 3.9335✕10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Mars
"
,
mass
=
6.4171e23
,
def
__init__
(
self
,
name
=
"
火星
"
,
mass
=
6.4171e23
,
init_position
=
[
1.5
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
24.13
,
0
],
texture
=
"mars.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/mercury.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Mercury(Body):
平均密度: 5.427 g/cm³ -> 5.427×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Mercury
"
,
mass
=
3.3011e23
,
def
__init__
(
self
,
name
=
"
水星
"
,
mass
=
3.3011e23
,
init_position
=
[
0.4
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
47.87
,
0
],
texture
=
"mercury.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/moon.py
浏览文件 @
21ae8251
...
...
@@ -22,7 +22,7 @@ class Moon(Body):
平均密度: 3.344 g/cm³ -> 3.344✕10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Moon
"
,
mass
=
7.342e22
,
def
__init__
(
self
,
name
=
"
月球
"
,
mass
=
7.342e22
,
init_position
=
[
363104
+
1.12
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
29.79
+
1.023
,
0
],
texture
=
"moon.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/neptune.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Neptune(Body):
平均密度: 1.638 g/cm³ -> 1.638×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Neptune
"
,
mass
=
1.0241e26
,
def
__init__
(
self
,
name
=
"
海王星
"
,
mass
=
1.0241e26
,
init_position
=
[
30
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
5.43
,
0
],
texture
=
"neptune.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/pluto.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Pluto(Body):
平均密度: 1.854 g/cm³(±0.006) -> 1.854×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Pluto
"
,
mass
=
1.303e22
,
def
__init__
(
self
,
name
=
"
冥王星
"
,
mass
=
1.303e22
,
init_position
=
[
40
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
4.7
,
0
],
texture
=
"pluto.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/saturn.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Saturn(Body):
平均密度: 0.687 g/cm³ -> 0.687×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Saturn
"
,
mass
=
5.6834e26
,
def
__init__
(
self
,
name
=
"
土星
"
,
mass
=
5.6834e26
,
init_position
=
[
10
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
9.64
,
0
],
texture
=
"saturn.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/sun.py
浏览文件 @
21ae8251
...
...
@@ -6,10 +6,10 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
.body
import
Body
from
bodies
import
FixedStar
class
Sun
(
Body
):
class
Sun
(
FixedStar
):
"""
太阳
------------------------
...
...
@@ -18,7 +18,7 @@ class Sun(Body):
平均密度: 1.408×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Sun
"
,
mass
=
1.9891e30
,
def
__init__
(
self
,
name
=
"
太阳
"
,
mass
=
1.9891e30
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
color
=
(
170
,
98
,
25
),
...
...
bodies/uranus.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Uranus(Body):
平均密度: 1.27 g/cm³ -> 1.27×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Uranus
"
,
mass
=
8.681e25
,
def
__init__
(
self
,
name
=
"
天王星
"
,
mass
=
8.681e25
,
init_position
=
[
19
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
6.81
,
0
],
texture
=
"uranus.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
bodies/venus.py
浏览文件 @
21ae8251
...
...
@@ -23,7 +23,7 @@ class Venus(Body):
平均密度: 5.24g/cm3 -> 5.24×10³ kg/m³
"""
def
__init__
(
self
,
name
=
"
Venus
"
,
mass
=
4.8675e24
,
def
__init__
(
self
,
name
=
"
金星
"
,
mass
=
4.8675e24
,
init_position
=
[
0.72
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
35
,
0
],
texture
=
"venus.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
...
...
common/system.py
浏览文件 @
21ae8251
...
...
@@ -18,16 +18,13 @@ class System(object):
天体系统
"""
def
__init__
(
self
,
bodies
,
max_distance
=
200
*
AU
,
ignore_mass
=
False
):
def
__init__
(
self
,
bodies
,
max_distance
=
200
*
AU
):
"""
:param bodies:
:param max_distance:系统的最大范围,超出范围的天体就不显示了
"""
self
.
bodies
=
bodies
if
ignore_mass
:
for
body
in
self
.
bodies
:
body
.
ignore_mass
=
True
# self.adjust_distance_and_velocity()
self
.
max_distance
=
max_distance
...
...
@@ -184,7 +181,7 @@ class System(object):
if
calculate_distance
(
body2
.
position
)
>
self
.
max_distance
:
# 超过了max_distance距离,则消失
body2
.
appeared
=
False
if
False
==
body1
.
appeared
or
body2
.
appeared
==
False
:
if
not
body1
.
appeared
or
not
body2
.
appeared
:
continue
if
body1
is
body2
:
...
...
scenes/fixed_stars.py
浏览文件 @
21ae8251
...
...
@@ -6,8 +6,8 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
Sun
,
Sirius
,
Rigel
,
Stephenson_2_18
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
from
bodies
import
Sun
,
Earth
,
Sirius
,
Rigel
,
Alcyone
,
Antares
,
Arcturus
,
Betelgeuse
,
Stephenson_2_18
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_
MONTH
,
SECONDS_PER_YEAR
,
SECONDS_PER_
DAY
from
scenes.func
import
mayavi_run
,
mpl_run
,
ursina_run
from
bodies.body
import
Body
,
AU
...
...
@@ -16,14 +16,30 @@ if __name__ == '__main__':
恒星演示
"""
# 构建两个天体对象(太阳、地球)
D
=
5e5
SIZE_SCALE
=
0.02
bodies
=
[
Sun
(
size_scale
=
1
,
init_position
=
[
0
,
0
,
0
]),
Sirius
(
size_scale
=
1
,
init_position
=
[
0
,
1
*
AU
,
0
]),
Rigel
(
size_scale
=
1
,
init_position
=
[
0
,
2
*
AU
,
0
]),
Stephenson_2_18
(
size_scale
=
1
,
init_position
=
[
0
,
3
*
AU
,
0
])
Earth
(
size_scale
=
1
,
init_velocity
=
[
0
,
29.79
,
0
],
distance_scale
=
0.0006
),
Sun
(
size_scale
=
SIZE_SCALE
),
Sirius
(
size_scale
=
SIZE_SCALE
,
ignore_mass
=
True
),
Alcyone
(
size_scale
=
SIZE_SCALE
,
ignore_mass
=
True
),
Arcturus
(
size_scale
=
SIZE_SCALE
,
ignore_mass
=
True
),
Rigel
(
size_scale
=
SIZE_SCALE
,
ignore_mass
=
True
),
Antares
(
size_scale
=
SIZE_SCALE
,
ignore_mass
=
True
),
# Betelgeuse(size_scale=SIZE_SCALE, ignore_mass=True),
Stephenson_2_18
(
size_scale
=
SIZE_SCALE
,
ignore_mass
=
True
)
]
distance_sum
=
0
for
idx
,
body
in
enumerate
(
bodies
):
body
.
rotation_speed
/=
50
if
idx
>
1
:
body
.
light_on
=
False
# 关闭灯光效果,只有太阳对地球有灯光效果
d
=
pow
((
body
.
diameter
+
bodies
[
idx
-
1
].
diameter
)
*
SIZE_SCALE
,
0.75
)
*
120
# d = (body.diameter + bodies[idx - 1].diameter) * SIZE_SCALE * 1.1 + D
body
.
init_position
=
[(
distance_sum
+
d
)
/
2
,
(
distance_sum
+
d
),
0
]
distance_sum
+=
d
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_
WEEK
,
position
=
(
0
,
AU
,
-
5
*
AU
),
ignore_mass
=
True
)
ursina_run
(
bodies
,
SECONDS_PER_
MONTH
,
position
=
(
0
,
10
,
-
4
*
AU
/
200
)
)
scenes/func.py
浏览文件 @
21ae8251
...
...
@@ -55,13 +55,12 @@ def mayavi_run(bodies, dt=SECONDS_PER_WEEK,
def
ursina_run
(
bodies
,
dt
=
SECONDS_PER_HALF_DAY
,
position
=
(
4000000
,
800000000
,
400000
0
),
position
=
(
0
,
0
,
0
),
# view_azimuth=0,
light
=
True
,
cosmic_bg
=
None
,
show_grid
=
True
,
save_as_json
=
None
,
ignore_mass
=
False
):
save_as_json
=
None
):
"""
:param bodies: 天体
...
...
@@ -79,7 +78,7 @@ def ursina_run(bodies,
from
simulators.ursina_simulator
import
UrsinaSimulator
,
UrsinaPlayer
from
ursina
import
application
,
Sequence
,
camera
,
held_keys
,
time
,
clamp
,
Entity
,
Text
,
color
from
ursina.prefabs.first_person_controller
import
FirstPersonController
body_sys
=
System
(
bodies
,
ignore_mass
)
body_sys
=
System
(
bodies
)
if
save_as_json
is
not
None
:
try
:
body_sys
.
save_to_json
(
save_as_json
,
{
"dt"
:
dt
,
"position"
:
position
})
...
...
scenes/sun_earth.py
浏览文件 @
21ae8251
...
...
@@ -6,16 +6,17 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
Sun
,
Earth
from
bodies
import
Sun
,
Earth
,
Sirius
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
AU
from
scenes.func
import
mayavi_run
,
ursina_run
if
__name__
==
'__main__'
:
"""
太阳、地球
太阳、地球
Sirius(size_scale=0.2, init_position=[0, 0, 0]),
"""
bodies
=
[
Sun
(
size_scale
=
5e1
),
# 太阳放大 50 倍
Sirius
(
size_scale
=
2e1
,
init_position
=
[
0
,
0
,
0
]),
Sun
(
size_scale
=
5e1
,
init_position
=
[
0
,
0
,
0
]),
# 太阳放大 50 倍
Earth
(
size_scale
=
2e3
,
distance_scale
=
1
),
# 地球放大 2000 倍,距离保持不变
]
...
...
simulators/views/ursina_view.py
浏览文件 @
21ae8251
...
...
@@ -107,13 +107,15 @@ class Planet(Entity):
rotation
=
(
0
,
0
,
0
)
UrsinaEvent
.
on_reset_subscription
(
self
.
on_reset
)
# color.white
self
.
plant_color
=
color
.
white
# self.plant_color = color.rgba(*self.body_view.color)
super
().
__init__
(
# model="sphere",
model
=
model
,
scale
=
scale
,
texture
=
texture
,
color
=
color
.
white
,
color
=
self
.
plant_color
,
position
=
pos
,
rotation
=
rotation
# ,double_sided=True
)
...
...
@@ -295,11 +297,27 @@ class Planet(Entity):
# lights = []
# # 创建多个新的 Entity 对象,作为光晕的容器
# _color = color.rgba(1.0, 0.6, 0.2, 1)
if
hasattr
(
self
.
body_view
.
body
,
"glow_num"
):
glow_num
=
self
.
body_view
.
body
.
glow_num
if
glow_num
>
12
:
glow_num
=
12
if
glow_num
>
5
:
alpha
=
0.1
elif
glow_num
>
4
:
alpha
=
0.2
elif
glow_num
>
3
:
alpha
=
0.3
elif
glow_num
>
2
:
alpha
=
0.4
if
glow_num
>
0
:
_color
=
self
.
body_view
.
body
.
color
_color
=
color
.
rgba
(
_color
[
0
]
/
255
,
_color
[
1
]
/
255
,
_color
[
2
]
/
255
,
1
)
for
i
in
range
(
10
):
for
i
in
range
(
glow_num
):
glow_entity
=
Entity
(
parent
=
self
,
model
=
'sphere'
,
color
=
_color
,
scale
=
math
.
pow
(
1.03
,
i
),
alpha
=
0.1
)
scale
=
math
.
pow
(
1.03
,
i
),
alpha
=
alpha
)
if
hasattr
(
self
.
body_view
.
body
,
"light_on"
):
if
self
.
body_view
.
body
.
light_on
:
for
i
in
range
(
2
):
# 创建 PointLight 对象,作为恒星的灯光源
light
=
PointLight
(
parent
=
self
,
intensity
=
10
,
range
=
10
,
color
=
color
.
white
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录