Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
bfcd4c81
宇宙模拟器
项目概览
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看板
提交
bfcd4c81
编写于
3月 31, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
17fc08ca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
12 deletion
+21
-12
simulators/ursina/ui/control_handler.py
simulators/ursina/ui/control_handler.py
+8
-7
simulators/ursina/ui_component.py
simulators/ursina/ui_component.py
+2
-2
simulators/ursina_simulator.py
simulators/ursina_simulator.py
+11
-3
未找到文件。
simulators/ursina/ui/control_handler.py
浏览文件 @
bfcd4c81
...
@@ -37,10 +37,10 @@ class ControlHandler(EventHandler):
...
@@ -37,10 +37,10 @@ class ControlHandler(EventHandler):
background
=
True
)
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
=
Tru
e
)
background
=
Fals
e
)
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
# 鼠标右键
# rot = camera.rotation
# rot = camera.rotation
wt
=
camera
.
world_transform
# QE[0,1,2] AD [0 , 2] 鼠标右键
wt
=
camera
.
world_transform
# QE[0,1,2] AD [0 , 2] 鼠标右键
...
@@ -50,11 +50,12 @@ class ControlHandler(EventHandler):
...
@@ -50,11 +50,12 @@ class ControlHandler(EventHandler):
# print(camera.left,camera.forward,camera.back,camera.right,camera.scale,camera.aspect_ratio,camera.down,camera.up,camera.world_scale,camera.world_rotation)
# print(camera.left,camera.forward,camera.back,camera.right,camera.scale,camera.aspect_ratio,camera.down,camera.up,camera.world_scale,camera.world_rotation)
# fw = camera.forward
# fw = camera.forward
# self.camera_info.text = "pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] rot:[%.2f,%.2f,%.2f] wt:[%s,%s,%s]" % \
# self.camera_info.text = "pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] rot:[%.2f,%.2f,%.2f] wt:[%s,%s,%s]" % \
self
.
camera_info
.
text
=
"pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] wt:[%s,%s]"
%
\
if
hasattr
(
self
,
"camera_info"
):
(
pos
[
0
],
pos
[
1
],
pos
[
2
],
self
.
camera_info
.
text
=
"pos:[%.2f,%.2f,%.2f] w_pos:[%.2f,%.2f,%.2f] wt:[%s,%s]"
%
\
w_pos
[
0
],
w_pos
[
1
],
w_pos
[
2
],
(
pos
[
0
],
pos
[
1
],
pos
[
2
],
# rot[0], rot[1], rot[2],
w_pos
[
0
],
w_pos
[
1
],
w_pos
[
2
],
wt
[
0
],
wt
[
1
])
# , wt[2]
# rot[0], rot[1], rot[2],
wt
[
0
],
wt
[
1
])
# , wt[2]
def
sec_per_time_switch_changed
(
self
):
def
sec_per_time_switch_changed
(
self
):
"""
"""
...
...
simulators/ursina/ui_component.py
浏览文件 @
bfcd4c81
...
@@ -29,7 +29,7 @@ class UiSlider(Slider):
...
@@ -29,7 +29,7 @@ class UiSlider(Slider):
max
=
max
,
max
=
max
,
default
=
default
,
default
=
default
,
color
=
color
.
rgba
(
0.0
,
0.0
,
0.0
,
0.5
),
color
=
color
.
rgba
(
0.0
,
0.0
,
0.0
,
0.5
),
ignore_paused
=
Fals
e
,
ignore_paused
=
Tru
e
,
dynamic
=
True
)
dynamic
=
True
)
# self.label.scale *= 8/10
# self.label.scale *= 8/10
self
.
label
.
font
=
UrsinaConfig
.
CN_FONT
self
.
label
.
font
=
UrsinaConfig
.
CN_FONT
...
@@ -88,5 +88,5 @@ class UiButton(Button):
...
@@ -88,5 +88,5 @@ class UiButton(Button):
def
__init__
(
self
,
text
,
on_click
):
def
__init__
(
self
,
text
,
on_click
):
super
(
UiButton
,
self
).
__init__
(
text
=
text
,
origin
=
(
0
,
0
),
y
=
2
,
super
(
UiButton
,
self
).
__init__
(
text
=
text
,
origin
=
(
0
,
0
),
y
=
2
,
on_click
=
on_click
,
color
=
color
.
rgba
(
0.0
,
0.0
,
0.0
,
0.5
),
on_click
=
on_click
,
color
=
color
.
rgba
(
0.0
,
0.0
,
0.0
,
0.5
),
ignore_paused
=
Fals
e
)
ignore_paused
=
Tru
e
)
self
.
text_entity
.
font
=
UrsinaConfig
.
CN_FONT
self
.
text_entity
.
font
=
UrsinaConfig
.
CN_FONT
simulators/ursina_simulator.py
浏览文件 @
bfcd4c81
...
@@ -164,9 +164,14 @@ class UrsinaSimulator(Simulator):
...
@@ -164,9 +164,14 @@ class UrsinaSimulator(Simulator):
:return:
:return:
"""
"""
# Add skybox
# Add skybox
if
camera
.
clip_plane_near
>=
0.01
:
sky_scale
=
50000
else
:
sky_scale
=
500000
*
camera
.
clip_plane_near
from
ursina
import
Sky
from
ursina
import
Sky
sky_scale
=
50000
sky
=
Sky
(
texture
=
texture
)
sky
=
Sky
(
texture
=
texture
)
sky
.
scale
=
sky_scale
sky
.
scale
=
sky_scale
# sky.set_shader_input('texture_scale', Vec2(20, 20))
# sky.set_shader_input('texture_scale', Vec2(20, 20))
...
@@ -191,8 +196,11 @@ class UrsinaSimulator(Simulator):
...
@@ -191,8 +196,11 @@ class UrsinaSimulator(Simulator):
if
view_closely
:
if
view_closely
:
# 近距离查看
# 近距离查看
# 设置 camera 的裁剪面和位置
if
isinstance
(
view_closely
,
float
):
camera
.
clip_plane_near
=
0.01
camera
.
clip_plane_near
=
view_closely
else
:
# 设置 camera 的裁剪面和位置
camera
.
clip_plane_near
=
0.01
camera
.
fov
=
60
camera
.
fov
=
60
# interval_fator 能让更新天体运行状态(位置、速度)更精确
# interval_fator 能让更新天体运行状态(位置、速度)更精确
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录