1 |
- [1,["1brw/JvvpFnIvdrxpFCgMZ","12Y9dMgWdJKJGmTiZyQR9H@fc873","bd0kRRCrBAf6EGdLS3rh6x","09afT1oGVIXZBOfgAp0ruI@6c48a","322wVq5wROwJ9oE12P1qrL@6c48a","71AY1xQPtL2ZcqX2EloRcF@2058a","ddQy0XsLxNcZ6PVTSQqEal","71AY1xQPtL2ZcqX2EloRcF@07ec3","71AY1xQPtL2ZcqX2EloRcF@4943a","6bwl42RRhDbpxvdKq/p7a2@6c48a","71AY1xQPtL2ZcqX2EloRcF@940be","36PYXp1L9H8Iu0EJlvXdmn","86+f+u26JPzZYE7LK9nVmo","21wsrA8RZIaaliXlKFP5/E","d1JAVd8apE/5LrFTdjHzL8","a4PSbAakBEXqZ2SAfugM9v","d3kaTF7JZB54pwhrX5BrqK","8bbVh/O8JHA5DPR45cFdEK@b47c0","e9CAaUJBlCCbw1WZRMmhl8@6c48a","71AY1xQPtL2ZcqX2EloRcF@a0aa9","bdjT81Yn9K6ayTZSMPTLv1@6c48a","e7QvWN5wFHMq4kJcFyGnuT@6c48a","71AY1xQPtL2ZcqX2EloRcF@08fca"],["node","_mesh","mainTexture","_effectAsset","root","value","data","_parent","screamAdapter","target","scene","asset","_envmap"],[["cc.Node",["_name","_id","_layer","_active","_parent","_children","_components","_lpos","_prefab","_euler","_lscale","_lrot"],-1,1,2,9,5,4,5,5,5],"cc.ImageAsset",["cc.Material",["_states","_defines","_techIdx","_props"],0,12],["cc.MeshRenderer",["_name","_shadowReceivingMode","node","__prefab","_materials","lightmapSettings","_mesh"],1,1,4,3,4,6],"cc.TextureCube",["cc.Mesh",["_native","_dataLength","_hash","_struct"],0,11],["cc.EffectAsset",["_name","shaders","techniques"],0],["cc.Prefab",[],3],["cc.PrefabInfo",["fileId","root","asset"],2,1,1],["cc.PrefabInfo",["fileId","root","instance","asset"],2,1,4,6],["cc.CompPrefabInfo",["fileId"],2],["cc.ModelLightmapSettings",[],3],["cc.SceneAsset",["_name"],2],["cc.Scene",["_name","_children","_globals"],2,12,4],["cc.SceneGlobals",["ambient","shadows","_skybox","fog"],3,4,4,4,4],["cc.AmbientInfo",[],3],["cc.ShadowsInfo",["_shadowColor"],3,5],["cc.SkyboxInfo",["_enabled","_envmap"],2,6],["cc.FogInfo",[],3],["cc.Camera",["_orthoHeight","_clearFlags","_visibility","node","_color"],0,1,5],["db84aBtpFpEGq0hVnSgIqtJ",["speed","maxSpeed","node","target","screamAdapter"],1,1,1,1],["63f0f2Yq81LNZ+dqJR5cnNA",["isLookAtCam","isCanClick","websiteUrl","node","camera_3d","model"],0,1,1,1],["cc.BoxCollider",["node","_size"],3,1,5],["cc.RigidBody",["_useGravity","node"],2,1],["cc.PrefabInstance",["fileId","prefabRootNode","propertyOverrides"],1,9],["CCPropertyOverrideInfo",["value","propertyPath","targetInfo"],1,4],["CCPropertyOverrideInfo",["propertyPath","targetInfo","value"],2,4,8],["CCPropertyOverrideInfo",["propertyPath","targetInfo","value"],2,4,1],["cc.TargetInfo",["localID"],2],["cc.DirectionalLight",["_illuminance","node","_staticSettings"],2,1,4],["cc.StaticLightSettings",[],3],["cc.SpotLight",["_size","_range","_spotAngle","node","__prefab","_staticSettings"],0,1,4,4]],[[28,0,2],[10,0,2],[25,0,1,2,3],[11,1],[2,2,0,1,3,4],[0,0,2,1,4,6,7,11,10,9,4],[3,0,1,2,3,4,5,6,3],[21,0,1,2,3,4,5,4],[22,0,1,1],[23,0,1,2],[8,0,1,2,2],[5,0,1,2,3,4],[0,0,4,6,8,7,10,9,2],[3,2,3,4,5,6,1],[26,0,1,2,2],[2,0,1,3,3],[0,0,1,4,7,3],[27,0,1,2,2],[30,1],[6,0,1,2,4],[7,1],[0,0,5,8,2],[0,0,4,5,8,2],[0,0,1,4,5,6,7,3],[0,0,1,4,5,3],[0,4,8,1],[0,0,4,6,2],[0,0,3,1,4,5,4],[0,0,4,6,7,11,9,2],[9,0,1,2,3,2],[12,0,2],[13,0,1,2,2],[14,0,1,2,3,1],[15,1],[16,0,1],[17,0,1,2],[18,1],[19,0,1,2,3,4,4],[20,0,1,2,3,4,3],[24,0,1,2,3],[29,0,1,2,2],[31,0,1,2,3,4,5,4]],[[[[11,".bin",236,3297164954,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":224,"length":12,"count":6,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":224,"count":4,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}]},"minPosition",8,[1,-0.5,-0.5,0],"maxPosition",8,[1,0.5,0.5,0]]]],0,0,[],[],[]],[[[19,"builtin-standard",[{"hash":971152766,"name":"builtin-standard|standard-vs|standard-fs","glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 6) uniform sampler2D cc_PositionDisplacements;\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 7) uniform sampler2D cc_NormalDisplacements;\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 8) uniform sampler2D cc_TangentDisplacements;\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout StandardVertInput attr) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n attr.position.xyz = attr.position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n attr.normal.xyz = attr.normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n attr.tangent.xyz = attr.tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n #if CC_USE_BAKED_ANIMATION\n #if USE_INSTANCING\n layout(location = 7) in highp vec4 a_jointAnimInfo;\n #endif\n layout(set = 2, binding = 3) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(set = 2, binding = 2) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n layout(set = 2, binding = 5) uniform highp sampler2D cc_jointTexture;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[30 * 3];\n };\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 3.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 3.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 12.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 12.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout StandardVertInput attr) {\n mat4 m = skinMatrix();\n attr.position = m * attr.position;\n attr.normal = (m * vec4(attr.normal, 0.0)).xyz;\n attr.tangent.xyz = (m * vec4(attr.tangent.xyz, 0.0)).xyz;\n }\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n};\n#if USE_INSTANCING\n layout(location = 8) in vec4 a_matWorld0;\n layout(location = 9) in vec4 a_matWorld1;\n layout(location = 10) in vec4 a_matWorld2;\n #if USE_LIGHTMAP\n layout(location = 11) in vec4 a_lightingMapUVParam;\n #endif\n#elif USE_BATCHING\n layout(location = 12) in float a_dyn_batch_id;\n layout(set = 2, binding = 0) uniform CCLocalBatched {\n highp mat4 cc_matWorlds[10];\n };\n#else\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n };\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nfloat LinearFog(vec4 pos) {\n vec4 wPos = pos;\n float cam_dis = distance(cc_cameraPos, wPos);\n float fogStart = cc_fogBase.x;\n float fogEnd = cc_fogBase.y;\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n}\nfloat ExpFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float fogDensity = cc_fogBase.z;\n float cam_dis = distance(cc_cameraPos, wPos) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n}\nfloat ExpSquaredFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float fogDensity = cc_fogBase.z;\n float cam_dis = distance(cc_cameraPos, wPos) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n}\nfloat LayeredFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float _FogTop = cc_fogAdd.x;\n float _FogRange = cc_fogAdd.y;\n vec3 camWorldProj = cc_cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cc_cameraPos.y > _FogTop) {\n if (wPos.y < _FogTop) {\n fDeltaY = (_FogTop - wPos.y) / _FogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n } else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n } else {\n if (wPos.y < _FogTop) {\n float fDeltaA = (_FogTop - cc_cameraPos.y) / _FogRange * 2.;\n float fDeltaB = (_FogTop - wPos.y) / _FogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n } else {\n fDeltaY = abs(_FogTop - cc_cameraPos.y) / _FogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n } else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n}\nlayout(location = 0) out float v_fog_factor;\nlayout(location = 1) out highp vec4 v_shadowPos;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 3) uniform sampler2D cc_shadowMap;\n layout(set = 0, binding = 5) uniform sampler2D cc_spotLightingMap;\n#endif\n#if USE_VERTEX_COLOR\n layout(location = 13) in vec4 a_color;\n layout(location = 2) out vec4 v_color;\n#endif\nlayout(location = 3) out vec3 v_position;\nlayout(location = 4) out vec3 v_normal;\nlayout(location = 5) out vec2 v_uv;\nlayout(location = 6) out vec2 v_uv1;\n#if USE_NORMAL_MAP\n layout(location = 7) out vec3 v_tangent;\n layout(location = 8) out vec3 v_bitangent;\n#endif\n#if HAS_SECOND_UV || USE_LIGHTMAP\n layout(location = 14) in vec2 a_texCoord1;\n#endif\n#if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n layout(location = 9) out vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.zw;\n v_luv.z = cc_lightingMapUVParam.z;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.zw;\n v_luv.z = a_lightingMapUVParam.z;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n mat4 matWorld, matWorldIT;\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n matWorldIT = matWorld;\n #elif USE_BATCHING\n matWorld = cc_matWorlds[int(a_dyn_batch_id)];\n matWorldIT = matWorld;\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if USE_NORMAL_MAP\n v_tangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_bitangent = cross(v_normal, v_tangent) * In.tangent.w;\n #endif\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv1 = cc_cameraPos.w > 1.0 ? vec2(v_uv1.x, 1.0 - v_uv1.y) : v_uv1;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n #if CC_USE_FOG == 0\n v_fog_factor = LinearFog(pos);\n #elif CC_USE_FOG == 1\n v_fog_factor = ExpFog(pos);\n #elif CC_USE_FOG == 2\n v_fog_factor = ExpSquaredFog(pos);\n #elif CC_USE_FOG == 3\n v_fog_factor = LayeredFog(pos);\n #else\n v_fog_factor = 1.0;\n #endif\n v_shadowPos = cc_matLightViewProj * pos;\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n CCLightingMapCaclUV();\n #endif\n gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;\n}","frag":"\nprecision highp float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n};\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nlayout(location = 0) in float v_fog_factor;\nvec3 SRGBToLinear (vec3 gamma) {\n return gamma * gamma;\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 3) uniform sampler2D cc_shadowMap;\n layout(set = 0, binding = 5) uniform sampler2D cc_spotLightingMap;\n float CCGetLinearDepth (vec3 worldPos) {\n vec4 viewStartPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n float dist = length(viewStartPos.xyz);\n return cc_shadowNFLSInfo.x + (-dist / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x));\n }\n float CCGetShadowFactorX1 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float shadow = 0.0;\n float closestDepth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n closestDepth = dot(texture(cc_shadowMap, clipPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n } else {\n closestDepth = texture(cc_shadowMap, clipPos.xy).x;\n }\n shadow = step(closestDepth, clipPos.z- cc_shadowWHPBInfo.w);\n return shadow;\n }\n float CCGetShadowFactorX5 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n float closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x, clipPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n } else {\n float closestDepth = texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x, clipPos.y)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n return shadow / 5.0;\n }\n float CCGetShadowFactorX9 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float closestDepth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = dot(texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 9.0;\n }\n float CCGetShadowFactorX25 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = dot(texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 25.0;\n }\n float CCGetDirLightShadowFactorX1 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float shadow = 0.0;\n float closestDepth = 0.0;\n float depth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n if (cc_shadowLPNNInfo.y > 0.000001) {\n closestDepth = dot(texture(cc_spotLightingMap, clipPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n } else {\n closestDepth = texture(cc_spotLightingMap, clipPos.xy).x;\n }\n shadow = step(closestDepth, depth - cc_shadowWHPBInfo.w);\n return shadow;\n }\n float CCGetDirLightShadowFactorX5 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float depth = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n float closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n } else {\n float closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n return shadow / 5.0;\n }\n float CCGetDirLightShadowFactorX9 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float depth = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = dot(texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 9.0;\n }\n float CCGetDirLightShadowFactorX25 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float depth = 0.0;\n float shadow = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = dot(texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 25.0;\n }\n#endif\n#if CC_USE_IBL\n layout(set = 0, binding = 4) uniform samplerCube cc_environment;\n vec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(2.0, rgbe.a * 255.0 - 128.0);\n }\n vec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n }\n vec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n }\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / (OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return specular * AB.x + AB.y;\n}\nstruct StandardSurface {\n vec4 albedo;\n vec3 position;\n vec3 normal;\n vec3 emissive;\n vec3 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n};\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - s.position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n float NL = max(dot(N, L), 0.001);\n vec3 finalColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse;\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n if (s.lightmap_test > 0.0001) {\n finalColor = s.lightmap.rgb;\n }\n #else\n diffuseContrib /= 3.14159265359;\n #endif\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n finalColor *= (diffuseContrib + specularContrib);\n float fAmb = 0.5 - N.y * 0.5;\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb) * cc_ambientSky.w;\n finalColor += (ambDiff.rgb * diffuse);\n #if CC_USE_IBL\n vec3 R = normalize(reflect(-V, N));\n vec4 envmap = fragTextureLod(cc_environment, R, s.roughness * cc_ambientGround.w);\n #if CC_USE_IBL == 2\n vec3 env = unpackRGBE(envmap);\n #else\n vec3 env = SRGBToLinear(envmap.rgb);\n #endif\n finalColor += env * cc_ambientSky.w * specular;\n #endif\n finalColor = finalColor * s.occlusion;\n #if CC_USE_HDR\n s.emissive *= cc_exposure.w;\n #endif\n finalColor += s.emissive;\n #if CC_RECEIVE_SHADOW\n {\n float pcf = cc_shadowWHPBInfo.z + 0.001;\n float shadowAttenuation = 0.0;\n float cosAngle = clamp(1.0 - dot(N, L.xyz), 0.0, 1.0);\n vec3 projWorldPos = shadowPos.xyz + cosAngle * cc_shadowLPNNInfo.z * N;\n vec4 pos = vec4(projWorldPos.xyz, shadowPos.w);\n if (pcf > 3.0) shadowAttenuation = CCGetShadowFactorX25(pos);\n else if (pcf > 2.0) shadowAttenuation = CCGetShadowFactorX9(pos);\n else if (pcf > 1.0) shadowAttenuation = CCGetShadowFactorX5(pos);\n else shadowAttenuation = CCGetShadowFactorX1(pos);\n vec3 shadowColor = cc_shadowColor.rgb * cc_shadowColor.a + finalColor.rgb * (1.0 - cc_shadowColor.a);\n if (cc_shadowNFLSInfo.w > 0.000001) {\n finalColor.rgb = shadowColor.rgb * shadowAttenuation + finalColor.rgb * (1.0 - shadowAttenuation);\n } else {\n finalColor.rgb = shadowColor.rgb * shadowAttenuation * NL + finalColor.rgb * (1.0 - shadowAttenuation * NL);\n }\n }\n #endif\n return vec4(finalColor, s.albedo.a);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec4 CCFragOutput (vec4 color) {\n #if !CC_USE_HDR\n color.rgb = sqrt(ACESToneMap(color.rgb));\n #endif\n return color;\n}\nlayout(location = 1) in highp vec4 v_shadowPos;\n#if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n layout(location = 9) in vec3 v_luv;\n layout(set = 2, binding = 9) uniform sampler2D cc_lightingMap;\n vec3 UnpackLightingmap(vec4 color) {\n vec3 c;\n float e = 1.0 + color.a * (8.0 - 1.0);\n c.r = color.r * e;\n c.g = color.g * e;\n c.b = color.b * e;\n return c;\n }\n#endif\nlayout(location = 3) in vec3 v_position;\nlayout(location = 5) in vec2 v_uv;\nlayout(location = 6) in vec2 v_uv1;\nlayout(location = 4) in vec3 v_normal;\n#if USE_VERTEX_COLOR\n layout(location = 2) in vec4 v_color;\n#endif\n#if USE_ALBEDO_MAP\n layout(set = 1, binding = 1) uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n layout(location = 7) in vec3 v_tangent;\n layout(location = 8) in vec3 v_bitangent;\n layout(set = 1, binding = 2) uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n layout(set = 1, binding = 3) uniform sampler2D pbrMap;\n#endif\n#if USE_METALLIC_ROUGHNESS_MAP\n layout(set = 1, binding = 4) uniform sampler2D metallicRoughnessMap;\n#endif\n#if USE_OCCLUSION_MAP\n layout(set = 1, binding = 5) uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n layout(set = 1, binding = 6) uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvoid surf (out StandardSurface s) {\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor *= v_color;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n s.albedo = baseColor;\n s.albedo.rgb *= albedoScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n vec4 lightColor = texture(cc_lightingMap, v_luv.xy);\n s.lightmap = UnpackLightingmap(lightColor);\n s.lightmap_test = v_luv.z;\n #endif\n s.normal = v_normal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n s.normal =\n (nmmp.x * pbrParams.w) * normalize(v_tangent) +\n (nmmp.y * pbrParams.w) * normalize(v_bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n s.position = v_position;\n vec4 pbr = pbrParams;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, PBR_UV);\n pbr.x *= res.r;\n pbr.y *= res.g;\n pbr.z *= res.b;\n #endif\n #if USE_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughness = texture(metallicRoughnessMap, PBR_UV);\n pbr.z *= metallicRoughness.b;\n pbr.y *= metallicRoughness.g;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x *= texture(occlusionMap, PBR_UV).r;\n #endif\n s.occlusion = clamp(pbr.x, 0.0, 0.96);\n s.roughness = clamp(pbr.y, 0.04, 1.0);\n s.metallic = pbr.z;\n s.emissive = emissive.rgb * emissiveScaleParam.xyz;\n #if USE_EMISSIVE_MAP\n s.emissive *= SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n}\n#if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n # define LIGHTS_PER_PASS 1\n #else\n # define LIGHTS_PER_PASS 10\n #endif\n layout(set = 2, binding = 1) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n };\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / 3.14159265359;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - s.position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = cc_lightPos[i].xyz - s.position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = 3.14159265359 * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (cc_lightPos[i].w > 0.0) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = cc_lightColor[i].rgb;\n #if CC_RECEIVE_SHADOW\n if (cc_lightPos[i].w > 0.0) {\n {\n float pcf = cc_shadowWHPBInfo.z + 0.001;\n float shadowAttenuation = 0.0;\n float cosAngle = clamp(1.0 - dot(N, normalize(cc_lightPos[i].xyz - s.position.xyz)), 0.0, 1.0);\n vec3 projWorldPos = shadowPos.xyz + cosAngle * cc_shadowLPNNInfo.z * N;\n vec4 pos = vec4(projWorldPos.xyz, shadowPos.w);\n if (pcf > 3.0) shadowAttenuation = CCGetDirLightShadowFactorX25(pos, s.position);\n else if (pcf > 2.0) shadowAttenuation = CCGetDirLightShadowFactorX9(pos, s.position);\n else if (pcf > 1.0) shadowAttenuation = CCGetDirLightShadowFactorX5(pos, s.position);\n else shadowAttenuation = CCGetDirLightShadowFactorX1(pos, s.position);\n lightColor *= 1.0 - shadowAttenuation;\n }\n }\n #endif\n finalColor += SNL * lightColor * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n finalColor = finalColor * s.occlusion;\n return vec4(finalColor, 0.0);\n }\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n color = vec4(mix(CC_FORWARD_ADD > 0 ? vec3(0.0) : cc_fogColor.rgb, color.rgb, v_fog_factor), color.a);\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 0\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n color = vec4(mix(CC_FORWARD_ADD > 0 ? vec3(0.0) : cc_fogColor.rgb, color.rgb, v_fog_factor), color.a);\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n layout(location = 0) out vec4 fragColor0;\n layout(location = 1) out vec4 fragColor1;\n layout(location = 2) out vec4 fragColor2;\n layout(location = 3) out vec4 fragColor3;\n void main () {\n StandardSurface s; surf(s);\n fragColor0 = s.albedo;\n fragColor1 = vec4(s.position, s.roughness);\n fragColor2 = vec4(s.normal, s.metallic);\n fragColor3 = vec4(s.emissive, s.occlusion);\n }\n#endif"},"glsl3":{"vert":"\nprecision highp float;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout StandardVertInput attr) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n attr.position.xyz = attr.position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n attr.normal.xyz = attr.normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n attr.tangent.xyz = attr.tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n #if CC_USE_BAKED_ANIMATION\n #if USE_INSTANCING\n in highp vec4 a_jointAnimInfo;\n #endif\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[30 * 3];\n };\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 3.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 3.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 12.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 12.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout StandardVertInput attr) {\n mat4 m = skinMatrix();\n attr.position = m * attr.position;\n attr.normal = (m * vec4(attr.normal, 0.0)).xyz;\n attr.tangent.xyz = (m * vec4(attr.tangent.xyz, 0.0)).xyz;\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n};\n#if USE_INSTANCING\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n#elif USE_BATCHING\n in float a_dyn_batch_id;\n layout(std140) uniform CCLocalBatched {\n highp mat4 cc_matWorlds[10];\n };\n#else\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n };\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nfloat LinearFog(vec4 pos) {\n vec4 wPos = pos;\n float cam_dis = distance(cc_cameraPos, wPos);\n float fogStart = cc_fogBase.x;\n float fogEnd = cc_fogBase.y;\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n}\nfloat ExpFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float fogDensity = cc_fogBase.z;\n float cam_dis = distance(cc_cameraPos, wPos) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n}\nfloat ExpSquaredFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float fogDensity = cc_fogBase.z;\n float cam_dis = distance(cc_cameraPos, wPos) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n}\nfloat LayeredFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float _FogTop = cc_fogAdd.x;\n float _FogRange = cc_fogAdd.y;\n vec3 camWorldProj = cc_cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cc_cameraPos.y > _FogTop) {\n if (wPos.y < _FogTop) {\n fDeltaY = (_FogTop - wPos.y) / _FogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n } else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n } else {\n if (wPos.y < _FogTop) {\n float fDeltaA = (_FogTop - cc_cameraPos.y) / _FogRange * 2.;\n float fDeltaB = (_FogTop - wPos.y) / _FogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n } else {\n fDeltaY = abs(_FogTop - cc_cameraPos.y) / _FogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n } else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n}\nout float v_fog_factor;\nout highp vec4 v_shadowPos;\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\n#if CC_RECEIVE_SHADOW\n uniform sampler2D cc_shadowMap;\n uniform sampler2D cc_spotLightingMap;\n#endif\n#if USE_VERTEX_COLOR\n in vec4 a_color;\n out vec4 v_color;\n#endif\nout vec3 v_position;\nout vec3 v_normal;\nout vec2 v_uv;\nout vec2 v_uv1;\n#if USE_NORMAL_MAP\n out vec3 v_tangent;\n out vec3 v_bitangent;\n#endif\n#if HAS_SECOND_UV || USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n out vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.zw;\n v_luv.z = cc_lightingMapUVParam.z;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.zw;\n v_luv.z = a_lightingMapUVParam.z;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n mat4 matWorld, matWorldIT;\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n matWorldIT = matWorld;\n #elif USE_BATCHING\n matWorld = cc_matWorlds[int(a_dyn_batch_id)];\n matWorldIT = matWorld;\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if USE_NORMAL_MAP\n v_tangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_bitangent = cross(v_normal, v_tangent) * In.tangent.w;\n #endif\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv1 = cc_cameraPos.w > 1.0 ? vec2(v_uv1.x, 1.0 - v_uv1.y) : v_uv1;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n #if CC_USE_FOG == 0\n v_fog_factor = LinearFog(pos);\n #elif CC_USE_FOG == 1\n v_fog_factor = ExpFog(pos);\n #elif CC_USE_FOG == 2\n v_fog_factor = ExpSquaredFog(pos);\n #elif CC_USE_FOG == 3\n v_fog_factor = LayeredFog(pos);\n #else\n v_fog_factor = 1.0;\n #endif\n v_shadowPos = cc_matLightViewProj * pos;\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n CCLightingMapCaclUV();\n #endif\n gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;\n}","frag":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n};\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nin float v_fog_factor;\nvec3 SRGBToLinear (vec3 gamma) {\n return gamma * gamma;\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\n#if CC_RECEIVE_SHADOW\n uniform sampler2D cc_shadowMap;\n uniform sampler2D cc_spotLightingMap;\n float CCGetLinearDepth (vec3 worldPos) {\n vec4 viewStartPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n float dist = length(viewStartPos.xyz);\n return cc_shadowNFLSInfo.x + (-dist / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x));\n }\n float CCGetShadowFactorX1 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float shadow = 0.0;\n float closestDepth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n closestDepth = dot(texture(cc_shadowMap, clipPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n } else {\n closestDepth = texture(cc_shadowMap, clipPos.xy).x;\n }\n shadow = step(closestDepth, clipPos.z- cc_shadowWHPBInfo.w);\n return shadow;\n }\n float CCGetShadowFactorX5 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n float closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x, clipPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n } else {\n float closestDepth = texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x, clipPos.y)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n return shadow / 5.0;\n }\n float CCGetShadowFactorX9 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float closestDepth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = dot(texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 9.0;\n }\n float CCGetShadowFactorX25 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = dot(texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = texture(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 25.0;\n }\n float CCGetDirLightShadowFactorX1 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float shadow = 0.0;\n float closestDepth = 0.0;\n float depth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n if (cc_shadowLPNNInfo.y > 0.000001) {\n closestDepth = dot(texture(cc_spotLightingMap, clipPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n } else {\n closestDepth = texture(cc_spotLightingMap, clipPos.xy).x;\n }\n shadow = step(closestDepth, depth - cc_shadowWHPBInfo.w);\n return shadow;\n }\n float CCGetDirLightShadowFactorX5 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float depth = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n float closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n } else {\n float closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n return shadow / 5.0;\n }\n float CCGetDirLightShadowFactorX9 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float depth = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = dot(texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 9.0;\n }\n float CCGetDirLightShadowFactorX25 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float depth = 0.0;\n float shadow = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = dot(texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = texture(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 25.0;\n }\n#endif\n#if CC_USE_IBL\n uniform samplerCube cc_environment;\n vec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(2.0, rgbe.a * 255.0 - 128.0);\n }\n vec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n }\n vec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n }\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / (OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return specular * AB.x + AB.y;\n}\nstruct StandardSurface {\n vec4 albedo;\n vec3 position;\n vec3 normal;\n vec3 emissive;\n vec3 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n};\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - s.position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n float NL = max(dot(N, L), 0.001);\n vec3 finalColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse;\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n if (s.lightmap_test > 0.0001) {\n finalColor = s.lightmap.rgb;\n }\n #else\n diffuseContrib /= 3.14159265359;\n #endif\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n finalColor *= (diffuseContrib + specularContrib);\n float fAmb = 0.5 - N.y * 0.5;\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb) * cc_ambientSky.w;\n finalColor += (ambDiff.rgb * diffuse);\n #if CC_USE_IBL\n vec3 R = normalize(reflect(-V, N));\n vec4 envmap = fragTextureLod(cc_environment, R, s.roughness * cc_ambientGround.w);\n #if CC_USE_IBL == 2\n vec3 env = unpackRGBE(envmap);\n #else\n vec3 env = SRGBToLinear(envmap.rgb);\n #endif\n finalColor += env * cc_ambientSky.w * specular;\n #endif\n finalColor = finalColor * s.occlusion;\n #if CC_USE_HDR\n s.emissive *= cc_exposure.w;\n #endif\n finalColor += s.emissive;\n #if CC_RECEIVE_SHADOW\n {\n float pcf = cc_shadowWHPBInfo.z + 0.001;\n float shadowAttenuation = 0.0;\n float cosAngle = clamp(1.0 - dot(N, L.xyz), 0.0, 1.0);\n vec3 projWorldPos = shadowPos.xyz + cosAngle * cc_shadowLPNNInfo.z * N;\n vec4 pos = vec4(projWorldPos.xyz, shadowPos.w);\n if (pcf > 3.0) shadowAttenuation = CCGetShadowFactorX25(pos);\n else if (pcf > 2.0) shadowAttenuation = CCGetShadowFactorX9(pos);\n else if (pcf > 1.0) shadowAttenuation = CCGetShadowFactorX5(pos);\n else shadowAttenuation = CCGetShadowFactorX1(pos);\n vec3 shadowColor = cc_shadowColor.rgb * cc_shadowColor.a + finalColor.rgb * (1.0 - cc_shadowColor.a);\n if (cc_shadowNFLSInfo.w > 0.000001) {\n finalColor.rgb = shadowColor.rgb * shadowAttenuation + finalColor.rgb * (1.0 - shadowAttenuation);\n } else {\n finalColor.rgb = shadowColor.rgb * shadowAttenuation * NL + finalColor.rgb * (1.0 - shadowAttenuation * NL);\n }\n }\n #endif\n return vec4(finalColor, s.albedo.a);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec4 CCFragOutput (vec4 color) {\n #if !CC_USE_HDR\n color.rgb = sqrt(ACESToneMap(color.rgb));\n #endif\n return color;\n}\nin highp vec4 v_shadowPos;\n#if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n in vec3 v_luv;\n uniform sampler2D cc_lightingMap;\n vec3 UnpackLightingmap(vec4 color) {\n vec3 c;\n float e = 1.0 + color.a * (8.0 - 1.0);\n c.r = color.r * e;\n c.g = color.g * e;\n c.b = color.b * e;\n return c;\n }\n#endif\nin vec3 v_position;\nin vec2 v_uv;\nin vec2 v_uv1;\nin vec3 v_normal;\n#if USE_VERTEX_COLOR\n in vec4 v_color;\n#endif\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n in vec3 v_tangent;\n in vec3 v_bitangent;\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_METALLIC_ROUGHNESS_MAP\n uniform sampler2D metallicRoughnessMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvoid surf (out StandardSurface s) {\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor *= v_color;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n s.albedo = baseColor;\n s.albedo.rgb *= albedoScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n vec4 lightColor = texture(cc_lightingMap, v_luv.xy);\n s.lightmap = UnpackLightingmap(lightColor);\n s.lightmap_test = v_luv.z;\n #endif\n s.normal = v_normal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n s.normal =\n (nmmp.x * pbrParams.w) * normalize(v_tangent) +\n (nmmp.y * pbrParams.w) * normalize(v_bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n s.position = v_position;\n vec4 pbr = pbrParams;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, PBR_UV);\n pbr.x *= res.r;\n pbr.y *= res.g;\n pbr.z *= res.b;\n #endif\n #if USE_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughness = texture(metallicRoughnessMap, PBR_UV);\n pbr.z *= metallicRoughness.b;\n pbr.y *= metallicRoughness.g;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x *= texture(occlusionMap, PBR_UV).r;\n #endif\n s.occlusion = clamp(pbr.x, 0.0, 0.96);\n s.roughness = clamp(pbr.y, 0.04, 1.0);\n s.metallic = pbr.z;\n s.emissive = emissive.rgb * emissiveScaleParam.xyz;\n #if USE_EMISSIVE_MAP\n s.emissive *= SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n}\n#if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n # define LIGHTS_PER_PASS 1\n #else\n # define LIGHTS_PER_PASS 10\n #endif\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n };\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / 3.14159265359;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - s.position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = cc_lightPos[i].xyz - s.position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = 3.14159265359 * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (cc_lightPos[i].w > 0.0) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = cc_lightColor[i].rgb;\n #if CC_RECEIVE_SHADOW\n if (cc_lightPos[i].w > 0.0) {\n {\n float pcf = cc_shadowWHPBInfo.z + 0.001;\n float shadowAttenuation = 0.0;\n float cosAngle = clamp(1.0 - dot(N, normalize(cc_lightPos[i].xyz - s.position.xyz)), 0.0, 1.0);\n vec3 projWorldPos = shadowPos.xyz + cosAngle * cc_shadowLPNNInfo.z * N;\n vec4 pos = vec4(projWorldPos.xyz, shadowPos.w);\n if (pcf > 3.0) shadowAttenuation = CCGetDirLightShadowFactorX25(pos, s.position);\n else if (pcf > 2.0) shadowAttenuation = CCGetDirLightShadowFactorX9(pos, s.position);\n else if (pcf > 1.0) shadowAttenuation = CCGetDirLightShadowFactorX5(pos, s.position);\n else shadowAttenuation = CCGetDirLightShadowFactorX1(pos, s.position);\n lightColor *= 1.0 - shadowAttenuation;\n }\n }\n #endif\n finalColor += SNL * lightColor * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n finalColor = finalColor * s.occlusion;\n return vec4(finalColor, 0.0);\n }\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n color = vec4(mix(CC_FORWARD_ADD > 0 ? vec3(0.0) : cc_fogColor.rgb, color.rgb, v_fog_factor), color.a);\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 0\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n color = vec4(mix(CC_FORWARD_ADD > 0 ? vec3(0.0) : cc_fogColor.rgb, color.rgb, v_fog_factor), color.a);\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n layout(location = 0) out vec4 fragColor0;\n layout(location = 1) out vec4 fragColor1;\n layout(location = 2) out vec4 fragColor2;\n layout(location = 3) out vec4 fragColor3;\n void main () {\n StandardSurface s; surf(s);\n fragColor0 = s.albedo;\n fragColor1 = vec4(s.position, s.roughness);\n fragColor2 = vec4(s.normal, s.metallic);\n fragColor3 = vec4(s.emissive, s.occlusion);\n }\n#endif"},"glsl1":{"vert":"\nprecision highp float;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout StandardVertInput attr) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n attr.position.xyz = attr.position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n attr.normal.xyz = attr.normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n attr.tangent.xyz = attr.tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n #if CC_USE_BAKED_ANIMATION\n #if USE_INSTANCING\n attribute highp vec4 a_jointAnimInfo;\n #endif\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n #else\n uniform highp vec4 cc_joints[90];\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 3.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 3.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 12.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 12.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout StandardVertInput attr) {\n mat4 m = skinMatrix();\n attr.position = m * attr.position;\n attr.normal = (m * vec4(attr.normal, 0.0)).xyz;\n attr.tangent.xyz = (m * vec4(attr.tangent.xyz, 0.0)).xyz;\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if USE_INSTANCING\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n#elif USE_BATCHING\n attribute float a_dyn_batch_id;\n uniform highp mat4 cc_matWorlds[10];\n#else\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n uniform highp vec4 cc_lightingMapUVParam;\n#endif\n uniform vec4 tilingOffset;\nfloat LinearFog(vec4 pos) {\n vec4 wPos = pos;\n float cam_dis = distance(cc_cameraPos, wPos);\n float fogStart = cc_fogBase.x;\n float fogEnd = cc_fogBase.y;\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n}\nfloat ExpFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float fogDensity = cc_fogBase.z;\n float cam_dis = distance(cc_cameraPos, wPos) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n}\nfloat ExpSquaredFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float fogDensity = cc_fogBase.z;\n float cam_dis = distance(cc_cameraPos, wPos) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n}\nfloat LayeredFog(vec4 pos) {\n vec4 wPos = pos;\n float fogAtten = cc_fogAdd.z;\n float _FogTop = cc_fogAdd.x;\n float _FogRange = cc_fogAdd.y;\n vec3 camWorldProj = cc_cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cc_cameraPos.y > _FogTop) {\n if (wPos.y < _FogTop) {\n fDeltaY = (_FogTop - wPos.y) / _FogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n } else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n } else {\n if (wPos.y < _FogTop) {\n float fDeltaA = (_FogTop - cc_cameraPos.y) / _FogRange * 2.;\n float fDeltaB = (_FogTop - wPos.y) / _FogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n } else {\n fDeltaY = abs(_FogTop - cc_cameraPos.y) / _FogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n } else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n}\nvarying float v_fog_factor;\nvarying highp vec4 v_shadowPos;\nuniform highp mat4 cc_matLightViewProj;\n#if CC_RECEIVE_SHADOW\n uniform sampler2D cc_shadowMap;\n uniform sampler2D cc_spotLightingMap;\n#endif\n#if USE_VERTEX_COLOR\n attribute vec4 a_color;\n varying vec4 v_color;\n#endif\nvarying vec3 v_position;\nvarying vec3 v_normal;\nvarying vec2 v_uv;\nvarying vec2 v_uv1;\n#if USE_NORMAL_MAP\n varying vec3 v_tangent;\n varying vec3 v_bitangent;\n#endif\n#if HAS_SECOND_UV || USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n varying vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.zw;\n v_luv.z = cc_lightingMapUVParam.z;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.zw;\n v_luv.z = a_lightingMapUVParam.z;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n mat4 matWorld, matWorldIT;\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n matWorldIT = matWorld;\n #elif USE_BATCHING\n matWorld = cc_matWorlds[int(a_dyn_batch_id)];\n matWorldIT = matWorld;\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if USE_NORMAL_MAP\n v_tangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_bitangent = cross(v_normal, v_tangent) * In.tangent.w;\n #endif\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv1 = cc_cameraPos.w > 1.0 ? vec2(v_uv1.x, 1.0 - v_uv1.y) : v_uv1;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n #if CC_USE_FOG == 0\n v_fog_factor = LinearFog(pos);\n #elif CC_USE_FOG == 1\n v_fog_factor = ExpFog(pos);\n #elif CC_USE_FOG == 2\n v_fog_factor = ExpSquaredFog(pos);\n #elif CC_USE_FOG == 3\n v_fog_factor = LayeredFog(pos);\n #else\n v_fog_factor = 1.0;\n #endif\n v_shadowPos = cc_matLightViewProj * pos;\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n CCLightingMapCaclUV();\n #endif\n gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;\n}","frag":"\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_exposure;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_mainLitColor;\n uniform mediump vec4 cc_ambientSky;\n uniform mediump vec4 cc_ambientGround;\n uniform mediump vec4 cc_fogColor;\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\n uniform vec4 pbrParams;\n uniform vec4 emissive;\n uniform vec4 emissiveScaleParam;\nvarying float v_fog_factor;\nvec3 SRGBToLinear (vec3 gamma) {\n return gamma * gamma;\n}\nuniform highp mat4 cc_matLightView;\n uniform lowp vec4 cc_shadowNFLSInfo;\n uniform lowp vec4 cc_shadowWHPBInfo;\n uniform lowp vec4 cc_shadowLPNNInfo;\n uniform lowp vec4 cc_shadowColor;\n#if CC_RECEIVE_SHADOW\n uniform sampler2D cc_shadowMap;\n uniform sampler2D cc_spotLightingMap;\n float CCGetLinearDepth (vec3 worldPos) {\n vec4 viewStartPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n float dist = length(viewStartPos.xyz);\n return cc_shadowNFLSInfo.x + (-dist / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x));\n }\n float CCGetShadowFactorX1 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float shadow = 0.0;\n float closestDepth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n closestDepth = dot(texture2D(cc_shadowMap, clipPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n } else {\n closestDepth = texture2D(cc_shadowMap, clipPos.xy).x;\n }\n shadow = step(closestDepth, clipPos.z- cc_shadowWHPBInfo.w);\n return shadow;\n }\n float CCGetShadowFactorX5 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n float closestDepth = dot(texture2D(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_shadowMap, vec2(clipPos.x, clipPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n } else {\n float closestDepth = texture2D(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_shadowMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_shadowMap, vec2(clipPos.x, clipPos.y)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_shadowMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n return shadow / 5.0;\n }\n float CCGetShadowFactorX9 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float closestDepth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = dot(texture2D(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = texture2D(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 9.0;\n }\n float CCGetShadowFactorX25 (vec4 shadowPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = dot(texture2D(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = texture2D(cc_shadowMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 25.0;\n }\n float CCGetDirLightShadowFactorX1 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float shadow = 0.0;\n float closestDepth = 0.0;\n float depth = 0.0;\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n if (cc_shadowLPNNInfo.y > 0.000001) {\n closestDepth = dot(texture2D(cc_spotLightingMap, clipPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n } else {\n closestDepth = texture2D(cc_spotLightingMap, clipPos.xy).x;\n }\n shadow = step(closestDepth, depth - cc_shadowWHPBInfo.w);\n return shadow;\n }\n float CCGetDirLightShadowFactorX5 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float depth = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n float closestDepth = dot(texture2D(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = dot(texture2D(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n } else {\n float closestDepth = texture2D(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_spotLightingMap, vec2(clipPos.x - offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y - offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n closestDepth = texture2D(cc_spotLightingMap, vec2(clipPos.x + offsetx, clipPos.y + offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n return shadow / 5.0;\n }\n float CCGetDirLightShadowFactorX9 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float shadow = 0.0;\n float depth = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = dot(texture2D(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -1; i <= 1; i++) {\n for (int j = -1; j <= 1; j++) {\n float closestDepth = texture2D(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, depth - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 9.0;\n }\n float CCGetDirLightShadowFactorX25 (vec4 shadowPos, vec3 worldPos) {\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x < 0.0 || clipPos.x > 1.0 ||\n clipPos.y < 0.0 || clipPos.y > 1.0 ||\n clipPos.z <-1.0 || clipPos.z > 1.0) { return 0.0; }\n float offsetx = 1.0 / cc_shadowWHPBInfo.x;\n float offsety = 1.0 / cc_shadowWHPBInfo.y;\n float depth = 0.0;\n float shadow = 0.0;\n if (cc_shadowNFLSInfo.z > 0.000001) {\n depth = CCGetLinearDepth(worldPos);\n } else {\n depth = clipPos.z;\n }\n clipPos.xy = cc_cameraPos.w == 1.0 ? vec2(clipPos.xy.x, 1.0 - clipPos.xy.y) : clipPos.xy;\n if (cc_shadowLPNNInfo.y > 0.000001) {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = dot(texture2D(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n } else {\n for (int i = -2; i <= 2; i++) {\n for (int j = -2; j <= 2; j++) {\n float closestDepth = texture2D(cc_spotLightingMap, clipPos.xy + vec2(i, j) * vec2(offsetx, offsety)).x;\n shadow += step(closestDepth, clipPos.z - cc_shadowWHPBInfo.w);\n }\n }\n }\n return shadow / 25.0;\n }\n#endif\n#if CC_USE_IBL\n uniform samplerCube cc_environment;\n vec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(2.0, rgbe.a * 255.0 - 128.0);\n }\n vec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n }\n vec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n }\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / (OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return specular * AB.x + AB.y;\n}\nstruct StandardSurface {\n vec4 albedo;\n vec3 position;\n vec3 normal;\n vec3 emissive;\n vec3 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n};\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - s.position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n float NL = max(dot(N, L), 0.001);\n vec3 finalColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse;\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n if (s.lightmap_test > 0.0001) {\n finalColor = s.lightmap.rgb;\n }\n #else\n diffuseContrib /= 3.14159265359;\n #endif\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n finalColor *= (diffuseContrib + specularContrib);\n float fAmb = 0.5 - N.y * 0.5;\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb) * cc_ambientSky.w;\n finalColor += (ambDiff.rgb * diffuse);\n #if CC_USE_IBL\n vec3 R = normalize(reflect(-V, N));\n vec4 envmap = fragTextureLod(cc_environment, R, s.roughness * cc_ambientGround.w);\n #if CC_USE_IBL == 2\n vec3 env = unpackRGBE(envmap);\n #else\n vec3 env = SRGBToLinear(envmap.rgb);\n #endif\n finalColor += env * cc_ambientSky.w * specular;\n #endif\n finalColor = finalColor * s.occlusion;\n #if CC_USE_HDR\n s.emissive *= cc_exposure.w;\n #endif\n finalColor += s.emissive;\n #if CC_RECEIVE_SHADOW\n {\n float pcf = cc_shadowWHPBInfo.z + 0.001;\n float shadowAttenuation = 0.0;\n float cosAngle = clamp(1.0 - dot(N, L.xyz), 0.0, 1.0);\n vec3 projWorldPos = shadowPos.xyz + cosAngle * cc_shadowLPNNInfo.z * N;\n vec4 pos = vec4(projWorldPos.xyz, shadowPos.w);\n if (pcf > 3.0) shadowAttenuation = CCGetShadowFactorX25(pos);\n else if (pcf > 2.0) shadowAttenuation = CCGetShadowFactorX9(pos);\n else if (pcf > 1.0) shadowAttenuation = CCGetShadowFactorX5(pos);\n else shadowAttenuation = CCGetShadowFactorX1(pos);\n vec3 shadowColor = cc_shadowColor.rgb * cc_shadowColor.a + finalColor.rgb * (1.0 - cc_shadowColor.a);\n if (cc_shadowNFLSInfo.w > 0.000001) {\n finalColor.rgb = shadowColor.rgb * shadowAttenuation + finalColor.rgb * (1.0 - shadowAttenuation);\n } else {\n finalColor.rgb = shadowColor.rgb * shadowAttenuation * NL + finalColor.rgb * (1.0 - shadowAttenuation * NL);\n }\n }\n #endif\n return vec4(finalColor, s.albedo.a);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec4 CCFragOutput (vec4 color) {\n #if !CC_USE_HDR\n color.rgb = sqrt(ACESToneMap(color.rgb));\n #endif\n return color;\n}\nvarying highp vec4 v_shadowPos;\n#if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n varying vec3 v_luv;\n uniform sampler2D cc_lightingMap;\n vec3 UnpackLightingmap(vec4 color) {\n vec3 c;\n float e = 1.0 + color.a * (8.0 - 1.0);\n c.r = color.r * e;\n c.g = color.g * e;\n c.b = color.b * e;\n return c;\n }\n#endif\nvarying vec3 v_position;\nvarying vec2 v_uv;\nvarying vec2 v_uv1;\nvarying vec3 v_normal;\n#if USE_VERTEX_COLOR\n varying vec4 v_color;\n#endif\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n varying vec3 v_tangent;\n varying vec3 v_bitangent;\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_METALLIC_ROUGHNESS_MAP\n uniform sampler2D metallicRoughnessMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvoid surf (out StandardSurface s) {\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor *= v_color;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture2D(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n s.albedo = baseColor;\n s.albedo.rgb *= albedoScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD\n vec4 lightColor = texture2D(cc_lightingMap, v_luv.xy);\n s.lightmap = UnpackLightingmap(lightColor);\n s.lightmap_test = v_luv.z;\n #endif\n s.normal = v_normal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture2D(normalMap, NORMAL_UV).xyz - vec3(0.5);\n s.normal =\n (nmmp.x * pbrParams.w) * normalize(v_tangent) +\n (nmmp.y * pbrParams.w) * normalize(v_bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n s.position = v_position;\n vec4 pbr = pbrParams;\n #if USE_PBR_MAP\n vec4 res = texture2D(pbrMap, PBR_UV);\n pbr.x *= res.r;\n pbr.y *= res.g;\n pbr.z *= res.b;\n #endif\n #if USE_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughness = texture2D(metallicRoughnessMap, PBR_UV);\n pbr.z *= metallicRoughness.b;\n pbr.y *= metallicRoughness.g;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x *= texture2D(occlusionMap, PBR_UV).r;\n #endif\n s.occlusion = clamp(pbr.x, 0.0, 0.96);\n s.roughness = clamp(pbr.y, 0.04, 1.0);\n s.metallic = pbr.z;\n s.emissive = emissive.rgb * emissiveScaleParam.xyz;\n #if USE_EMISSIVE_MAP\n s.emissive *= SRGBToLinear(texture2D(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n}\n#if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n # define LIGHTS_PER_PASS 1\n #else\n # define LIGHTS_PER_PASS 10\n #endif\n uniform highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n uniform vec4 cc_lightColor[LIGHTS_PER_PASS];\n uniform vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n uniform vec4 cc_lightDir[LIGHTS_PER_PASS];\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / 3.14159265359;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - s.position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = cc_lightPos[i].xyz - s.position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = 3.14159265359 * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (cc_lightPos[i].w > 0.0) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = cc_lightColor[i].rgb;\n #if CC_RECEIVE_SHADOW\n if (cc_lightPos[i].w > 0.0) {\n {\n float pcf = cc_shadowWHPBInfo.z + 0.001;\n float shadowAttenuation = 0.0;\n float cosAngle = clamp(1.0 - dot(N, normalize(cc_lightPos[i].xyz - s.position.xyz)), 0.0, 1.0);\n vec3 projWorldPos = shadowPos.xyz + cosAngle * cc_shadowLPNNInfo.z * N;\n vec4 pos = vec4(projWorldPos.xyz, shadowPos.w);\n if (pcf > 3.0) shadowAttenuation = CCGetDirLightShadowFactorX25(pos, s.position);\n else if (pcf > 2.0) shadowAttenuation = CCGetDirLightShadowFactorX9(pos, s.position);\n else if (pcf > 1.0) shadowAttenuation = CCGetDirLightShadowFactorX5(pos, s.position);\n else shadowAttenuation = CCGetDirLightShadowFactorX1(pos, s.position);\n lightColor *= 1.0 - shadowAttenuation;\n }\n }\n #endif\n finalColor += SNL * lightColor * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n finalColor = finalColor * s.occlusion;\n return vec4(finalColor, 0.0);\n }\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n color = vec4(mix(CC_FORWARD_ADD > 0 ? vec3(0.0) : cc_fogColor.rgb, color.rgb, v_fog_factor), color.a);\n gl_FragData[0] = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 0\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n color = vec4(mix(CC_FORWARD_ADD > 0 ? vec3(0.0) : cc_fogColor.rgb, color.rgb, v_fog_factor), color.a);\n gl_FragData[0] = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n void main () {\n StandardSurface s; surf(s);\n gl_FragData[0] = s.albedo;\n gl_FragData[1] = vec4(s.position, s.roughness);\n gl_FragData[2] = vec4(s.normal, s.metallic);\n gl_FragData[3] = vec4(s.emissive, s.occlusion);\n }\n#endif"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotLightingMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","defines":["CC_USE_IBL"]}]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION"]},{"name":"CCLocalBatched","defines":["!USE_INSTANCING","USE_BATCHING"]},{"name":"CCLocal","defines":["!USE_INSTANCING","!USE_BATCHING"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_lightingMap","defines":["USE_LIGHTMAP","!USE_BATCHING","!CC_FORWARD_ADD"]}]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":216,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":59}},"defines":[{"name":"CC_USE_MORPH","type":"boolean","defines":[]},{"name":"CC_MORPH_TARGET_COUNT","type":"number","defines":["CC_USE_MORPH"],"range":[2,8]},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_USE_SKINNING","type":"boolean","defines":[]},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean","defines":["CC_USE_SKINNING"]},{"name":"USE_INSTANCING","type":"boolean","defines":[],"editor":{"elevated":true}},{"name":"USE_BATCHING","type":"boolean","defines":["!USE_INSTANCING"],"editor":{"elevated":true}},{"name":"USE_LIGHTMAP","type":"boolean","defines":[]},{"name":"CC_USE_FOG","type":"number","defines":[],"range":[0,4]},{"name":"CC_FORWARD_ADD","type":"boolean","defines":[]},{"name":"CC_RECEIVE_SHADOW","type":"boolean","defines":[]},{"name":"USE_VERTEX_COLOR","type":"boolean","defines":[]},{"name":"USE_NORMAL_MAP","type":"boolean","defines":[]},{"name":"HAS_SECOND_UV","type":"boolean","defines":[]},{"name":"SAMPLE_FROM_RT","type":"boolean","defines":[]},{"name":"CC_USE_IBL","type":"number","defines":[],"range":[0,2]},{"name":"CC_USE_HDR","type":"boolean","defines":[]},{"name":"USE_ALBEDO_MAP","type":"boolean","defines":[]},{"name":"ALBEDO_UV","type":"string","defines":["USE_ALBEDO_MAP"],"options":["v_uv","v_uv1"]},{"name":"NORMAL_UV","type":"string","defines":["USE_NORMAL_MAP"],"options":["v_uv","v_uv1"]},{"name":"PBR_UV","type":"string","defines":[],"options":["v_uv","v_uv1"]},{"name":"USE_PBR_MAP","type":"boolean","defines":[]},{"name":"USE_METALLIC_ROUGHNESS_MAP","type":"boolean","defines":[]},{"name":"USE_OCCLUSION_MAP","type":"boolean","defines":[]},{"name":"USE_EMISSIVE_MAP","type":"boolean","defines":[]},{"name":"EMISSIVE_UV","type":"string","defines":["USE_EMISSIVE_MAP"],"options":["v_uv","v_uv1"]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"ALPHA_TEST_CHANNEL","type":"string","defines":["USE_ALPHA_TEST"],"options":["a","r"]},{"name":"CC_PIPELINE_TYPE","type":"number","defines":["CC_FORWARD_ADD"],"range":[0,1]}],"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"metallicRoughnessMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_METALLIC_ROUGHNESS_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["USE_EMISSIVE_MAP"]}],"attributes":[{"name":"a_position","type":15,"count":1,"stageFlags":1,"format":32,"location":0,"defines":[]},{"name":"a_normal","type":15,"count":1,"stageFlags":1,"format":32,"location":1,"defines":[]},{"name":"a_texCoord","type":14,"count":1,"stageFlags":1,"format":21,"location":2,"defines":[]},{"name":"a_tangent","type":16,"count":1,"stageFlags":1,"format":44,"location":3,"defines":[]},{"name":"a_vertexId","type":13,"count":1,"stageFlags":1,"format":11,"location":6,"defines":["CC_USE_MORPH"]},{"name":"a_joints","type":"u32vec4","count":1,"stageFlags":1,"location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","type":16,"count":1,"stageFlags":1,"format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":7,"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION","USE_INSTANCING"]},{"name":"a_matWorld0","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING","USE_LIGHTMAP"]},{"name":"a_dyn_batch_id","type":13,"count":1,"stageFlags":1,"format":11,"location":12,"defines":["!USE_INSTANCING","USE_BATCHING"]},{"name":"a_color","type":16,"count":1,"stageFlags":1,"format":44,"location":13,"defines":["USE_VERTEX_COLOR"]},{"name":"a_texCoord1","type":14,"count":1,"stageFlags":1,"format":21,"location":14,"defines":[]}],"varyings":[{"name":"v_fog_factor","type":13,"count":1,"stageFlags":1,"location":0,"defines":[]},{"name":"v_shadowPos","type":16,"count":1,"stageFlags":1,"location":1,"defines":[]},{"name":"v_color","type":16,"count":1,"stageFlags":1,"location":2,"defines":["USE_VERTEX_COLOR"]},{"name":"v_position","type":15,"count":1,"stageFlags":1,"location":3,"defines":[]},{"name":"v_normal","type":15,"count":1,"stageFlags":1,"location":4,"defines":[]},{"name":"v_uv","type":14,"count":1,"stageFlags":1,"location":5,"defines":[]},{"name":"v_uv1","type":14,"count":1,"stageFlags":1,"location":6,"defines":[]},{"name":"v_tangent","type":15,"count":1,"stageFlags":1,"location":7,"defines":["USE_NORMAL_MAP"]},{"name":"v_bitangent","type":15,"count":1,"stageFlags":1,"location":8,"defines":["USE_NORMAL_MAP"]},{"name":"v_luv","type":15,"count":1,"stageFlags":1,"location":9,"defines":["USE_LIGHTMAP","!USE_BATCHING","!CC_FORWARD_ADD"]}]},{"hash":826679743,"name":"builtin-standard|shadow-caster-vs:vert|shadow-caster-fs:frag","glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 6) uniform sampler2D cc_PositionDisplacements;\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 7) uniform sampler2D cc_NormalDisplacements;\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 8) uniform sampler2D cc_TangentDisplacements;\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout StandardVertInput attr) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n attr.position.xyz = attr.position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n attr.normal.xyz = attr.normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n attr.tangent.xyz = attr.tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n #if CC_USE_BAKED_ANIMATION\n #if USE_INSTANCING\n layout(location = 7) in highp vec4 a_jointAnimInfo;\n #endif\n layout(set = 2, binding = 3) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(set = 2, binding = 2) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n layout(set = 2, binding = 5) uniform highp sampler2D cc_jointTexture;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[30 * 3];\n };\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 3.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 3.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 12.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 12.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout StandardVertInput attr) {\n mat4 m = skinMatrix();\n attr.position = m * attr.position;\n attr.normal = (m * vec4(attr.normal, 0.0)).xyz;\n attr.tangent.xyz = (m * vec4(attr.tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if USE_INSTANCING\n layout(location = 8) in vec4 a_matWorld0;\n layout(location = 9) in vec4 a_matWorld1;\n layout(location = 10) in vec4 a_matWorld2;\n #if USE_LIGHTMAP\n layout(location = 11) in vec4 a_lightingMapUVParam;\n #endif\n#elif USE_BATCHING\n layout(location = 12) in float a_dyn_batch_id;\n layout(set = 2, binding = 0) uniform CCLocalBatched {\n highp mat4 cc_matWorlds[10];\n };\n#else\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n };\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\n#if HAS_SECOND_UV || USE_LIGHTMAP\n layout(location = 13) in vec2 a_texCoord1;\n#endif\nlayout(location = 0) out vec2 v_uv;\nlayout(location = 1) out vec2 v_uv1;\nlayout(location = 2) out vec4 v_worldPos;\nlayout(location = 3) out float v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n mat4 matWorld, matWorldIT;\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n matWorldIT = matWorld;\n #elif USE_BATCHING\n matWorld = cc_matWorlds[int(a_dyn_batch_id)];\n matWorldIT = matWorld;\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #endif\n v_clip_depth = clipPos.z / clipPos.w * 0.5 + 0.5;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\n ret = fract(ret);\n ret -= ret.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n return ret;\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 1) in vec2 v_uv1;\nlayout(location = 2) in vec4 v_worldPos;\nlayout(location = 3) in float v_clip_depth;\n#if USE_ALBEDO_MAP\n layout(set = 1, binding = 1) uniform sampler2D albedoMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = albedo;\n #if USE_ALBEDO_MAP\n baseColor *= texture(albedoMap, ALBEDO_UV);\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n if(cc_shadowLPNNInfo.x > 0.000001 && cc_shadowLPNNInfo.x < 1.999999) {\n if (cc_shadowNFLSInfo.z > 0.000001) {\n vec4 viewStartPos = cc_matLightView * v_worldPos;\n float dist = length(viewStartPos.xyz);\n float linearDepth = cc_shadowNFLSInfo.x + (-dist / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x));\n return vec4(linearDepth, 1.0, 1.0, 1.0);\n }\n }\n if (cc_shadowLPNNInfo.y > 0.000001) {\n return packDepthToRGBA(v_clip_depth);\n }\n return vec4(v_clip_depth, 1.0, 1.0, 1.0);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl3":{"vert":"\nprecision highp float;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout StandardVertInput attr) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n attr.position.xyz = attr.position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n attr.normal.xyz = attr.normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n attr.tangent.xyz = attr.tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n #if CC_USE_BAKED_ANIMATION\n #if USE_INSTANCING\n in highp vec4 a_jointAnimInfo;\n #endif\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[30 * 3];\n };\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 3.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 3.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 12.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 12.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout StandardVertInput attr) {\n mat4 m = skinMatrix();\n attr.position = m * attr.position;\n attr.normal = (m * vec4(attr.normal, 0.0)).xyz;\n attr.tangent.xyz = (m * vec4(attr.tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if USE_INSTANCING\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n#elif USE_BATCHING\n in float a_dyn_batch_id;\n layout(std140) uniform CCLocalBatched {\n highp mat4 cc_matWorlds[10];\n };\n#else\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n };\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\n#if HAS_SECOND_UV || USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\nout vec2 v_uv;\nout vec2 v_uv1;\nout vec4 v_worldPos;\nout float v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n mat4 matWorld, matWorldIT;\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n matWorldIT = matWorld;\n #elif USE_BATCHING\n matWorld = cc_matWorlds[int(a_dyn_batch_id)];\n matWorldIT = matWorld;\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #endif\n v_clip_depth = clipPos.z / clipPos.w * 0.5 + 0.5;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\n ret = fract(ret);\n ret -= ret.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n return ret;\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightPlaneProj;\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n lowp vec4 cc_shadowNFLSInfo;\n lowp vec4 cc_shadowWHPBInfo;\n lowp vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n};\nin vec2 v_uv;\nin vec2 v_uv1;\nin vec4 v_worldPos;\nin float v_clip_depth;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = albedo;\n #if USE_ALBEDO_MAP\n baseColor *= texture(albedoMap, ALBEDO_UV);\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n if(cc_shadowLPNNInfo.x > 0.000001 && cc_shadowLPNNInfo.x < 1.999999) {\n if (cc_shadowNFLSInfo.z > 0.000001) {\n vec4 viewStartPos = cc_matLightView * v_worldPos;\n float dist = length(viewStartPos.xyz);\n float linearDepth = cc_shadowNFLSInfo.x + (-dist / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x));\n return vec4(linearDepth, 1.0, 1.0, 1.0);\n }\n }\n if (cc_shadowLPNNInfo.y > 0.000001) {\n return packDepthToRGBA(v_clip_depth);\n }\n return vec4(v_clip_depth, 1.0, 1.0, 1.0);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout StandardVertInput attr) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n attr.position.xyz = attr.position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n attr.normal.xyz = attr.normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n attr.tangent.xyz = attr.tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n #if CC_USE_BAKED_ANIMATION\n #if USE_INSTANCING\n attribute highp vec4 a_jointAnimInfo;\n #endif\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n #else\n uniform highp vec4 cc_joints[90];\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 3.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 3.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n #if USE_INSTANCING\n highp float j = 12.0 * (a_jointAnimInfo.x * a_jointAnimInfo.y + i) + a_jointAnimInfo.z;\n #else\n highp float j = 12.0 * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + i) + cc_jointTextureInfo.z;\n #endif\n highp float invSize = cc_jointTextureInfo.w;\n highp float y = floor(j * invSize);\n highp float x = floor(j - y * cc_jointTextureInfo.x);\n y = (y + 0.5) * invSize;\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout StandardVertInput attr) {\n mat4 m = skinMatrix();\n attr.position = m * attr.position;\n attr.normal = (m * vec4(attr.normal, 0.0)).xyz;\n attr.tangent.xyz = (m * vec4(attr.tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if USE_INSTANCING\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n#elif USE_BATCHING\n attribute float a_dyn_batch_id;\n uniform highp mat4 cc_matWorlds[10];\n#else\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\n uniform vec4 tilingOffset;\nuniform highp mat4 cc_matLightViewProj;\n#if HAS_SECOND_UV || USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\nvarying vec2 v_uv;\nvarying vec2 v_uv1;\nvarying vec4 v_worldPos;\nvarying float v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n mat4 matWorld, matWorldIT;\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n matWorldIT = matWorld;\n #elif USE_BATCHING\n matWorld = cc_matWorlds[int(a_dyn_batch_id)];\n matWorldIT = matWorld;\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #endif\n v_clip_depth = clipPos.z / clipPos.w * 0.5 + 0.5;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\n ret = fract(ret);\n ret -= ret.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n return ret;\n}\nuniform highp mat4 cc_matLightView;\n uniform lowp vec4 cc_shadowNFLSInfo;\n uniform lowp vec4 cc_shadowLPNNInfo;\nvarying vec2 v_uv;\nvarying vec2 v_uv1;\nvarying vec4 v_worldPos;\nvarying float v_clip_depth;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = albedo;\n #if USE_ALBEDO_MAP\n baseColor *= texture2D(albedoMap, ALBEDO_UV);\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n if(cc_shadowLPNNInfo.x > 0.000001 && cc_shadowLPNNInfo.x < 1.999999) {\n if (cc_shadowNFLSInfo.z > 0.000001) {\n vec4 viewStartPos = cc_matLightView * v_worldPos;\n float dist = length(viewStartPos.xyz);\n float linearDepth = cc_shadowNFLSInfo.x + (-dist / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x));\n return vec4(linearDepth, 1.0, 1.0, 1.0);\n }\n }\n if (cc_shadowLPNNInfo.y > 0.000001) {\n return packDepthToRGBA(v_clip_depth);\n }\n return vec4(v_clip_depth, 1.0, 1.0, 1.0);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCShadow","defines":[]}],"samplerTextures":[]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION"]},{"name":"CCLocalBatched","defines":["!USE_INSTANCING","USE_BATCHING"]},{"name":"CCLocal","defines":["!USE_INSTANCING","!USE_BATCHING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]}]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":179,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":22}},"defines":[{"name":"CC_USE_MORPH","type":"boolean","defines":[]},{"name":"CC_MORPH_TARGET_COUNT","type":"number","defines":["CC_USE_MORPH"],"range":[2,8]},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean","defines":["CC_USE_MORPH"]},{"name":"CC_USE_SKINNING","type":"boolean","defines":[]},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean","defines":["CC_USE_SKINNING"]},{"name":"USE_INSTANCING","type":"boolean","defines":[],"editor":{"elevated":true}},{"name":"USE_BATCHING","type":"boolean","defines":["!USE_INSTANCING"],"editor":{"elevated":true}},{"name":"USE_LIGHTMAP","type":"boolean","defines":["USE_INSTANCING"]},{"name":"HAS_SECOND_UV","type":"boolean","defines":[]},{"name":"USE_ALBEDO_MAP","type":"boolean","defines":[]},{"name":"ALBEDO_UV","type":"string","defines":["USE_ALBEDO_MAP"],"options":["v_uv","v_uv1"]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"ALPHA_TEST_CHANNEL","type":"string","defines":["USE_ALPHA_TEST"],"options":["a","r"]}],"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]}],"attributes":[{"name":"a_position","type":15,"count":1,"stageFlags":1,"format":32,"location":0,"defines":[]},{"name":"a_normal","type":15,"count":1,"stageFlags":1,"format":32,"location":1,"defines":[]},{"name":"a_texCoord","type":14,"count":1,"stageFlags":1,"format":21,"location":2,"defines":[]},{"name":"a_tangent","type":16,"count":1,"stageFlags":1,"format":44,"location":3,"defines":[]},{"name":"a_vertexId","type":13,"count":1,"stageFlags":1,"format":11,"location":6,"defines":["CC_USE_MORPH"]},{"name":"a_joints","type":"u32vec4","count":1,"stageFlags":1,"location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","type":16,"count":1,"stageFlags":1,"format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":7,"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION","USE_INSTANCING"]},{"name":"a_matWorld0","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","type":16,"count":1,"stageFlags":1,"format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING","USE_LIGHTMAP"]},{"name":"a_dyn_batch_id","type":13,"count":1,"stageFlags":1,"format":11,"location":12,"defines":["!USE_INSTANCING","USE_BATCHING"]},{"name":"a_texCoord1","type":14,"count":1,"stageFlags":1,"format":21,"location":13,"defines":[]}],"varyings":[{"name":"v_uv","type":14,"count":1,"stageFlags":1,"location":0,"defines":[]},{"name":"v_uv1","type":14,"count":1,"stageFlags":1,"location":1,"defines":[]},{"name":"v_worldPos","type":16,"count":1,"stageFlags":1,"location":2,"defines":[]},{"name":"v_clip_depth","type":13,"count":1,"stageFlags":1,"location":3,"defines":[]}]}],[{"name":"opaque","passes":[{"program":"builtin-standard|standard-vs|standard-fs","properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"metallicRoughnessMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}},"migrations":{"properties":{"pbrParams":{"removeImmediately":true}}}},{"phase":"deferred","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","blendState":{"targets":[{"blend":false},{"blend":false},{"blend":false},{"blend":false}]},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"metallicRoughnessMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}}},{"phase":"forward-add","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_FORWARD_ADD":true},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":1}]},"depthStencilState":{"depthFunc":2,"depthTest":true,"depthWrite":false},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"metallicRoughnessMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}}},{"phase":"shadow-caster","propertyIndex":0,"program":"builtin-standard|shadow-caster-vs:vert|shadow-caster-fs:frag","rasterizerState":{"cullMode":1},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST"},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP"},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}}}]},{"name":"transparent","passes":[{"program":"builtin-standard|standard-vs|standard-fs","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"metallicRoughnessMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}}},{"phase":"forward-add","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_FORWARD_ADD":true},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":1}]},"depthStencilState":{"depthFunc":2,"depthTest":true,"depthWrite":false},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"editor":{"slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP","slide":true,"step":0.001,"range":[0,1]},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"metallicRoughnessMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}}},{"phase":"shadow-caster","propertyIndex":0,"program":"builtin-standard|shadow-caster-vs:vert|shadow-caster-fs:frag","rasterizerState":{"cullMode":1},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"editor":{"displayName":"Albedo","type":"color"},"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"editor":{"parent":"USE_ALPHA_TEST"},"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[1],"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.8],"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0.6],"handleInfo":["pbrParams",2,13]},"normalStrenth":{"type":13,"value":[1],"editor":{"parent":"USE_NORMAL_MAP"},"handleInfo":["pbrParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1],"editor":{"type":"color"}},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"mainTexture":{"value":"grey","type":28,"editor":{"displayName":"AlbedoMap"},"handleInfo":["albedoMap",0,28]},"albedo":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0.5]},"pbrParams":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,0.8,0.6,1]},"emissiveScaleParam":{"type":16,"editor":{"visible":false,"deprecated":true},"value":[1,1,1,0]},"albedoMap":{"type":28,"value":"grey","editor":{"visible":false,"deprecated":true}}}}]}]]],0,0,[],[],[]],[[[4,"1",[{"rasterizerState":{},"depthStencilState":{"depthWrite":true},"blendState":{"isA2C":true,"targets":[{"blendDst":0,"blendSrcAlpha":2,"blendDstAlpha":0}]}},{},{}],[{"USE_ALBEDO_MAP":true},{},{}],[[[{"alphaThreshold":0,"roughness":0.889,"metallic":0},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[2,3],[3,0]],[[[4,"1",[{"rasterizerState":{},"depthStencilState":{"depthWrite":true},"blendState":{"isA2C":true,"targets":[{"blendDst":0,"blendSrcAlpha":2,"blendDstAlpha":0}]}},{},{}],[{"USE_ALBEDO_MAP":true},{},{}],[[[{"alphaThreshold":0,"roughness":0.889,"metallic":0},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[2,3],[4,0]],[[[11,".bin",3407706,4222335463,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3165120,"length":242586,"count":121293,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":3165120,"count":56520,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}]},"minPosition",8,[1,-0.30425167083740234,-0.02769732102751732,-0.36746475100517273],"maxPosition",8,[1,0.30425167083740234,0.02769731916487217,0.3674647808074951]]]],0,0,[],[],[]],[[[11,".bin",602248,1327119309,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":554008,"length":48240,"count":24120,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":554008,"count":9893,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}]},"minPosition",8,[1,-0.3161841034889221,-0.04823184385895729,-0.3813505470752716],"maxPosition",8,[1,0.31618404388427734,0.04823184013366699,0.3813505470752716]]]],0,0,[],[],[]],[[[11,".bin",1180,1931304792,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1120,"length":60,"count":30,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":1120,"count":20,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}]},"minPosition",8,[1,-0.42500004172325134,-0.01249999925494194,-0.42500004172325134],"maxPosition",8,[1,0.42500004172325134,0.012499997392296791,0.42500004172325134]]]],0,0,[],[],[]],[[[20],[21,"shuang chuangx",[-2],[10,"df87CfqV9Z7avOunIbfo8c",-1,0]],[22,"RootNode",1,[-3,-4,-5],[10,"52AnibCMlaVLXEuMElNWv+",1,0]],[12,"zhan ban",2,[[13,-6,[1,"10yuWktrFfga00ZWOJ8Of1"],[0],[3],1]],[10,"f131hgIY9fhLm7FzP2Up4l",1,0],[1,65.8335418701172,4.78952503204346,4.13883304595947],[1,100,100,100],[1,0.00000250447806548767,0,0]],[12,"zhan tai",2,[[13,-7,[1,"8e1RyoaLxaMILoNtLYpn2I"],[2],[3],3]],[10,"1fmc9Md5hfSrCzvn5JMcBJ",1,0],[1,64.6561737060547,2.7547333240509,5.11429166793823],[1,100,100,100],[1,0.00000250447806548767,0,0]],[12,"diban",2,[[13,-8,[1,"3cDt2EMQ5e+pYgzQpUTVoK"],[4],[3],5]],[10,"df6nDNnJBYwImAyXFPdSCd",1,0],[1,65.1198425292969,-1.25,6.75993204116821],[1,100,100,100],[1,0.00000250447806548767,0,0]]],0,[0,4,1,0,-1,2,0,-1,3,0,-2,4,0,-3,5,0,0,3,0,0,4,0,0,5,0,6,1,8],[0,0,0,0,0,0],[-1,1,-1,1,-1,1],[2,5,6,7,2,8]],[[[4,"1",[{"rasterizerState":{"isDiscard":true,"cullMode":0},"depthStencilState":{"depthWrite":true},"blendState":{"isA2C":true,"targets":[{"blendDst":0,"blendSrcAlpha":2,"blendDstAlpha":0}]}},{},{}],[{"USE_ALBEDO_MAP":true},{},{}],[[[{"alphaThreshold":0,"roughness":0.889,"metallic":0},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[2,3],[9,0]],[[{"base":"2,2,0,0,2,0","mipmaps":[{"front":"8b6d587f-3bc2-4703-90cf-478e5c15d10a@b47c0@e9a6d","back":"8b6d587f-3bc2-4703-90cf-478e5c15d10a@b47c0@40c10","left":"8b6d587f-3bc2-4703-90cf-478e5c15d10a@b47c0@8fd34","right":"8b6d587f-3bc2-4703-90cf-478e5c15d10a@b47c0@74afd","top":"8b6d587f-3bc2-4703-90cf-478e5c15d10a@b47c0@bb97f","bottom":"8b6d587f-3bc2-4703-90cf-478e5c15d10a@b47c0@7d38f"}]}],[4],0,[],[],[]],[[{"fmt":"0","w":0,"h":0}],[1],0,[],[],[]],[[{"fmt":"0","w":0,"h":0}],[1],0,[],[],[]],[[{"fmt":"0","w":0,"h":0}],[1],0,[],[],[]],[[{"fmt":"0","w":0,"h":0}],[1],0,[],[],[]],[[{"fmt":"0","w":0,"h":0}],[1],0,[],[],[]],[[{"fmt":"0","w":0,"h":0}],[1],0,[],[],[]],[[[30,"scene"],[31,"scene",[[-1,-2,-3,-4,-5,-6,-7,-8,-9,[16,"Node","05ykahV11CjIE3wNLKClms",-10,[1,-64.5,0,-6.7]],-11],1,1,1,1,1,1,1,1,1,4,1],[32,[33],[34,[4,4283190348]],[35,true,13],[36]]],[23,"Main Camera","c9DMICJLFO5IeO07EPon7U",1,[-16],[[37,320,14,1822425087,-12,[4,1583966569]],[38,2,5,-15,-14,-13]],[1,0,50.961,150]],[24,"Node-001","01ymy6b55FJblNO2TCAhXF",1,[-17]],[5,"xuting",8388608,"264pWBfE1KTK7qvULLDS9q",1,[[6,"Quad<ModelComponent>",0,-18,[1,"cf0e2Ddb1LaZRmljaFideC"],[1],[3],2],[7,true,true,"https://www.baidu.com",-19,2,3],[8,-20,[1,1,1,0.001]],[9,false,-21]],[1,20.029,15.568,-30.303],[3,0,-1,0,6.123233995736766e-17],[1,16.882,7.246,7.246],[1,0,-180,0]],[5,"c",8388608,"790kXuFYNEgJg6PTeCAp72",1,[[6,"Quad<ModelComponent>",0,-22,[1,"cf0e2Ddb1LaZRmljaFideC"],[3],[3],4],[7,true,true,"https://www.baidu.com",-23,2,3],[8,-24,[1,1,1,0.001]],[9,false,-25]],[1,20.029,15.568,-4.11],[3,0,-1,0,6.123233995736766e-17],[1,16.882,7.246,7.246],[1,0,-180,0]],[5,"d",8388608,"dd6zFtVy1I7YVq4vwg+ipi",1,[[6,"Quad<ModelComponent>",0,-26,[1,"cf0e2Ddb1LaZRmljaFideC"],[5],[3],6],[7,true,true,"https://www.baidu.com",-27,2,3],[8,-28,[1,1,1,0.001]],[9,false,-29]],[1,20.029,15.568,23.983],[3,0,-1,0,6.123233995736766e-17],[1,16.882,7.246,7.246],[1,0,-180,0]],[5,"a",8388608,"b2rL9fe7tILbfJ5q4nsfJv",1,[[6,"Quad<ModelComponent>",0,-30,[1,"cf0e2Ddb1LaZRmljaFideC"],[7],[3],8],[7,true,true,"https://www.baidu.com",-31,2,3],[8,-32,[1,1,1,0.001]],[9,false,-33]],[1,-18.035,15.568,-30.303],[3,0,-1,0,6.123233995736766e-17],[1,16.882,7.246,7.246],[1,0,-180,0]],[5,"b",8388608,"4dDBI2v6JG9JnZoQ7K1kJY",1,[[6,"Quad<ModelComponent>",0,-34,[1,"cf0e2Ddb1LaZRmljaFideC"],[9],[3],10],[7,true,true,"https://www.baidu.com",-35,2,3],[8,-36,[1,1,1,0.001]],[9,false,-37]],[1,-18.035,15.568,-4.11],[3,0,-1,0,6.123233995736766e-17],[1,16.882,7.246,7.246],[1,0,-180,0]],[5,"e",8388608,"34FSONcMNF7KvgKT483YUQ",1,[[6,"Quad<ModelComponent>",0,-38,[1,"cf0e2Ddb1LaZRmljaFideC"],[11],[3],12],[7,true,true,"https://www.baidu.com",-39,2,3],[8,-40,[1,1,1,0.001]],[9,false,-41]],[1,-18.035,15.568,23.983],[3,0,-1,0,6.123233995736766e-17],[1,16.882,7.246,7.246],[1,0,-180,0]],[25,3,[29,"df87CfqV9Z7avOunIbfo8c",-44,[39,"47nMibBSVFwLh6inQrFJdI",null,[[2,"shuang chuangx",["_name"],[0,["df87CfqV9Z7avOunIbfo8c"]]],[14,["_lpos"],[0,["df87CfqV9Z7avOunIbfo8c"]],[1,-64.5,0,-6.7]],[14,["_lrot"],[0,["df87CfqV9Z7avOunIbfo8c"]],[3,0,0,0,1]],[17,["_prefab","root"],[0,["df87CfqV9Z7avOunIbfo8c"]],-42],[2,false,["lightmapSettings","_receiveShadow"],[0,["10yuWktrFfga00ZWOJ8Of1"]]],[2,false,["lightmapSettings","_receiveShadow"],[0,["8e1RyoaLxaMILoNtLYpn2I"]]],[2,false,["lightmapSettings","_receiveShadow"],[0,["3cDt2EMQ5e+pYgzQpUTVoK"]]],[2,false,["lightmapSettings","_castShadow"],[0,["10yuWktrFfga00ZWOJ8Of1"]]],[2,false,["lightmapSettings","_castShadow"],[0,["8e1RyoaLxaMILoNtLYpn2I"]]],[2,false,["lightmapSettings","_castShadow"],[0,["3cDt2EMQ5e+pYgzQpUTVoK"]]],[2,false,["lightmapSettings","_bakeable"],[0,["10yuWktrFfga00ZWOJ8Of1"]]],[2,false,["lightmapSettings","_bakeable"],[0,["8e1RyoaLxaMILoNtLYpn2I"]]],[2,false,["lightmapSettings","_bakeable"],[0,["3cDt2EMQ5e+pYgzQpUTVoK"]]],[17,["_prefab","root"],[0,["df6nDNnJBYwImAyXFPdSCd"]],-43],[14,["_lpos"],[0,["df6nDNnJBYwImAyXFPdSCd"]],[1,65.12,-1.442,6.76]]]],0]],[26,"Main Light",2,[[40,90000,-45,[18]]]],[16,"Node-002","5cKdg6gsNHR4IfNgkrDtgX",1,[1,-47.14,0,42.543]],[27,"light",false,"1cb/tyO5NHWYHTrGoMatfS",1,[-46]],[28,"Spot Light",13,[[41,4,5,130.557,-47,[1,"42FuKkPeBOSLyZuICQqfaf"],[18]]],[1,20.444,3.626,-45.748],[3,1,0,0,6.123233995736766e-17],[1,180,0,0]]],0,[0,-1,2,0,-2,3,0,-3,4,0,-4,5,0,-5,6,0,-6,7,0,-7,8,0,-8,9,0,-9,13,0,7,1,0,-11,12,0,0,2,0,8,12,0,9,3,0,0,2,0,-1,11,0,-1,10,0,0,4,0,0,4,0,0,4,0,0,4,0,0,5,0,0,5,0,0,5,0,0,5,0,0,6,0,0,6,0,0,6,0,0,6,0,0,7,0,0,7,0,0,7,0,0,7,0,0,8,0,0,8,0,0,8,0,0,8,0,0,9,0,0,9,0,0,9,0,0,9,0,5,10,0,5,10,0,4,10,0,0,11,0,-1,14,0,0,14,0,10,1,47],[0,0,0,0,0,0,0,0,0,0,0,0,0,0],[11,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,12],[10,11,1,12,1,13,1,14,1,15,1,16,1,17]],[[[4,"1",[{"rasterizerState":{},"depthStencilState":{"depthWrite":true},"blendState":{"isA2C":true,"targets":[{"blendDst":0,"blendSrcAlpha":2,"blendDstAlpha":0}]}},{},{}],[{"USE_ALBEDO_MAP":true},{},{}],[[[{"alphaThreshold":0,"roughness":0.889,"metallic":0},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[2,3],[18,0]],[[[15,[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}},{},{},{}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true},{},{},{}],[[[{"roughness":0.70710676908493,"metallic":0},"mainTexture",6,0],{},{},{}],11,0,0,0]]],0,0,[0,0],[2,3],[19,0]],[[[4,"1",[{"rasterizerState":{},"depthStencilState":{"depthWrite":true},"blendState":{"isA2C":true,"targets":[{"blendDst":0,"blendSrcAlpha":2,"blendDstAlpha":0}]}},{},{}],[{"USE_ALBEDO_MAP":true},{},{}],[[[{"alphaThreshold":0,"roughness":0.889,"metallic":0},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[2,3],[20,0]],[[[4,"1",[{"rasterizerState":{},"depthStencilState":{"depthWrite":true},"blendState":{"isA2C":true,"targets":[{"blendDst":0,"blendSrcAlpha":2,"blendDstAlpha":0}]}},{},{}],[{"USE_ALBEDO_MAP":true},{},{}],[[[{"alphaThreshold":0,"roughness":0.889,"metallic":0},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[2,3],[21,0]],[[[15,[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}},{},{},{}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true},{},{},{}],[[[{"roughness":0.70710676908493,"metallic":0},"mainTexture",6,0],{},{},{}],11,0,0,0]]],0,0,[0,0],[2,3],[22,0]]]]
|