Use immutable storage for fullscreen vbo

This commit is contained in:
2023-03-21 12:47:02 +00:00
parent 9bba0a43a4
commit ba240723f3
13 changed files with 105 additions and 40 deletions
+16 -3
View File
@@ -8,14 +8,27 @@ layout (location=1) out vec4 fPos;
layout (location=2) out vec4 fNorm;
void main()
{
// there are quite a few intricate controls concerning the normals
// we want normals to be bigger towards the center, so that when two clouds
// are blended central normals predominate
// similarly, we want normals to be bigger the further up the cloud is
// finally, we want normals to allow for shadows at the edge of a cloud
// when a light is direcly above the cloud
float d = dot(vControls,vControls);
if (d > 1) {discard;}
//fCol = vCol;
fCol = vec4(vCol.xyz,vCol.w*(1-d));
fPos = vec4(vPosID.xy, vPosID.z + (1-d) * vCenterSize.w, 0.5);
vec3 fn1 = (1-d)*vec3(vCenterSize.xyz - fPos.xyz);
//float rad = vCenterSize.w;
float rad = vCenterSize.w*0.5;
float h = (1-d) * rad;
fPos = vec4(vPosID.xy, vPosID.z + h, 1);
float h1 = float (1 - 0.01*fPos.z);
//vec3 fn1 = fPos.z*(1-d)*normalize(vec3(vCenterSize.xyz - fPos.xyz));
//vec3 fn1 = fPos.z*normalize(vec3(vCenterSize.xyz - fPos.xyz));
//vec3 fn1 = vec3(vCenterSize.xyz - fPos.xyz);
vec3 fn1 = fPos.z*(1-d)*normalize(vec3(vCenterSize.xyz - (fPos.xyz + vec3(0,0,0.5*h))));
//fNorm = vec4(0.5*fn1.xy,fn1.z, 0.5);
fNorm = vec4(fn1.xyz, 0.5);
//fNorm = vec4(fn1.xyz, fCol.w);
fNorm = vec4(fn1,1);
//fNorm = vec4(0,0,1, 1);
}