This is a huge change, and basically breaks everything (as per usual!) First of, this includes stuff like shaders so anything involving those are broken and then fixed. A new BuildAssets cmake file is added to aid in running AssetCompiler, and it seems to work fine on the engine base assets. The File API will eventually be revamped to handle this new way of organizing the files and domains will eventually be gotten rid of all together since I probably will replace it with game directory priorities. As it stands right now, there isn't a way to easily replace say - render_options.cfg with your own game-specific version. Apple builds are probably broken by this commit (since I'm moving around content and shader directories) to be fixed later.
47 lines
1.2 KiB
GLSL
47 lines
1.2 KiB
GLSL
#include "atmosphere.glsl"
|
|
|
|
layout (location = 0) in vec2 in_uv;
|
|
|
|
layout (location = 0) out vec4 out_color;
|
|
|
|
layout(push_constant) uniform PushConstant{
|
|
mat4 view;
|
|
vec4 sun_position_fov;
|
|
float aspect;
|
|
};
|
|
|
|
vec3 sky_ray(const vec2 uv) {
|
|
const float d = 0.5 / tan(sun_position_fov.w / 2.0);
|
|
return normalize(vec3((uv.x - 0.5) * aspect,
|
|
uv.y - 0.5,
|
|
d));
|
|
}
|
|
|
|
void main() {
|
|
const vec3 color = atmosphere(
|
|
// ray direction
|
|
normalize(mat3(view) * sky_ray(in_uv)),
|
|
// ray origin
|
|
vec3(0, 6372e3, 0),
|
|
// position of the sun in world space (this will be normalized)
|
|
sun_position_fov.xyz,
|
|
// intensity of the sun
|
|
22.0,
|
|
// radius of the plant in meters
|
|
6371e3,
|
|
// radius of the atmosphere in meters
|
|
6471e3,
|
|
// Rayleigh scattering coefficient
|
|
vec3(5.5e-6, 13.0e-6, 22.4e-6),
|
|
// Mie scattering coefficient
|
|
21e-6,
|
|
// Rayleigh scale height
|
|
8e3,
|
|
// Mie scale height
|
|
1.2e3,
|
|
// Mie preferred scattering direction
|
|
0.758
|
|
);
|
|
|
|
out_color = vec4(color, 1.0);
|
|
}
|