Make sun a real light source.

This commit is contained in:
Quantum 2018-08-23 22:08:47 -04:00
parent 13867d7fd0
commit e33fad8bbb
2 changed files with 5 additions and 1 deletions

View file

@ -246,6 +246,7 @@ class SphericalBody(Body):
self.radius = world.evaluate(info.get('radius', world.length)) / world.length self.radius = world.evaluate(info.get('radius', world.length)) / world.length
division = info.get('division', max(min(int(self.radius / 8), 60), 10)) division = info.get('division', max(min(int(self.radius / 8), 60), 10))
self.light_source = info.get('light_source', False)
texture = get_best_texture(info['texture']) texture = get_best_texture(info['texture'])
self.sphere_id = compile(sphere, self.radius, division, division, texture) self.sphere_id = compile(sphere, self.radius, division, division, texture)
@ -291,7 +292,9 @@ class SphericalBody(Body):
get_best_texture(info['ring'].get('texture', None))) get_best_texture(info['ring'].get('texture', None)))
def _draw_sphere(self): def _draw_sphere(self):
with glMatrix(self.location, self.rotation), glRestore(GL_CURRENT_BIT): with glMatrix(self.location, self.rotation), glRestore(GL_CURRENT_BIT | GL_ENABLE_BIT):
if self.light_source:
glDisable(GL_LIGHTING)
glCallList(self.sphere_id) glCallList(self.sphere_id)
def _draw_atmosphere(self, cam, glMatrixBuffer=GLfloat * 16): def _draw_atmosphere(self, cam, glMatrixBuffer=GLfloat * 16):

View file

@ -21,6 +21,7 @@
"yaw": 7.25, "yaw": 7.25,
"mass": 1.9891e+30, "mass": 1.9891e+30,
"rotation": 2164320, "rotation": 2164320,
"light_source": true,
"atmosphere": { "atmosphere": {
"corona_texture": "sun_corona.png", "corona_texture": "sun_corona.png",
"corona_size": 1500, "corona_size": 1500,