fs-input.chunk 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #if __VERSION__ < 300
  2. #pragma define CC_SURFACES_VARING_MODIFIER varying
  3. #else
  4. #pragma define CC_SURFACES_VARING_MODIFIER in
  5. #endif
  6. #include <shading-entries/data-structures/vs-fs>
  7. // FS Input
  8. /*struct SurfacesStandardFragmentInput
  9. {
  10. }
  11. void CCSurfacesGetFragmentInput(out SurfacesStandardFragmentInput fsInput)
  12. {
  13. }
  14. */
  15. // Use macros instead of structure to avoid structure precision issues
  16. #define FSInput_worldPos v_worldPos
  17. #define FSInput_worldNormal v_normal.xyz // unnormalized
  18. #define FSInput_faceSideSign v_normal.w // physical face side, has no relation to USE_TWO_SIDED
  19. #define FSInput_texcoord v_uv
  20. #if CC_SURFACES_USE_VERTEX_COLOR
  21. #define FSInput_vertexColor v_color
  22. #else
  23. #define FSInput_vertexColor vec4(1.0) // for compatible user-surface functions in other render usage
  24. #endif
  25. #if CC_SURFACES_USE_TANGENT_SPACE
  26. #define FSInput_worldTangent v_tangent.xyz // unnormalized
  27. #define FSInput_mirrorNormal v_tangent.w
  28. #else
  29. #define FSInput_worldTangent vec3(1.0, 1.0, 1.0) // normalize zero vector may crash on webgpu, use 1 instead
  30. #define FSInput_mirrorNormal 1.0
  31. #endif
  32. #if CC_SURFACES_USE_SECOND_UV
  33. #define FSInput_texcoord1 v_uv1
  34. #else
  35. #define FSInput_texcoord1 vec2(0.0, 0.0)
  36. #endif
  37. #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD
  38. #define FSInput_lightMapUV v_luv
  39. #endif
  40. #if CC_RECEIVE_SHADOW
  41. #define FSInput_shadowBias v_shadowBiasAndProbeId.xy
  42. #endif
  43. #if CC_USE_REFLECTION_PROBE
  44. #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z
  45. #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX
  46. #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w
  47. #endif
  48. #if USE_INSTANCING
  49. #define FSInput_reflectionProbeData v_reflectionProbeData
  50. #endif
  51. #endif
  52. #if CC_USE_FOG != CC_FOG_NONE && !CC_USE_ACCURATE_FOG
  53. #define FSInput_fogFactor v_fogFactor
  54. #endif
  55. #if CC_SURFACES_TRANSFER_LOCAL_POS
  56. #define FSInput_localPos v_localPos
  57. #endif
  58. #if CC_SURFACES_TRANSFER_CLIP_POS
  59. #define FSInput_clipPos v_clipPos
  60. #endif