diff --git a/punyverse/assets/textures.txt b/punyverse/assets/textures.txt index 1e01337..70099d9 100644 --- a/punyverse/assets/textures.txt +++ b/punyverse/assets/textures.txt @@ -1,7 +1,9 @@ # This file contains all the textures that is bigger than the minimum OpenGL texture size # and hence may need to be resized depending on the machine +sun.jpg mercury.jpg +venus.jpg earth.jpg earth_normal.jpg earth_emission.jpg @@ -11,6 +13,8 @@ moon.jpg mars.jpg jupiter.jpg saturn.jpg +uranus.jpg +neptune.jpg sky_px.jpg sky_py.jpg sky_pz.jpg diff --git a/punyverse/assets/textures/atmosphere_earth.png b/punyverse/assets/textures/atmosphere_earth.png deleted file mode 100644 index d519f8c..0000000 Binary files a/punyverse/assets/textures/atmosphere_earth.png and /dev/null differ diff --git a/punyverse/assets/textures/font.png b/punyverse/assets/textures/font.png index 589c370..06f85b6 100644 Binary files a/punyverse/assets/textures/font.png and b/punyverse/assets/textures/font.png differ diff --git a/punyverse/assets/textures/glow.png b/punyverse/assets/textures/glow.png new file mode 100644 index 0000000..179dc5d Binary files /dev/null and b/punyverse/assets/textures/glow.png differ diff --git a/punyverse/assets/textures/neptune.jpg b/punyverse/assets/textures/neptune.jpg index 895955f..d5ce14e 100644 Binary files a/punyverse/assets/textures/neptune.jpg and b/punyverse/assets/textures/neptune.jpg differ diff --git a/punyverse/assets/textures/ring_saturn.png b/punyverse/assets/textures/ring_saturn.png index 4612d3d..a550651 100644 Binary files a/punyverse/assets/textures/ring_saturn.png and b/punyverse/assets/textures/ring_saturn.png differ diff --git a/punyverse/assets/textures/ring_uranus.png b/punyverse/assets/textures/ring_uranus.png index 4678d5c..26e73ea 100644 Binary files a/punyverse/assets/textures/ring_uranus.png and b/punyverse/assets/textures/ring_uranus.png differ diff --git a/punyverse/assets/textures/saturn.jpg b/punyverse/assets/textures/saturn.jpg index c701ffb..10352dd 100644 Binary files a/punyverse/assets/textures/saturn.jpg and b/punyverse/assets/textures/saturn.jpg differ diff --git a/punyverse/assets/textures/sun.jpg b/punyverse/assets/textures/sun.jpg index e4a7b24..2945085 100644 Binary files a/punyverse/assets/textures/sun.jpg and b/punyverse/assets/textures/sun.jpg differ diff --git a/punyverse/assets/textures/sun_diffuse.png b/punyverse/assets/textures/sun_diffuse.png deleted file mode 100644 index 9dc5139..0000000 Binary files a/punyverse/assets/textures/sun_diffuse.png and /dev/null differ diff --git a/punyverse/assets/textures/uranus.jpg b/punyverse/assets/textures/uranus.jpg index fecec25..a6b20a4 100644 Binary files a/punyverse/assets/textures/uranus.jpg and b/punyverse/assets/textures/uranus.jpg differ diff --git a/punyverse/assets/textures/venus.jpg b/punyverse/assets/textures/venus.jpg index a692613..416ac0f 100644 Binary files a/punyverse/assets/textures/venus.jpg and b/punyverse/assets/textures/venus.jpg differ diff --git a/punyverse/entity.py b/punyverse/entity.py index c3191c5..249c08b 100644 --- a/punyverse/entity.py +++ b/punyverse/entity.py @@ -388,8 +388,9 @@ class SphericalBody(Body): if 'atmosphere' in info: atmosphere_data = info['atmosphere'] - atm_size = world.evaluate(atmosphere_data.get('diffuse_size', None)) - atm_texture = atmosphere_data.get('diffuse_texture', None) + atm_size = world.evaluate(atmosphere_data.get('glow_size', None)) + atm_texture = atmosphere_data.get('glow_texture', None) + atm_color = atmosphere_data.get('glow_color', None) cloud_texture = atmosphere_data.get('cloud_texture', None) if cloud_texture is not None: self.cloud_transparency = get_best_texture(cloud_texture, loader=load_alpha_mask) @@ -405,8 +406,9 @@ class SphericalBody(Body): self.clouds.stride, self.clouds.uv_offset) glBindBuffer(GL_ARRAY_BUFFER, 0) - if atm_texture is not None: + if atm_texture is not None and atm_color is not None: self.atm_texture = load_texture_1d(atm_texture, clamp=True) + self.atm_color = atm_color self.atmosphere = Disk(self.radius, self.radius + atm_size, 30) self.atmosphere_vao = VAO() shader = self.world.activate_shader('atmosphere') @@ -513,7 +515,8 @@ class SphericalBody(Body): shader.uniform_mat4('u_mvpMatrix', self.world.projection_matrix() * matrix) glBindTexture(GL_TEXTURE_1D, self.atm_texture) - shader.uniform_texture('u_texture', 0) + shader.uniform_texture('u_transparency', 0) + shader.uniform_vec3('u_color', *self.atm_color) with self.atmosphere_vao: glDrawArrays(GL_TRIANGLE_STRIP, 0, self.atmosphere.vertex_count) diff --git a/punyverse/shaders/atmosphere.fragment.glsl b/punyverse/shaders/atmosphere.fragment.glsl index 962a70a..e6d787d 100644 --- a/punyverse/shaders/atmosphere.fragment.glsl +++ b/punyverse/shaders/atmosphere.fragment.glsl @@ -3,8 +3,10 @@ in float v_u; out vec4 o_fragColor; -uniform sampler1D u_texture; + +uniform vec3 u_color; +uniform sampler1D u_transparency; void main() { - o_fragColor = texture(u_texture, v_u); + o_fragColor = vec4(u_color, texture(u_transparency, v_u).r); } diff --git a/punyverse/world.json b/punyverse/world.json index c4e04ae..2b2aaa5 100644 --- a/punyverse/world.json +++ b/punyverse/world.json @@ -7,7 +7,7 @@ "distance": "virtual distance to look better, in km", "sma": "semi-major axis used with mass of parent to calculate orbit, in km", "mass": "mass in kg", - "texture": "a group of texture to use, tried in that order. a list means a colour", + "texture": "a group of texture to use, tried in that order", "model": "used to load a wavefront object instead of a textured sphere" }, "au": 10000, @@ -24,8 +24,9 @@ "light_source": true, "type": "star", "atmosphere": { - "diffuse_texture": "sun_diffuse.png", - "diffuse_size": 300 + "glow_color": [0.92, 0.92, 0.82], + "glow_texture": "glow.png", + "glow_size": 300 } }, "mercury": { @@ -61,8 +62,9 @@ "emission_map": ["earth_emission.jpg", "earth_emission_medium.jpg", "earth_emission_small.jpg"], "atmosphere": { "cloud_texture": ["cloudmap.jpg", "cloudmap_small.jpg"], - "diffuse_texture": "atmosphere_earth.png", - "diffuse_size": 30 + "glow_color": [0.11, 0.32, 0.43], + "glow_texture": "glow.png", + "glow_size": 30 }, "orbit_distance": "AU", "satellites": { diff --git a/setup.py b/setup.py index 79d42c5..47e05ac 100644 --- a/setup.py +++ b/setup.py @@ -105,7 +105,7 @@ else: setup( name='punyverse', - version='1.0', + version='1.1', packages=['punyverse'], package_data={ 'punyverse': [