From 3abdc816e41dfcb7c6a7c1bba134c6037897a175 Mon Sep 17 00:00:00 2001 From: march3 Date: Sun, 5 Mar 2023 19:41:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=AA=E9=98=B3=E7=B3=BB=E4=B8=89=E4=BD=93?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simulators/ursina_simulator.py | 10 ++++++++-- simulators/views/ursina_view.py | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/simulators/ursina_simulator.py b/simulators/ursina_simulator.py index 6150084..9954687 100644 --- a/simulators/ursina_simulator.py +++ b/simulators/ursina_simulator.py @@ -150,8 +150,14 @@ class UrsinaSimulator(Simulator): self.last_time = datetime.datetime.now() - datetime.timedelta(seconds=2) if "light" in kwargs: if kwargs["light"]: - li = PointLight() - # PointLight, SpotLight, AmbientLight + for v in self.ursina_views: + if v.body.is_fixed_star: + PointLight(parent=v) + # PointLight(parent=camera, color=color.white, position=(0, 0, 0)) + # AmbientLight(color=color.rgba(100, 100, 100, 0.1)) + # DirectionalLight + # SpotLight + if "cosmic_bg" in kwargs: cosmic_bg = kwargs["cosmic_bg"] if cosmic_bg is None: diff --git a/simulators/views/ursina_view.py b/simulators/views/ursina_view.py index cb7f291..9907819 100644 --- a/simulators/views/ursina_view.py +++ b/simulators/views/ursina_view.py @@ -207,7 +207,7 @@ class Planet(Entity): # texture = eval(f"{_type}_texture") # e = os.path.exists(texture) # texture = self.__set_texture(body_view.texture) - if hasattr(body_view,"texture"): + if hasattr(body_view, "texture"): texture = load_texture(body_view.texture) else: texture = None @@ -288,6 +288,10 @@ class UrsinaView(BodyView): ring.position = self.planet.position def update(self): + # self.planet.clear_light() + if self.body.is_fixed_star: + # 如果是恒星(如:太阳),自身会发光,则需要关闭灯光 + self.planet.set_light_off() self.planet.turn() def appear(self): -- GitLab