提交 9809fe3d 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 15270931
......@@ -33,7 +33,7 @@ def create_name_text(parent):
origin=(0, 0))
name_text.background.color = color.rgba(b_color[0], b_color[1], b_color[2], 0.3)
name_text.resolution = 24
# self.name_text.scale = self.scale
# parent.name_text.scale = parent.scale
if text_color is None:
text_color = get_inverse_color(b_color)
else:
......@@ -239,7 +239,7 @@ def create_trail_line(parent, pos):
return trail
def create_rings(self):
def create_rings(parent):
"""
创建行星环(使用土星贴图)
@return:
......@@ -248,34 +248,34 @@ def create_rings(self):
rings_texture = find_file(rings_texture)
# 行星环偏移角度
# self.ring_rotation_x = 80
# parent.ring_rotation_x = 80
# 创建行星环
# self.ring = Entity(parent=self.planet, model='circle', texture=rings_texture, scale=3.5,
# rotation=(self.ring_rotation_x, 0, 0), double_sided=True)
# parent.ring = Entity(parent=parent.planet, model='circle', texture=rings_texture, scale=3.5,
# rotation=(parent.ring_rotation_x, 0, 0), double_sided=True)
# 行星环偏移角度
self.ring_rotation_x = 80
parent.ring_rotation_x = 80
# 创建行星环
torus = create_torus(0.7, 1.2, 64)
self.ring = Entity(parent=self, model=torus, texture=rings_texture, scale=1,
rotation=(self.ring_rotation_x, 0, 0), double_sided=True)
parent.ring = Entity(parent=parent, model=torus, texture=rings_texture, scale=1,
rotation=(parent.ring_rotation_x, 0, 0), double_sided=True)
# 设置行星环不受灯光影响,否则看不清行星环
self.ring.set_light_off()
parent.ring.set_light_off()
def clear_trails(self):
def clear_trails(parent):
"""
@param self:
@param parent:
@return:
"""
if not hasattr(self, "trails"):
if not hasattr(parent, "trails"):
return
# 删除拖尾
for entity, pos in self.trails.items():
for entity, pos in parent.trails.items():
destroy(entity)
self.trails.clear()
parent.trails.clear()
def create_fixed_star_lights(fixed_star):
......
......@@ -109,6 +109,18 @@ def create_line(from_pos, to_pos, parent=None, alpha=1.0, len_scale=1, set_light
return line
def create_circle(parent=None, pos=Vec3(0, 0, 0), thickness=1, scale=1, color=color.white, alpha=1):
circle = Entity(parent=parent, model="circle", thickness=thickness, scale=scale, position=pos,
color=color, alpha=alpha)
return circle
def create_circle_line(parent=None, pos=Vec3(0, 0, 0), thickness=1, scale=1, color=color.white, alpha=1):
circle = Entity(parent=parent, model="circle", thickness=thickness, scale=scale, position=pos,
color=color, alpha=alpha)
return circle
def create_arrow_line(from_pos, to_pos, parent=None, label=None,
set_light_off=True, alpha=1.0, len_scale=0.5,
color=color.white, thickness=2,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册