1.求 shadowCoord,归一化到[0,1]
vec4 shadowCoord = vPositionFromLight/vPositionFromLight.w;
shadowCoord.xyz = shadowCoord.xyz*0.5+vec3(0.5,0.5,0.5);
2.填充API
float useShadowMap(sampler2D shadowMap, vec4 shadowCoord){
//return 1.0;
vec4 rgbaDepth = texture2D(uShadowMap,shadowCoord.xy);
float depthZ = unpack(rgbaDepth);
//depthZ = depthZ*0.5+0.5;
float shadow = shadowCoord.z > depthZ ? 0.0 : 1.0;
return shadow;
}