载入中...
搜索中...
未找到
WeatherWgsl.h
浏览该文件的文档.
7struct Frame { mvp:mat4x4f,model:mat4x4f,lightDir:vec4f,lightColor:vec4f,tint:vec4f,cameraPos:vec4f,ambient:vec4f,lights:array<Light3D,8>,texBomb:vec4f,parallax:vec4f,surface:vec4f,view:mat4x4f,clipInfo:vec4f,cloud:vec4f,cloudWind:vec4f };
8struct Params { data: array<vec4f,8> }; struct In{@location(0) pos:vec3f,@location(1) normal:vec3f,@location(2) uv:vec2f};
9struct Out{@builtin(position) pos:vec4f,@location(0) normal:vec3f,@location(1) uv:vec2f,@location(2) tint:vec4f,@location(3) world:vec3f,@location(4) camera:vec3f,@location(5) view:vec3f,@location(6) particle:f32};
10@group(0) @binding(0) var<uniform> frame:Frame; @group(0) @binding(15) var<uniform> params:Params;
12fn hash12(q:vec2f)->f32{var v=fract(vec3f(q.x,q.y,q.x)*0.1031);v+=dot(v,v.yzx+vec3f(33.33));return fract((v.x+v.y)*v.z);}
21 base=relative-floor(relative/vec3f(52.0,20.0,52.0))*vec3f(52.0,20.0,52.0)-vec3f(26.0,10.0,26.0)+frame.cameraPos.xyz;
47 let edgeFade=1.0-smoothstep(20.0,26.0,max(abs(base.x-frame.cameraPos.x),abs(base.z-frame.cameraPos.z)));
55struct Params{data:array<vec4f,8>};struct In{@builtin(position) pos:vec4f,@location(1) uv:vec2f,@location(2) tint:vec4f,@location(3) world:vec3f,@location(4) camera:vec3f,@location(5) view:vec3f,@location(6) particle:f32};
56@group(0) @binding(1) var albedo:texture_2d<f32>;@group(0) @binding(7) var samp:sampler;@group(0) @binding(15) var<uniform> params:Params;fn p(i:u32)->f32{return params.data[i/4u][i%4u];}
83struct Light3D{posRadius:vec4f,color:vec4f};struct Frame{mvp:mat4x4f,model:mat4x4f,lightDir:vec4f,lightColor:vec4f,tint:vec4f,cameraPos:vec4f,ambient:vec4f,lights:array<Light3D,8>,texBomb:vec4f,parallax:vec4f,surface:vec4f,view:mat4x4f,clipInfo:vec4f,cloud:vec4f,cloudWind:vec4f};struct In{@location(0) pos:vec3f,@location(1) normal:vec3f,@location(2) uv:vec2f};struct Out{@builtin(position) pos:vec4f,@location(0) normal:vec3f,@location(1) uv:vec2f,@location(2) tint:vec4f,@location(3) world:vec3f,@location(4) camera:vec3f,@location(5) view:vec3f};@group(0) @binding(0) var<uniform> frame:Frame;@vertex fn vs_main(i:In)->Out{let w=frame.model*vec4f(i.pos,1);var o:Out;o.pos=frame.mvp*vec4f(i.pos,1);o.pos.y=-o.pos.y;o.normal=i.normal;o.uv=i.uv;o.tint=frame.tint;o.world=w.xyz;o.camera=frame.cameraPos.xyz;o.view=(frame.view*w).xyz;return o;}
87struct Params{data:array<vec4f,8>};struct In{@builtin(position) pos:vec4f,@location(1) uv:vec2f,@location(2) tint:vec4f,@location(3) world:vec3f,@location(5) view:vec3f};@group(0) @binding(15) var<uniform> params:Params;fn p(i:u32)->f32{return params.data[i/4u][i%4u];}
88@fragment fn fs_main(i:In)->@location(0) vec4f{let flash=clamp(p(11u),0.0,1.0);if(flash<=0.01){discard;}let across=abs(i.uv.x);let core=1.0-smoothstep(0.08,0.34,across);let halo=pow(max(0.0,1.0-across),2.2)*flash;let bayer=array<f32,16>(0.0,0.5,0.125,0.625,0.75,0.25,0.875,0.375,0.1875,0.6875,0.0625,0.5625,0.9375,0.4375,0.8125,0.3125);let q=vec2u(i.pos.xy)%vec2u(4);if(max(core,halo*0.72)<=bayer[q.y*4u+q.x]){discard;}let color=mix(vec3f(0.20,0.38,0.95),vec3f(0.92,0.97,1.0),core)*(0.55+0.85*flash);let fog=clamp(1.0-exp(-length(i.view)*p(10u)),0.0,1.0);return vec4f(mix(color,vec3f(p(7u),p(8u),p(9u)),fog*0.6),1);}
Definition WeatherWgsl.h:3
constexpr const char * kWeatherFragWgsl
Definition WeatherWgsl.h:54
constexpr const char * kWeatherVertWgsl
Definition WeatherWgsl.h:5