vs.chunk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. void main()
  2. {
  3. SurfacesStandardVertexIntermediate In;
  4. // Local Space
  5. CCSurfacesVertexInput(In);
  6. CCSurfacesVertexAnimation(In);
  7. In.position.xyz = SurfacesVertexModifyLocalPos(In);
  8. In.normal.xyz = SurfacesVertexModifyLocalNormal(In);
  9. #if CC_SURFACES_USE_TANGENT_SPACE
  10. In.tangent = SurfacesVertexModifyLocalTangent(In);
  11. #endif
  12. SurfacesVertexModifyLocalSharedData(In);
  13. // World Space
  14. CCSurfacesVertexWorldTransform(In);
  15. In.worldPos = SurfacesVertexModifyWorldPos(In);
  16. // Clip Space
  17. #if CC_USE_2D
  18. In.clipPos = cc_matProj * cc_matView * vec4(In.position.xyz, 1.0);
  19. #else
  20. In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);
  21. In.clipPos = SurfacesVertexModifyClipPos(In);
  22. #endif
  23. // Other Surfaces Function
  24. vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);
  25. In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;
  26. In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);
  27. SurfacesVertexModifyUV(In);
  28. SurfacesVertexModifySharedData(In);
  29. // Other Data
  30. CCSurfacesVertexTransformUV(In);
  31. CCSurfacesVertexTransferFog(In);
  32. CCSurfacesVertexTransferLightMapUV(In);
  33. CCSurfacesVertexTransferShadow(In);
  34. #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE
  35. In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);
  36. #endif
  37. CCSurfacesVertexOutput(In);
  38. }