diff --git a/simulators/ursina_simulator.py b/simulators/ursina_simulator.py index 615008478d7b7760506bc5f262faa1dcfd2301ad..99546875189de6f6ea9faa112da4ba66f84acaba 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 cb7f29177b48322e0c2e23956fa2c63b021fd687..99078190ba310885d3f5b5b15282de645f2d5731 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):