#version 430 core #extension GL_ARB_bindless_texture : require in vec2 vTex; in vec3 vTint; in float vFogFactor; // 1 = no fog, 0 = full fog color out vec4 fragColor; // Campaign V slice V6e: the sky's texture is now read through the shared table // (ACDREAM_SAMPLE_2D, injected by tools/ShaderCompiler/VulkanGlslPreamble.cs) // rather than a `uniform sampler2D` bound to texture unit 0. Vulkan has no // default uniform block to declare a loose sampler in, and set 2 is where // every sampled texture lives. // // The wrap mode travels WITH the slot: SkyRenderer registers a distinct table // entry per (texture, sampler) pair, so the per-submesh Repeat-vs-ClampToEdge // choice that used to be a glBindSampler call is now which slot it asks for. // That is the same shape the Vulkan table has, where a table entry is a // combined image sampler. uniform uint uTextureIndexA; // The per-draw block sky.vert declares. A uniform block must be declared // identically in every stage of a program that names it — the same rule the // SceneLighting block below has always followed — so the whole thing appears // here even though the fragment stage reads only the last three scalars. layout(std140, ACDREAM_UBO_SET binding = 4) uniform SkyParams { mat4 uModel; mat4 uSkyView; mat4 uSkyProjection; vec3 uAmbientColor; float uEmissive; vec3 uSunColor; float uDiffuseFactor; vec3 uSunDir; float uTransparency; vec2 uUvScroll; float uApplyFog; float uSurfOpacity; }; struct Light { vec4 posAndKind; vec4 dirAndRange; vec4 colorAndIntensity; vec4 coneAngleEtc; }; layout(std140, ACDREAM_UBO_SET binding = 1) uniform SceneLighting { Light uLights[8]; vec4 uCellAmbient; vec4 uFogParams; vec4 uFogColor; vec4 uCameraAndTime; }; void main() { vec4 sampled = ACDREAM_SAMPLE_2D(uTextureIndexA, vTex); vec3 rgb = sampled.rgb * vTint; if (uApplyFog > 0.5) { const float SKY_FOG_FLOOR = 0.2; float skyFogFactor = max(vFogFactor, SKY_FOG_FLOOR); rgb = mix(uFogColor.rgb, rgb, skyFogFactor); } float flash = uFogParams.z; rgb += flash * vec3(1.5, 1.5, 1.8); float cap = mix(1.0, 3.0, clamp(flash, 0.0, 1.0)); rgb = min(rgb, vec3(cap)); float a = sampled.a * (1.0 - uTransparency) * uSurfOpacity; if (a < 0.01) discard; fragColor = vec4(rgb, a); }