Skip to content

Commit

Permalink
Downscale textures.
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-graj committed Aug 14, 2022
1 parent 619f050 commit fa104c3
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 8 deletions.
6 changes: 3 additions & 3 deletions res/shader/satellite.vert
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ layout (location = 0) uniform mat4 transform;

out vec3 color;

const float scaling_factor = 0.05;
const float max_size = 10.0;
const float scaling_factor = 15.0;
const float max_size = 8.0;

void main()
{
gl_Position = transform * vec4(in_pos, 1.0f);
gl_PointSize = min(round((1.0 + scaling_factor) / (scaling_factor + gl_Position.z / gl_Position.w)), max_size);
gl_PointSize = clamp(round(scaling_factor - scaling_factor * (gl_Position.z / gl_Position.w)), 1, max_size);
color = in_color;
}
Binary file removed res/texture/8k_earth_clouds.jpg
Binary file not shown.
Binary file removed res/texture/8k_earth_daymap.jpg
Binary file not shown.
Binary file removed res/texture/8k_earth_nightmap.jpg
Binary file not shown.
Binary file removed res/texture/8k_earth_specular_map.jpg
Binary file not shown.
Binary file removed res/texture/8k_stars.jpg
Binary file not shown.
Binary file added res/texture/earth_clouds.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/texture/earth_daymap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/texture/earth_nightmap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/texture/earth_specular_map.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/texture/stars.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions res/ui/ui.glade
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">True</property>
Expand Down
106 changes: 106 additions & 0 deletions res/ui/ui.glade~
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,102 @@
<property name="position">1</property>
</packing>
</child>
<child>
<!-- n-columns=4 n-rows=3 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Intl Des</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">ID</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Payload</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Status</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Owner</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
Expand Down Expand Up @@ -300,6 +396,16 @@
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">True</property>
Expand Down
8 changes: 4 additions & 4 deletions src/entity/earth.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ void earth_init(void)
{ LOCL_ATEXCOORD, "in_uv" },
});

texture_init_from_image(&texture_day, "res/texture/8k_earth_daymap.jpg", GL_TEXTURE0, GL_TEXTURE_2D);
texture_init_from_image(&texture_night, "res/texture/8k_earth_nightmap.jpg", GL_TEXTURE1, GL_TEXTURE_2D);
texture_init_from_image(&texture_specular, "res/texture/8k_earth_specular_map.jpg", GL_TEXTURE2, GL_TEXTURE_2D);
texture_init_from_image(&texture_clouds, "res/texture/8k_earth_clouds.jpg", GL_TEXTURE3, GL_TEXTURE_2D);
texture_init_from_image(&texture_day, "res/texture/earth_daymap.jpg", GL_TEXTURE0, GL_TEXTURE_2D);
texture_init_from_image(&texture_night, "res/texture/earth_nightmap.jpg", GL_TEXTURE1, GL_TEXTURE_2D);
texture_init_from_image(&texture_specular, "res/texture/earth_specular_map.jpg", GL_TEXTURE2, GL_TEXTURE_2D);
texture_init_from_image(&texture_clouds, "res/texture/earth_clouds.jpg", GL_TEXTURE3, GL_TEXTURE_2D);
texture_init_from_image(&texture_clouds, "res/texture/sky_gradient.jpg", GL_TEXTURE4, GL_TEXTURE_1D);

vao_attr(&vao_earth, &obj_earth.vbo_verts, 0, 3, GL_FLOAT, sizeof(vec3), 0);
Expand Down
2 changes: 1 addition & 1 deletion src/entity/sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void sky_init(void)
{ LOCL_ATEXCOORD, "in_uv" },
});

texture_init_from_image(&texture, "res/texture/8k_stars.jpg", GL_TEXTURE0, GL_TEXTURE_2D);
texture_init_from_image(&texture, "res/texture/stars.jpg", GL_TEXTURE0, GL_TEXTURE_2D);

vao_attr(&vao, &obj.vbo_verts, 0, 3, GL_FLOAT, sizeof(vec3), 0);
vao_attr(&vao, &obj.vbo_uv, 1, 2, GL_FLOAT, sizeof(vec2), 0);
Expand Down

0 comments on commit fa104c3

Please sign in to comment.