载入中...
搜索中...
未找到
TreeWindWgsl.h
浏览该文件的文档.
7 mvp:mat4x4f,model:mat4x4f,lightDir:vec4f,lightColor:vec4f,tint:vec4f,cameraPos:vec4f,ambient:vec4f,
10 envProbeExtent:vec4f,skinInfo:vec4f,reflectionProbeCenter:array<vec4f,2>,reflectionProbeExtent:array<vec4f,2>,
15 @location(2) tint:vec4f,@location(3) worldPos:vec3f,@location(4) cameraPos:vec3f,@location(5) viewPos:vec3f };
27 let distance=(root-frame.cameraPos.xyz)/range;var attenuation=1.0-clamp(dot(distance,distance),0.0,1.0);
29 let flex=vec3f(p(6u),p(7u),p(8u))*vec3f(clamp(main*3.0,0.0,1.0),clamp(main*2.0,0.0,1.0),1.0-main*main*0.5)*main*attenuation;
31 let time=-fract(p(4u)*6.0)*6.283185;let norm=local/vec3f(dimensions.x,dimensions.y,dimensions.x);
32 let branch=dot(norm.xz,norm.xz);let stem=clamp(norm.y,0.0,1.0);let lengthA=dot(local,local);let world=root+local;
33 var gust=((sin(time+frequency.x*(root.x+root.y+root.z))*0.3+main*0.5)+(p(12u)*0.4+main)*main)*(p(13u)*0.3+0.7);
35 if(p(5u)>0.0){let displaced=world+tally*0.25;tally+=direction*stem*stem*(sin(time*2.0+dot(displaced,vec3f(frequency.y)))*branch*0.7+0.3)*gust*flex.y;}
37 if(denominator!=0.0){normalization=clamp(lengthA/denominator,0.0,1.0);} tally=offset*normalization;
39 tally+=(wave*direction+direction)*vec3f(branch,branch*0.75,branch)*(stem*gust*flex.z)*(normalization+0.5);}
43 let model3=mat3x3f(frame.model[0].xyz,frame.model[1].xyz,frame.model[2].xyz);let inv=inverse3(model3);
44 let objectPos=inv*deform(model3*input.pos,frame.model[3].xyz);let world=frame.model*vec4f(objectPos,1.0);
45 var out:VSOut;out.pos=frame.mvp*vec4f(objectPos,1.0);out.pos.y=-out.pos.y;out.worldPos=world.xyz;
46 out.viewPos=(frame.view*world).xyz;out.normal=normalize(transpose(inv)*input.normal);out.uv=input.uv;
constexpr const char * kTreeWindVertWgsl
Immutable WGSL source. @ownership Program image. @lifetime Entire process.
Definition TreeWindWgsl.h:4