Files
cocos4/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk
T
jk20012001 0ecaa8db51 add surface shader (#11048)
* add surface shader

* remove unused item

* arrange main-functions

* arrange main-functions

* fix compatible lighting mode
2022-05-13 21:18:22 +08:00

91 lines
2.0 KiB
Plaintext

#if __VERSION__ < 300
#define CC_SURFACES_VARING_MODIFIER varying
#else
#define CC_SURFACES_VARING_MODIFIER in
#endif
#include <shading-entries/data-structures/vs-fs>
// FS Input
/*struct SurfacesStandardFragmentInput
{
HIGHP_VALUE_STRUCT_DEFINE(vec3, worldPos);
vec3 worldNormal;
vec2 texcoord;
#if CC_SURFACES_USE_VERTEX_COLOR
vec4 vertexColor;
#endif
#if CC_SURFACES_USE_TANGENT_SPACE
vec3 worldTangent, worldBitangent;
float mirrorNormal;
#endif
#if CC_SURFACES_USE_SECOND_UV
vec2 texcoord1;
#endif
#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
vec3 lightMapUV;
#endif
#if CC_RECEIVE_SHADOW
highp vec4 shadowPos;
vec2 shadowBias;
#endif
#if !CC_USE_ACCURATE_FOG
float fogFactor;
#endif
}
void CCSurfacesGetFragmentInput(out SurfacesStandardFragmentInput fsInput)
{
}
*/
// Use macros instead of structure to avoid structure precision issues
#define FSInput_worldPos v_worldPos
#define FSInput_worldNormal v_normal.xyz
#define FSInput_faceSideSign v_normal.w
#define FSInput_texcoord v_uv
#if CC_SURFACES_USE_VERTEX_COLOR
#define FSInput_vertexColor v_color
#else
#define FSInput_vertexColor vec4(1.0) // for compatible user-surface functions in other render usage
#endif
#if CC_SURFACES_USE_TANGENT_SPACE
#define FSInput_worldTangent v_tangent.xyz
#define FSInput_mirrorNormal v_tangent.w
#else
#define FSInput_worldTangent vec3(0.0, 0.0, 0.0)
#define FSInput_mirrorNormal 1.0
#endif
#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
#define FSInput_texcoord1 v_uv1
#else
#define FSInput_texcoord1 vec2(0.0, 0.0)
#endif
#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
#define FSInput_lightMapUV v_luv
#endif
#if CC_RECEIVE_SHADOW
#define FSInput_shadowPos v_shadowPos
#if CC_SURFACES_USE_INSTANCING
#define FSInput_shadowBias v_shadowBias
#endif
#endif
#if !CC_USE_ACCURATE_FOG
#define FSInput_fogFactor v_fogFactor
#endif
#if CC_SURFACES_TRANSFER_LOCAL_POS
#define FSInput_localPos v_localPos
#endif