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.
35 lines
936 B
GLSL
35 lines
936 B
GLSL
layout(constant_id = 0) const int width = 25;
|
|
layout(constant_id = 1) const int height = 25;
|
|
|
|
layout(location = 0) out vec2 outUV;
|
|
layout(location = 1) out flat ivec2 outPixel;
|
|
layout(location = 2) out float outDepth;
|
|
|
|
layout(binding = 1) uniform sampler2D depth_sampler;
|
|
|
|
layout(push_constant) uniform readonly PushConstant{
|
|
vec4 params;
|
|
};
|
|
|
|
void main() {
|
|
outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
|
|
|
|
ivec2 pixel = ivec2(gl_InstanceIndex % width, gl_InstanceIndex / width);
|
|
outPixel = pixel;
|
|
|
|
const float depth = texture(depth_sampler, vec2(pixel) / vec2(width, height)).r;
|
|
outDepth = depth;
|
|
|
|
vec2 pos = vec2(outUV * 2.0 + -1.0);
|
|
|
|
// far field mode
|
|
if(params.y == 0) {
|
|
pos *= params.x * depth;
|
|
}
|
|
|
|
pos += vec2(pixel.x, pixel.y);
|
|
pos *= 2.0 / vec2(width, height);
|
|
pos += vec2(-1, -1);
|
|
|
|
gl_Position = vec4(pos.x, pos.y, 0.0, 1.0);
|
|
}
|