mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 13:11:57 -04:00
Add emission texture for earth.
This commit is contained in:
parent
c3176ce7f6
commit
25e28c3c12
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
mercury.jpg
|
mercury.jpg
|
||||||
earth.jpg
|
earth.jpg
|
||||||
|
earth_normal.jpg
|
||||||
|
earth_emission.jpg
|
||||||
cloudmap.jpg
|
cloudmap.jpg
|
||||||
moon.jpg
|
moon.jpg
|
||||||
mars.jpg
|
mars.jpg
|
||||||
|
|
BIN
punyverse/assets/textures/earth_emission.jpg
Normal file
BIN
punyverse/assets/textures/earth_emission.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 328 KiB |
|
@ -293,6 +293,7 @@ class SphericalBody(Body):
|
||||||
|
|
||||||
self.texture = get_best_texture(info['texture'])
|
self.texture = get_best_texture(info['texture'])
|
||||||
self.normal_texture = None
|
self.normal_texture = None
|
||||||
|
self.emission_texture = None
|
||||||
self.sphere = self._get_sphere(division, tangent=self.type == 'planet')
|
self.sphere = self._get_sphere(division, tangent=self.type == 'planet')
|
||||||
|
|
||||||
self.atmosphere = None
|
self.atmosphere = None
|
||||||
|
@ -302,6 +303,9 @@ class SphericalBody(Body):
|
||||||
if 'normal_map' in info:
|
if 'normal_map' in info:
|
||||||
self.normal_texture = get_best_texture(info['normal_map'])
|
self.normal_texture = get_best_texture(info['normal_map'])
|
||||||
|
|
||||||
|
if 'emission_map' in info:
|
||||||
|
self.emission_texture = get_best_texture(info['emission_map'])
|
||||||
|
|
||||||
if 'atmosphere' in info:
|
if 'atmosphere' in info:
|
||||||
atmosphere_data = info['atmosphere']
|
atmosphere_data = info['atmosphere']
|
||||||
atm_size = world.evaluate(atmosphere_data.get('diffuse_size', None))
|
atm_size = world.evaluate(atmosphere_data.get('diffuse_size', None))
|
||||||
|
@ -346,12 +350,20 @@ class SphericalBody(Body):
|
||||||
shader.uniform_texture('u_planet.normalMap', 1)
|
shader.uniform_texture('u_planet.normalMap', 1)
|
||||||
|
|
||||||
shader.uniform_bool('u_planet.hasSpecular', False)
|
shader.uniform_bool('u_planet.hasSpecular', False)
|
||||||
shader.uniform_bool('u_planet.hasEmission', False)
|
|
||||||
|
|
||||||
shader.uniform_vec3('u_planet.ambient', 1, 1, 1)
|
shader.uniform_bool('u_planet.hasEmission', self.emission_texture)
|
||||||
|
if self.emission_texture:
|
||||||
|
glActiveTexture(GL_TEXTURE3)
|
||||||
|
glBindTexture(GL_TEXTURE_2D, self.emission_texture)
|
||||||
|
shader.uniform_texture('u_planet.emissionMap', 3)
|
||||||
|
shader.uniform_vec3('u_planet.ambient', 0, 0, 0)
|
||||||
|
shader.uniform_vec3('u_planet.emission', 1, 1, 1)
|
||||||
|
else:
|
||||||
|
shader.uniform_vec3('u_planet.ambient', 1, 1, 1)
|
||||||
|
shader.uniform_vec3('u_planet.emission', 0, 0, 0)
|
||||||
|
|
||||||
shader.uniform_vec3('u_planet.diffuse', 1, 1, 1)
|
shader.uniform_vec3('u_planet.diffuse', 1, 1, 1)
|
||||||
shader.uniform_vec3('u_planet.specular', 0, 0, 0)
|
shader.uniform_vec3('u_planet.specular', 0, 0, 0)
|
||||||
shader.uniform_vec3('u_planet.emission', 0, 0, 0)
|
|
||||||
|
|
||||||
shader.uniform_float('u_planet.shininess', 0)
|
shader.uniform_float('u_planet.shininess', 0)
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
"rotation": 86400,
|
"rotation": 86400,
|
||||||
"division": 90,
|
"division": 90,
|
||||||
"normal_map": ["earth_normal.jpg", "earth_normal_small.jpg"],
|
"normal_map": ["earth_normal.jpg", "earth_normal_small.jpg"],
|
||||||
|
"emission_map": ["earth_emission.jpg", "earth_emission_medium.jpg", "earth_emission_small.jpg"],
|
||||||
"atmosphere": {
|
"atmosphere": {
|
||||||
"cloud_texture": ["cloudmap.jpg", "cloudmap_small.jpg"],
|
"cloud_texture": ["cloudmap.jpg", "cloudmap_small.jpg"],
|
||||||
"diffuse_texture": "atmosphere_earth.png",
|
"diffuse_texture": "atmosphere_earth.png",
|
||||||
|
|
Loading…
Reference in a new issue