diff --git a/cocos_view_pod.podspec b/cocos_view_pod.podspec index ee0819e..f9c90fb 100644 --- a/cocos_view_pod.podspec +++ b/cocos_view_pod.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'cocos_view_pod' - s.version = '0.1.13' + s.version = '0.1.14' s.summary = 'A short description of cocos_view_pod.' # This description is used to generate tags and improve search results. @@ -29,6 +29,10 @@ TODO: Add long description of the pod here. # s.social_media_url = 'https://twitter.com/' s.ios.deployment_target = '14' + s.resource_bundles = { + 'cocos_main_bundle' => ['cocos_view_pod/Assets/*'] + } + #s.static_framework = true s.source_files = 'cocos_view_pod/Classes/**/*.{h,m,mm}' s.vendored_libraries = "cocos_view_pod/Libs/**/*.a" diff --git a/cocos_view_pod/Assets/assets/internal/cc.config.json b/cocos_view_pod/Assets/assets/internal/cc.config.json new file mode 100644 index 0000000..74af4a0 --- /dev/null +++ b/cocos_view_pod/Assets/assets/internal/cc.config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"internal","deps":[],"uuids":["08HKsx3M1CjoZS8kBMyBxH","0b2bbb7a0","142hclxMJCtKsI7grraJiz","173rzDCmtLirAL3Fi4hVge","1cAq5vRJJJFbj4dJKjseTN","1dCO9ipQNM4ouaRskIc/fT","509DSLyINOL48RziM7hZ+h","51HSYzCadL3axC93gDISSz","5dRaoA4GRJOLMUQmXwwiWM","609xlc7CpF67qUiVX2DoHQ","71Hr4R9nNM2ZqDY8YLpUxb","784FhKQ0NHJ4834U5lwqLb","81Dpbk5FZEaJtZ9OjzlzLA","87HDtsc3lBnb2jeUsjmrkN","8bvbzdXNRBALbVt8liW2EH","93Yf2QulJPhKqTboeP1XbK","97CwWYvLBHFJH7LoFEDczY","97G9sjP/ZD67QiHDAWWjZj","a3zQCfCrBCDZJ4uf2rk5u8","b51hFfA3BNfKrTwZTMcc+Y","baIUdvKGZPgZxNbjWTFuRI","bc1kzGLdlD9qu+ZjGNMyAy","c0FDkGmu1EfpQ2KuhRLRtu","c2chXYaDVLaL+7verGEAwE","d1NGQ2rJZCcbhjH0/erZWw","d9MFkNu5JMyIvRI80Cf57f","ddOhRNq39B8IK4LkOgkNSW","e9qpo+WytKx6LHBz3isrJP","ef6OKj6s5Ce7Txy4qTfsd9","f0QW5oAgBLd6kmT50W5JTa","f9KAbXF2hEP6/oErzehNDw","fdoJXLgx1GAa2UhGATlj3o"],"paths":{"0":["db:/internal/default_materials/default-trail-material",1],"2":["db:/internal/default_materials/default-particle-gpu-material",1],"3":["db:/internal/effects/particles/builtin-particle-trail",0],"4":["db:/internal/effects/internal/builtin-graphics",0],"5":["db:/internal/effects/legacy/terrain",0],"6":["db:/internal/default_materials/ui-alpha-test-material",1],"7":["db:/internal/effects/pipeline/skybox",0],"8":["db:/internal/effects/pipeline/deferred-lighting",0],"9":["db:/internal/effects/for2d/builtin-sprite",0],"10":["db:/internal/effects/particles/builtin-billboard",0],"11":["db:/internal/default_materials/default-billboard-material",1],"12":["db:/internal/effects/internal/builtin-clear-stencil",0],"13":["db:/internal/effects/util/profiler",0],"14":["db:/internal/default_materials/default-clear-stencil",1],"15":["db:/internal/effects/pipeline/planar-shadow",0],"16":["db:/internal/effects/util/splash-screen",0],"17":["db:/internal/effects/particles/builtin-particle-gpu",0],"18":["db:/internal/effects/builtin-unlit",0],"19":["db:/internal/default_materials/default-spine-material",1],"20":["db:/internal/physics/default-physics-material",2],"21":["db:/internal/default_materials/missing-effect-material",1],"22":["db:/internal/default_materials/default-particle-material",1],"23":["db:/internal/effects/for2d/builtin-spine",0],"24":["db:/internal/effects/particles/builtin-particle",0],"25":["db:/internal/default_materials/missing-material",1],"26":["db:/internal/default_materials/ui-sprite-gray-alpha-sep-material",1],"27":["db:/internal/default_materials/ui-base-material",1],"28":["db:/internal/default_materials/ui-sprite-gray-material",1],"29":["db:/internal/default_materials/ui-graphics-material",1],"30":["db:/internal/default_materials/ui-sprite-alpha-sep-material",1],"31":["db:/internal/default_materials/ui-sprite-material",1]},"scenes":{},"packs":{"0b2bbb7a0":[0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.EffectAsset","cc.Material","cc.PhysicsMaterial"]} \ No newline at end of file diff --git a/cocos_view_pod/Assets/assets/internal/import/0b/0b2bbb7a0.json b/cocos_view_pod/Assets/assets/internal/import/0b/0b2bbb7a0.json new file mode 100644 index 0000000..dd9c8a4 --- /dev/null +++ b/cocos_view_pod/Assets/assets/internal/import/0b/0b2bbb7a0.json @@ -0,0 +1 @@ +[1,["609xlc7CpF67qUiVX2DoHQ","a3zQCfCrBCDZJ4uf2rk5u8","173rzDCmtLirAL3Fi4hVge","97G9sjP/ZD67QiHDAWWjZj","71Hr4R9nNM2ZqDY8YLpUxb","81Dpbk5FZEaJtZ9OjzlzLA","c2chXYaDVLaL+7verGEAwE","d1NGQ2rJZCcbhjH0/erZWw","1cAq5vRJJJFbj4dJKjseTN"],["_effectAsset"],[["cc.EffectAsset",["_name","shaders","techniques","combinations"],-1],["cc.Material",["_name","_props","_states","_defines"],-1],["cc.Material",["_name","_states","_defines","_props"],0,12],["cc.PhysicsMaterial",["_name","_friction","_rollingFriction","_spinningFriction","_restitution"],-2]],[[1,0,1,2,3,5],[0,0,1,2,4],[2,0,1,2,3,4],[0,0,3,1,2,5],[3,0,1,2,3,4,6]],[[[[0,"default-trail-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[2]],[[[0,"default-particle-gpu-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[3]],[[[1,"particles/builtin-particle-trail",[{"hash":2100859085,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_texCoord;\nlayout(location = 2) in vec3 a_texCoord1;\nlayout(location = 3) in vec3 a_texCoord2;\nlayout(location = 4) in vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n layout(location = 2) out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\n precision mediump float;\n layout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n layout(location = 0) in vec2 uv;\n layout(location = 1) in vec4 color;\n #if CC_DRAW_WIRE_FRAME\n layout(location = 2) in vec3 vBarycentric;\n #endif\n layout(set = 1, binding = 2) uniform sampler2D mainTexture;\n layout(set = 1, binding = 1) uniform FragConstants {\n vec4 tintColor;\n };\n vec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n#if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., 1.);\n }\n#endif\n return CCFragOutput(col);\n }\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":3093758986,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_texCoord;\nlayout(location = 2) in vec3 a_texCoord1;\nlayout(location = 3) in vec3 a_texCoord2;\nlayout(location = 4) in vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n layout(location = 2) out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\n precision mediump float;\n layout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n layout(location = 0) in vec2 uv;\n layout(location = 1) in vec4 color;\n #if CC_DRAW_WIRE_FRAME\n layout(location = 2) in vec3 vBarycentric;\n #endif\n layout(set = 1, binding = 2) uniform sampler2D mainTexture;\n layout(set = 1, binding = 1) uniform FragConstants {\n vec4 tintColor;\n };\n vec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n#if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., col.a);\n }\n#endif\n return CCFragOutput(col);\n }\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":915995403,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_texCoord;\nlayout(location = 2) in vec3 a_texCoord1;\nlayout(location = 3) in vec3 a_texCoord2;\nlayout(location = 4) in vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n layout(location = 2) out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 1) uniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":2435723114,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_texCoord;\nlayout(location = 2) in vec3 a_texCoord1;\nlayout(location = 3) in vec3 a_texCoord2;\nlayout(location = 4) in vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n layout(location = 2) out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 1) uniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]}],[{"name":"add","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"internal/builtin-graphics",[{"hash":586721616,"name":"internal/builtin-graphics|vs:vert|fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dist","format":11,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 0) out vec4 v_color;\nlayout(location = 2) in float a_dist;\nlayout(location = 1) out float v_dist;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(location = 0) in vec4 v_color;\nlayout(location = 1) in float v_dist;\nvec4 frag () {\n vec4 o = v_color;\n float aa = fwidth(v_dist);\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":56,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[]}],[{"passes":[{"program":"internal/builtin-graphics|vs:vert|fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"legacy/terrain",[{"hash":2418767668,"name":"legacy/terrain|terrain-vs|terrain-fs","blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"UVScale","type":16,"count":1},{"name":"lightMapUVParam","type":16,"count":1}],"defines":[]},{"name":"PbrParams","stageFlags":16,"binding":1,"members":[{"name":"metallic","type":16,"count":1},{"name":"roughness","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"weightMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]},{"name":"detailMap0","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]},{"name":"detailMap1","type":28,"count":1,"stageFlags":16,"binding":4,"defines":[]},{"name":"detailMap2","type":28,"count":1,"stageFlags":16,"binding":5,"defines":[]},{"name":"detailMap3","type":28,"count":1,"stageFlags":16,"binding":6,"defines":[]},{"name":"normalMap0","type":28,"count":1,"stageFlags":16,"binding":7,"defines":[]},{"name":"normalMap1","type":28,"count":1,"stageFlags":16,"binding":8,"defines":[]},{"name":"normalMap2","type":28,"count":1,"stageFlags":16,"binding":9,"defines":[]},{"name":"normalMap3","type":28,"count":1,"stageFlags":16,"binding":10,"defines":[]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":11,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":12,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":13,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":["CC_FORWARD_ADD"]},{"name":"albedoOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":1,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]},{"name":"emissiveOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":2,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]},{"name":"normalOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":3,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"UVScale","type":16,"count":1},{"name":"lightMapUVParam","type":16,"count":1}],"defines":[]},{"name":"PbrParams","stageFlags":16,"binding":1,"members":[{"name":"metallic","type":16,"count":1},{"name":"roughness","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"weightMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]},{"name":"detailMap0","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]},{"name":"detailMap1","type":28,"count":1,"stageFlags":16,"binding":4,"defines":[]},{"name":"detailMap2","type":28,"count":1,"stageFlags":16,"binding":5,"defines":[]},{"name":"detailMap3","type":28,"count":1,"stageFlags":16,"binding":6,"defines":[]},{"name":"normalMap0","type":28,"count":1,"stageFlags":16,"binding":7,"defines":[]},{"name":"normalMap1","type":28,"count":1,"stageFlags":16,"binding":8,"defines":[]},{"name":"normalMap2","type":28,"count":1,"stageFlags":16,"binding":9,"defines":[]},{"name":"normalMap3","type":28,"count":1,"stageFlags":16,"binding":10,"defines":[]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":11,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":12,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":13,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) out mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nlayout(location = 1) out highp vec4 v_shadowPos;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\n#endif\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\n#if CC_RECEIVE_SHADOW\n layout(location = 2) out vec2 v_shadowBias;\n#endif\nlayout(location = 3) out highp vec3 v_position;\nlayout(location = 4) out mediump vec3 v_normal;\nlayout(location = 5) out mediump vec2 uvw;\nlayout(location = 6) out mediump vec2 uv0;\nlayout(location = 7) out mediump vec2 uv1;\nlayout(location = 8) out mediump vec2 uv2;\nlayout(location = 9) out mediump vec2 uv3;\nlayout(location = 10) out mediump vec3 luv;\nlayout(location = 11) out mediump vec3 diffuse;\nlayout(set = 1, binding = 0) uniform TexCoords {\n vec4 UVScale;\n vec4 lightMapUVParam;\n};\nvoid main () {\n vec3 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n vec4 pos = vec4(worldPos, 1.0);\n pos = cc_matViewProj * pos;\n uvw = a_texCoord;\n uv0 = a_position.xz * UVScale.x;\n uv1 = a_position.xz * UVScale.y;\n uv2 = a_position.xz * UVScale.z;\n uv3 = a_position.xz * UVScale.w;\n #if CC_USE_LIGHTMAP\n luv.xy = cc_lightingMapUVParam.xy + a_texCoord * cc_lightingMapUVParam.z;\n luv.z = cc_lightingMapUVParam.w;\n #endif\n v_position = worldPos;\n v_normal = a_normal;\n CC_TRANSFER_FOG(vec4(worldPos, 1.0));\n #if CC_RECEIVE_SHADOW\n v_shadowBias = vec2(0.0, 0.0);\n #endif\n v_shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n gl_Position = pos;\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\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}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) in mediump vec4 v_sh_linear_const_r;\n layout(location = 13) in mediump vec4 v_sh_linear_const_g;\n layout(location = 14) in mediump vec4 v_sh_linear_const_b;\n #else\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\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 / max(EPSILON, 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 max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\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_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) in mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\nlayout(location = 1) in highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 15) in vec3 v_luv;\n layout(set = 2, binding = 11) uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n#endif\nlayout(location = 3) in highp vec3 v_position;\nlayout(location = 4) in mediump vec3 v_normal;\n#if CC_RECEIVE_SHADOW\n layout(location = 2) in vec2 v_shadowBias;\n#endif\nlayout(location = 5) in mediump vec2 uvw;\nlayout(location = 6) in mediump vec2 uv0;\nlayout(location = 7) in mediump vec2 uv1;\nlayout(location = 8) in mediump vec2 uv2;\nlayout(location = 9) in mediump vec2 uv3;\nlayout(location = 11) in mediump vec3 diffuse;\nlayout(location = 10) in mediump vec3 luv;\nlayout(set = 1, binding = 1) uniform PbrParams {\n vec4 metallic;\n vec4 roughness;\n};\nlayout(set = 1, binding = 2) uniform sampler2D weightMap;\nlayout(set = 1, binding = 3) uniform sampler2D detailMap0;\nlayout(set = 1, binding = 4) uniform sampler2D detailMap1;\nlayout(set = 1, binding = 5) uniform sampler2D detailMap2;\nlayout(set = 1, binding = 6) uniform sampler2D detailMap3;\nlayout(set = 1, binding = 7) uniform sampler2D normalMap0;\nlayout(set = 1, binding = 8) uniform sampler2D normalMap1;\nlayout(set = 1, binding = 9) uniform sampler2D normalMap2;\nlayout(set = 1, binding = 10) uniform sampler2D normalMap3;\nvoid surf (out StandardSurface s) {\n #if LAYERS > 1\n vec4 w = texture(weightMap, uvw);\n #endif\n vec4 baseColor = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseColor = texture(detailMap0, uv0);\n #elif LAYERS == 2\n baseColor += texture(detailMap0, uv0) * w.r;\n baseColor += texture(detailMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseColor += texture(detailMap0, uv0) * w.r;\n baseColor += texture(detailMap1, uv1) * w.g;\n baseColor += texture(detailMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseColor += texture(detailMap0, uv0) * w.r;\n baseColor += texture(detailMap1, uv1) * w.g;\n baseColor += texture(detailMap2, uv2) * w.b;\n baseColor += texture(detailMap3, uv3) * w.a;\n #else\n baseColor = texture(detailMap0, uv0);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n #if USE_NORMALMAP\n vec4 baseNormal = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseNormal = texture(normalMap0, uv0);\n #elif LAYERS == 2\n baseNormal += texture(normalMap0, uv0) * w.r;\n baseNormal += texture(normalMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseNormal += texture(normalMap0, uv0) * w.r;\n baseNormal += texture(normalMap1, uv1) * w.g;\n baseNormal += texture(normalMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseNormal += texture(normalMap0, uv0) * w.r;\n baseNormal += texture(normalMap1, uv1) * w.g;\n baseNormal += texture(normalMap2, uv2) * w.b;\n baseNormal += texture(normalMap3, uv3) * w.a;\n #else\n baseNormal = texture(normalMap0, uv0);\n #endif\n vec3 tangent = vec3(1.0, 0.0, 0.0);\n vec3 binormal = vec3(0.0, 0.0, 1.0);\n binormal = cross(tangent, v_normal);\n tangent = cross(v_normal, binormal);\n vec3 nmmp = baseNormal.xyz - vec3(0.5);\n s.normal =\n nmmp.x * normalize(tangent) +\n nmmp.y * normalize(binormal) +\n nmmp.z * normalize(v_normal);\n #else\n s.normal = v_normal;\n #endif\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBias;\n #endif\n s.albedo = vec4(SRGBToLinear(baseColor.rgb), 1.0);\n s.occlusion = 1.0;\n #if USE_PBR\n s.roughness = 0.0;\n #if LAYERS == 1\n s.roughness = roughness.x;\n #elif LAYERS == 2\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n #elif LAYERS == 3\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n #elif LAYERS == 4\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n s.roughness += roughness.w * w.a;\n #else\n s.roughness = 1.0;\n #endif\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #if LAYERS == 1\n s.specularIntensity = 0.5;\n s.metallic = metallic.x;\n #elif LAYERS == 2\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n #elif LAYERS == 3\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n #elif LAYERS == 4\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n s.metallic += metallic.w * w.a;\n #else\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n #else\n s.roughness = 1.0;\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n s.emissive = vec3(0.0, 0.0, 0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, luv.xy, luv.z, s.normal);\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 #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\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 vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\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 float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\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 / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\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 = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\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 }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, set = 1, binding = 11) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, set = 1, binding = 12) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, set = 1, binding = 13) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (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 / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - 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 uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - 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 = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n }\n layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n StandardSurface s; surf(s);\n albedoOut = s.albedo;\n normalOut = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n emissiveOut = vec4(s.emissive, s.occlusion);\n }\n#endif"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":115,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":122}},"defines":[{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"number","range":[0,3]},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_HDR","type":"boolean"},{"name":"USE_REFLECTION_DENOISE","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_LIGHT_MAP_VERSION","type":"number","range":[0,3]},{"name":"LAYERS","type":"number","range":[0,4]},{"name":"USE_NORMALMAP","type":"boolean"},{"name":"USE_PBR","type":"boolean"},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]}]},{"hash":816809058,"name":"legacy/terrain|shadow-caster-vs:vert|shadow-caster-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 0) out highp vec2 v_clip_depth;\nvec4 vert () {\n vec4 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n worldPos.w = 1.0;\n vec4 clipPos = cc_matLightViewProj * worldPos;\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nlayout(location = 0) in highp vec2 v_clip_depth;\nvec4 frag () {\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":72,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]}]}],[{"name":"opaque","passes":[{"program":"legacy/terrain|terrain-vs|terrain-fs","properties":{"UVScale":{"type":16,"value":[1,1,1,1]},"metallic":{"type":16,"value":[0,0,0,0]},"roughness":{"type":16,"value":[1,1,1,1]},"weightMap":{"value":"black","type":28},"detailMap0":{"value":"grey","type":28},"detailMap1":{"value":"grey","type":28},"detailMap2":{"value":"grey","type":28},"detailMap3":{"value":"grey","type":28},"normalMap0":{"value":"normal","type":28},"normalMap1":{"value":"normal","type":28},"normalMap2":{"value":"normal","type":28},"normalMap3":{"value":"normal","type":28}}},{"phase":"forward-add","propertyIndex":0,"program":"legacy/terrain|terrain-vs|terrain-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":{"UVScale":{"type":16,"value":[1,1,1,1]},"metallic":{"type":16,"value":[0,0,0,0]},"roughness":{"type":16,"value":[1,1,1,1]},"weightMap":{"value":"black","type":28},"detailMap0":{"value":"grey","type":28},"detailMap1":{"value":"grey","type":28},"detailMap2":{"value":"grey","type":28},"detailMap3":{"value":"grey","type":28},"normalMap0":{"value":"normal","type":28},"normalMap1":{"value":"normal","type":28},"normalMap2":{"value":"normal","type":28},"normalMap3":{"value":"normal","type":28}}},{"phase":"shadow-add","propertyIndex":0,"program":"legacy/terrain|shadow-caster-vs:vert|shadow-caster-fs:frag","rasterizerState":{"cullMode":2}},{"phase":"deferred-forward","propertyIndex":0,"program":"legacy/terrain|terrain-vs|terrain-fs"}]}]]],0,0,[],[],[]],[[[0,"ui-alpha-test-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_ALPHA_TEST":true,"USE_TEXTURE":true,"IS_GRAY":false,"CC_USE_EMBEDDED_ALPHA":false}]]],0,0,[0],[0],[0]],[[[1,"pipeline/skybox",[{"hash":2384917432,"name":"pipeline/skybox|sky-vs:vert|sky-fs:frag","blocks":[],"samplerTextures":[{"name":"environmentMap","type":31,"count":1,"stageFlags":16,"binding":0,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[{"name":"environmentMap","type":31,"count":1,"stageFlags":16,"binding":0,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\nlayout(location = 0) out mediump vec4 viewDir;\nvec4 vert () {\n viewDir = vec4(a_position, 1.0);\n mat4 matViewRotOnly = mat4(mat3(cc_matView));\n vec4 pos = matViewRotOnly * viewDir;\n if (cc_matProj[3].w > 0.0) {\n mat4 matProj = cc_matProj;\n matProj[0].x = 5.2;\n matProj[1].y = 2.6;\n matProj[2].zw = vec2(-1.0);\n matProj[3].zw = vec2(0.0);\n pos = matProj * pos;\n } else {\n pos = cc_matProj * pos;\n }\n pos.z = 0.99999 * pos.w;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nlayout(location = 0) in mediump vec4 viewDir;\nlayout(set = 1, binding = 0) uniform samplerCube environmentMap;\nvec4 frag () {\n vec3 rotationDir = RotationVecFromAxisY(viewDir.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_RGBE_CUBEMAP\n vec3 c = unpackRGBE(fragTextureLod(environmentMap, rotationDir.xyz, 0.0));\n #else\n vec3 c = SRGBToLinear(fragTextureLod(environmentMap, rotationDir.xyz, 0.0).rgb);\n #endif\n vec4 color = vec4(c * cc_ambientSky.w, 1.0);\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[{"name":"cc_environment","defines":[]}],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":42,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC","type":"boolean"},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"USE_RGBE_CUBEMAP","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"}]}],[{"passes":[{"program":"pipeline/skybox|sky-vs:vert|sky-fs:frag","priority":245,"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"environmentMap":{"value":"grey","type":31}}},{"propertyIndex":0,"phase":"deferred-forward","program":"pipeline/skybox|sky-vs:vert|sky-fs:frag","priority":245,"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"pipeline/deferred-lighting",[{"hash":1701877551,"name":"pipeline/deferred-lighting|lighting-vs|lighting-fs","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":0,"defines":[]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]},{"name":"depthStencil","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":4,"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":5,"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":6,"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) out vec2 v_uv;\nvoid main () {\n vec4 position;\n position = vec4(a_position, 1.0);\n position.xy = cc_cameraPos.w == 0.0 ? vec2(position.xy.x, -position.xy.y) : position.xy;\n gl_Position = vec4(position.x, position.y, 1.0, 1.0);\n v_uv = a_texCoord;\n}","frag":"\n precision highp float;\n layout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define LIGHT_MAP_TYPE_DISABLED 0\n #define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n #define REFLECTION_PROBE_TYPE_NONE 0\n #define REFLECTION_PROBE_TYPE_CUBE 1\n #define REFLECTION_PROBE_TYPE_PLANAR 2\n #define REFLECTION_PROBE_TYPE_BLEND 3\n #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n #define LIGHT_TYPE_DIRECTIONAL 0.0\n #define LIGHT_TYPE_SPHERE 1.0\n #define LIGHT_TYPE_SPOT 2.0\n #define LIGHT_TYPE_POINT 3.0\n #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n #define TONE_MAPPING_ACES 0\n #define TONE_MAPPING_LINEAR 1\n #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n #endif\n #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n #endif\n vec3 SRGBToLinear (vec3 gamma) {\n #ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n #endif\n return gamma * gamma;\n }\n vec3 LinearToSRGB(vec3 linear) {\n #ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n #endif\n return sqrt(linear);\n }\n layout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n };\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n #endif\n #if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n #else\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n #endif\n vec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n {\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n }\n float GetCameraDepthRH(float depthHS, mat4 matProj)\n {\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n }\n float GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n {\n return -matProj32 / (depthHS + matProj22);\n }\n vec4 GetWorldPosFromNDCPosRH(vec3 posHS, mat4 matProj, mat4 matViewProjInv)\n {\n float w = -GetCameraDepthRH(posHS.z, matProj);\n return matViewProjInv * vec4(posHS * w, w);\n }\n float GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n }\n vec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n {\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n }\n vec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n {\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n }\n float CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n \tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n \treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n }\n float CCGetLinearDepth(vec3 worldPos) {\n \treturn CCGetLinearDepth(worldPos, 0.0);\n }\n #if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #endif\n highp 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 }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, 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 layout(set = 0, binding = 5) uniform samplerCube cc_environment;\n vec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n {\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n }\n vec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n {\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n }\n vec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n {\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n }\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n #endif\n #if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 1) in mediump vec4 v_sh_linear_const_r;\n layout(location = 2) in mediump vec4 v_sh_linear_const_g;\n layout(location = 3) in mediump vec4 v_sh_linear_const_b;\n #else\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n #endif\n #endif\n float 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 / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n }\n float CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n }\n vec3 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 max(vec3(0.0), specular * AB.x + AB.y);\n }\n #if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n #endif\n struct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n };\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\n vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n #if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n #endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\n }\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\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 vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\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 float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\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 / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\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 = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\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 }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, set = 1, binding = 4) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, set = 1, binding = 5) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, set = 1, binding = 6) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (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 / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - 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 uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - 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 = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n#endif\n vec3 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 }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n void CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n \tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n }\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec3 oct_to_float32x3(vec2 e) {\n vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));\n if (v.z < 0.0) v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);\n return normalize(v);\n }\n layout(location = 0) in vec2 v_uv;\n layout(set = 1, binding = 0) uniform sampler2D albedoMap;\n layout(set = 1, binding = 1) uniform sampler2D normalMap;\n layout(set = 1, binding = 2) uniform sampler2D emissiveMap;\n layout(set = 1, binding = 3) uniform sampler2D depthStencil;\n layout(location = 0) out vec4 fragColor;\n vec4 screen2WS(vec3 coord) {\n vec3 ndc = vec3(\n 2.0 * (coord.x - cc_viewPort.x) / cc_viewPort.z - 1.0,\n 2.0 * (coord.y - cc_viewPort.y) / cc_viewPort.w - 1.0,\n coord.z);\n CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(ndc.y);\n return GetWorldPosFromNDCPosRH(ndc, cc_matProj, cc_matViewProjInv);\n }\n void main () {\n StandardSurface s;\n vec4 albedo = texture(albedoMap, v_uv);\n vec4 normal = texture(normalMap, v_uv);\n vec4 emissive = texture(emissiveMap, v_uv);\n float depth = texture(depthStencil, v_uv).x;\n s.albedo = albedo;\n vec3 position = screen2WS(vec3(gl_FragCoord.xy, depth)).xyz;\n s.position = position;\n s.roughness = normal.z;\n s.normal = oct_to_float32x3(normal.xy);\n s.specularIntensity = 0.5;\n s.metallic = normal.w;\n s.emissive = emissive.xyz;\n s.occlusion = emissive.w;\n#if CC_RECEIVE_SHADOW\n s.shadowBias = vec2(0, 0);\n#endif\n float fogFactor;\n CC_TRANSFER_FOG_BASE(vec4(position, 1), fogFactor);\n vec4 shadowPos;\n shadowPos = cc_matLightViewProj * vec4(position, 1);\n vec4 color = CCStandardShadingBase(s, shadowPos) +\n#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n CCClusterShadingAdditive(s, shadowPos);\n#else\n CCStandardShadingAdditive(s, shadowPos);\n#endif\n CC_APPLY_FOG_BASE(color, fogFactor);\n color = CCFragOutput(color);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n color = vec4(albedoMap.rgb, 1.0);\n#endif\n fragColor = color;\n }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":42,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":120}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"number","range":[0,3]},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_HDR","type":"boolean"},{"name":"USE_REFLECTION_DENOISE","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]}]}],[{"passes":[{"pass":"deferred-lighting","program":"pipeline/deferred-lighting|lighting-vs|lighting-fs","rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[3,"for2d/builtin-sprite",[{}],[{"hash":2249878161,"name":"for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag","blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if USE_LOCAL\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if SAMPLE_FROM_RT\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define LIGHT_MAP_TYPE_DISABLED 0\n #define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n #define REFLECTION_PROBE_TYPE_NONE 0\n #define REFLECTION_PROBE_TYPE_CUBE 1\n #define REFLECTION_PROBE_TYPE_PLANAR 2\n #define REFLECTION_PROBE_TYPE_BLEND 3\n #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n #define LIGHT_TYPE_DIRECTIONAL 0.0\n #define LIGHT_TYPE_SPHERE 1.0\n #define LIGHT_TYPE_SPOT 2.0\n #define LIGHT_TYPE_POINT 3.0\n #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n #define TONE_MAPPING_ACES 0\n #define TONE_MAPPING_LINEAR 1\n #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n #endif\n #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n #endif\n#endif\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 0) out vec4 color;\nlayout(location = 1) out vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n layout(set = 1, binding = 0) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nlayout(location = 0) in vec4 color;\n#if USE_TEXTURE\n layout(location = 1) in vec2 uv0;\n layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","defines":["USE_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":56,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[{"name":"USE_LOCAL","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"USE_PIXEL_ALIGNMENT","type":"boolean"},{"name":"CC_USE_EMBEDDED_ALPHA","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"USE_TEXTURE","type":"boolean"},{"name":"IS_GRAY","type":"boolean"}]}],[{"passes":[{"program":"for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[1,"particles/builtin-billboard",[{"hash":2281029704,"name":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(set = 1, binding = 1) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 3) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 2) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[]},{"hash":2715866145,"name":"particles/builtin-billboard|vert:vs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(set = 1, binding = 1) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 3) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 2) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[]},{"hash":3617975406,"name":"particles/builtin-billboard|vert:vs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(set = 1, binding = 1) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 2) uniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[]},{"hash":3619147658,"name":"particles/builtin-billboard|vert:vs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(set = 1, binding = 1) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 2) uniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[]}],[{"name":"add","passes":[{"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"default-billboard-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[4]],[[[3,"internal/builtin-clear-stencil",[{}],[{"hash":3507038093,"name":"internal/builtin-clear-stencil|sprite-vs:vert|sprite-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision highp float;\nlayout(location = 0) in vec3 a_position;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 frag () {\n vec4 o = vec4(1.0);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":0,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[]}],[{"passes":[{"program":"internal/builtin-clear-stencil|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"util/profiler",[{"hash":394204838,"name":"util/profiler|profiler-vs:vert|profiler-fs:frag","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"offset","type":16,"count":1}],"defines":[]},{"name":"PerFrameInfo","stageFlags":1,"binding":1,"members":[{"name":"digits","type":16,"count":22}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"offset","type":16,"count":1}],"defines":[]},{"name":"PerFrameInfo","stageFlags":1,"binding":1,"members":[{"name":"digits","type":16,"count":22}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 0) out vec2 v_uv;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 offset;\n};\nlayout(set = 1, binding = 1) uniform PerFrameInfo {\n vec4 digits[8 * 11 / 4];\n};\nfloat getComponent(vec4 v, float i) {\n if (i < 1.0) { return v.x; }\n else if (i < 2.0) { return v.y; }\n else if (i < 3.0) { return v.z; }\n else { return v.w; }\n}\nvec4 vert () {\n mat2 proj = mat2(cc_matProj[0].xy, cc_matProj[1].xy);\n proj /= abs(proj[1].x + proj[1].y);\n vec2 position = proj * a_position.xy + offset.xy;\n v_uv = a_color.xy;\n if (a_color.z >= 0.0) {\n float n = getComponent(digits[int(a_color.z)], a_color.w);\n v_uv += vec2(offset.z * n, 0.0);\n }\n return vec4(position, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 v_uv;\nlayout(set = 1, binding = 2) uniform sampler2D mainTexture;\nvec4 frag () {\n return CCFragOutput(texture(mainTexture, v_uv));\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":65,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[]}],[{"passes":[{"program":"util/profiler|profiler-vs:vert|profiler-fs:frag","priority":255,"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"default-clear-stencil",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":false}]]],0,0,[0],[0],[5]],[[[1,"pipeline/planar-shadow",[{"hash":3680218420,"name":"pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nlayout(location = 0) out float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":90,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":58}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"passes":[{"phase":"planarShadow","program":"pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}}]}]]],0,0,[],[],[]],[[[1,"util/splash-screen",[{"hash":3189094080,"name":"util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag","blocks":[{"name":"Constant","stageFlags":1,"binding":0,"members":[{"name":"u_buffer0","type":16,"count":1},{"name":"u_buffer1","type":16,"count":1},{"name":"u_projection","type":25,"count":1}],"defines":[]},{"name":"Factor","stageFlags":16,"binding":1,"members":[{"name":"u_percent","type":13,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":21,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constant","stageFlags":1,"binding":0,"members":[{"name":"u_buffer0","type":16,"count":1},{"name":"u_buffer1","type":16,"count":1},{"name":"u_projection","type":25,"count":1}],"defines":[]},{"name":"Factor","stageFlags":16,"binding":1,"members":[{"name":"u_percent","type":13,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nlayout(location = 0) in vec2 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 0) out vec2 v_uv;\nlayout(set = 1, binding = 0) uniform Constant {\n vec4 u_buffer0;\n vec4 u_buffer1;\n mat4 u_projection;\n};\nvec4 vert () {\n vec2 worldPos = a_position * u_buffer1.xy + u_buffer1.zw;\n vec2 clipSpace = worldPos / u_buffer0.xy * 2.0 - 1.0;\n vec4 screenPos = u_projection * vec4(clipSpace, 0.0, 1.0);\n v_uv = a_texCoord;\n return screenPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(location = 0) in vec2 v_uv;\nlayout(set = 1, binding = 1) uniform Factor {\n float u_percent;\n};\nlayout(set = 1, binding = 2) uniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = texture(mainTexture, v_uv);\n float percent = clamp(u_percent, 0.0, 1.0);\n color.xyz *= percent;\n return color;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":6,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[]}],[{"name":"default","passes":[{"program":"util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"resolution":{"type":14,"value":[640,960],"handleInfo":["u_buffer0",0,14]},"percent":{"type":13,"value":[0.5],"handleInfo":["u_percent",0,13]},"scale":{"type":14,"value":[200,500],"handleInfo":["u_buffer1",0,14]},"translate":{"type":14,"value":[320,480],"handleInfo":["u_buffer1",2,14]},"u_buffer0":{"type":16,"value":[640,960,0,0]},"u_percent":{"type":13,"value":[0.5]},"u_buffer1":{"type":16,"value":[200,500,320,480]}}}]}]]],0,0,[],[],[]],[[[1,"particles/builtin-particle-gpu",[{"hash":2859307513,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 15) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 16) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 9) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":2330235135,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 15) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 16) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 9) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":1067163463,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 9) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 15) uniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":3967087977,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 9) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 15) uniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]}],[{"name":"add","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"builtin-unlit",[{"hash":340555192,"name":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1}],"defines":["USE_TEXTURE"]},{"name":"Constant","stageFlags":16,"binding":1,"members":[{"name":"mainColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]},{"name":"a_color","format":44,"location":17,"defines":["USE_VERTEX_COLOR"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1}],"defines":["USE_TEXTURE"]},{"name":"Constant","stageFlags":16,"binding":1,"members":[{"name":"mainColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\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 #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) out mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n layout(location = 17) in lowp vec4 a_color;\n layout(location = 1) out lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n layout(location = 2) out vec2 v_uv;\n layout(set = 1, binding = 0) uniform TexCoords {\n vec4 tilingOffset;\n };\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\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 #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\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}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) in mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n layout(location = 2) in vec2 v_uv;\n layout(set = 1, binding = 2) uniform sampler2D mainTexture;\n#endif\nlayout(set = 1, binding = 1) uniform Constant {\n vec4 mainColor;\n vec4 colorScaleAndCutoff;\n};\n#if USE_VERTEX_COLOR\n layout(location = 1) in lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":75,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":44}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"USE_TEXTURE","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC","type":"boolean"},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r","g","b"]}]},{"hash":3680218420,"name":"builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nlayout(location = 0) out float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":90,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":58}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"name":"opaque","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"planar-shadow","propertyIndex":0,"program":"builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag"}]},{"name":"transparent","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"planar-shadow","propertyIndex":0,"program":"builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":2,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":2,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"default-spine-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":false,"IS_GRAY":false}]]],0,0,[0],[0],[6]],[[[4,"default-physics-material",0.8,0.1,0.1,0.1]],0,0,[],[],[]],[[[2,"missing-effect-material",[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_COLOR":true}],[[[{},"mainColor",8,[4,4278255615]]],11]]],0,0,[0],[0],[1]],[[[0,"default-particle-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[7]],[[[1,"for2d/builtin-spine",[{"hash":3152403458,"name":"for2d/builtin-spine|sprite-vs:vert|sprite-fs:frag","blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_color2","format":44,"location":3,"defines":["TWO_COLORED"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if USE_LOCAL\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 0) out vec4 v_light;\nlayout(location = 1) out vec2 uv0;\n#if TWO_COLORED\n layout(location = 3) in vec4 a_color2;\n layout(location = 2) out vec4 v_dark;\n#endif\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n pos = cc_matViewProj * pos;\n uv0 = a_texCoord;\n v_light = a_color;\n #if TWO_COLORED\n v_dark = a_color2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n layout(set = 1, binding = 0) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nlayout(location = 0) in vec4 v_light;\n#if TWO_COLORED\n layout(location = 2) in vec4 v_dark;\n#endif\nlayout(location = 1) in vec2 uv0;\nlayout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if TWO_COLORED\n vec4 texColor = vec4(1, 1, 1, 1);\n texColor *= texture(cc_spriteTexture, uv0);\n o.a = texColor.a * v_light.a;\n o.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n o *= texture(cc_spriteTexture, uv0);\n o *= v_light;\n #endif\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","defines":[]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":56,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[{"name":"USE_LOCAL","type":"boolean"},{"name":"TWO_COLORED","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"}]}],[{"passes":[{"program":"for2d/builtin-spine|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[1,"particles/builtin-particle",[{"hash":3958058022,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 2) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 1) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]},{"hash":3441772896,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 2) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 1) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]},{"hash":868591613,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 1) uniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]},{"hash":2411109044,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 1) uniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]}],[{"name":"add","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[2,"missing-material",[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_COLOR":true}],[[[{},"mainColor",8,[4,4294902015]]],11]]],0,0,[0],[0],[1]],[[[0,"ui-sprite-gray-alpha-sep-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":true,"IS_GRAY":true}]]],0,0,[0],[0],[0]],[[[0,"ui-base-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":false}]]],0,0,[0],[0],[0]],[[[0,"ui-sprite-gray-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":false,"IS_GRAY":true}]]],0,0,[0],[0],[0]],[[[0,"ui-graphics-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[8]],[[[0,"ui-sprite-alpha-sep-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":true,"IS_GRAY":false}]]],0,0,[0],[0],[0]],[[[0,"ui-sprite-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"IS_GRAY":false,"CC_USE_EMBEDDED_ALPHA":false}]]],0,0,[0],[0],[0]]]] diff --git a/cocos_view_pod/Assets/assets/internal/index.js b/cocos_view_pod/Assets/assets/internal/index.js new file mode 100644 index 0000000..757337a --- /dev/null +++ b/cocos_view_pod/Assets/assets/internal/index.js @@ -0,0 +1,20 @@ +System.register("chunks:///_virtual/internal",[],(function(){return{execute:function(){}}})); + +(function(r) { + r('virtual:///prerequisite-imports/internal', 'chunks:///_virtual/internal'); +})(function(mid, cid) { + System.register(mid, [cid], function (_export, _context) { + return { + setters: [function(_m) { + var _exportObj = {}; + + for (var _key in _m) { + if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key]; + } + + _export(_exportObj); + }], + execute: function () { } + }; + }); +}); \ No newline at end of file diff --git a/cocos_view_pod/Assets/assets/main/cc.config.json b/cocos_view_pod/Assets/assets/main/cc.config.json new file mode 100644 index 0000000..8fed333 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/cc.config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"main","deps":["internal"],"uuids":["010d3a23c","04b964e93","070e260c2","07GNmWOb9KtLtjSWZm/vRn","7cPn+rex5IZbqEPPgbSLn7","baIUdvKGZPgZxNbjWTFuRI","07GNmWOb9KtLtjSWZm/vRn@6c48a","0a40fbfd0","0a9f2beb8","0asxQqaWhAc5WvAmvDsjYj@0e750","0asxQqaWhAc5WvAmvDsjYj@1332c","0asxQqaWhAc5WvAmvDsjYj@2b0a8","0asxQqaWhAc5WvAmvDsjYj@2df3a","0asxQqaWhAc5WvAmvDsjYj@426f2","0asxQqaWhAc5WvAmvDsjYj@4a7d8","0asxQqaWhAc5WvAmvDsjYj@4d16f","0asxQqaWhAc5WvAmvDsjYj@71919","0asxQqaWhAc5WvAmvDsjYj@754a2","0asxQqaWhAc5WvAmvDsjYj@ef86b","0asxQqaWhAc5WvAmvDsjYj@efe84","0d0d3c8df","1brw/JvvpFnIvdrxpFCgMZ","4fTEo0LQhKTZFpg0186Czu","5a8gG1WVFOLKgfrEqtkTLL@b47c0","5a8gG1WVFOLKgfrEqtkTLL@b47c0@40c10","5a8gG1WVFOLKgfrEqtkTLL@b47c0@74afd","5a8gG1WVFOLKgfrEqtkTLL@b47c0@7d38f","5a8gG1WVFOLKgfrEqtkTLL@b47c0@8fd34","5a8gG1WVFOLKgfrEqtkTLL@b47c0@bb97f","5a8gG1WVFOLKgfrEqtkTLL@b47c0@e9a6d","5eTUjEDjRFr6JoiUhRl+i8","6fiRp7WghI5phB3bNkrIax","6fiRp7WghI5phB3bNkrIax@6c48a","700zdYHB5CTbCr6sdBBVm/","7b+d9AS8lOJYywmlAPlJEC","8aWN3s9DdAuY7AH8h96X+1","8eBHF49hxDIqL20a2yi2ri","955bAq4zhCPL27F0htsdnr","955bAq4zhCPL27F0htsdnr@6c48a","a1Vfk7d2lMpLdfsT5SGThZ","a3zQCfCrBCDZJ4uf2rk5u8","a7YStUNeNCOKGpSntUY1g5","aa3gnuj51BPKnojGhupeFg@438fe","aa3gnuj51BPKnojGhupeFg@73b7f","aa3gnuj51BPKnojGhupeFg@ef5e1","aeGN7qxuBKPb9w7lUz+bqH","aeGN7qxuBKPb9w7lUz+bqH@6c48a","b6mOVasAtJh6i0r4PN3Fn3","c5CD51rS5OqYsz3udImVsA","c5CD51rS5OqYsz3udImVsA@6c48a","ccw6dVfT1DBKo7ykeS152f","cfxTxOeVZIK668P7Hc027v","e3VTytLxVCk4Waj0PHgPKJ@18751","e3VTytLxVCk4Waj0PHgPKJ@30732","e3VTytLxVCk4Waj0PHgPKJ@39f7b","e3VTytLxVCk4Waj0PHgPKJ@4b929","e3VTytLxVCk4Waj0PHgPKJ@73b7f","e3VTytLxVCk4Waj0PHgPKJ@75ee4","e3VTytLxVCk4Waj0PHgPKJ@a72ab","e3VTytLxVCk4Waj0PHgPKJ@da6f3","e3VTytLxVCk4Waj0PHgPKJ@f1394","fdjsU2o1RKF5x0TziDw3jI"],"paths":{"4":["db:/assets/scene/main",0],"5":["db:/internal/physics/default-physics-material",2],"61":["db:/internal/default_renderpipeline/builtin-forward",1]},"scenes":{"db://assets/scene/main.scene":4},"packs":{"010d3a23c":[34,41],"04b964e93":[9,10,11,13,14,15,16,17,18,19,4,35,36,39,50,51,52,53,54,55,57,58,59,60],"070e260c2":[30,42,44,47],"0a40fbfd0":[12,32,38,6,46,49],"0a9f2beb8":[21,33],"0d0d3c8df":[23,24,25,26,27,28,29]},"versions":{"import":[],"native":[]},"redirect":[40,"0",5,"0"],"debug":false,"extensionMap":{".ccon":[43,56]},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.SceneAsset","cc.RenderPipeline","cc.PhysicsMaterial"]} \ No newline at end of file diff --git a/cocos_view_pod/Assets/assets/main/import/01/010d3a23c.json b/cocos_view_pod/Assets/assets/main/import/01/010d3a23c.json new file mode 100644 index 0000000..72d5df6 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/01/010d3a23c.json @@ -0,0 +1 @@ +[1,["c5CD51rS5OqYsz3udImVsA@6c48a","a7YStUNeNCOKGpSntUY1g5"],["mainTexture","_effectAsset"],[["cc.Material",["_name","_states","_defines","_props"],0,12],["cc.EffectAsset",["_name","shaders","techniques"],0]],[[0,0,1,2,3,4],[1,0,1,2,4]],[[[[0,"tree",[{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}}],[{"USE_OUTLINE_PASS":true},{"USE_BASE_COLOR_MAP":true,"BASE_COLOR_MAP_AS_SHADE_MAP_1":true,"BASE_COLOR_MAP_AS_SHADE_MAP_2":true},{"USE_BASE_COLOR_MAP":true,"BASE_COLOR_MAP_AS_SHADE_MAP_1":true,"BASE_COLOR_MAP_AS_SHADE_MAP_2":true},{"USE_BASE_COLOR_MAP":true}],[[{},[{},"specular",8,[4,16777215],"mainTexture",6,0],{},{}],0,11,0,0]]],0,0,[0,0],[0,1],[0,1]],[[[1,"legacy/toon",[{"hash":2832630087,"name":"legacy/toon|legacy/main-functions/outline-vs:vert|legacy/main-functions/outline-fs:frag","blocks":[{"name":"OutlineVert","stageFlags":1,"binding":0,"members":[{"name":"outlineParams","type":16,"count":1}],"defines":[]},{"name":"OutlineFrag","stageFlags":16,"binding":1,"members":[{"name":"baseColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"baseColorMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_BASE_COLOR_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"OutlineVert","stageFlags":1,"binding":0,"members":[{"name":"outlineParams","type":16,"count":1}],"defines":[]},{"name":"OutlineFrag","stageFlags":16,"binding":1,"members":[{"name":"baseColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"baseColorMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_BASE_COLOR_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout StandardVertInput In)\n{\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.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\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 #else\n matWorld = cc_matWorld;\n #endif\n}\nlayout(location = 0) out vec2 v_uv;\nlayout(set = 1, binding = 0) uniform OutlineVert {\n vec4 outlineParams;\n};\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n float width = outlineParams.x * 0.001;\n #if USE_POSITION_SCALING\n vec3 dir = normalize(In.position.xyz);\n float flip = dot(dir, normalize(In.normal)) < 0.0 ? -1.0 : 1.0;\n In.position.xyz += flip * dir * width * 2.0;\n vec4 pos = cc_matProj * (cc_matView * matWorld) * In.position;\n #else\n In.position.xyz += normalize(In.normal) * width;\n vec4 pos = cc_matProj * (cc_matView * matWorld) * In.position;\n #endif\n float scaleZ = cc_nearFar.z == 0.0 ? 0.5 : 1.0;\n pos.z -= outlineParams.y * 0.002 * scaleZ;\n v_uv = a_texCoord;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 v_uv;\nlayout(set = 1, binding = 1) uniform OutlineFrag {\n vec4 baseColor;\n};\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 2) uniform sampler2D baseColorMap;\n#endif\nvec4 frag () {\n vec4 color = baseColor * cc_mainLitColor;\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture(baseColorMap, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #endif\n return CCFragOutput(vec4(color.rgb, 1.0));\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":75,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"USE_POSITION_SCALING","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC","type":"boolean"},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"USE_BASE_COLOR_MAP","type":"boolean"}]},{"hash":3633044401,"name":"legacy/toon|toon-vs:vert|toon-fs:frag","blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"baseColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1},{"name":"shadeColor1","type":16,"count":1},{"name":"shadeColor2","type":16,"count":1},{"name":"specular","type":16,"count":1},{"name":"shadeParams","type":16,"count":1},{"name":"miscParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleAndStrenth","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"baseColorMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_BASE_COLOR_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"shadeMap1","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_1ST_SHADE_MAP"]},{"name":"shadeMap2","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_2ND_SHADE_MAP"]},{"name":"specularMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_SPECULAR_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["USE_EMISSIVE_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"baseColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1},{"name":"shadeColor1","type":16,"count":1},{"name":"shadeColor2","type":16,"count":1},{"name":"specular","type":16,"count":1},{"name":"shadeParams","type":16,"count":1},{"name":"miscParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleAndStrenth","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"baseColorMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_BASE_COLOR_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"shadeMap1","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_1ST_SHADE_MAP"]},{"name":"shadeMap2","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_2ND_SHADE_MAP"]},{"name":"specularMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_SPECULAR_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["USE_EMISSIVE_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout StandardVertInput In)\n{\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.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\nlayout(location = 0) out highp vec4 v_shadowPos;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\nvec2 CCGetShadowBias()\n{\n #if USE_INSTANCING\n return vec2(a_localShadowBiasAndProbeId.x + cc_shadowWHPBInfo.w, a_localShadowBiasAndProbeId.y + cc_shadowLPNNInfo.z);\n #else\n return vec2(cc_localShadowBias.x + cc_shadowWHPBInfo.w, cc_localShadowBias.y + cc_shadowLPNNInfo.z);\n #endif\n}\n#endif\nlayout(location = 1) out vec3 v_position;\nlayout(location = 2) out vec2 v_uv;\nlayout(location = 3) out mediump vec3 v_normal;\n#if CC_RECEIVE_SHADOW\n layout(location = 4) out mediump vec2 v_shadowBias;\n#endif\n#if USE_NORMAL_MAP\n layout(location = 5) out mediump vec4 v_tangent;\n#endif\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if CC_RECEIVE_SHADOW\n v_shadowBias = CCGetShadowBias();\n #endif\n v_normal = (matWorldIT * vec4(In.normal, 0.0)).xyz;\n #if USE_NORMAL_MAP\n v_tangent.xyz = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_tangent.w = In.tangent.w;\n #endif\n v_shadowPos = cc_matLightViewProj * pos;\n return cc_matProj * (cc_matView * matWorld) * In.position;\n}\nvoid main() { gl_Position = vert(); }","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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nstruct ToonSurface {\n vec4 baseColor;\n vec4 specular;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 shade1;\n vec3 shade2;\n vec3 emissive;\n float baseStep;\n float baseFeather;\n float shadeStep;\n float shadeFeather;\n float shadowCover;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\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 #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\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 vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\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 float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n vec4 CCToonShading (ToonSurface s) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 N = normalize(s.normal);\n float specularWeight = 1.0 - pow(s.specular.a, 5.0);\n vec3 finalColor = vec3(0.0);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n vec3 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = 0.5 * dot(N, SL) + 0.5;\n float SNH = 0.5 * dot(N, SH) + 0.5;\n vec3 diffuse = mix(s.shade1, s.shade2,\n clamp(1.0 + (s.shadeStep - s.shadeFeather - SNL) / s.shadeFeather, 0.0, 1.0));\n diffuse = mix(s.baseColor.rgb, diffuse,\n clamp(1.0 + (s.baseStep - s.baseFeather - SNL) / s.baseFeather, 0.0, 1.0));\n float specularMask = step(specularWeight, SNH);\n vec3 specular = s.specular.rgb * specularMask;\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr , distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\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 }\n finalColor += SNL * cc_lightColor[i].rgb * cc_lightColor[i].a * illum * att * s.baseStep * (diffuse + specular);\n }\n return vec4(finalColor, 0.0);\n }\n#else\n #if CC_RECEIVE_SHADOW\n layout(location = 0) in highp vec4 v_shadowPos;\n layout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n };\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n #endif\n #if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n #else\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n #endif\n #if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n #endif\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n #endif\n #endif\n vec4 CCToonShading (ToonSurface s) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 N = normalize(s.normal);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = 0.5 * dot(N, L) + 0.5;\n float NH = 0.5 * dot(normalize(V + L), N) + 0.5;\n vec3 lightColor = cc_mainLitColor.rgb * cc_mainLitColor.w * s.baseStep;\n vec3 diffuse = mix(s.shade1, s.shade2,\n clamp(1.0 + (s.shadeStep - s.shadeFeather - NL) / s.shadeFeather, 0.0, 1.0));\n diffuse = mix(s.baseColor.rgb, diffuse,\n clamp(1.0 + (s.baseStep - s.baseFeather - NL) / s.baseFeather, 0.0, 1.0));\n float specularWeight = 1.0 - pow(s.specular.a, 5.0);\n float specularMask = step(specularWeight + EPSILON_LOWP, NH);\n vec3 specular = s.specular.rgb * specularMask;\n vec3 dirlightContrib = diffuse + specular;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if(s.shadowCover < NL && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(v_shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n dirlightContrib *= shadow;\n vec3 finalColor = lightColor * dirlightContrib;\n finalColor += s.emissive;\n return vec4(finalColor, s.baseColor.a);\n }\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\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}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(location = 1) in vec3 v_position;\nlayout(location = 2) in vec2 v_uv;\n#if CC_RECEIVE_SHADOW\n layout(location = 4) in mediump vec2 v_shadowBias;\n#endif\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 1) uniform sampler2D baseColorMap;\n#endif\nlayout(location = 3) in mediump vec3 v_normal;\n#if USE_NORMAL_MAP\n layout(location = 5) in mediump vec4 v_tangent;\n layout(set = 1, binding = 2) uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n layout(set = 1, binding = 3) uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n layout(set = 1, binding = 4) uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n layout(set = 1, binding = 5) uniform sampler2D specularMap;\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 ToonSurface s) {\n s.shade2 = shadeColor2.rgb * colorScaleAndCutoff.rgb;\n #if USE_2ND_SHADE_MAP\n s.shade2 *= SRGBToLinear(texture(shadeMap2, v_uv).rgb);\n #endif\n s.shade1 = shadeColor1.rgb * colorScaleAndCutoff.rgb;\n #if USE_1ST_SHADE_MAP\n s.shade1 *= SRGBToLinear(texture(shadeMap1, v_uv).rgb);\n #if SHADE_MAP_1_AS_SHADE_MAP_2\n s.shade2 *= s.shade1.rgb;\n #endif\n #endif\n vec4 localBaseColor = baseColor;\n #if USE_BASE_COLOR_MAP\n vec4 baseColorMap = texture(baseColorMap, v_uv);\n baseColorMap.rgb = SRGBToLinear(baseColorMap.rgb);\n localBaseColor *= baseColorMap;\n #if BASE_COLOR_MAP_AS_SHADE_MAP_1\n s.shade1 *= baseColorMap.rgb;\n #endif\n #if BASE_COLOR_MAP_AS_SHADE_MAP_2\n s.shade2 *= baseColorMap.rgb;\n #endif\n #endif\n s.baseColor = localBaseColor;\n s.baseColor.rgb *= colorScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.baseColor.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n s.normal = v_normal;\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBias;\n #endif\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, v_uv).xyz - vec3(0.5);\n vec3 bitangent = cross(v_normal, v_tangent.xyz) * (v_tangent.w > 0.0 ? 1.0 : -1.0);\n s.normal =\n (nmmp.x * emissiveScaleAndStrenth.w) * normalize(v_tangent.xyz) +\n (nmmp.y * emissiveScaleAndStrenth.w) * normalize(bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n s.specular = specular;\n #if USE_SPECULAR_MAP\n s.specular.rgb *= SRGBToLinear(texture(specularMap, v_uv).rgb);\n #endif\n s.emissive = emissive.rgb * emissiveScaleAndStrenth.xyz;\n #if USE_EMISSIVE_MAP\n s.emissive *= SRGBToLinear(texture(emissiveMap, v_uv).rgb);\n #endif\n s.baseStep = shadeParams.x;\n s.baseFeather = shadeParams.y;\n s.shadeStep = shadeParams.z;\n s.shadeFeather = shadeParams.w;\n s.shadowCover = miscParams.x;\n}\nvec4 frag () {\n ToonSurface s; surf(s);\n vec4 color = CCToonShading(s);\n return CCFragOutput(color);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":141,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":109}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"USE_NORMAL_MAP","type":"boolean"},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"USE_BASE_COLOR_MAP","type":"boolean"},{"name":"USE_1ST_SHADE_MAP","type":"boolean"},{"name":"USE_2ND_SHADE_MAP","type":"boolean"},{"name":"USE_SPECULAR_MAP","type":"boolean"},{"name":"USE_EMISSIVE_MAP","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r","g","b"]},{"name":"SHADE_MAP_1_AS_SHADE_MAP_2","type":"boolean"},{"name":"BASE_COLOR_MAP_AS_SHADE_MAP_1","type":"boolean"},{"name":"BASE_COLOR_MAP_AS_SHADE_MAP_2","type":"boolean"}]},{"hash":1269196002,"name":"legacy/toon|shadow-caster-vs:vert|shadow-caster-fs:frag","blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"baseColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1},{"name":"shadeColor1","type":16,"count":1},{"name":"shadeColor2","type":16,"count":1},{"name":"specular","type":16,"count":1},{"name":"shadeParams","type":16,"count":1},{"name":"miscParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleAndStrenth","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"baseColorMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_BASE_COLOR_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"baseColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1},{"name":"shadeColor1","type":16,"count":1},{"name":"shadeColor2","type":16,"count":1},{"name":"specular","type":16,"count":1},{"name":"shadeParams","type":16,"count":1},{"name":"miscParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleAndStrenth","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"baseColorMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_BASE_COLOR_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]},{"name":"CCGlobal","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":["CC_RECEIVE_SHADOW"]},{"name":"CCCamera","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":["CC_RECEIVE_SHADOW"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout StandardVertInput In)\n{\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.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(location = 0) out vec2 v_uv;\nlayout(location = 1) out vec4 v_worldPos;\nlayout(location = 2) out highp vec2 v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_clip_depth = clipPos.zw;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\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 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 1) in vec4 v_worldPos;\nlayout(location = 2) in highp vec2 v_clip_depth;\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 1) uniform sampler2D baseColorMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = baseColor;\n #if USE_ALPHA_TEST\n #if USE_BASE_COLOR_MAP\n baseColor *= texture(baseColorMap, v_uv);\n #endif\n if (baseColor.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(v_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]},{"name":"CCGlobal","defines":["CC_RECEIVE_SHADOW"]},{"name":"CCCamera","defines":["CC_RECEIVE_SHADOW"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":58,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":109}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"USE_BASE_COLOR_MAP","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r","g","b"]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]}]},{"hash":3680218420,"name":"legacy/toon|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nlayout(location = 0) out float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":90,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":58}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"passes":[{"program":"legacy/toon|legacy/main-functions/outline-vs:vert|legacy/main-functions/outline-fs:frag","switch":"USE_OUTLINE_PASS","rasterizerState":{"cullMode":1},"depthStencilState":{"depthFunc":3,"depthTest":true,"depthWrite":true},"properties":{"lineWidth":{"type":13,"value":[10],"handleInfo":["outlineParams",0,13]},"depthBias":{"type":13,"value":[0],"handleInfo":["outlineParams",1,13]},"baseColor":{"type":16},"baseColorMap":{"value":"grey","type":28},"outlineParams":{"type":16,"value":[10,0,0,0]}}},{"program":"legacy/toon|toon-vs:vert|toon-fs:frag","properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[0.6,0.6,0.6,1],"handleInfo":["baseColor",0,16]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"shadeColor1":{"linear":true,"type":16,"value":[0.4,0.4,0.4,1]},"shadeColor2":{"linear":true,"type":16,"value":[0.2,0.2,0.2,1]},"specular":{"linear":true,"type":16,"value":[1,1,1,0.3]},"baseStep":{"type":13,"value":[0.8],"handleInfo":["shadeParams",0,13]},"baseFeather":{"type":13,"value":[0.001],"handleInfo":["shadeParams",1,13]},"shadeStep":{"type":13,"value":[0.5],"handleInfo":["shadeParams",2,13]},"shadeFeather":{"type":13,"value":[0.001],"handleInfo":["shadeParams",3,13]},"shadowCover":{"type":13,"value":[0.5],"handleInfo":["miscParams",0,13]},"emissive":{"linear":true,"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleAndStrenth",0,15]},"normalStrength":{"slide":true,"step":0.001,"type":13,"value":[1],"range":[0,5],"handleInfo":["emissiveScaleAndStrenth",3,13]},"normalMap":{"value":"normal","type":28},"mainTexture":{"value":"white","type":28,"handleInfo":["baseColorMap",0,28]},"shadeMap1":{"value":"white","type":28},"shadeMap2":{"value":"white","type":28},"specularMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"baseColor":{"type":16,"value":[0.6,0.6,0.6,1]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"shadeParams":{"type":16,"value":[0.8,0.001,0.5,0.001]},"miscParams":{"type":16,"value":[0.5,0,0,0]},"emissiveScaleAndStrenth":{"type":16,"value":[1,1,1,1]},"baseColorMap":{"type":28,"value":"white"}}},{"phase":"forward-add","propertyIndex":1,"program":"legacy/toon|toon-vs:vert|toon-fs:frag","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":{"linear":true,"type":16,"value":[0.6,0.6,0.6,1],"handleInfo":["baseColor",0,16]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"shadeColor1":{"linear":true,"type":16,"value":[0.4,0.4,0.4,1]},"shadeColor2":{"linear":true,"type":16,"value":[0.2,0.2,0.2,1]},"specular":{"linear":true,"type":16,"value":[1,1,1,0.3]},"baseStep":{"type":13,"value":[0.8],"handleInfo":["shadeParams",0,13]},"baseFeather":{"type":13,"value":[0.001],"handleInfo":["shadeParams",1,13]},"shadeStep":{"type":13,"value":[0.5],"handleInfo":["shadeParams",2,13]},"shadeFeather":{"type":13,"value":[0.001],"handleInfo":["shadeParams",3,13]},"shadowCover":{"type":13,"value":[0.5],"handleInfo":["miscParams",0,13]},"emissive":{"linear":true,"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleAndStrenth",0,15]},"normalStrength":{"slide":true,"step":0.001,"type":13,"value":[1],"range":[0,5],"handleInfo":["emissiveScaleAndStrenth",3,13]},"normalMap":{"value":"normal","type":28},"mainTexture":{"value":"white","type":28,"handleInfo":["baseColorMap",0,28]},"shadeMap1":{"value":"white","type":28},"shadeMap2":{"value":"white","type":28},"specularMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"baseColor":{"type":16,"value":[0.6,0.6,0.6,1]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"shadeParams":{"type":16,"value":[0.8,0.001,0.5,0.001]},"miscParams":{"type":16,"value":[0.5,0,0,0]},"emissiveScaleAndStrenth":{"type":16,"value":[1,1,1,1]},"baseColorMap":{"type":28,"value":"white"}}},{"phase":"shadow-caster","propertyIndex":1,"program":"legacy/toon|shadow-caster-vs:vert|shadow-caster-fs:frag","rasterizerState":{"cullMode":1},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[0.6,0.6,0.6,1],"handleInfo":["baseColor",0,16]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"shadeColor1":{"type":16,"value":[0.4,0.4,0.4,1]},"shadeColor2":{"type":16,"value":[0.2,0.2,0.2,1]},"specular":{"type":16,"value":[1,1,1,0.3]},"baseStep":{"type":13,"value":[0.8],"handleInfo":["shadeParams",0,13]},"baseFeather":{"type":13,"value":[0.001],"handleInfo":["shadeParams",1,13]},"shadeStep":{"type":13,"value":[0.5],"handleInfo":["shadeParams",2,13]},"shadeFeather":{"type":13,"value":[0.001],"handleInfo":["shadeParams",3,13]},"emissive":{"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleAndStrenth",0,15]},"normalStrenth":{"type":13,"value":[1],"handleInfo":["emissiveScaleAndStrenth",3,13]},"mainTexture":{"value":"white","type":28,"handleInfo":["baseColorMap",0,28]},"baseColor":{"type":16,"value":[0.6,0.6,0.6,1]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"shadeParams":{"type":16,"value":[0.8,0.001,0.5,0.001]},"emissiveScaleAndStrenth":{"type":16,"value":[1,1,1,1]},"baseColorMap":{"type":28,"value":"white"}}},{"phase":"planar-shadow","propertyIndex":0,"program":"legacy/toon|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"legacy/toon|legacy/main-functions/outline-vs:vert|legacy/main-functions/outline-fs:frag","switch":"USE_OUTLINE_PASS","rasterizerState":{"cullMode":1},"depthStencilState":{"depthFunc":3,"depthTest":true,"depthWrite":true}},{"phase":"deferred-forward","propertyIndex":1,"program":"legacy/toon|toon-vs:vert|toon-fs:frag"}]}]]],0,0,[],[],[]]]] diff --git a/cocos_view_pod/Assets/assets/main/import/04/04b964e93.json b/cocos_view_pod/Assets/assets/main/import/04/04b964e93.json new file mode 100644 index 0000000..c7c3c85 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/04/04b964e93.json @@ -0,0 +1 @@ +[1,["7b+d9AS8lOJYywmlAPlJEC","8aWN3s9DdAuY7AH8h96X+1","5a8gG1WVFOLKgfrEqtkTLL@b47c0","a7YStUNeNCOKGpSntUY1g5","e3VTytLxVCk4Waj0PHgPKJ@73b7f","ccw6dVfT1DBKo7ykeS152f","cfxTxOeVZIK668P7Hc027v","5eTUjEDjRFr6JoiUhRl+i8","6fiRp7WghI5phB3bNkrIax@6c48a","955bAq4zhCPL27F0htsdnr@6c48a","1brw/JvvpFnIvdrxpFCgMZ","07GNmWOb9KtLtjSWZm/vRn@6c48a","700zdYHB5CTbCr6sdBBVm/","0asxQqaWhAc5WvAmvDsjYj@2b0a8","a1Vfk7d2lMpLdfsT5SGThZ","0asxQqaWhAc5WvAmvDsjYj@4a7d8","0asxQqaWhAc5WvAmvDsjYj@0e750","0asxQqaWhAc5WvAmvDsjYj@ef86b","0asxQqaWhAc5WvAmvDsjYj@426f2","0asxQqaWhAc5WvAmvDsjYj@754a2","0asxQqaWhAc5WvAmvDsjYj@71919","0asxQqaWhAc5WvAmvDsjYj@1332c","0asxQqaWhAc5WvAmvDsjYj@4d16f","0asxQqaWhAc5WvAmvDsjYj@efe84","e3VTytLxVCk4Waj0PHgPKJ@18751","e3VTytLxVCk4Waj0PHgPKJ@30732","e3VTytLxVCk4Waj0PHgPKJ@da6f3","e3VTytLxVCk4Waj0PHgPKJ@f1394","e3VTytLxVCk4Waj0PHgPKJ@4b929","e3VTytLxVCk4Waj0PHgPKJ@75ee4","8eBHF49hxDIqL20a2yi2ri","e3VTytLxVCk4Waj0PHgPKJ@39f7b","e3VTytLxVCk4Waj0PHgPKJ@a72ab"],["node","_mesh","_parent","root","_skeleton","asset","mainTexture","_effectAsset","data","scene","_envmapHDR","_envmapLDR","_defaultClip"],[["cc.Node",["_name","_objFlags","__editorExtras__","_id","_prefab","_parent","_lpos","_euler","_lrot","_children","_components","_lscale"],-1,4,1,5,5,5,2,9,5],["cc.TargetInfo",["localID"],2],["cc.MeshRenderer",["_shadowCastingMode","node","__prefab","_materials","bakeSettings","_mesh"],2,1,4,3,4,6],["cc.SkinnedMeshRenderer",["_shadowCastingMode","node","__prefab","_materials","bakeSettings","_skinningRoot","_mesh","_skeleton"],2,1,4,3,4,1,6,6],["cc.Mesh",["_native","_hash","_struct"],1,11],["cc.SceneAsset",["_name"],2],["cc.Node",["_name","_parent","_children","_prefab","_lpos","_lrot","_euler"],2,1,12,4,5,5,5],["cc.Node",["_name","_parent","_children","_prefab","_lpos","_lrot","_euler"],2,1,9,4,5,5,5],["cc.PrefabInfo",["fileId","targetOverrides","nestedPrefabInstanceRoots","root","instance","asset"],0,1,4,6],["cc.PrefabInfo",["root","asset","instance","targetOverrides","nestedPrefabInstanceRoots"],0,9,2],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1],["cc.PrefabInstance",["fileId","prefabRootNode","propertyOverrides"],1,9],["CCPropertyOverrideInfo",["propertyPath","targetInfo","value"],2,4,4],["CCPropertyOverrideInfo",["value","propertyPath","targetInfo"],1,4],["CCPropertyOverrideInfo",["propertyPath","targetInfo","value"],2,4,8],["cc.ModelBakeSettings",[],3],["cc.Scene",["_children","_prefab","_globals"],3,2,4,4],["cc.TargetOverrideInfo",["propertyPath","source","sourceInfo","target","targetInfo"],2,1,4,1,4],["cc.SceneGlobals",["ambient","shadows","_skybox","fog","octree","skin","lightProbeInfo","postSettings"],3,4,4,4,4,4,4,4,4],["cc.AmbientInfo",["_skyIllumLDR","_skyColorHDR","_skyColorLDR"],2,5,5],["cc.ShadowsInfo",["_enabled","_type","_distance","_shadowColor","_size"],0,5,5],["cc.SkyboxInfo",["_enabled","_envmapHDR","_envmapLDR"],2,6,6],["cc.FogInfo",["_fogColor"],3,5],["cc.OctreeInfo",[],3],["cc.SkinInfo",[],3],["cc.LightProbeInfo",[],3],["cc.PostSettingsInfo",[],3],["cc.DirectionalLight",["_illuminanceHDR","_illuminanceLDR","_shadowEnabled","_shadowPcf","_shadowBias","_shadowSaturation","_shadowDistance","_csmLevel","_shadowFar","_shadowOrthoSize","node","_staticSettings"],-7,1,4],["cc.StaticLightSettings",[],3],["cc.Camera",["_clearFlags","_visibility","node"],1,1],["cc.Material",["_name","_states","_defines","_props"],0,12],["cc.Prefab",["_name"],2],["cc.CompPrefabInfo",["fileId"],2],["cc.SkeletalAnimation",["playOnLoad","node","__prefab","_clips","_defaultClip"],2,1,4,3,6],["cc.Skeleton",["_name","_hash","_joints","_bindposes"],0,12]],[[1,0,2],[10,0,1,2,3,4,5,5],[15,1],[12,0,1,2,2],[17,0,1,2,3,4,2],[32,0,2],[4,0,1,2,3],[13,0,1,2,3],[0,0,5,9,4,6,8,7,2],[1,1],[0,0,5,10,4,6,8,11,7,2],[2,0,1,2,3,4,5,2],[7,0,1,2,3,4,5,6,2],[0,0,5,10,4,8,11,7,2],[34,0,1,2,3,4],[0,0,5,4,6,8,7,2],[8,0,1,2,3,4,5,4],[11,0,1,2,3],[30,0,1,2,3,4],[3,1,2,3,4,5,6,7,1],[0,1,2,4,3],[0,0,3,5,10,6,8,7,3],[0,0,5,9,4,2],[0,0,5,4,6,2],[31,0,2],[2,1,2,3,4,5,1],[5,0,2],[0,1,2,5,4,3],[0,0,9,4,2],[0,0,5,10,4,6,11,7,2],[0,0,9,10,4,6,2],[0,0,9,4,6,8,7,2],[0,0,9,4,6,2],[0,0,5,9,4,8,7,2],[0,0,5,4,6,8,11,7,2],[0,0,5,9,4,6,2],[6,0,1,2,3,4,5,6,2],[9,0,1,2,3,4,4],[14,0,1,2,2],[16,0,1,2,1],[18,0,1,2,3,4,5,6,7,1],[19,0,1,2,2],[20,0,1,2,3,4,4],[21,0,1,2,2],[22,0,1],[23,1],[24,1],[25,1],[26,1],[27,0,1,2,3,4,5,6,7,8,9,10,11,11],[28,1],[29,0,1,2,3],[33,0,1,2,3,4,2],[3,0,1,2,3,4,5,6,7,2]],[[[[6,".bin",3495632489,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":22336,"length":3516,"count":1758,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":22336,"count":349,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-1.0263243913650513,-0.3362765312194824,-0.03969179466366768],"maxPosition",8,[1,1.0416858196258545,0.37944579124450684,2.4551167488098145]]],-1],0,0,[],[],[]],[[[6,".bin",3036632834,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":22272,"length":3516,"count":1758,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":22272,"count":348,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-1.0627228021621704,-0.22964781522750854,-0.03969179466366768],"maxPosition",8,[1,1.0608391761779785,0.271166056394577,2.4551167488098145]]],-1],0,0,[],[],[]],[[[6,".bin",254309135,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":4752,"length":1008,"count":504,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":4752,"count":99,"stride":48},"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}]}]},"minPosition",8,[1,-2.0139009952545166,-2.0199241638183594,-0.5083037614822388],"maxPosition",8,[1,2.0139009952545166,2.0199241638183594,0.41632819175720215]]],-1],0,0,[],[],[]],[[[6,".bin",29018075,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":17024,"length":2616,"count":1308,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":17024,"count":266,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.8331011533737183,-0.3728335201740265,-0.03329771012067795],"maxPosition",8,[1,0.7926641702651978,0.46718841791152954,2.0596137046813965]]],-1],0,0,[],[],[]],[[[6,".bin",1251657800,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":44032,"length":5268,"count":2634,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":44032,"count":688,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-26.697162628173828,-5.055922985076904,-21.154483795166016],"maxPosition",8,[1,60.5887565612793,11.239510536193848,12.134369850158691]]],-1],0,0,[],[],[]],[[[6,".bin",2591114660,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":17024,"length":2616,"count":1308,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":17024,"count":266,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.7926226854324341,-0.7388861179351807,-0.05313277989625931],"maxPosition",8,[1,0.3647039830684662,0.5992574691772461,2.038058042526245]]],-1],0,0,[],[],[]],[[[6,".bin",3382949082,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":22144,"length":3516,"count":1758,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":22144,"count":346,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.9536016583442688,-0.38312095403671265,-0.05688628926873207],"maxPosition",8,[1,0.487619012594223,0.4689179062843323,1.8973422050476074]]],-1],0,0,[],[],[]],[[[6,".bin",4260990112,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":22144,"length":3516,"count":1758,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":22144,"count":346,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-1.091290831565857,-0.41489967703819275,-0.07584762573242188],"maxPosition",8,[1,0.9092828035354614,0.5096479654312134,2.450913906097412]]],-1],0,0,[],[],[]],[[[6,".bin",3840728426,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":17216,"length":2622,"count":1311,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":17216,"count":269,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.7611004710197449,-0.18266357481479645,-0.06545485556125641],"maxPosition",8,[1,0.961718738079071,0.5065948367118835,2.02461838722229]]],-1],0,0,[],[],[]],[[[6,".bin",1400315511,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":17216,"length":2622,"count":1311,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":17216,"count":269,"stride":64},"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_color","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.49995025992393494,-0.4541564881801605,-0.09076808393001556],"maxPosition",8,[1,0.9192519783973694,0.6330084204673767,2.026685953140259]]],-1],0,0,[],[],[]],[[[26,"main"],[20,0,{},[16,"e5Peksu5tL9peMeABb8/JC",null,null,-1,[17,"7e4SH9jydKyaQjXZtS5AiQ",null,[[3,["lightmapSettings"],[0,["a6J1jU/r1BPKNIcVMEREit"]],[2]],[7,1,["_shadowReceivingMode"],[0,["a6J1jU/r1BPKNIcVMEREit"]]],[3,["lightmapSettings"],[0,["28WH2cvhNDFbN3it+8Q+XK"]],[2]],[7,1,["_shadowReceivingMode"],[0,["28WH2cvhNDFbN3it+8Q+XK"]]],[3,["lightmapSettings"],[0,["87exLhmM1P35jx6GLN7j5f"]],[2]],[7,1,["_shadowReceivingMode"],[0,["87exLhmM1P35jx6GLN7j5f"]]],[3,["lightmapSettings"],[0,["dduLonFhNK+q908BUlLM7f"]],[2]],[7,1,["_shadowCastingMode"],[0,["dduLonFhNK+q908BUlLM7f"]]],[7,1,["_shadowReceivingMode"],[0,["dduLonFhNK+q908BUlLM7f"]]],[3,["lightmapSettings"],[0,["af0f1GeGlKf5MvKMEuH8MJ"]],[2]],[7,1,["_shadowReceivingMode"],[0,["af0f1GeGlKf5MvKMEuH8MJ"]]],[3,["lightmapSettings"],[0,["e9BPt5G81CloUmA5IJNHIQ"]],[2]],[7,1,["_shadowReceivingMode"],[0,["e9BPt5G81CloUmA5IJNHIQ"]]],[3,["lightmapSettings"],[0,["7dt8ZZ5EBNDIxOgpt1XbGu"]],[2]],[7,1,["_shadowReceivingMode"],[0,["7dt8ZZ5EBNDIxOgpt1XbGu"]]],[3,["lightmapSettings"],[0,["c4Nekl9YtKUKupS0ASX7It"]],[2]],[7,1,["_shadowReceivingMode"],[0,["c4Nekl9YtKUKupS0ASX7It"]]],[3,["lightmapSettings"],[0,["b9cuhcVRxPvZTPHcAyE7eS"]],[2]],[7,1,["_shadowReceivingMode"],[0,["b9cuhcVRxPvZTPHcAyE7eS"]]],[3,["lightmapSettings"],[0,["f3T3OFBBJBYrGbPSQ+k7GJ"]],[2]],[7,1,["_shadowReceivingMode"],[0,["f3T3OFBBJBYrGbPSQ+k7GJ"]]],[3,["lightmapSettings"],[0,["d0A5LfhGhAfrDnBGJ3JzOe"]],[2]],[7,1,["_shadowReceivingMode"],[0,["d0A5LfhGhAfrDnBGJ3JzOe"]]],[3,["lightmapSettings"],[0,["161SEdWiFO/abXxUI8RkYk"]],[2]],[7,1,["_shadowReceivingMode"],[0,["161SEdWiFO/abXxUI8RkYk"]]]]],2]],[20,0,{},[16,"6dMvPN2t1B66O9Zc3HG8dr",null,null,-2,[17,"93xtJEZ71OF5Gk8u497J9k",null,[[3,["lightmapSettings"],[0,["78XZsd31xPjIsSP2888FcN"]],[2]],[3,["lightmapSettings"],[0,["ffoVYmt2NOmIBz5DHpacF8"]],[2]],[3,["lightmapSettings"],[0,["9aCVBuMeZPv6so1VxT6c40"]],[2]],[3,["lightmapSettings"],[0,["ca1srfPsJJgKKJww9GO/JE"]],[2]]]],1]],[39,[-4,-5,-6,2,1],[37,null,null,null,[[4,["_skinningRoot"],2,[0,["04W3Kzvb9BZbZUGFZzfzi5"]],2,[0,["6dMvPN2t1B66O9Zc3HG8dr"]]],[4,["_skinningRoot"],2,[0,["04W3Kzvb9BZbZUGFZzfzi5"]],2,[0,["6dMvPN2t1B66O9Zc3HG8dr"]]],[4,["_skinningRoot"],2,[0,["04W3Kzvb9BZbZUGFZzfzi5"]],2,[0,["6dMvPN2t1B66O9Zc3HG8dr"]]],[4,["_skinningRoot"],2,[0,["04W3Kzvb9BZbZUGFZzfzi5"]],2,[0,["6dMvPN2t1B66O9Zc3HG8dr"]]],[4,["_skinningRoot"],1,[9],1,[0,["87M1Av0v5LhZ3LsJOTzwr3"]]],[4,["_skinningRoot"],1,[9],1,[0,["8avX4W7ZtLOLCZ8n5QtiPm"]]],[4,["_skinningRoot"],1,[9],1,[0,["5fAmHUz0xO9YFym/gsZawP"]]],[4,["_skinningRoot"],1,[9],1,[0,["9bIVhdYYpFl7JZmL4oubNS"]]],[4,["_skinningRoot"],1,[9],1,[0,["2d66RAsipF1brG2RGpHJY1"]]],[4,["_skinningRoot"],1,[9],1,[0,["ffwse8PqZBf4sIEkNdsA+i"]]],[4,["_skinningRoot"],1,[9],1,[0,["adNP+ELEhC4awfcKkY8jYJ"]]],[4,["_skinningRoot"],1,[9],1,[0,["33gYFxG8dO2r8iKjzjEx4z"]]],[4,["_skinningRoot"],1,[9],1,[0,["27mCip0lFNkL+6Dj/Bpwj4"]]],[4,["_skinningRoot"],1,[9],1,[0,["50aim7sdtB2rmsHB4KRkd5"]]],[4,["_skinningRoot"],1,[9],1,[0,["70DWXrCRRL4pWATtzgi7DN"]]],[4,["_skinningRoot"],1,[9],1,[0,["7aOtJ3fThN27Zj4fmkg0ut"]]]],[-3,2,1]],[40,[41,0.78125,[2,0.2,0.5019607843137255,0.8,0.520833125],[2,0.2,0.5019607843137255,0.8,0.520833125]],[42,true,1,1,[4,1929379840],[0,512,512]],[43,true,3,4],[44,[4,4292993505]],[45],[46],[47],[48]]],[27,0,{},3,[16,"26LvC5hbxAuJZ9Jl2SB/IV",null,null,-7,[17,"cdNOYl3LRPhapW8a8hi/Iy",null,[[3,["lightmapSettings"],[0,["ddvMFij+ZIL5lu+/NQX8Nf"]],[2]],[3,["lightmapSettings"],[0,["e3XMjUJKFLH41z39JaWzyB"]],[2]],[38,["position"],[0,["fd517lz3tOuqVWGd5300X6"]],[1,-1.341,0.805,-2.555]],[3,["lightmapSettings"],[0,["a5Viy6l3VLDpf6gY5yZF+v"]],[2]],[7,1,["_shadowCastingMode"],[0,["a5Viy6l3VLDpf6gY5yZF+v"]]],[3,["lightmapSettings"],[0,["e4If/bQrJCsb9D9JopZa2h"]],[2]],[3,["lightmapSettings"],[0,["d7Vkz0NV5Mn4RUce28JVTp"]],[2]],[3,["lightmapSettings"],[0,["3eVATgLQJKDbqOvE33W2uc"]],[2]],[3,["lightmapSettings"],[0,["2akU/MgO5Ovo6QcS0c/I7e"]],[2]],[3,["lightmapSettings"],[0,["54xaKIQbtPLK5r21VY0qmM"]],[2]],[3,["lightmapSettings"],[0,["23UFBqszxJ/6Otof04QwYT"]],[2]],[3,["lightmapSettings"],[0,["c7PE6gNTdDw45ytwlOEWR3"]],[2]]]],0]],[21,"Main Light","c0y6F5f+pAvI805TdmxIjx",3,[[49,125000,3.2552083333333335,true,2,0.01,0.45098039215686275,10,1,50,10,-8,[50]]],[1,-2.955,3.412,5.118],[3,-0.24999999999999997,-0.24999999999999997,-0.06698729810778066,0.9330127018922194],[1,-30,-30,0]],[21,"Main Camera","c9DMICJLFO5IeO07EPon7U",3,[[51,14,1820327937,-9]],[1,0.4563737338172984,4.020698998822525,7.83104356477376],[3,-0.07236081996736556,0.03501809641207027,0.002542173940871125,0.9967603433167774],[1,-8.304321541008003,4.024165472580301,9.93923337957349e-17]]],0,[0,3,1,0,3,2,0,-1,4,0,-1,5,0,-2,6,0,-3,4,0,3,4,0,0,5,0,0,6,0,9,3,1,2,3,2,2,3,9],[0,0,0,0,0],[5,5,5,10,11],[5,6,7,2,2]],[[[18,"soldier",[{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}}],[{"USE_OUTLINE_PASS":true},{"USE_BASE_COLOR_MAP":true,"BASE_COLOR_MAP_AS_SHADE_MAP_1":true,"BASE_COLOR_MAP_AS_SHADE_MAP_2":true},{"USE_BASE_COLOR_MAP":true,"BASE_COLOR_MAP_AS_SHADE_MAP_1":true,"BASE_COLOR_MAP_AS_SHADE_MAP_2":true},{"USE_BASE_COLOR_MAP":true}],[[{},[{},"specular",8,[4,16777215],"mainTexture",6,0],{},{}],0,11,0,0]]],0,0,[0,0],[6,7],[8,3]],[[[18,"shield",[{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}}],[{"USE_ALBEDO_MAP":true},{"USE_ALBEDO_MAP":true},{"USE_ALBEDO_MAP":true}],[[[{"alphaThreshold":0,"roughness":0.70710676908493,"metallic":0.400000005960464},"mainTexture",6,0],{},{}],11,0,0]]],0,0,[0,0],[6,7],[9,10]],[[[18,"stone",[{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}},{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}}],[{"USE_OUTLINE_PASS":true},{"USE_BASE_COLOR_MAP":true,"BASE_COLOR_MAP_AS_SHADE_MAP_1":true,"BASE_COLOR_MAP_AS_SHADE_MAP_2":true},{"USE_BASE_COLOR_MAP":true,"BASE_COLOR_MAP_AS_SHADE_MAP_1":true,"BASE_COLOR_MAP_AS_SHADE_MAP_2":true},{"USE_BASE_COLOR_MAP":true}],[[{},[{},"specular",8,[4,16777215],"mainTexture",6,0],{},{}],0,11,0,0]]],0,0,[0,0],[6,7],[11,3]],[[[24,"islands"],[28,"islands",[-2],[1,"26LvC5hbxAuJZ9Jl2SB/IV",null,null,null,-1,0]],[22,"RootNode",1,[-3,-4,-5,-6,-7,-8,-9,-10,-11,-12],[1,"068WXOAs1HrIDx+RBQ6XoV",null,null,null,1,0]],[13,"plane01",2,[[25,-13,[5,"ddvMFij+ZIL5lu+/NQX8Nf"],[0],[2],1]],[1,"70dgNwYARPfbvgVcNs+gIQ",null,null,null,1,0],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,4.25968408584595,4.25968408584595,2.35247683525085],[1,-90.00000000000003,0,0]],[29,"stone1",2,[[11,1,-14,[5,"e3XMjUJKFLH41z39JaWzyB"],[2],[2],3]],[1,"fd517lz3tOuqVWGd5300X6",null,null,null,1,0],[1,-1.68451106548309,0.804959058761597,-2.55509376525879],[1,0.111417099833488,0.111417099833488,0.111417099833488],[1,0.000009334667642611398,0,0]],[10,"tree1",2,[[25,-15,[5,"a5Viy6l3VLDpf6gY5yZF+v"],[4],[2],5]],[1,"1evO3wfhhGVomhJPkvbiM/",null,null,null,1,0],[1,2.69967889785767,0.392187118530273,-3.67192149162292],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-90.00000000000003,0,0]],[10,"tree1(__autogen 3)",2,[[11,1,-16,[5,"e4If/bQrJCsb9D9JopZa2h"],[6],[2],7]],[1,"91DpAWXZ9CFJ+Wk1gnOU27",null,null,null,1,0],[1,4.34285020828247,0.273025780916214,-4.5796275138855],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-90.00000000000003,0,0]],[10,"tree1(__autogen 4)",2,[[11,1,-17,[5,"d7Vkz0NV5Mn4RUce28JVTp"],[8],[2],9]],[1,"03YnQPZo5Nc7TYZfZ1EVIK",null,null,null,1,0],[1,-2.78155946731567,0.366120487451553,-5.44366216659546],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-90.00000000000003,0,0]],[10,"tree1(__autogen 5)",2,[[11,1,-18,[5,"3eVATgLQJKDbqOvE33W2uc"],[10],[2],11]],[1,"aehmnp6BdEt5duOREy07Ic",null,null,null,1,0],[1,-3.78196001052856,0.328564822673798,-3.62895131111145],[3,-0.7071067811865447,-6.18172403853676e-8,-6.18172403853676e-8,0.7071067811865447],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-89.99999999999999,-0.000010017912624975451,0]],[10,"tree1(__autogen 6)",2,[[11,1,-19,[5,"2akU/MgO5Ovo6QcS0c/I7e"],[12],[2],13]],[1,"1dXVprqA1AkpKbrdcroE4U",null,null,null,1,0],[1,-6.02857780456543,0.0573978498578072,-3.32550001144409],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-90.00000000000003,0,0]],[10,"tree1(__autogen 7)",2,[[11,1,-20,[5,"54xaKIQbtPLK5r21VY0qmM"],[14],[2],15]],[1,"c2n9MRvPxJRbv1PP2mhkZO",null,null,null,1,0],[1,-0.547172009944916,0.595235526561737,-3.40697646141052],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-90.00000000000003,0,0]],[10,"tree1(__autogen 8)",2,[[11,1,-21,[5,"23UFBqszxJ/6Otof04QwYT"],[16],[2],17]],[1,"e7VpTFkQ1Ev40vpNxYe7EG",null,null,null,1,0],[1,-6.58904409408569,0.117208734154701,-1.02060234546661],[3,-0.7071067811865476,0,0,0.7071067811865476],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-90.00000000000003,0,0]],[10,"tree1(__autogen 9)",2,[[11,1,-22,[5,"c7PE6gNTdDw45ytwlOEWR3"],[18],[2],19]],[1,"a1wQefYUNInYWhsOmPzInv",null,null,null,1,0],[1,5.92053079605103,0.1805190294981,-2.71322011947632],[3,-0.7071067811865447,-6.18172403853676e-8,-6.18172403853676e-8,0.7071067811865447],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-89.99999999999999,-0.000010017912624975451,0]]],0,[0,3,1,0,-1,2,0,-1,3,0,-2,4,0,-3,5,0,-4,6,0,-5,7,0,-6,8,0,-7,9,0,-8,10,0,-9,11,0,-10,12,0,0,3,0,0,4,0,0,5,0,0,6,0,0,7,0,0,8,0,0,9,0,0,10,0,0,11,0,0,12,0,8,1,22],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1],[12,13,14,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23]],[[[24,"soldier"],[30,"soldier",[-3],[[52,true,-2,[5,"04W3Kzvb9BZbZUGFZzfzi5"],[12],13]],[1,"6dMvPN2t1B66O9Zc3HG8dr",null,null,null,-1,0],[1,0,0.956,1.402]],[22,"RootNode",1,[-4,-5,-6,-7,-8],[1,"a5uiqiY3JH2IVaNOBBe7fQ",null,null,null,1,0]],[31,"Bip001 Spine",[-9,-10,-11],[1,"deedfocu1E0amfQjzHnnD8",null,null,null,1,0],[1,0.0765029862523079,-0.000119566058856435,1.06260117149759e-7],[3,-0.000002080475910607327,-6.936759723456761e-7,0.0003981589901667568,0.9999999207323014],[1,-0.00023837338537102568,-0.00007939450691674313,0.045625660794268635]],[32,"Bip001 Neck",[-12,-13,-14],[1,"de+U9IqPVD+qUUY0y7H/86",null,null,null,1,0],[1,0.15020164847374,-0.0000435724105045665,-1.20852522433879e-10]],[36,"Bip001",2,[[[15,"Bip001 Footsteps",-15,[1,"24sP2WouNOyq9Pp+iqRgiX",null,null,null,1,0],[1,-5.16987871290063e-28,0,-0.734457075595856],[3,-6.921034890422563e-34,6.921044533149828e-34,0.7071063043492202,0.7071072580235535],[1,0,-1.1216009582263186e-31,90]],-16],4,1],[1,"15XJ/3651AFKLyr6XRj3d7",null,null,null,1,0],[1,0,0.738336980342865,-3.74271143591121e-12],[3,-0.5000003576277411,-0.4999996423720031,-0.4999996423720031,0.5000003576277411],[1,-90,-89.99991803772988,0]],[13,"soldier",2,[[53,1,-17,[5,"78XZsd31xPjIsSP2888FcN"],[0],[2],1,1,2]],[1,"824q3ldSpHoYl9xi6zWeg4",null,null,null,1,0],[3,0.9999999999999953,0,0,-9.735359185469814e-8],[1,87.7489852905273,87.7489852905273,87.7489852905273],[1,-179.99998884410013,0,0]],[33,"Bip001 Pelvis",5,[3],[1,"9brOPlFAxPnLhkrpP6KbLQ",null,null,null,1,0],[3,-0.4999999925491744,-0.4999999925491744,-0.4999993070957696,0.5000007078049007],[1,-89.9999197452773,-89.9999197452773,-0.0000017074910412130916]],[8,"Bip001 L Thigh",3,[-18],[1,"4aENadJ59Io4SS6BMn9Aw4",null,null,null,1,0],[1,-0.0765029117465019,0.000180334449396469,0.0665242150425911],[3,-0.015412850192755845,0.9969698713847834,0.002043751751963479,-0.07621904406852757],[1,-0.098918034361683,-171.25793904676914,-1.7789668366715101]],[8,"Bip001 L Calf",8,[-19],[1,"71+6ovA8dDUowhlyNGBIbM",null,null,null,1,0],[1,0.368020862340927,-2.38418573772492e-9,1.90734859017994e-8],[3,-3.77253945323161e-21,-4.658679694134547e-18,-0.0008097870399876981,0.999999672122421],[1,-8.646032309262241e-19,-5.338462443351186e-16,-0.09279476953314847]],[8,"Bip001 L Foot",9,[-20],[1,"71/rP0sWxM1bfHuNwls2lv",null,null,null,1,0],[1,0.29802131652832,-2.38418573772492e-9,0],[3,0.0020737143220202685,-0.07621822672483194,0.016616994877612996,0.9969505289155877],[1,0.3822464844159605,-8.749946017824339,1.8805865416881686]],[12,"Bip001 L Toe0",10,[[34,"Bip001 L Toe0Nub",-21,[1,"b7ARhVJWFJP4yiboWbM1Xs",null,null,null,1,0],[1,0.00997863244265318,-2.98023217215615e-10,3.55271359939116e-17],[3,9.55341250274695e-16,-2.4399608215727e-23,1,1.83758927467374e-15],[1,-1,-1,-1],[1,180,-179.9999999999999,2.1057221983462293e-13]]],[1,"b7IX4wc+BII5SOxaDKm4bu",null,null,null,1,0],[1,0.0765028968453407,0.0984558463096619,1.90734859017994e-8],[3,-1.5454308319985125e-8,-1.5454308319985125e-8,0.7071067811865472,0.7071067811865472],[1,0,-0.0000025044778683729224,90]],[8,"Bip001 R Thigh",3,[-22],[1,"baRkxlpMJMup2UzoK3llZt",null,null,null,1,0],[1,-0.0765029117465019,0.000180703471414745,-0.0665242150425911],[3,-0.0154126518850906,0.9969698755273314,-0.0020409899233692465,0.07621910398987286],[1,0.09860398393799301,171.25792731952373,-1.7789200579558455]],[8,"Bip001 R Calf",12,[-23],[1,"8a4oYAyD9MkZi9aL5G15gW",null,null,null,1,0],[1,0.36802089214325,0,-3.55271359939116e-17],[3,2.226103102352033e-19,7.125063520427799e-18,-0.0008097898921612967,0.9999996721201113],[1,2.6170459347986135e-17,8.164935972515574e-16,-0.09279509636827488]],[8,"Bip001 R Foot",13,[-24],[1,"cdWn1utjJOUaNdTLXxb/CR",null,null,null,1,0],[1,0.29802131652832,0,-3.81469718035987e-8],[3,-0.002073778117879438,0.07621821928385913,0.016617013506159614,0.9969505290412618],[1,-0.38225392566993516,8.749945293799216,1.8805881155171484]],[12,"Bip001 R Toe0",14,[[23,"Bip001 R Toe0Nub",-25,[1,"77BI3YwgNJqKMpf0rJhZ9s",null,null,null,1,0],[1,0.00997863244265318,-2.98023217215615e-10,7.10542719878232e-17]]],[1,"26R5ll6SNGP5ArlFhrFOzH",null,null,null,1,0],[1,0.0765028968453407,0.0984558537602425,1.90734859017994e-8],[3,-1.5454308319985125e-8,-1.5454308319985125e-8,0.7071067811865472,0.7071067811865472],[1,0,-0.0000025044778683729224,90]],[35,"Bip001 Spine1",3,[4],[1,"78+5xpqyNL2aHMIBr4YHvg",null,null,null,1,0],[1,0.150201484560966,-0.000119601711048745,-3.31727090241429e-10]],[8,"Bip001 L Clavicle",4,[-26],[1,"c67UVUfoFCNLAcx8dX7SW1",null,null,null,1,0],[1,0,0.0000435078145528678,0.0232834853231907],[3,0.6087613827170933,-0.0002434881366867595,0.7933532758994495,0.0003150325566206266],[1,179.9558877717535,-104.99999523006848,0.01165464185401893]],[8,"Bip001 L UpperArm",17,[-27],[1,"66qUHYCHZNMoAvIMM8jTZn",null,null,null,1,0],[1,0.272405058145523,4.54747340722069e-15,0],[3,0.004462069723208538,0.4381802273458216,-0.0019434620153348766,0.8988739629404916],[1,0.5572016837940187,51.97620557313351,0.02386521946895269]],[8,"Bip001 L Forearm",18,[-28],[1,"503RTkgyFOwZRj7QxbXFGT",null,null,null,1,0],[1,0.263291478157043,0,0],[3,-2.7197715504795845e-20,-3.0893820368327117e-17,-0.0008803606294924629,0.9999996124825059],[1,-6.233264281423144e-18,-3.5401778996822195e-15,-0.10088191006996569]],[12,"Bip001 L Hand",19,[[15,"sword01",-29,[1,"98Mxm4C+NAIp1/ms1CXDWg",null,null,null,1,0],[1,0.0919111594557762,0.0340489186346531,-0.14926840364933],[3,0.6409670678902519,-0.3070256396863465,-0.5278458569202463,-0.4650540030872693],[1,-112.37885078724646,75.2002383569922,5.587571211625747]]],[1,"7cWlWOkFtKX6ILXuZfhYqO",null,null,null,1,0],[1,0.199572831392288,-5.9604643443123e-10,1.42108543975646e-16],[3,-0.7068252124052271,1.0458620867947887e-8,1.0614867442646885e-8,0.7073882378922519],[1,-89.95437890588059,0.0000017075473071153707,1.3340228971442967e-8]],[8,"Bip001 R Clavicle",4,[-30],[1,"9fRB6KFOpAz6pb5W8NAqZg",null,null,null,1,0],[1,0,0.0000436370064562652,-0.0232834853231907],[3,-0.6087613827171046,0.00024128768333211222,0.793353275899464,0.0003167210153793466],[1,-179.95597003338875,104.99999512047448,0.011961643569376679]],[8,"Bip001 R UpperArm",21,[-31],[1,"a72KzY4dJDrb/Ifgjl7CSF",null,null,null,1,0],[1,0.272405058145523,6.82120985672115e-14,-1.42108543975646e-16],[3,-0.030114175418424236,-0.43755956999841955,0.05059855375302801,0.897259463867486],[1,-0.5631334715243025,-51.96038786477057,6.727854372934277]],[8,"Bip001 R Forearm",22,[-32],[1,"5eAc4VAlRExZ6nABKN5Ihq",null,null,null,1,0],[1,0.263291418552399,0,-7.62939436071974e-8],[3,-8.302567498559346e-18,-5.588016764292516e-17,-0.13176086831298384,0.9912815309393233],[1,-1.8510999406615195e-15,-6.705762043264369e-15,-15.14271605062808]],[12,"Bip001 R Hand",23,[[15,"shield01",-33,[1,"4f4kzbhYBIMIVjz0nZTcvw",null,null,null,1,0],[1,0.124533005058765,-0.00692871073260903,0.0576667860150337],[3,0.5417342069004817,-0.1379658103002438,0.11668003843623054,0.8208990515846776],[1,67.2841187503732,-20.685866498064005,2.411917394086867]]],[1,"19JEI2tAtAo5mcAZ7XSRWH",null,null,null,1,0],[1,0.199572905898094,8.88178399847791e-18,0],[3,0.7068252124052272,-1.9327187937127104e-17,1.9311804031753923e-17,0.707388237892252],[1,89.95437890588059,-3.1308585900006548e-15,-7.956237644289779e-23]],[12,"Bip001 Head",4,[[23,"Bip001 HeadNub",-34,[1,"ebvw49UjBMKoIvQOBhsyUF",null,null,null,1,0],[1,0.475234657526016,-1.45519149031062e-13,2.99510855318999e-20]]],[1,"4ckJuubwNG3KpsMgkuxo12",null,null,null,1,0],[1,0.0547203049063683,-1.38777874976217e-19,2.71050537062924e-22],[3,-7.265599787883251e-14,1.1042733174299354e-9,-0.0003988305609355657,0.9999999204670887],[1,4.214242912539149e-11,1.2654042790710837e-7,-0.04570261697650697]],[13,"shield",2,[[19,-35,[5,"ffoVYmt2NOmIBz5DHpacF8"],[3],[2],1,4,5]],[1,"2fgzyRcBxNmZKzBdJpnT0Q",null,null,null,1,0],[3,0.9999999999999878,0,0,-1.569582366300871e-7],[1,87.7489852905273,87.7489852905273,87.7489852905273],[1,-179.99998201391097,0,0]],[13,"sword",2,[[19,-36,[5,"9aCVBuMeZPv6so1VxT6c40"],[6],[2],1,7,8]],[1,"d0xEUY/HZBVZJ0EMEz3doQ",null,null,null,1,0],[3,0.9999999999999878,0,0,-1.569582366300871e-7],[1,87.7489852905273,87.7489852905273,87.7489852905273],[1,-179.99998201391097,0,0]],[10,"shield01",2,[[19,-37,[5,"ca1srfPsJJgKKJww9GO/JE"],[9],[2],1,10,11]],[1,"464KPea2NOibwROP5moUvA",null,null,null,1,0],[1,-0.00499999988824129,0,0.00499999988824129],[3,0.9999999999999878,0,0,-1.569582366300871e-7],[1,87.7489852905273,87.7489852905273,87.7489852905273],[1,-179.99998201391097,0,0]]],0,[0,3,1,0,0,1,0,-1,2,0,-1,6,0,-2,5,0,-3,26,0,-4,27,0,-5,28,0,-1,8,0,-2,12,0,-3,16,0,-1,17,0,-2,21,0,-3,25,0,2,5,0,-2,7,0,0,6,0,-1,9,0,-1,10,0,-1,11,0,2,11,0,-1,13,0,-1,14,0,-1,15,0,2,15,0,-1,18,0,-1,19,0,-1,20,0,2,20,0,-1,22,0,-1,23,0,-1,24,0,2,24,0,2,25,0,0,26,0,0,27,0,0,28,0,8,1,3,2,7,4,2,16,37],[0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-1,1,4,-1,1,4,-1,1,4,-1,1,4,-1,12],[1,24,25,1,26,27,1,28,29,30,31,32,4,4]],[[[6,".bin",2341262723,[{"primitives":[{"primitiveMode":7,"jointMapIndex":0,"vertexBundelIndices":[0],"indexView":{"offset":70128,"length":6960,"count":3480,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":70128,"count":974,"stride":72},"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_joints","format":42,"isNormalized":false},{"name":"a_weights","format":44,"isNormalized":false}]}],"jointMaps":[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]]},"minPosition",8,[1,-0.006235902663320303,-0.022199034690856934,-0.00308204535394907],"maxPosition",8,[1,0.006235902663320303,0.0000021968080545775592,0.0029080540407449007]]],-1],0,0,[],[],[]],[[[14,"Skin-0",2507836796,["RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh","RootNode/Bip001/Bip001 Pelvis","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh/Bip001 R Calf","RootNode/Bip001","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh/Bip001 L Calf","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh/Bip001 R Calf/Bip001 R Foot","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 Head/Bip001 HeadNub","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 Head","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh/Bip001 L Calf/Bip001 L Foot","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand","RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/shield01"],[[[7,13.330132484436035,0.5659459233283997,-86.72872161865234,0,86.68508911132812,2.7542707920074463,13.341398239135742,0,2.808293342590332,-87.70392608642578,-0.14067713916301727,0,0.719279408454895,0.022746119648218155,0.1780078411102295,1],[7,-13.330143928527832,-0.5657054781913757,-86.72872924804688,0,86.68508911132812,2.7542707920074463,-13.34140396118164,0,2.8082568645477295,-87.70392608642578,0.14043928682804108,0,0.7192792892456055,0.022746119648218155,-0.17800788581371307,1],[7,0.00012169029650976881,0.0002419860102236271,87.74899291992188,0,-87.74898529052734,-0.00001708502350084018,0.00012169034744147211,0,0.000017085358194890432,-87.74899291992188,0.0002419859665678814,0,-0.738336980342865,6.5663993339959426e-12,0.0000010239258472211077,1],[7,9.57883514729474e-8,-0.00012308494478929788,87.74899291992188,0,-87.74895477294922,0.06985900551080704,1.9377911542051152e-7,0,-0.06985900551080704,-87.74896240234375,-0.00012308482837397605,0,-0.8148396015167236,0.0007684377487748861,2.1313388831600832e-9,1],[7,-13.329378128051758,-0.5835267305374146,-86.72872924804688,0,86.68132781982422,2.870192527770996,-13.341405868530273,0,2.9255402088165283,-87.7000961303711,0.14043459296226501,0,0.3512277603149414,0.023215843364596367,-0.17800790071487427,1],[7,0.00012029569188598543,87.74899291992188,-5.373075573876507e-15,0,-0.000017085358194890432,2.3417063427233487e-11,-87.74898529052734,0,-87.74899291992188,0.00012029569188598543,0.000017085358194890432,0,3.742711869592075e-12,-5.034101432245029e-17,-0.738336980342865,1],[7,13.329362869262695,0.5837728977203369,-86.72872161865234,0,86.68132781982422,2.870190143585205,13.341397285461426,0,2.9255752563476562,-87.7000961303711,-0.14067858457565308,0,0.3512278199195862,0.023215826600790024,0.1780078411102295,1],[7,0.000003835630195681006,0.00012029569188598543,-87.74899291992188,0,87.74898529052734,-0.000017085363651858643,0.0000038356070035661105,0,-0.000017085358194890432,-87.74899291992188,-0.00012029569188598543,0,0.08038292825222015,0.021714111790060997,-0.16770152747631073,1],[7,0.0001178546590381302,-0.00012308491568546742,87.74899291992188,0,-87.74898529052734,-0.000017085523722926155,0.00011785465176217258,0,0.000017085358194890432,-87.74899291992188,-0.00012308494478929788,0,-1.6451982259750366,5.87142210406455e-7,0.0000022096469365351368,1],[7,0.0001178546590381302,-0.00012308491568546742,87.74899291992188,0,-87.74898529052734,-0.000017085523722926155,0.00011785465176217258,0,0.000017085358194890432,-87.74899291992188,-0.00012308494478929788,0,-1.1699634790420532,-5.1139195988980646e-8,0.0000015713648053861107,1],[7,-84.7590103149414,-0.00011930296022910625,22.711111068725586,0,22.711111068725586,0.000016954663806245662,84.7590103149414,0,-0.00011962600547121838,87.74899291992188,0.00001450093350285897,0,0.26615607738494873,4.7347434417588374e-8,1.0832682847976685,1],[7,84.7590103149414,-0.00012128843081882223,22.711111068725586,0,22.711111068725586,0.000016954663806245662,-84.7590103149414,0,0.00011276743316557258,87.74899291992188,0.00004776870264322497,0,0.26615607738494873,4.734742375944734e-8,-1.0832682847976685,1],[7,9.57883514729474e-8,-0.00012308494478929788,87.74899291992188,0,-87.74895477294922,0.06985900551080704,1.9377911542051152e-7,0,-0.06985900551080704,-87.74896240234375,-0.00012308482837397605,0,-0.9650411605834961,0.0008880393579602242,2.4630661954461175e-9,1],[7,9.57883514729474e-8,-0.00012308494478929788,87.74899291992188,0,-87.74895477294922,0.06985900551080704,1.9377911542051152e-7,0,-0.06985900551080704,-87.74896240234375,-0.00012308482837397605,0,-1.1152427196502686,0.0009316118084825575,2.583918634613269e-9,1],[7,0.000003835630195681006,0.00012029569188598543,-87.74899291992188,0,87.74898529052734,-0.000017085363651858643,0.0000038356070035661105,0,-0.000017085358194890432,-87.74899291992188,-0.00012029569188598543,0,0.08038290590047836,0.0217141043394804,0.16770148277282715,1],[7,34.319801330566406,0.7709546685218811,80.75544738769531,0,80.75911712646484,-0.3673746883869171,-34.31785202026367,0,0.0365816168487072,87.74483489990234,-0.853227436542511,0,0.8495007157325745,-0.006890855263918638,-0.672168493270874,1],[7,-34.105628967285156,3.229346752166748,80.7852783203125,0,80.19358825683594,-9.797160148620605,34.247459411621094,0,10.280043601989746,87.1405258178711,0.8565954566001892,0,0.8434666395187378,-0.10610441118478775,0.6714277267456055,1],[7,34.318382263183594,0.8313809037208557,80.75544738769531,0,80.75962829589844,-0.22517983615398407,-34.317848205566406,0,-0.11791250109672546,87.7447509765625,-0.8532273173332214,0,0.5862204432487488,-0.005858692806214094,-0.6721684336662292,1],[7,34.318382263183594,-80.75476837158203,0.8956841230392456,0,80.75962829589844,34.31765365600586,-0.25250619649887085,0,-0.11791250109672546,0.9230960011482239,87.74404907226562,0,0.38664767146110535,0.6721636056900024,-0.0063939220272004604,1],[7,-33.76499557495117,-5.791998386383057,80.7852783203125,0,79.96836853027344,11.491525650024414,34.24745178222656,0,-12.840116500854492,86.80025482177734,0.8565958738327026,0,0.5877475142478943,0.04913555085659027,0.6714276671409607,1],[7,-33.76499557495117,80.7806396484375,5.856326103210449,0,79.96836853027344,34.256595611572266,-11.464248657226562,0,-12.840116500854492,0.9257150888442993,-86.7995376586914,0,0.3881746232509613,0.671466588973999,-0.04860087111592293,1],[7,-26.09381103515625,47.70235824584961,-68.8729248046875,0,72.14217376708984,-23.88349151611328,-43.87446212768555,0,-42.596981048583984,-69.67027282714844,-32.11593246459961,0,0.23747046291828156,0.08072908967733383,-0.6914553046226501,1]],8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]]],0,0,[],[],[]],[[[6,".bin",2184526039,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":648,"length":48,"count":24,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":648,"count":9,"stride":72},"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_joints","format":42,"isNormalized":false},{"name":"a_weights","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.009095229208469391,-0.00829001609236002,-0.0038153051864355803],"maxPosition",8,[1,-0.002438712865114212,-0.0038237078115344048,0.0021244001109153032]]],-1],0,0,[],[],[]],[[[6,".bin",2718085466,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":2016,"length":264,"count":132,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":2016,"count":28,"stride":72},"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_joints","format":42,"isNormalized":false},{"name":"a_weights","format":44,"isNormalized":false}]}]},"minPosition",8,[1,0.004531483631581068,-0.006827499717473984,-0.009057947434484959],"maxPosition",8,[1,0.00610683299601078,-0.003189224749803543,0.0015691547887399793]]],-1],0,0,[],[],[]],[[[14,"Skin-2",1928083474,["RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand/sword01"],[[[7,-0.000007191588792920811,-0.00005849258377566002,-87.7490005493164,0,24.115726470947266,-84.3700942993164,0.0000542638408660423,0,-84.37010192871094,-24.115724563598633,0.000022989974240772426,0,-0.00041664036689326167,-0.5413689017295837,0.47052377462387085,1]],8]]],0,0,[],[],[]],[[[14,"Skin-3",3487038830,["RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/shield01"],[[[7,-26.09381103515625,47.70235824584961,-68.8729248046875,0,72.14216613769531,-23.883501052856445,-43.87446594238281,0,-42.59699249267578,-69.6702651977539,-32.11592483520508,0,0.24138452112674713,0.08198083937168121,-0.6857008934020996,1]],8]]],0,0,[],[],[]],[[[6,".bin",428950450,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":6480,"length":480,"count":240,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":6480,"count":90,"stride":72},"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_joints","format":42,"isNormalized":false},{"name":"a_weights","format":44,"isNormalized":false}]}]},"minPosition",8,[1,-0.009095229208469391,-0.00861329771578312,-0.0038153051864355803],"maxPosition",8,[1,-0.0022758706472814083,-0.0038237078115344048,0.002340445527806878]]],-1],0,0,[],[],[]],[[[14,"Skin-1",1546018204,["RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/shield01"],[[[7,-26.09381103515625,47.70235824584961,-68.8729248046875,0,72.14216613769531,-23.883501052856445,-43.87446594238281,0,-42.59699249267578,-69.6702651977539,-32.11592483520508,0,0.23747046291828156,0.08072908967733383,-0.6914553046226501,1]],8]]],0,0,[],[],[]]]] diff --git a/cocos_view_pod/Assets/assets/main/import/07/070e260c2.json b/cocos_view_pod/Assets/assets/main/import/07/070e260c2.json new file mode 100644 index 0000000..b7e22fa --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/07/070e260c2.json @@ -0,0 +1 @@ +[1,["aa3gnuj51BPKnojGhupeFg@73b7f","b6mOVasAtJh6i0r4PN3Fn3","aa3gnuj51BPKnojGhupeFg@ef5e1","aa3gnuj51BPKnojGhupeFg@438fe","aeGN7qxuBKPb9w7lUz+bqH@6c48a","a3zQCfCrBCDZJ4uf2rk5u8"],["node","_parent","_mesh","_skeleton","_defaultClip","root","data","mainTexture","_effectAsset"],[["cc.Node",["_name","_prefab","_parent","_children","_lpos","_lscale","_lrot","_euler","_components"],2,4,1,2,5,5,5,5,9],["cc.SkeletalAnimation",["playOnLoad","_name","node","__prefab","_clips","_defaultClip"],1,1,4,3,6],["cc.Prefab",["_name"],2],["cc.Node",["_name","_parent","_children","_prefab","_lpos","_lrot","_euler"],2,1,9,4,5,5,5],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1],["cc.CompPrefabInfo",["fileId"],2],["cc.SkinnedMeshRenderer",["node","__prefab","_materials","bakeSettings","_skinningRoot","_mesh","_skeleton"],3,1,4,3,4,1,6,6],["cc.ModelBakeSettings",[],3],["cc.Skeleton",["_name","_hash","_joints","_bindposes"],0,12],["cc.Mesh",["_native","_hash","_struct"],1,11],["cc.Material",["_name","_states","_defines","_props"],0,12]],[[4,0,1,2,3,4,5,5],[0,0,2,3,1,4,6,5,7,2],[0,0,2,1,4,6,7,2],[3,0,1,2,3,4,5,6,2],[5,0,2],[0,0,2,3,1,2],[0,0,2,8,1,6,5,7,2],[6,0,1,2,3,4,5,6,1],[7,1],[0,0,2,3,8,1,4,6,5,7,2],[1,1,0,2,3,4,5,3],[1,0,2,3,4,5,2],[2,0,2],[0,0,3,1,2],[0,0,2,3,8,1,4,5,2],[8,0,1,2,3,4],[9,0,1,2,3],[10,0,1,2,3,4]],[[[[12,"grassGoup"],[13,"grassGoup",[-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13],[0,"e5Peksu5tL9peMeABb8/JC",null,null,null,-1,0]],[14,"grass",1,[-15],[[11,true,-14,[4,"11JgtTUn5OJKE3LJ8pTj/2"],[3],4]],[0,"87M1Av0v5LhZ3LsJOTzwr3",null,null,null,1,0],[1,-0.852,0.892,-1.49],[1,1.8,1.8,1.8]],[5,"RootNode",2,[-16,-17,-18],[0,"54SHCY049LyqH1HRGY3ZVR",null,null,null,1,0]],[9,"grass",1,[-20],[[11,true,-19,[4,"abXR2STONCQrmlGd7QjDWb"],[8],9]],[0,"8avX4W7ZtLOLCZ8n5QtiPm",null,null,null,1,0],[1,1.271,0.836,-2.68],[3,0,-0.09886819763876702,0,0.9951005373808527],[1,1.4,1.4,1.4],[1,0,-11.348,0]],[5,"RootNode",4,[-21,-22,-23],[0,"bdiB2XMldLgpbPP0u9vyiH",null,null,null,1,0]],[9,"grass",1,[-25],[[10,"grass",true,-24,[4,"3eRlu7+XFMf4IKjhzVuyYo"],[13],14]],[0,"5fAmHUz0xO9YFym/gsZawP",null,null,null,1,0],[1,0.816,0.874,-2.029],[3,0.009594606467145706,-0.09840154486124139,-0.09656895017241425,0.9904037143297977],[1,1.8,1.8,1.8],[1,0,-11.348,-11.138]],[5,"RootNode",6,[-26,-27,-28],[0,"0cYonIu91LHamoapMUydbc",null,null,null,1,0]],[9,"grass",1,[-30],[[10,"grass",true,-29,[4,"22rvun9aNNBbAK//dWXzkX"],[18],19]],[0,"9bIVhdYYpFl7JZmL4oubNS",null,null,null,1,0],[1,1.505,0.835,-2.352],[3,0.009051343059323664,0.011005731118140823,-0.042668681053864996,0.9989876529409666],[1,1.8,1.8,1.8],[1,1.094,1.309,-4.879]],[5,"RootNode",8,[-31,-32,-33],[0,"2at9CGY1VK9qtNpM8kC/KU",null,null,null,1,0]],[9,"grass",1,[-35],[[10,"grass",true,-34,[4,"0f8P8jwTVOzaIGGhmhMYJ6"],[23],24]],[0,"2d66RAsipF1brG2RGpHJY1",null,null,null,1,0],[1,2.591,0.697,-3.192],[3,-0.009569056200142995,-0.27238145223532967,-0.02174826425431747,0.961895935454317],[1,1.4,1.4,1.4],[1,-1.735,-31.653,-2.099]],[5,"RootNode",10,[-36,-37,-38],[0,"75DE0pyqBGsIOI2RSOFxap",null,null,null,1,0]],[9,"grass",1,[-40],[[10,"grass",true,-39,[4,"b6LjWqcFFEYa267NpDVpBB"],[28],29]],[0,"ffwse8PqZBf4sIEkNdsA+i",null,null,null,1,0],[1,-2.85,0.766,-2.616],[3,-0.007707220961668685,-0.0985673335815995,0.07757256533280044,0.9920723646001587],[1,1.8,1.8,1.8],[1,0,-11.348,8.942]],[5,"RootNode",12,[-41,-42,-43],[0,"12tzV7tYdKJJxbVmqiEpry",null,null,null,1,0]],[9,"grass",1,[-45],[[10,"grass",true,-44,[4,"a5eATDuwJGuL6l09vX0n3S"],[33],34]],[0,"adNP+ELEhC4awfcKkY8jYJ",null,null,null,1,0],[1,-3.252,0.663,-3.355],[3,-0.005303598000440666,-0.09872584440048117,0.053380291603709065,0.9936677633716235],[1,1.6,1.6,1.6],[1,9.996766443584073e-17,-11.348,6.150000000000002]],[5,"RootNode",14,[-46,-47,-48],[0,"0eVA3+ezRBf4EQOOoMIo4S",null,null,null,1,0]],[9,"grass",1,[-50],[[10,"grass",true,-49,[4,"8fKHzMP19M76liKGOWy5fp"],[38],39]],[0,"33gYFxG8dO2r8iKjzjEx4z",null,null,null,1,0],[1,-4.716,0.534,-2.539],[3,-0.011417842217574529,0.10201162854238845,0.09441482697624534,0.9902267926936081],[1,1.2999999999999998,1.3,1.3],[1,-2.442,11.991,10.641]],[5,"RootNode",16,[-51,-52,-53],[0,"53OGGCuwFNs4KQ0nQRdow5",null,null,null,1,0]],[9,"grass",1,[-55],[[10,"grass",true,-54,[4,"63dAWSpBBOqo5RjIXi5sEW"],[43],44]],[0,"27mCip0lFNkL+6Dj/Bpwj4",null,null,null,1,0],[1,-3.151,0.706,-2.905],[3,-0.01606605470413201,0.10576273729137807,0.0511818299419083,0.9929433748057723],[1,1.6,1.6,1.6],[1,-2.461,12.281,5.638]],[5,"RootNode",18,[-56,-57,-58],[0,"560/1xR41BPKG+lcc5935I",null,null,null,1,0]],[9,"grass",1,[-60],[[10,"grass",true,-59,[4,"5c8UINxBNN1bAOwYYO6ZIW"],[48],49]],[0,"50aim7sdtB2rmsHB4KRkd5",null,null,null,1,0],[1,2.179,0.714,-3.159],[3,0.0002046174412504865,-0.2725489284000769,-0.05622568582446521,0.9604976376926917],[1,1.4,1.4,1.4],[1,-1.744,-31.778,-6.207]],[5,"RootNode",20,[-61,-62,-63],[0,"25mf8t9bhJIo3E0lcGCo1H",null,null,null,1,0]],[9,"grass",1,[-65],[[10,"grass",true,-64,[4,"2dbXeRDsVAWK67o3tGgUEl"],[53],54]],[0,"70DWXrCRRL4pWATtzgi7DN",null,null,null,1,0],[1,5.041,0.406,-3.58],[3,0.026333680128465056,-0.27127042474669716,-0.14805365417229147,0.9506834433368816],[1,1.4,1.4,1.4],[1,-1.815,-32.126,-17.205]],[5,"RootNode",22,[-66,-67,-68],[0,"9dXaYb8ytBBb2yYH4yN6Vh",null,null,null,1,0]],[9,"grass",1,[-70],[[10,"grass",true,-69,[4,"42733HPMdIEqobiaBVXbRJ"],[58],59]],[0,"7aOtJ3fThN27Zj4fmkg0ut",null,null,null,1,0],[1,4.153,0.548,-3.566],[3,0.01263456693718553,-0.27225485806840527,-0.09997674733537244,0.9569338064718487],[1,1.4,1.4,1.4],[1,-1.769,-31.94,-11.433]],[5,"RootNode",24,[-71,-72,-73],[0,"fa4L3FVuFMwYhNq67HoU7c",null,null,null,1,0]],[6,"grass",3,[[7,-74,[4,"a6J1jU/r1BPKNIcVMEREit"],[0],[8],2,1,2]],[0,"5fs1r6h0xEiJFeWVPk8SNl",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",3,[-75],[0,"daWdShf/9NHLgm8BB+DJZm",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",27,[[2,"Bone003",-76,[0,"8e/dPEvbdIMo48q55vpZZ3",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"beKna0bXZNtrHWMkpFZoVU",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",3,[-77],[0,"94aP4+w7dE/qUrh7Cfcv3Y",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",29,[[2,"Bone006",-78,[0,"96ATlvvpZKqpZWVYxnyW6U",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"8fu8biB4BPFKtDBKsYv4K/",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",5,[[7,-79,[4,"28WH2cvhNDFbN3it+8Q+XK"],[5],[8],4,6,7]],[0,"74Q+wg/aVBj5Bkvd+Cqz4L",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",5,[-80],[0,"4fGc2baulLjbJeePpPYcqt",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",32,[[2,"Bone003",-81,[0,"af9wSIs/ZHx5FXOjfa1Jum",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"25LOOT8GBDpr0h1KIC5gCx",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",5,[-82],[0,"b8DSzxi5tJyKiMnjvG0NLg",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",34,[[2,"Bone006",-83,[0,"65QAhjUVBAtLwEci9t05Ey",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"e75gT5ogJMOoh/2sggS7OQ",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",7,[[7,-84,[4,"87exLhmM1P35jx6GLN7j5f"],[10],[8],6,11,12]],[0,"60njdFxDhJWowG9HZr9kRy",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",7,[-85],[0,"dfSzBMugdCkL5lyChYPcpt",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",37,[[2,"Bone003",-86,[0,"91jR835RZHKbRhzSn1x2pJ",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"3bw6IJ5hBJ0aqjcninjsA3",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",7,[-87],[0,"36km6+kJtJZ4iiy8pwU3RO",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",39,[[2,"Bone006",-88,[0,"977HJ5Wy5HiapZRnYB3I8X",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"3da6ppQblGu7DGQDIjczFt",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",9,[[7,-89,[4,"dduLonFhNK+q908BUlLM7f"],[15],[8],8,16,17]],[0,"f2zxp5nX1CJq18JC2EndYO",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",9,[-90],[0,"3c+BtM6atJC4XerbYlNlM0",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",42,[[2,"Bone003",-91,[0,"baL59AVvRKlKmpQqSjNAYI",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"89NJAVd1tBZ6C0iX/YbeY2",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",9,[-92],[0,"9byDe6eNtGPIztX4VSZKlQ",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",44,[[2,"Bone006",-93,[0,"6fAgsRfRRHeoZrCvNeGhDK",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"8exO45eF5F2KzRxFbNE1M/",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",11,[[7,-94,[4,"af0f1GeGlKf5MvKMEuH8MJ"],[20],[8],10,21,22]],[0,"a2WxB7prNBKZLuuRtE7RC2",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",11,[-95],[0,"d9cSWZZzxJ0JJz3NZ3KYKr",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",47,[[2,"Bone003",-96,[0,"65JgfqDUlBhq62ZblXl99a",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"613BOOO+hIlqnTjr1LZ7yD",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",11,[-97],[0,"daMGy+QoZIMbYWUh1/PBDR",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",49,[[2,"Bone006",-98,[0,"4bzVNkn1hF04sTb5BrBwWZ",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"aea82LsKdAiqVuBFPi2Vfz",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",13,[[7,-99,[4,"e9BPt5G81CloUmA5IJNHIQ"],[25],[8],12,26,27]],[0,"32O+zfC79Ly5/JDvR+zPy3",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",13,[-100],[0,"2csxgVNAlDEIWU7lnXQfKS",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",52,[[2,"Bone003",-101,[0,"f31n3srf1OQ6ztTn+Z0+bi",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"39pnXuaeZGe5VqFTUXoXAo",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",13,[-102],[0,"e1Z+TO4odC37Bc8FKLNniF",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",54,[[2,"Bone006",-103,[0,"c8HIUzEBxJx72ffmHr7Yzh",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"82tqRzYDNKi6iXruWWHldm",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",15,[[7,-104,[4,"7dt8ZZ5EBNDIxOgpt1XbGu"],[30],[8],14,31,32]],[0,"3c/GljN9JNKpGUQDJiCaAz",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",15,[-105],[0,"17tlC2EGZMWoKAixVNAp0A",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",57,[[2,"Bone003",-106,[0,"9fnTS8hnVIWqrzTdhgEpre",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"77DlSvZMVCFLNlyGWiwIha",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",15,[-107],[0,"d1EnMgh6RE7o+kI5cUNlG0",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",59,[[2,"Bone006",-108,[0,"8cUixi2TpMHINjSklAPeYi",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"b7XmnH2bBCVpvgTAKnVXA2",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",17,[[7,-109,[4,"c4Nekl9YtKUKupS0ASX7It"],[35],[8],16,36,37]],[0,"43yCcO1I5D6qP+LJIIGKjX",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",17,[-110],[0,"0aJTcuk/5M56nEkb+D7tN9",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",62,[[2,"Bone003",-111,[0,"d5T2sohQVAEa4ljoSzlMKU",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"93hV+qqgFP44pIvuByy6RE",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",17,[-112],[0,"6etpava3ZGlovr3HG7SpRo",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",64,[[2,"Bone006",-113,[0,"6c2sTe+khLGYrsZVSADL4H",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"ecsSU+lvpNf7DhOOeFG7w2",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",19,[[7,-114,[4,"b9cuhcVRxPvZTPHcAyE7eS"],[40],[8],18,41,42]],[0,"87cW2HzEtNk4+RMW95NbLB",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",19,[-115],[0,"16ssZzbLdO76GQg4Dvdp/y",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",67,[[2,"Bone003",-116,[0,"5bcVkwfGRPza49BU4T6rqn",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"fcqb+cLDVJ3KNvBTyJYBwm",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",19,[-117],[0,"0eRKfLOh9OdLsOOjTosv1c",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",69,[[2,"Bone006",-118,[0,"0b/yPLcR1FiZPqyfaG8HBZ",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"0fPapM97RGmYmlB69FuuSF",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",21,[[7,-119,[4,"f3T3OFBBJBYrGbPSQ+k7GJ"],[45],[8],20,46,47]],[0,"08LJZ1ezRCiqnszI5cXQTx",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",21,[-120],[0,"c9g0zchT9L8IQmY+99TABR",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",72,[[2,"Bone003",-121,[0,"d8OdalQsZKwLFf2mFuR1VJ",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"ecFy8CTgxCib8Fky/YcoUL",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",21,[-122],[0,"91+xPZxDtGRp/x7cNrBUhM",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",74,[[2,"Bone006",-123,[0,"66R8TA3S1NT4HLywjDiP1Q",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"963dgjTmdES7q6KBvCTllJ",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",23,[[7,-124,[4,"d0A5LfhGhAfrDnBGJ3JzOe"],[50],[8],22,51,52]],[0,"203+J3Vb1LP7KUgkjLvNtX",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",23,[-125],[0,"9eOEdVVahA+rbDiF4AJNNX",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",77,[[2,"Bone003",-126,[0,"3aJII/zG9KaYapX0uizphW",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"48r+NZR1BD7Y5qEv/ruQsO",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",23,[-127],[0,"469eCD0ttKHZacZ3xtfeuD",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",79,[[2,"Bone006",-128,[0,"1fFpy0ihVOYbzhBLRLkL1Y",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"d9iCqzyppAILXebiHSqtDk",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[6,"grass",25,[[7,-129,[4,"161SEdWiFO/abXxUI8RkYk"],[55],[8],24,56,57]],[0,"80TsYKkUVBAIbPGc2Ao+X4",null,null,null,1,0],[3,0.37992816729770207,0.5963678291908521,0.5963678291908521,-0.37992816729770207],[1,0.614784121513367,0.614784121513367,0.614784121513367],[1,-90,-115.0000056286655,0]],[1,"Bone001",25,[-130],[0,"54j/6cneBCF4PpXQIO+ZrT",null,null,null,1,0],[1,-0.0461842827498913,0.0000118009265861474,-0.0284814611077309],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone002",82,[[2,"Bone003",-131,[0,"6aDs2ciZhDh6tahiNmO4QO",null,null,null,1,0],[1,0.0397140197455883,-1.19209286886246e-9,7.15255721317476e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"1er+9JvftCj5j548DE5PNk",null,null,null,1,0],[1,0.0404664427042007,-3.57627860658738e-9,0],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]],[1,"Bone004",25,[-132],[0,"c8ON8aNTZH1YV9KZsolNGO",null,null,null,1,0],[1,0.0710692703723907,0.0000118009265861474,0.0136896027252078],[3,-0.0000017283479103639154,-0.000001696768662714476,0.7049074170330618,0.7092993256770451],[1,2.53999996185303,2.53999996185303,2.53999996185303],[1,-0.0005507418826256091,0.00027320859410338513,89.64412979694991]],[3,"Bone005",84,[[2,"Bone006",-133,[0,"1eZ45FwjhMoY5AmDd/ApaW",null,null,null,1,0],[1,0.039714016020298,0,7.74860353658369e-9],[3,1.4018830392883508e-10,-1.4662893682703937e-13,-0.0010459420626472054,0.9999994530024512],[1,1.606440509162768e-8,-1.4726229276075984e-18,-0.11985615346346049]]],[0,"7fkJUsKFZMHbutZKiHcKAf",null,null,null,1,0],[1,0.0404664427042007,-4.76837147544984e-9,5.9604643443123e-10],[3,0.000002421418716486127,1.5182564735607207e-8,0.006269989150778519,0.9999803434219023],[1,0.000277479600078167,-3.18993241527229e-13,0.7184925395739944]]],0,[0,5,1,0,-1,2,0,-2,4,0,-3,6,0,-4,8,0,-5,10,0,-6,12,0,-7,14,0,-8,16,0,-9,18,0,-10,20,0,-11,22,0,-12,24,0,0,2,0,-1,3,0,-1,26,0,-2,27,0,-3,29,0,0,4,0,-1,5,0,-1,31,0,-2,32,0,-3,34,0,0,6,0,-1,7,0,-1,36,0,-2,37,0,-3,39,0,0,8,0,-1,9,0,-1,41,0,-2,42,0,-3,44,0,0,10,0,-1,11,0,-1,46,0,-2,47,0,-3,49,0,0,12,0,-1,13,0,-1,51,0,-2,52,0,-3,54,0,0,14,0,-1,15,0,-1,56,0,-2,57,0,-3,59,0,0,16,0,-1,17,0,-1,61,0,-2,62,0,-3,64,0,0,18,0,-1,19,0,-1,66,0,-2,67,0,-3,69,0,0,20,0,-1,21,0,-1,71,0,-2,72,0,-3,74,0,0,22,0,-1,23,0,-1,76,0,-2,77,0,-3,79,0,0,24,0,-1,25,0,-1,81,0,-2,82,0,-3,84,0,0,26,0,-1,28,0,1,28,0,-1,30,0,1,30,0,0,31,0,-1,33,0,1,33,0,-1,35,0,1,35,0,0,36,0,-1,38,0,1,38,0,-1,40,0,1,40,0,0,41,0,-1,43,0,1,43,0,-1,45,0,1,45,0,0,46,0,-1,48,0,1,48,0,-1,50,0,1,50,0,0,51,0,-1,53,0,1,53,0,-1,55,0,1,55,0,0,56,0,-1,58,0,1,58,0,-1,60,0,1,60,0,0,61,0,-1,63,0,1,63,0,-1,65,0,1,65,0,0,66,0,-1,68,0,1,68,0,-1,70,0,1,70,0,0,71,0,-1,73,0,1,73,0,-1,75,0,1,75,0,0,76,0,-1,78,0,1,78,0,-1,80,0,1,80,0,0,81,0,-1,83,0,1,83,0,-1,85,0,1,85,0,6,1,133],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4,-1,2,3,-1,4],[1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0,1,2,3,0,0]],[[[15,"Skin-0",753820634,["RootNode/Bone004/Bone005/Bone006","RootNode/Bone004/Bone005","RootNode/Bone004","RootNode/Bone001/Bone002/Bone003","RootNode/Bone001/Bone002","RootNode/Bone001"],[[[7,0.0004333891556598246,0.10229005664587021,0.21936364471912384,0,-0.0009294628980569541,-0.21936167776584625,0.10229097306728363,0,0.24203883111476898,-0.0010255376109853387,2.406476085070608e-8,0,-0.08006425946950912,0.028319520875811577,-0.005389618221670389,1],[7,0.0006473671528510749,0.10228893905878067,0.21936364471912384,0,-0.001388339907862246,-0.21935929358005524,0.10229097306728363,0,0.24203617870807648,-0.0015318524092435837,2.4064471304541257e-8,0,-0.04029082506895065,0.0284869447350502,-0.005389610305428505,1],[7,-0.0006353461649268866,0.10228794068098068,0.21936413645744324,0,0.0013624817365780473,-0.21935993432998657,0.10228990018367767,0,0.2420363426208496,0.0015033365925773978,1.664581716909197e-8,0,-0.0001784319174475968,0.02797948755323887,-0.0053894720040261745,1],[7,0.0004333891556598246,0.10229005664587021,0.21936364471912384,0,-0.0009294628980569541,-0.21936167776584625,0.10229097306728363,0,0.24203883111476898,-0.0010255376109853387,2.406476085070608e-8,0,-0.08025984466075897,-0.017842883244156837,0.01121316384524107,1],[7,0.0006473671528510749,0.10228893905878067,0.21936364471912384,0,-0.001388339907862246,-0.21935929358005524,0.10229097306728363,0,0.24203617870807648,-0.0015318524092435837,2.4064471304541257e-8,0,-0.040582988411188126,-0.017674952745437622,0.011213171295821667,1],[7,-0.0006353461649268866,0.10228794068098068,0.21936413645744324,0,0.0013624817365780473,-0.21935993432998657,0.10228990018367767,0,0.2420363426208496,0.0015033365925773978,1.664581716909197e-8,0,0.00010828844096977264,-0.01818251982331276,0.011213085614144802,1]],8,8,8,8,8,8]]],0,0,[],[],[]],[[[16,".bin",891374575,[{"primitives":[{"primitiveMode":7,"jointMapIndex":0,"vertexBundelIndices":[0],"indexView":{"offset":8080,"length":462,"count":231,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":8080,"count":101,"stride":80},"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_joints","format":42,"isNormalized":false},{"name":"a_weights","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"jointMaps":[[0,1,2,3,4,5]]},"minPosition",8,[1,-0.23816974461078644,-0.3651643395423889,-0.02080436609685421],"maxPosition",8,[1,0.2359408587217331,0.26479941606521606,0.6728445887565613]]],-1],0,0,[],[],[]],[[[17,"grass",[{"blendState":{"targets":[{}]},"depthStencilState":{},"rasterizerState":{}}],[{"USE_TEXTURE":true}],[[[{"alphaThreshold":0},"mainTexture",6,0]],11]]],0,0,[0,0],[7,8],[4,5]]]] diff --git a/cocos_view_pod/Assets/assets/main/import/07/0718d996-39bf-4ab4-bb63-496666fef467.json b/cocos_view_pod/Assets/assets/main/import/07/0718d996-39bf-4ab4-bb63-496666fef467.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/07/0718d996-39bf-4ab4-bb63-496666fef467.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/import/0a/0a40fbfd0.json b/cocos_view_pod/Assets/assets/main/import/0a/0a40fbfd0.json new file mode 100644 index 0000000..df6869c --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/0a/0a40fbfd0.json @@ -0,0 +1 @@ +{"type":"cc.Texture2D","data":[["2,2,0,0,0,0",["4fTEo0LQhKTZFpg0186Czu"]],["2,2,0,0,0,0",["6fiRp7WghI5phB3bNkrIax"]],["2,2,0,0,0,0",["955bAq4zhCPL27F0htsdnr"]],["2,2,0,0,0,0",["07GNmWOb9KtLtjSWZm/vRn"]],["2,2,0,0,2,0",["aeGN7qxuBKPb9w7lUz+bqH"]],["2,2,0,0,0,0",["c5CD51rS5OqYsz3udImVsA"]]]} diff --git a/cocos_view_pod/Assets/assets/main/import/0a/0a9f2beb8.json b/cocos_view_pod/Assets/assets/main/import/0a/0a9f2beb8.json new file mode 100644 index 0000000..6644513 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/0a/0a9f2beb8.json @@ -0,0 +1 @@ +[1,["0asxQqaWhAc5WvAmvDsjYj@2df3a","1brw/JvvpFnIvdrxpFCgMZ"],["mainTexture","_effectAsset"],[["cc.EffectAsset",["_name","shaders","techniques"],0],["cc.Material",["_name","_states","_defines","_props"],0,12]],[[0,0,1,2,4],[1,0,1,2,3,4]],[[[[0,"legacy/standard",[{"hash":566880691,"name":"legacy/standard|standard-vs|standard-fs","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"]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":7,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":8,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":9,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]},{"name":"a_color","format":44,"location":17,"defines":["USE_VERTEX_COLOR"]},{"name":"a_texCoord1","format":21,"location":18,"defines":[]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":["CC_FORWARD_ADD"]},{"name":"albedoOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":1,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]},{"name":"emissiveOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":2,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]},{"name":"normalOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":3,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":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"]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":7,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":8,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":9,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout StandardVertInput In)\n{\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.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\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};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) out mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nlayout(location = 1) out highp vec4 v_shadowPos;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\nvec2 CCGetShadowBias()\n{\n #if USE_INSTANCING\n return vec2(a_localShadowBiasAndProbeId.x + cc_shadowWHPBInfo.w, a_localShadowBiasAndProbeId.y + cc_shadowLPNNInfo.z);\n #else\n return vec2(cc_localShadowBias.x + cc_shadowWHPBInfo.w, cc_localShadowBias.y + cc_shadowLPNNInfo.z);\n #endif\n}\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 2) out mediump vec4 v_sh_linear_const_r;\n layout(location = 3) out mediump vec4 v_sh_linear_const_g;\n layout(location = 4) out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\nvoid CC_TRANSFER_SH() {\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\n#if USE_VERTEX_COLOR\n layout(location = 17) in vec4 a_color;\n layout(location = 5) out lowp vec4 v_color;\n#endif\nlayout(location = 6) out vec3 v_position;\nlayout(location = 7) out vec3 v_normal;\nlayout(location = 8) out vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 9) out mediump vec2 v_uv1;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 10) out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 11) out mediump vec4 v_reflectionProbeData;\n#endif\n#if USE_NORMAL_MAP\n layout(location = 12) out mediump vec4 v_tangent;\n#endif\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 18) in vec2 a_texCoord1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 13) out vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n v_luv.z = cc_lightingMapUVParam.w;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n v_luv.z = a_lightingMapUVParam.w;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if CC_RECEIVE_SHADOW\n v_shadowBiasAndProbeId.xy = CCGetShadowBias();\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n v_shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n v_shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n #if USE_TWOSIDE\n vec3 viewDirect = normalize(cc_cameraPos.xyz - v_position);\n v_normal *= dot(v_normal, viewDirect) < 0.0 ? -1.0 : 1.0;\n #endif\n #if USE_NORMAL_MAP\n v_tangent.xyz = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_tangent.w = 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 CC_TRANSFER_FOG(pos);\n v_shadowPos = cc_matLightViewProj * pos;\n CC_TRANSFER_SH();\n #if CC_USE_LIGHTMAP && !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 mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\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};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = 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 (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - 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 }\n else {\n fDeltaY = abs(fogTop - 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 }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) in mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\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}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 2) in mediump vec4 v_sh_linear_const_r;\n layout(location = 3) in mediump vec4 v_sh_linear_const_g;\n layout(location = 4) in mediump vec4 v_sh_linear_const_b;\n #else\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\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 / max(EPSILON, 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 max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\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_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(location = 1) in highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 13) in vec3 v_luv;\n layout(set = 2, binding = 11) uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n#endif\nlayout(location = 6) in vec3 v_position;\nlayout(location = 8) in vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 9) in mediump vec2 v_uv1;\n#endif\nlayout(location = 7) in vec3 v_normal;\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 10) in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 11) in mediump vec4 v_reflectionProbeData;\n#endif\n#if USE_VERTEX_COLOR\n layout(location = 5) in lowp 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 = 12) in mediump vec4 v_tangent;\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.rgb *= SRGBToLinear(v_color.rgb);\n baseColor.a *= v_color.a;\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 s.normal = v_normal;\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBiasAndProbeId.xy;\n #endif\n #if CC_USE_REFLECTION_PROBE\n s.reflectionProbeId = v_shadowBiasAndProbeId.z;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n s.reflectionProbeBlendId = v_shadowBiasAndProbeId.w;\n #if USE_INSTANCING\n s.reflectionProbeBlendFactor = v_reflectionProbeData.x;\n #else\n s.reflectionProbeBlendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n #endif\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n vec3 bitangent = cross(v_normal, v_tangent.xyz) * (v_tangent.w > 0.0 ? 1.0 : -1.0);\n s.normal =\n (nmmp.x * emissiveScaleParam.w) * normalize(v_tangent.xyz) +\n (nmmp.y * emissiveScaleParam.w) * normalize(bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, v_luv.xy, v_luv.z, s.normal);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, PBR_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\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 = mix(1.0, texture(occlusionMap, PBR_UV).r, pbrParams.x);\n #endif\n s.occlusion = pbr.x;\n s.roughness = pbr.y;\n s.metallic = pbr.z;\n s.specularIntensity = pbr.w;\n s.emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n s.emissive = SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n s.emissive *= emissiveScaleParam.xyz;\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 #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\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 vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\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 float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\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 / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\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 = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\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 }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, set = 1, binding = 7) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, set = 1, binding = 8) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, set = 1, binding = 9) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (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 / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - 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 uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - 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 = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n }\n layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n StandardSurface s; surf(s);\n albedoOut = s.albedo;\n normalOut = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n emissiveOut = vec4(s.emissive, s.occlusion);\n }\n#endif"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":137,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":126}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"number","range":[0,3]},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"HAS_SECOND_UV","type":"boolean"},{"name":"USE_NORMAL_MAP","type":"boolean"},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"USE_TWOSIDE","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_HDR","type":"boolean"},{"name":"USE_REFLECTION_DENOISE","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_LIGHT_MAP_VERSION","type":"number","range":[0,3]},{"name":"USE_ALBEDO_MAP","type":"boolean"},{"name":"ALBEDO_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"NORMAL_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"PBR_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_PBR_MAP","type":"boolean"},{"name":"USE_METALLIC_ROUGHNESS_MAP","type":"boolean"},{"name":"USE_OCCLUSION_MAP","type":"boolean"},{"name":"USE_EMISSIVE_MAP","type":"boolean"},{"name":"EMISSIVE_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r"]},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]}]},{"hash":651493757,"name":"legacy/standard|shadow-caster-vs:vert|shadow-caster-fs:frag","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"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]},{"name":"a_texCoord1","format":21,"location":17,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":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"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]},{"name":"CCGlobal","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":["CC_RECEIVE_SHADOW"]},{"name":"CCCamera","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":["CC_RECEIVE_SHADOW"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout StandardVertInput In)\n{\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.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\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(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 17) in vec2 a_texCoord1;\n#endif\nlayout(location = 0) out vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 1) out vec2 v_uv1;\n#endif\nlayout(location = 2) out vec4 v_worldPos;\nlayout(location = 3) out highp vec2 v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\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.zw;\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, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\nlayout(location = 0) in vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 1) in vec2 v_uv1;\n#endif\nlayout(location = 2) in vec4 v_worldPos;\nlayout(location = 3) in highp vec2 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_ALPHA_TEST\n #if USE_ALBEDO_MAP\n baseColor *= texture(albedoMap, ALBEDO_UV);\n #endif\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(v_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]},{"name":"CCGlobal","defines":["CC_RECEIVE_SHADOW"]},{"name":"CCCamera","defines":["CC_RECEIVE_SHADOW"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":54,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":105}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"HAS_SECOND_UV","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"USE_ALBEDO_MAP","type":"boolean"},{"name":"ALBEDO_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r"]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]}]},{"hash":3680218420,"name":"legacy/standard|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl4":{"vert":"#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\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_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\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 vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = 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 #if CC_USE_BAKED_ANIMATION\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 = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, 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 highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, 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 #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\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 float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\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 #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 vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\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 vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nlayout(location = 0) out float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\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_surfaceTransform;\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 mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"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","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"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_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":90,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":58}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"name":"opaque","passes":[{"program":"legacy/standard|standard-vs|standard-fs","properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[0],"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.5],"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0],"handleInfo":["pbrParams",2,13]},"specularIntensity":{"type":13,"value":[0.5],"handleInfo":["pbrParams",3,13]},"emissive":{"linear":true,"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"normalStrength":{"type":13,"value":[1],"handleInfo":["emissiveScaleParam",3,13]},"mainTexture":{"value":"grey","type":28,"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,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"pbrParams":{"type":16,"value":[0,0.5,0,0.5]},"emissiveScaleParam":{"type":16,"value":[1,1,1,1]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"forward-add","propertyIndex":0,"program":"legacy/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}},{"phase":"shadow-caster","propertyIndex":0,"program":"legacy/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],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"mainTexture":{"value":"grey","type":28,"handleInfo":["albedoMap",0,28]},"albedo":{"type":16,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"planar-shadow","propertyIndex":0,"program":"legacy/standard|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"pass":"gbuffer","phase":"gbuffer","propertyIndex":0,"program":"legacy/standard|standard-vs|standard-fs","embeddedMacros":{"CC_PIPELINE_TYPE":1}}]},{"name":"transparent","passes":[{"program":"legacy/standard|standard-vs|standard-fs","embeddedMacros":{"CC_FORCE_FORWARD_SHADING":true},"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":{"linear":true,"type":16,"value":[1,1,1,1],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[0],"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.5],"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0],"handleInfo":["pbrParams",2,13]},"specularIntensity":{"type":13,"value":[0.5],"handleInfo":["pbrParams",3,13]},"emissive":{"linear":true,"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"normalStrength":{"type":13,"value":[1],"handleInfo":["emissiveScaleParam",3,13]},"mainTexture":{"value":"grey","type":28,"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,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"pbrParams":{"type":16,"value":[0,0.5,0,0.5]},"emissiveScaleParam":{"type":16,"value":[1,1,1,1]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"forward-add","propertyIndex":0,"program":"legacy/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}},{"phase":"shadow-caster","propertyIndex":0,"program":"legacy/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],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"mainTexture":{"value":"grey","type":28,"handleInfo":["albedoMap",0,28]},"albedo":{"type":16,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"planar-shadow","propertyIndex":0,"program":"legacy/standard|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"legacy/standard|standard-vs|standard-fs","embeddedMacros":{"CC_PIPELINE_TYPE":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"seafloor",[{"rasterizerState":{},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true}],[[[{"metallic":0.400000005960464,"roughness":0.70710676908493,"alphaThreshold":0},"albedoScale",8,[1,1,1,1],"mainTexture",6,0]],11]]],0,0,[0,0],[0,1],[0,1]]]] diff --git a/cocos_view_pod/Assets/assets/main/import/0d/0d0d3c8df.json b/cocos_view_pod/Assets/assets/main/import/0d/0d0d3c8df.json new file mode 100644 index 0000000..1484f38 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/0d/0d0d3c8df.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset","cc.TextureCube"],0,[[[{"base":"2,2,0,0,2,1","rgbe":false,"mipmaps":[{"front":"5a8gG1WVFOLKgfrEqtkTLL@b47c0@e9a6d","back":"5a8gG1WVFOLKgfrEqtkTLL@b47c0@40c10","left":"5a8gG1WVFOLKgfrEqtkTLL@b47c0@8fd34","right":"5a8gG1WVFOLKgfrEqtkTLL@b47c0@74afd","top":"5a8gG1WVFOLKgfrEqtkTLL@b47c0@bb97f","bottom":"5a8gG1WVFOLKgfrEqtkTLL@b47c0@7d38f"}]}],[1],0,[],[],[]],[[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]]] diff --git a/cocos_view_pod/Assets/assets/main/import/4f/4f4c4a34-2d08-4a4d-9169-834d7ce82cee.json b/cocos_view_pod/Assets/assets/main/import/4f/4f4c4a34-2d08-4a4d-9169-834d7ce82cee.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/4f/4f4c4a34-2d08-4a4d-9169-834d7ce82cee.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/import/6f/6f891a7b-5a08-48e6-9841-ddb364ac86b1.json b/cocos_view_pod/Assets/assets/main/import/6f/6f891a7b-5a08-48e6-9841-ddb364ac86b1.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/6f/6f891a7b-5a08-48e6-9841-ddb364ac86b1.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/import/95/95e5b02a-e338-423c-bdbb-17486db1d9eb.json b/cocos_view_pod/Assets/assets/main/import/95/95e5b02a-e338-423c-bdbb-17486db1d9eb.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/95/95e5b02a-e338-423c-bdbb-17486db1d9eb.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/import/aa/aade09ee-8f9d-413c-a9e8-8c686ea5e160@73b7f.bin b/cocos_view_pod/Assets/assets/main/import/aa/aade09ee-8f9d-413c-a9e8-8c686ea5e160@73b7f.bin new file mode 100644 index 0000000..e447d58 Binary files /dev/null and b/cocos_view_pod/Assets/assets/main/import/aa/aade09ee-8f9d-413c-a9e8-8c686ea5e160@73b7f.bin differ diff --git a/cocos_view_pod/Assets/assets/main/import/aa/aade09ee-8f9d-413c-a9e8-8c686ea5e160@73b7f.json b/cocos_view_pod/Assets/assets/main/import/aa/aade09ee-8f9d-413c-a9e8-8c686ea5e160@73b7f.json new file mode 100644 index 0000000..735ab9e --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/aa/aade09ee-8f9d-413c-a9e8-8c686ea5e160@73b7f.json @@ -0,0 +1 @@ +{"version":1,"document":[{"__type__":"cc.AnimationClip","_name":"Take 001","_objFlags":0,"__editorExtras__":{},"_native":"","sample":30,"speed":1,"wrapMode":2,"enableTrsBlending":true,"_duration":3.3333332538604736,"_hash":745456618,"_tracks":[],"_exoticAnimation":{"__id__":1},"_events":[],"_embeddedPlayers":[],"_additiveSettings":{"__id__":58},"_auxiliaryCurveEntries":[]},{"__type__":"cc.animation.ExoticAnimation","_nodeAnimations":[{"__id__":2},{"__id__":9},{"__id__":16},{"__id__":23},{"__id__":30},{"__id__":37},{"__id__":44},{"__id__":51}]},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bone001","_position":{"__id__":3},"_rotation":{"__id__":5},"_scale":{"__id__":7}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":0,"length":1},"values":{"__id__":4}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16,"length":81},"values":{"__id__":6}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":340,"length":324},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1636,"length":1},"values":{"__id__":8}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1640,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bone001/Bone002","_position":{"__id__":10},"_rotation":{"__id__":12},"_scale":{"__id__":14}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1652,"length":1},"values":{"__id__":11}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1656,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1668,"length":81},"values":{"__id__":13}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1992,"length":324},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3288,"length":1},"values":{"__id__":15}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3292,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bone001/Bone002/Bone003","_position":{"__id__":17},"_rotation":{"__id__":19},"_scale":{"__id__":21}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3304,"length":1},"values":{"__id__":18}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3308,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3320,"length":81},"values":{"__id__":20}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3644,"length":324},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4940,"length":1},"values":{"__id__":22}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4944,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bone004","_position":{"__id__":24},"_rotation":{"__id__":26},"_scale":{"__id__":28}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4956,"length":1},"values":{"__id__":25}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4960,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4972,"length":81},"values":{"__id__":27}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5296,"length":324},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6592,"length":1},"values":{"__id__":29}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6596,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bone004/Bone005","_position":{"__id__":31},"_rotation":{"__id__":33},"_scale":{"__id__":35}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6608,"length":1},"values":{"__id__":32}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6612,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6624,"length":81},"values":{"__id__":34}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6948,"length":324},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8244,"length":1},"values":{"__id__":36}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8248,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bone004/Bone005/Bone006","_position":{"__id__":38},"_rotation":{"__id__":40},"_scale":{"__id__":42}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8260,"length":1},"values":{"__id__":39}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8264,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8276,"length":81},"values":{"__id__":41}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8600,"length":324},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9896,"length":1},"values":{"__id__":43}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9900,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode","_position":{"__id__":45},"_rotation":{"__id__":47},"_scale":{"__id__":49}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9912,"length":1},"values":{"__id__":46}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9916,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9928,"length":1},"values":{"__id__":48}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9932,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9948,"length":1},"values":{"__id__":50}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9952,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/grass","_position":{"__id__":52},"_rotation":{"__id__":54},"_scale":{"__id__":56}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9964,"length":1},"values":{"__id__":53}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9968,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9980,"length":1},"values":{"__id__":55}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9984,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10000,"length":1},"values":{"__id__":57}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10004,"length":3},"_isQuantized":false},{"__type__":"cc.AnimationClipAdditiveSettings","enabled":false,"refClip":null}],"chunks":[".bin"]} diff --git a/cocos_view_pod/Assets/assets/main/import/ae/ae18deea-c6e0-4a3d-bf70-ee5533f9ba87.json b/cocos_view_pod/Assets/assets/main/import/ae/ae18deea-c6e0-4a3d-bf70-ee5533f9ba87.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/ae/ae18deea-c6e0-4a3d-bf70-ee5533f9ba87.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/import/c5/c5083e75-ad2e-4ea9-8b33-dee748995b00.json b/cocos_view_pod/Assets/assets/main/import/c5/c5083e75-ad2e-4ea9-8b33-dee748995b00.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/c5/c5083e75-ad2e-4ea9-8b33-dee748995b00.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/import/e3/e3553cad-2f15-4293-859a-8f43c780f289@73b7f.bin b/cocos_view_pod/Assets/assets/main/import/e3/e3553cad-2f15-4293-859a-8f43c780f289@73b7f.bin new file mode 100644 index 0000000..ea9c42b Binary files /dev/null and b/cocos_view_pod/Assets/assets/main/import/e3/e3553cad-2f15-4293-859a-8f43c780f289@73b7f.bin differ diff --git a/cocos_view_pod/Assets/assets/main/import/e3/e3553cad-2f15-4293-859a-8f43c780f289@73b7f.json b/cocos_view_pod/Assets/assets/main/import/e3/e3553cad-2f15-4293-859a-8f43c780f289@73b7f.json new file mode 100644 index 0000000..3644a45 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/e3/e3553cad-2f15-4293-859a-8f43c780f289@73b7f.json @@ -0,0 +1 @@ +{"version":1,"document":[{"__type__":"cc.AnimationClip","_name":"Take 001","_objFlags":0,"__editorExtras__":{},"_native":"","sample":30,"speed":1,"wrapMode":2,"enableTrsBlending":true,"_duration":1.3000000397364297,"_hash":3067012107,"_tracks":[],"_exoticAnimation":{"__id__":1},"_events":[],"_embeddedPlayers":[],"_additiveSettings":{"__id__":233},"_auxiliaryCurveEntries":[]},{"__type__":"cc.animation.ExoticAnimation","_nodeAnimations":[{"__id__":2},{"__id__":9},{"__id__":16},{"__id__":23},{"__id__":30},{"__id__":37},{"__id__":44},{"__id__":51},{"__id__":58},{"__id__":65},{"__id__":72},{"__id__":79},{"__id__":86},{"__id__":93},{"__id__":100},{"__id__":107},{"__id__":114},{"__id__":121},{"__id__":128},{"__id__":135},{"__id__":142},{"__id__":149},{"__id__":156},{"__id__":163},{"__id__":170},{"__id__":177},{"__id__":184},{"__id__":191},{"__id__":198},{"__id__":205},{"__id__":212},{"__id__":219},{"__id__":226}]},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001","_position":{"__id__":3},"_rotation":{"__id__":5},"_scale":{"__id__":7}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":0,"length":33},"values":{"__id__":4}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":132,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":528,"length":33},"values":{"__id__":6}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":660,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1188,"length":1},"values":{"__id__":8}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1192,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Footsteps","_position":{"__id__":10},"_rotation":{"__id__":12},"_scale":{"__id__":14}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1204,"length":33},"values":{"__id__":11}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1336,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1732,"length":33},"values":{"__id__":13}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":1864,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":2392,"length":1},"values":{"__id__":15}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":2396,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine","_position":{"__id__":17},"_rotation":{"__id__":19},"_scale":{"__id__":21}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":2408,"length":33},"values":{"__id__":18}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":2540,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":2936,"length":33},"values":{"__id__":20}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3068,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3596,"length":1},"values":{"__id__":22}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3600,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh","_position":{"__id__":24},"_rotation":{"__id__":26},"_scale":{"__id__":28}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3612,"length":33},"values":{"__id__":25}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":3744,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4140,"length":33},"values":{"__id__":27}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4272,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4800,"length":1},"values":{"__id__":29}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4804,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh/Bip001 L Calf","_position":{"__id__":31},"_rotation":{"__id__":33},"_scale":{"__id__":35}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4816,"length":1},"values":{"__id__":32}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4820,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4832,"length":33},"values":{"__id__":34}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":4964,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5492,"length":1},"values":{"__id__":36}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5496,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh/Bip001 L Calf/Bip001 L Foot","_position":{"__id__":38},"_rotation":{"__id__":40},"_scale":{"__id__":42}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5508,"length":1},"values":{"__id__":39}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5512,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5524,"length":33},"values":{"__id__":41}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":5656,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6184,"length":1},"values":{"__id__":43}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6188,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh/Bip001 L Calf/Bip001 L Foot/Bip001 L Toe0","_position":{"__id__":45},"_rotation":{"__id__":47},"_scale":{"__id__":49}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6200,"length":1},"values":{"__id__":46}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6204,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6216,"length":33},"values":{"__id__":48}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6348,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6876,"length":1},"values":{"__id__":50}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6880,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh","_position":{"__id__":52},"_rotation":{"__id__":54},"_scale":{"__id__":56}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":6892,"length":33},"values":{"__id__":53}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":7024,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":7420,"length":33},"values":{"__id__":55}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":7552,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8080,"length":1},"values":{"__id__":57}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8084,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh/Bip001 R Calf","_position":{"__id__":59},"_rotation":{"__id__":61},"_scale":{"__id__":63}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8096,"length":33},"values":{"__id__":60}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8228,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8624,"length":33},"values":{"__id__":62}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":8756,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9284,"length":1},"values":{"__id__":64}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9288,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh/Bip001 R Calf/Bip001 R Foot","_position":{"__id__":66},"_rotation":{"__id__":68},"_scale":{"__id__":70}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9300,"length":1},"values":{"__id__":67}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9304,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9316,"length":33},"values":{"__id__":69}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9448,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9976,"length":1},"values":{"__id__":71}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9980,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh/Bip001 R Calf/Bip001 R Foot/Bip001 R Toe0","_position":{"__id__":73},"_rotation":{"__id__":75},"_scale":{"__id__":77}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9992,"length":1},"values":{"__id__":74}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":9996,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10008,"length":33},"values":{"__id__":76}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10140,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10668,"length":1},"values":{"__id__":78}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10672,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1","_position":{"__id__":80},"_rotation":{"__id__":82},"_scale":{"__id__":84}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10684,"length":33},"values":{"__id__":81}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":10816,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11212,"length":33},"values":{"__id__":83}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11344,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11872,"length":1},"values":{"__id__":85}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11876,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm","_position":{"__id__":87},"_rotation":{"__id__":89},"_scale":{"__id__":91}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11888,"length":1},"values":{"__id__":88}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11892,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":11904,"length":33},"values":{"__id__":90}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":12036,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":12564,"length":1},"values":{"__id__":92}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":12568,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm","_position":{"__id__":94},"_rotation":{"__id__":96},"_scale":{"__id__":98}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":12580,"length":33},"values":{"__id__":95}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":12712,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13108,"length":33},"values":{"__id__":97}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13240,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13768,"length":1},"values":{"__id__":99}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13772,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand","_position":{"__id__":101},"_rotation":{"__id__":103},"_scale":{"__id__":105}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13784,"length":1},"values":{"__id__":102}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13788,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13800,"length":33},"values":{"__id__":104}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":13932,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":14460,"length":1},"values":{"__id__":106}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":14464,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm","_position":{"__id__":108},"_rotation":{"__id__":110},"_scale":{"__id__":112}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":14476,"length":1},"values":{"__id__":109}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":14480,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":14492,"length":33},"values":{"__id__":111}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":14624,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":15152,"length":1},"values":{"__id__":113}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":15156,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm","_position":{"__id__":115},"_rotation":{"__id__":117},"_scale":{"__id__":119}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":15168,"length":33},"values":{"__id__":116}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":15300,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":15696,"length":33},"values":{"__id__":118}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":15828,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16356,"length":1},"values":{"__id__":120}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16360,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand","_position":{"__id__":122},"_rotation":{"__id__":124},"_scale":{"__id__":126}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16372,"length":1},"values":{"__id__":123}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16376,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16388,"length":33},"values":{"__id__":125}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":16520,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17048,"length":1},"values":{"__id__":127}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17052,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/shield01","_position":{"__id__":129},"_rotation":{"__id__":131},"_scale":{"__id__":133}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17064,"length":33},"values":{"__id__":130}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17196,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17592,"length":1},"values":{"__id__":132}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17596,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17612,"length":1},"values":{"__id__":134}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17616,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 Head","_position":{"__id__":136},"_rotation":{"__id__":138},"_scale":{"__id__":140}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17628,"length":1},"values":{"__id__":137}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17632,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17644,"length":33},"values":{"__id__":139}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":17776,"length":132},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18304,"length":1},"values":{"__id__":141}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18308,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 Head/Bip001 HeadNub","_position":{"__id__":143},"_rotation":{"__id__":145},"_scale":{"__id__":147}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18320,"length":33},"values":{"__id__":144}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18452,"length":99},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18848,"length":1},"values":{"__id__":146}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18852,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18868,"length":1},"values":{"__id__":148}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18872,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode","_position":{"__id__":150},"_rotation":{"__id__":152},"_scale":{"__id__":154}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18884,"length":1},"values":{"__id__":151}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18888,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18900,"length":1},"values":{"__id__":153}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18904,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18920,"length":1},"values":{"__id__":155}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18924,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/soldier","_position":{"__id__":157},"_rotation":{"__id__":159},"_scale":{"__id__":161}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18936,"length":1},"values":{"__id__":158}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18940,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18952,"length":1},"values":{"__id__":160}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18956,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18972,"length":1},"values":{"__id__":162}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18976,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis","_position":{"__id__":164},"_rotation":{"__id__":166},"_scale":{"__id__":168}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18988,"length":1},"values":{"__id__":165}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":18992,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19004,"length":1},"values":{"__id__":167}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19008,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19024,"length":1},"values":{"__id__":169}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19028,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Thigh/Bip001 L Calf/Bip001 L Foot/Bip001 L Toe0/Bip001 L Toe0Nub","_position":{"__id__":171},"_rotation":{"__id__":173},"_scale":{"__id__":175}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19040,"length":1},"values":{"__id__":172}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19044,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19056,"length":1},"values":{"__id__":174}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19060,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19076,"length":1},"values":{"__id__":176}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19080,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Thigh/Bip001 R Calf/Bip001 R Foot/Bip001 R Toe0/Bip001 R Toe0Nub","_position":{"__id__":178},"_rotation":{"__id__":180},"_scale":{"__id__":182}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19092,"length":1},"values":{"__id__":179}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19096,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19108,"length":1},"values":{"__id__":181}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19112,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19128,"length":1},"values":{"__id__":183}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19132,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck","_position":{"__id__":185},"_rotation":{"__id__":187},"_scale":{"__id__":189}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19144,"length":1},"values":{"__id__":186}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19148,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19160,"length":1},"values":{"__id__":188}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19164,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19180,"length":1},"values":{"__id__":190}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19184,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle","_position":{"__id__":192},"_rotation":{"__id__":194},"_scale":{"__id__":196}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19196,"length":1},"values":{"__id__":193}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19200,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19212,"length":1},"values":{"__id__":195}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19216,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19232,"length":1},"values":{"__id__":197}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19236,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand/sword01","_position":{"__id__":199},"_rotation":{"__id__":201},"_scale":{"__id__":203}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19248,"length":1},"values":{"__id__":200}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19252,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19264,"length":1},"values":{"__id__":202}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19268,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19284,"length":1},"values":{"__id__":204}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19288,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle","_position":{"__id__":206},"_rotation":{"__id__":208},"_scale":{"__id__":210}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19300,"length":1},"values":{"__id__":207}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19304,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19316,"length":1},"values":{"__id__":209}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19320,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19336,"length":1},"values":{"__id__":211}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19340,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/shield","_position":{"__id__":213},"_rotation":{"__id__":215},"_scale":{"__id__":217}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19352,"length":1},"values":{"__id__":214}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19356,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19368,"length":1},"values":{"__id__":216}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19372,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19388,"length":1},"values":{"__id__":218}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19392,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/sword","_position":{"__id__":220},"_rotation":{"__id__":222},"_scale":{"__id__":224}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19404,"length":1},"values":{"__id__":221}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19408,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19420,"length":1},"values":{"__id__":223}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19424,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19440,"length":1},"values":{"__id__":225}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19444,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticNodeAnimation","_path":"RootNode/shield01","_position":{"__id__":227},"_rotation":{"__id__":229},"_scale":{"__id__":231}},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19456,"length":1},"values":{"__id__":228}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19460,"length":3},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19472,"length":1},"values":{"__id__":230}},{"__type__":"cc.animation.ExoticQuatTrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19476,"length":4},"_isQuantized":false},{"__type__":"cc.animation.ExoticTrack","times":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19492,"length":1},"values":{"__id__":232}},{"__type__":"cc.animation.ExoticVec3TrackValues","_values":{"__type__":"TypedArrayRef","ctor":"Float32Array","offset":19496,"length":3},"_isQuantized":false},{"__type__":"cc.AnimationClipAdditiveSettings","enabled":false,"refClip":null}],"chunks":[".bin"]} diff --git a/cocos_view_pod/Assets/assets/main/import/fd/fd8ec536-a354-4a17-9c74-4f3883c378c8.json b/cocos_view_pod/Assets/assets/main/import/fd/fd8ec536-a354-4a17-9c74-4f3883c378c8.json new file mode 100644 index 0000000..2c029ec --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/import/fd/fd8ec536-a354-4a17-9c74-4f3883c378c8.json @@ -0,0 +1 @@ +[1,0,0,[["RenderQueueDesc",["stages","isTransparent","sortMode"],0],["ForwardPipeline",["_flows"],3,9],["ShadowFlow",["_name","_stages"],2,9],["ShadowStage",["_name"],2],["ForwardFlow",["_name","_priority","_stages"],1,9],["ForwardStage",["_name","renderQueues"],2,9]],[[1,0,1],[2,0,1,2],[3,0,2],[4,0,1,2,3],[5,0,1,2],[0,0,2],[0,1,2,0,4]],[[0,[[1,"ShadowFlow",[[2,"ShadowStage"]]],[3,"ForwardFlow",1,[[4,"ForwardStage",[[5,["default"]],[6,true,1,["default"]]]]]]]]],0,0,[],[],[]] diff --git a/cocos_view_pod/Assets/assets/main/index.js b/cocos_view_pod/Assets/assets/main/index.js new file mode 100644 index 0000000..494b452 --- /dev/null +++ b/cocos_view_pod/Assets/assets/main/index.js @@ -0,0 +1,22 @@ +System.register("chunks:///_virtual/debug-view-runtime-control.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,o,i,n,s,l,r,h,g,a,c,p,C,d,m;return{setters:[function(t){e=t.applyDecoratedDescriptor,o=t.initializerDefineProperty},function(t){i=t.cclegacy,n=t.Node,s=t._decorator,l=t.Component,r=t.Color,h=t.Canvas,g=t.UITransform,a=t.instantiate,c=t.Label,p=t.RichText,C=t.Toggle,d=t.Button,m=t.director}],execute:function(){var u,L,M,b,T,f,x,S,E;i._RF.push({},"b2bd1+njXxJxaFY3ymm06WU","debug-view-runtime-control",void 0);const{ccclass:v,property:I}=s;t("DebugViewRuntimeControl",(u=v("internal.DebugViewRuntimeControl"),L=I(n),M=I(n),b=I(n),u((x=e((f=class extends l{constructor(...t){super(...t),o(this,"compositeModeToggle",x,this),o(this,"singleModeToggle",S,this),o(this,"EnableAllCompositeModeButton",E,this),this._single=0,this.strSingle=["No Single Debug","Vertex Color","Vertex Normal","Vertex Tangent","World Position","Vertex Mirror","Face Side","UV0","UV1","UV Lightmap","Project Depth","Linear Depth","Fragment Normal","Fragment Tangent","Fragment Binormal","Base Color","Diffuse Color","Specular Color","Transparency","Metallic","Roughness","Specular Intensity","IOR","Direct Diffuse","Direct Specular","Direct All","Env Diffuse","Env Specular","Env All","Emissive","Light Map","Shadow","AO","Fresnel","Direct Transmit Diffuse","Direct Transmit Specular","Env Transmit Diffuse","Env Transmit Specular","Transmit All","Direct Internal Specular","Env Internal Specular","Internal All","Fog"],this.strComposite=["Direct Diffuse","Direct Specular","Env Diffuse","Env Specular","Emissive","Light Map","Shadow","AO","Normal Map","Fog","Tone Mapping","Gamma Correction","Fresnel","Transmit Diffuse","Transmit Specular","Internal Specular","TT"],this.strMisc=["CSM Layer Coloration","Lighting With Albedo"],this.compositeModeToggleList=[],this.singleModeToggleList=[],this.miscModeToggleList=[],this.textComponentList=[],this.labelComponentList=[],this.textContentList=[],this.hideButtonLabel=void 0,this._currentColorIndex=0,this.strColor=["","","","",""],this.color=[r.WHITE,r.BLACK,r.RED,r.GREEN,r.BLUE]}start(){if(!this.node.parent.getComponent(h))return void console.error("debug-view-runtime-control should be child of Canvas");const t=this.node.parent.getComponent(g),e=.5*t.width,o=.5*t.height;let i=.1*e-e,n=o-.1*o;const s=this.node.getChildByName("MiscMode"),l=a(s);l.parent=this.node,l.name="Buttons";const m=a(s);m.parent=this.node,m.name="Titles";for(let t=0;t<2;t++){const e=a(this.EnableAllCompositeModeButton.getChildByName("Label"));e.setPosition(i+(t>0?450:150),n,0),e.setScale(.75,.75,.75),e.parent=m;const o=e.getComponent(c);o.string=t?"----------Composite Mode----------":"----------Single Mode----------",o.color=r.WHITE,o.overflow=0,this.labelComponentList[this.labelComponentList.length]=o}n-=20;let u=0;for(let t=0;t>1&&(i+=200,u=0);const e=t?a(this.singleModeToggle):this.singleModeToggle;e.setPosition(i,n-20*u,0),e.setScale(.5,.5,.5),e.parent=this.singleModeToggle.parent;const o=e.getComponentInChildren(p);o.string=this.strSingle[t],this.textComponentList[this.textComponentList.length]=o,this.textContentList[this.textContentList.length]=o.string,e.on(C.EventType.TOGGLE,this.toggleSingleMode,this),this.singleModeToggleList[t]=e}i+=200,this.EnableAllCompositeModeButton.setPosition(i+15,n,0),this.EnableAllCompositeModeButton.setScale(.5,.5,.5),this.EnableAllCompositeModeButton.on(d.EventType.CLICK,this.enableAllCompositeMode,this),this.EnableAllCompositeModeButton.parent=l;let L=this.EnableAllCompositeModeButton.getComponentInChildren(c);this.labelComponentList[this.labelComponentList.length]=L;const M=a(this.EnableAllCompositeModeButton);M.setPosition(i+90,n,0),M.setScale(.5,.5,.5),M.on(d.EventType.CLICK,this.changeTextColor,this),M.parent=l,L=M.getComponentInChildren(c),L.string="TextColor",this.labelComponentList[this.labelComponentList.length]=L;const b=a(this.EnableAllCompositeModeButton);b.setPosition(i+200,n,0),b.setScale(.5,.5,.5),b.on(d.EventType.CLICK,this.hideUI,this),b.parent=this.node.parent,L=b.getComponentInChildren(c),L.string="Hide UI",this.labelComponentList[this.labelComponentList.length]=L,this.hideButtonLabel=L,n-=40;for(let t=0;t");return-1===i?t===e:(o=o.substr(i+1),o=o.substr(0,o.search("<")),o===e)}toggleSingleMode(t){const e=m.root.debugView,o=t.getComponentInChildren(p);for(let t=0;t=this.strColor.length&&(this._currentColorIndex=0);for(let t=0;t";for(let t=0;t { + if (REGEX.test(bundle.base)) this.makeBundleFolder(bundle.name); + }); + }, + clearLRU() { + if (cleaning) return; + cleaning = true; + const caches = []; + const self = this; + this.cachedFiles.forEach((val, key) => { + if (val.bundle === 'internal') return; + caches.push({ + originUrl: key, + url: this.getCache(key), + lastTime: val.lastTime + }); + }); + caches.sort((a, b) => a.lastTime - b.lastTime); + caches.length = Math.floor(caches.length / 3); + if (caches.length === 0) return; + for (let i = 0, l = caches.length; i < l; i++) { + this.cachedFiles.remove(caches[i].originUrl); + } + clearTimeout(writeCacheFileList); + this._write(); + function deferredDelete() { + const item = caches.pop(); + deleteFile(item.url); + if (caches.length > 0) { + setTimeout(deferredDelete, self.deleteInterval); + } else { + cleaning = false; + } + } + setTimeout(deferredDelete, self.deleteInterval); + }, + removeCache(url) { + if (this.cachedFiles.has(url)) { + const path = this.getCache(url); + this.cachedFiles.remove(url); + clearTimeout(writeCacheFileList); + this._write(); + deleteFile(path); + } + }, + makeBundleFolder(bundleName) { + makeDirSync(`${this.cacheDir}/${bundleName}`, true); + } +}; +cc.assetManager.cacheManager = module.exports = cacheManager; + +},{"./jsb-fs-utils":7}],4:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +const cacheManager = require('./jsb-cache-manager'); + +// @ts-expect-error jsb polyfills +(function () { + if (globalThis.dragonBones === undefined || globalThis.middleware === undefined) return; + const ArmatureDisplayComponent = cc.internal.ArmatureDisplay; + if (ArmatureDisplayComponent === undefined) return; + const dragonBones = globalThis.dragonBones; + const middleware = globalThis.middleware; + + // dragonbones global time scale. + Object.defineProperty(dragonBones, 'timeScale', { + get() { + return this._timeScale; + }, + set(value) { + this._timeScale = value; + const factory = this.CCFactory.getInstance(); + factory.setTimeScale(value); + }, + configurable: true + }); + middleware.generateGetSet(dragonBones); + const _slotColor = cc.color(0, 0, 255, 255); + const _boneColor = cc.color(255, 0, 0, 255); + const _originColor = cc.color(0, 255, 0, 255); + + //////////////////////////////////////////////////////////// + // override dragonBones library by native dragonBones + //////////////////////////////////////////////////////////// + //-------------------- + // adapt event name + //-------------------- + dragonBones.EventObject.START = 'start'; + dragonBones.EventObject.LOOP_COMPLETE = 'loopComplete'; + dragonBones.EventObject.COMPLETE = 'complete'; + dragonBones.EventObject.FADE_IN = 'fadeIn'; + dragonBones.EventObject.FADE_IN_COMPLETE = 'fadeInComplete'; + dragonBones.EventObject.FADE_OUT = 'fadeOut'; + dragonBones.EventObject.FADE_OUT_COMPLETE = 'fadeOutComplete'; + dragonBones.EventObject.FRAME_EVENT = 'frameEvent'; + dragonBones.EventObject.SOUND_EVENT = 'soundEvent'; + dragonBones.DragonBones = { + ANGLE_TO_RADIAN: Math.PI / 180, + RADIAN_TO_ANGLE: 180 / Math.PI + }; + + //------------------- + // native factory + //------------------- + + const factoryProto = dragonBones.CCFactory.prototype; + factoryProto.createArmatureNode = function (comp, armatureName, node) { + node = node || new cc.Node(); + let display = node.getComponent(ArmatureDisplayComponent); + if (!display) { + display = node.addComponent(ArmatureDisplayComponent); + } + node.name = armatureName; + display._armatureName = armatureName; + display._dragonAsset = comp.dragonAsset; + display._dragonAtlasAsset = comp.dragonAtlasAsset; + display._init(); + return display; + }; + const _replaceSkin = factoryProto.replaceSkin; + factoryProto.replaceSkin = function (armatrue, skinData, isOverride, exclude) { + if (isOverride === undefined) isOverride = false; + exclude = exclude || []; + _replaceSkin.call(this, armatrue, skinData, isOverride, exclude); + }; + const _changeSkin = factoryProto.changeSkin; + factoryProto.changeSkin = function (armatrue, skinData, exclude) { + _changeSkin.call(this, armatrue, skinData, exclude); + }; + dragonBones.CCFactory.getInstance = function () { + return dragonBones.CCFactory.getFactory(); + }; + + //------------------- + // native animation state + //------------------- + const animationStateProto = dragonBones.AnimationState.prototype; + const _isPlaying = animationStateProto.isPlaying; + Object.defineProperty(animationStateProto, 'isPlaying', { + get() { + return _isPlaying.call(this); + } + }); + + //------------------- + // native armature + //------------------- + const armatureProto = dragonBones.Armature.prototype; + armatureProto.addEventListener = function (eventType, listener, target) { + this.__persistentDisplay__ = this.getDisplay(); + this.__persistentDisplay__.on(eventType, listener, target); + }; + armatureProto.removeEventListener = function (eventType, listener, target) { + this.__persistentDisplay__ = this.getDisplay(); + this.__persistentDisplay__.off(eventType, listener, target); + }; + + //-------------------------- + // native CCArmatureDisplay + //-------------------------- + const nativeArmatureDisplayProto = dragonBones.CCArmatureDisplay.prototype; + Object.defineProperty(nativeArmatureDisplayProto, 'node', { + get() { + return this; + } + }); + nativeArmatureDisplayProto.getRootNode = function () { + const rootDisplay = this.getRootDisplay(); + return rootDisplay && rootDisplay._ccNode; + }; + nativeArmatureDisplayProto.convertToWorldSpace = function (point) { + let newPos = this.convertToRootSpace(point.x, point.y); + newPos = cc.v3(newPos.x, newPos.y, 0); + const ccNode = this.getRootNode(); + if (!ccNode) return newPos; + const finalPos = ccNode._uiProps.uiTransformComp.convertToWorldSpaceAR(newPos); + return finalPos; + }; + nativeArmatureDisplayProto.initEvent = function () { + if (this._eventTarget) { + return; + } + this._eventTarget = new cc.EventTarget(); + this.setDBEventCallback(function (eventObject) { + this._eventTarget.emit(eventObject.type, eventObject); + }); + }; + nativeArmatureDisplayProto.on = function (type, listener, target) { + this.initEvent(); + this._eventTarget.on(type, listener, target); + this.addDBEventListener(type, listener); + }; + nativeArmatureDisplayProto.off = function (type, listener, target) { + this.initEvent(); + this._eventTarget.off(type, listener, target); + this.removeDBEventListener(type, listener); + }; + nativeArmatureDisplayProto.once = function (type, listener, target) { + this.initEvent(); + this._eventTarget.once(type, listener, target); + this.addDBEventListener(type, listener); + }; + + //////////////////////////////////////////////////////////// + // override DragonBonesAtlasAsset + //////////////////////////////////////////////////////////// + const dbAtlas = cc.internal.DragonBonesAtlasAsset.prototype; + let _gTextureIdx = 1; + const _textureKeyMap = {}; + const _textureMap = new WeakMap(); + const _textureIdx2Name = {}; + dbAtlas.removeRecordTexture = function (texture) { + if (!texture) return; + delete _textureIdx2Name[texture.image.url]; + const index = texture.__textureIndex__; + if (index) { + const texKey = _textureKeyMap[index]; + if (texKey && _textureMap.has(texKey)) { + _textureMap.delete(texKey); + delete _textureKeyMap[index]; + } + } + }; + dbAtlas.recordTexture = function () { + if (this._texture && this._oldTexture !== this._texture) { + this.removeRecordTexture(this._oldTexture); + const texKey = _textureKeyMap[_gTextureIdx] = { + key: _gTextureIdx + }; + _textureMap.set(texKey, this._texture); + this._oldTexture = this._texture; + this._texture.__textureIndex__ = _gTextureIdx; + _gTextureIdx++; + } + }; + dbAtlas.getTextureByIndex = function (textureIdx) { + const texKey = _textureKeyMap[textureIdx]; + if (!texKey) return null; + return _textureMap.get(texKey); + }; + dbAtlas.updateTextureAtlasData = function (factory) { + const url = this._texture.image.url; + const preAtlasInfo = _textureIdx2Name[url]; + let index; + + // If the texture has store the atlas info before,then get native atlas object,and + // update script texture map. + if (preAtlasInfo) { + index = preAtlasInfo.index; + this._textureAtlasData = factory.getTextureAtlasDataByIndex(preAtlasInfo.name, index); + const texKey = _textureKeyMap[preAtlasInfo.index]; + _textureMap.set(texKey, this._texture); + this._texture.__textureIndex__ = index; + // If script has store the atlas info,but native has no atlas object,then + // still new native texture2d object,but no call recordTexture to increase + // textureIndex. + if (this._textureAtlasData) { + return; + } + } else { + this.recordTexture(); + } + index = this._texture.__textureIndex__; + this.jsbTexture = new middleware.Texture2D(); + this.jsbTexture.setRealTextureIndex(index); + this.jsbTexture.setPixelsWide(this._texture.width); + this.jsbTexture.setPixelsHigh(this._texture.height); + this.jsbTexture.setRealTexture(this._texture); + this._textureAtlasData = factory.parseTextureAtlasData(this.atlasJson, this.jsbTexture, this._uuid); + _textureIdx2Name[url] = { + name: this._textureAtlasData.name, + index + }; + }; + dbAtlas.init = function (factory) { + this._factory = factory; + + // If create by manual, uuid is empty. + if (!this._uuid) { + const atlasJsonObj = JSON.parse(this.atlasJson); + this._uuid = atlasJsonObj.name; + } + if (this._textureAtlasData) { + factory.addTextureAtlasData(this._textureAtlasData, this._uuid); + } else { + this.updateTextureAtlasData(factory); + } + }; + dbAtlas._clear = function (dontRecordTexture) { + if (this._factory) { + this._factory.removeTextureAtlasData(this._uuid, true); + this._factory.removeDragonBonesDataByUUID(this._uuid, true); + } + this._textureAtlasData = null; + if (!dontRecordTexture) { + this.recordTexture(); + } + }; + dbAtlas.destroy = function () { + this.removeRecordTexture(this._texture); + this._clear(true); + cc.Asset.prototype.destroy.call(this); + }; + + //////////////////////////////////////////////////////////// + // override DragonBonesAsset + //////////////////////////////////////////////////////////// + const dbAsset = cc.internal.DragonBonesAsset.prototype; + dbAsset.init = function (factory, atlasUUID) { + this._factory = factory || dragonBones.CCFactory.getInstance(); + + // If create by manual, uuid is empty. + // Only support json format, if remote load dbbin, must set uuid by manual. + if (!this._uuid && this.dragonBonesJson) { + const rawData = JSON.parse(this.dragonBonesJson); + this._uuid = rawData.name; + } + const armatureKey = `${this._uuid}#${atlasUUID}`; + const dragonBonesData = this._factory.getDragonBonesData(armatureKey); + if (dragonBonesData) return armatureKey; + let filePath = null; + if (this.dragonBonesJson) { + filePath = this.dragonBonesJson; + } else { + filePath = cacheManager.getCache(this.nativeUrl) || this.nativeUrl; + } + this._factory.parseDragonBonesDataByPath(filePath, armatureKey); + return armatureKey; + }; + const armatureCacheMgr = dragonBones.ArmatureCacheMgr.getInstance(); + dragonBones.armatureCacheMgr = armatureCacheMgr; + dbAsset._clear = function () { + if (this._factory) { + this._factory.removeDragonBonesDataByUUID(this._uuid, true); + } + armatureCacheMgr.removeArmatureCache(this._uuid); + }; + + //////////////////////////////////////////////////////////// + // override ArmatureDisplay + //////////////////////////////////////////////////////////// + const superProto = cc.internal.UIRenderer.prototype; + const armatureDisplayProto = cc.internal.ArmatureDisplay.prototype; + const AnimationCacheMode = cc.internal.ArmatureDisplay.AnimationCacheMode; + const armatureSystem = cc.internal.ArmatureSystem; + armatureDisplayProto.initFactory = function () { + this._factory = dragonBones.CCFactory.getFactory(); + }; + Object.defineProperty(armatureDisplayProto, 'armatureName', { + get() { + return this._armatureName; + }, + set(value) { + this._armatureName = value; + const animNames = this.getAnimationNames(this._armatureName); + if (!this.animationName || animNames.indexOf(this.animationName) < 0) { + this.animationName = ''; + } + const oldArmature = this._armature; + if (this._armature) { + if (!this.isAnimationCached()) { + this._factory.remove(this._armature); + } + this._armature = null; + } + this._nativeDisplay = null; + this._refresh(); + if (oldArmature && oldArmature !== this._armature) { + oldArmature.dispose(); + } + if (this._armature && !this.isAnimationCached() && this.shouldSchedule) { + this._factory.add(this._armature); + } + }, + visible: false + }); + Object.defineProperty(armatureDisplayProto, 'premultipliedAlpha', { + get() { + if (this._premultipliedAlpha === undefined) { + return false; + } + return this._premultipliedAlpha; + }, + set(value) { + this._premultipliedAlpha = value; + if (this._nativeDisplay) { + this._nativeDisplay.setOpacityModifyRGB(this._premultipliedAlpha); + } + } + }); + const _initDebugDraw = armatureDisplayProto._initDebugDraw; + armatureDisplayProto._initDebugDraw = function () { + _initDebugDraw.call(this); + if (this._armature && !this.isAnimationCached()) { + this._nativeDisplay.setDebugBonesEnabled(this.debugBones); + } + }; + armatureDisplayProto._buildArmature = function () { + if (!this.dragonAsset || !this.dragonAtlasAsset || !this.armatureName) { + return; + } + if (this._nativeDisplay) { + this._nativeDisplay.dispose(); + this._nativeDisplay._comp = null; + this._nativeDisplay = null; + } + const atlasUUID = this.dragonAtlasAsset._uuid; + this._armatureKey = this.dragonAsset.init(this._factory, atlasUUID); + if (this.isAnimationCached()) { + const isShare = this._cacheMode === AnimationCacheMode.SHARED_CACHE; + this._nativeDisplay = new dragonBones.CCArmatureCacheDisplay(this.armatureName, this._armatureKey, atlasUUID, isShare); + if (this.shouldSchedule) this._nativeDisplay.beginSchedule(); + this._armature = this._nativeDisplay.armature(); + } else { + this._nativeDisplay = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, '', atlasUUID); + if (!this._nativeDisplay) { + return; + } + this._nativeDisplay.setDebugBonesEnabled(this.debugBones); + this._armature = this._nativeDisplay.armature(); + this._armature.animation.timeScale = this.timeScale; + if (this.shouldSchedule) this._factory.add(this._armature); + } + + // add all event into native display + const callbackTable = this._eventTarget._callbackTable; + // just use to adapt to native api + const emptyHandle = function () {}; + for (const key in callbackTable) { + const list = callbackTable[key]; + if (!list || !list.callbackInfos || !list.callbackInfos.length) continue; + if (this.isAnimationCached()) { + this._nativeDisplay.addDBEventListener(key); + } else { + this._nativeDisplay.addDBEventListener(key, emptyHandle); + } + } + this._preCacheMode = this._cacheMode; + this._nativeDisplay._ccNode = this.node; + this._nativeDisplay._comp = this; + this._nativeDisplay._eventTarget = this._eventTarget; + this._sharedBufferOffset = this._nativeDisplay.getSharedBufferOffset(); + this._sharedBufferOffset[0] = 0; + this._useAttach = false; + this._nativeDisplay.setOpacityModifyRGB(this.premultipliedAlpha); + const compColor = this.color; + this._nativeDisplay.setColor(compColor.r, compColor.g, compColor.b, compColor.a); + this._nativeDisplay.setDBEventCallback(function (eventObject) { + this._eventTarget.emit(eventObject.type, eventObject); + }); + const materialTemplate = this.getMaterialTemplate(); + this._nativeDisplay.setMaterial(materialTemplate); + this._nativeDisplay.setRenderEntity(this._renderEntity.nativeObj); + this.attachUtil.init(this); + if (this._armature) { + const armatureData = this._armature.armatureData; + const aabb = armatureData.aABB; + this.node._uiProps.uiTransformComp.setContentSize(aabb.width, aabb.height); + } + if (this.animationName) { + this.playAnimation(this.animationName, this.playTimes); + } + this.markForUpdateRenderData(); + }; + armatureDisplayProto._updateColor = function () { + if (this._nativeDisplay) { + const compColor = this.color; + this._nativeDisplay.setColor(compColor.r, compColor.g, compColor.b, compColor.a); + } + }; + armatureDisplayProto.playAnimation = function (animName, playTimes) { + this.playTimes = playTimes === undefined ? -1 : playTimes; + this.animationName = animName; + if (this._nativeDisplay) { + if (this.isAnimationCached()) { + return this._nativeDisplay.playAnimation(animName, this.playTimes); + } else if (this._armature) { + return this._armature.animation.play(animName, this.playTimes); + } + } + return null; + }; + armatureDisplayProto.updateAnimationCache = function (animName) { + if (!this.isAnimationCached()) return; + if (this._nativeDisplay) { + if (animName) { + this._nativeDisplay.updateAnimationCache(animName); + } else { + this._nativeDisplay.updateAllAnimationCache(); + } + } + }; + armatureDisplayProto.invalidAnimationCache = function () { + if (!this.isAnimationCached()) return; + if (this._nativeDisplay) { + this._nativeDisplay.updateAllAnimationCache(); + } + }; + const _onEnable = superProto.onEnable; + armatureDisplayProto.onEnable = function () { + if (_onEnable) { + _onEnable.call(this); + } + this.shouldSchedule = true; + if (this._armature) { + if (this.isAnimationCached()) { + this._nativeDisplay.onEnable(); + } else { + this._factory.add(this._armature); + } + } + this._flushAssembler(); + armatureSystem.getInstance().add(this); + middleware.retain(); + }; + const _onDisable = superProto.onDisable; + armatureDisplayProto.onDisable = function () { + if (_onDisable) { + _onDisable.call(this); + } + if (this._armature && !this.isAnimationCached()) { + this._factory.remove(this._armature); + } + armatureSystem.getInstance().remove(this); + middleware.release(); + }; + const _updateMaterial = armatureDisplayProto.updateMaterial; + armatureDisplayProto.updateMaterial = function () { + _updateMaterial.call(this); + if (this._nativeDisplay) { + const mat = this.getMaterialTemplate(); + this._nativeDisplay.setMaterial(mat); + } + }; + armatureDisplayProto.once = function (eventType, listener, target) { + if (this._nativeDisplay) { + if (this.isAnimationCached()) { + this._nativeDisplay.addDBEventListener(eventType); + } else { + this._nativeDisplay.addDBEventListener(eventType, listener); + } + } + this._eventTarget.once(eventType, listener, target); + }; + armatureDisplayProto.addEventListener = function (eventType, listener, target) { + if (this._nativeDisplay) { + if (this.isAnimationCached()) { + this._nativeDisplay.addDBEventListener(eventType); + } else { + this._nativeDisplay.addDBEventListener(eventType, listener); + } + } + this._eventTarget.on(eventType, listener, target); + }; + armatureDisplayProto.removeEventListener = function (eventType, listener, target) { + if (this._nativeDisplay) { + if (this.isAnimationCached()) { + this._nativeDisplay.removeDBEventListener(eventType); + } else { + this._nativeDisplay.removeDBEventListener(eventType, listener); + } + } + this._eventTarget.off(eventType, listener, target); + }; + const _onDestroy = armatureDisplayProto.onDestroy; + armatureDisplayProto.onDestroy = function () { + _onDestroy.call(this); + if (this._nativeDisplay) { + this._nativeDisplay.dispose(); + this._nativeDisplay._comp = null; + this._nativeDisplay = null; + } + }; + armatureDisplayProto.setAnimationCacheMode = function (cacheMode) { + if (this._preCacheMode !== cacheMode) { + this._cacheMode = cacheMode; + this._buildArmature(); + if (this._armature && !this.isAnimationCached() && this.shouldSchedule) { + this._factory.add(this._armature); + } + this._updateSocketBindings(); + this.markForUpdateRenderData(); + } + }; + armatureDisplayProto.updateAnimation = function () { + const nativeDisplay = this._nativeDisplay; + if (!nativeDisplay) return; + const node = this.node; + if (!node) return; + if (this.__preColor__ === undefined || !this.color.equals(this.__preColor__)) { + const compColor = this.color; + nativeDisplay.setColor(compColor.r, compColor.g, compColor.b, compColor.a); + this.__preColor__ = compColor; + } + const socketNodes = this.socketNodes; + if (!this._useAttach && socketNodes.size > 0) { + this._useAttach = true; + nativeDisplay.setAttachEnabled(true); + } + this.markForUpdateRenderData(); + if (!this.isAnimationCached() && this._debugDraw && this.debugBones) { + const nativeDisplay = this._nativeDisplay; + this._debugData = this._debugData || nativeDisplay.getDebugData(); + if (!this._debugData) return; + const graphics = this._debugDraw; + graphics.clear(); + const debugData = this._debugData; + let debugIdx = 0; + graphics.lineWidth = 5; + graphics.strokeColor = _boneColor; + graphics.fillColor = _slotColor; // Root bone color is same as slot color. + + const debugBonesLen = debugData[debugIdx++]; + for (let i = 0; i < debugBonesLen; i += 4) { + const bx = debugData[debugIdx++]; + const by = debugData[debugIdx++]; + const x = debugData[debugIdx++]; + const y = debugData[debugIdx++]; + + // Bone lengths. + graphics.moveTo(bx, by); + graphics.lineTo(x, y); + graphics.stroke(); + + // Bone origins. + graphics.circle(bx, by, Math.PI * 2); + graphics.fill(); + if (i === 0) { + graphics.fillColor = _originColor; + } + } + } + }; + const _tempAttachMat4 = cc.mat4(); + armatureDisplayProto._render = function () {}; + armatureDisplayProto._updateBatch = function () { + if (this.nativeDisplay) { + this.nativeDisplay.setBatchEnabled(this.enableBatch); + this.markForUpdateRenderData(); + } + }; + armatureDisplayProto.syncAttachedNode = function () { + const nativeDisplay = this._nativeDisplay; + if (!nativeDisplay) return; + const sharedBufferOffset = this._sharedBufferOffset; + if (!sharedBufferOffset) return; + const sockets = this.sockets; + if (sockets.length > 0) { + const attachInfoMgr = middleware.attachInfoMgr; + const attachInfo = attachInfoMgr.attachInfo; + const attachInfoOffset = sharedBufferOffset[0]; + // reset attach info offset + sharedBufferOffset[0] = 0; + const socketNodes = this.socketNodes; + for (let l = sockets.length - 1; l >= 0; l--) { + const sock = sockets[l]; + const boneNode = sock.target; + const boneIdx = sock.boneIndex; + if (!boneNode) continue; + // Node has been destroy + if (!boneNode.isValid) { + socketNodes.delete(sock.path); + sockets.splice(l, 1); + continue; + } + const tm = _tempAttachMat4; + const matOffset = attachInfoOffset + boneIdx * 16; + tm.m00 = attachInfo[matOffset]; + tm.m01 = attachInfo[matOffset + 1]; + tm.m04 = attachInfo[matOffset + 4]; + tm.m05 = attachInfo[matOffset + 5]; + tm.m12 = attachInfo[matOffset + 12]; + tm.m13 = attachInfo[matOffset + 13]; + boneNode.matrix = tm; + } + } + }; + + ////////////////////////////////////////// + // assembler + const assembler = cc.internal.DragonBonesAssembler; + + // eslint-disable-next-line no-unused-vars + assembler.createData = function (comp) {}; + assembler.updateRenderData = function (comp) { + comp._render(); + }; + + // eslint-disable-next-line no-unused-vars + assembler.fillBuffers = function (comp, renderer) {}; +})(); + +},{"./jsb-cache-manager":3}],5:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +(function () { + if (!(cc && cc.internal && cc.internal.EditBox)) { + return; + } + const EditBox = cc.internal.EditBox; + const KeyboardReturnType = EditBox.KeyboardReturnType; + const InputMode = EditBox.InputMode; + const InputFlag = EditBox.InputFlag; + const worldMat = cc.mat4(); + function getInputType(type) { + switch (type) { + case InputMode.EMAIL_ADDR: + return 'email'; + case InputMode.NUMERIC: + case InputMode.DECIMAL: + return 'number'; + case InputMode.PHONE_NUMBER: + return 'phone'; + case InputMode.URL: + return 'url'; + case InputMode.SINGLE_LINE: + case InputMode.ANY: + default: + return 'text'; + } + } + function getKeyboardReturnType(type) { + switch (type) { + case KeyboardReturnType.DEFAULT: + case KeyboardReturnType.DONE: + return 'done'; + case KeyboardReturnType.SEND: + return 'send'; + case KeyboardReturnType.SEARCH: + return 'search'; + case KeyboardReturnType.GO: + return 'go'; + case KeyboardReturnType.NEXT: + return 'next'; + } + return 'done'; + } + const BaseClass = EditBox._EditBoxImpl; + class JsbEditBoxImpl extends BaseClass { + init(delegate) { + if (!delegate) { + cc.error('EditBox init failed'); + return; + } + this._delegate = delegate; + } + beginEditing() { + const self = this; + const delegate = this._delegate; + const multiline = delegate.inputMode === InputMode.ANY; + const rect = this._getRect(); + this.setMaxLength(delegate.maxLength); + let inputTypeString = getInputType(delegate.inputMode); + if (delegate.inputFlag === InputFlag.PASSWORD) { + inputTypeString = 'password'; + } + function onConfirm(res) { + delegate._editBoxEditingReturn(); + } + function onInput(res) { + if (res.value.length > self._maxLength) { + res.value = res.value.slice(0, self._maxLength); + } + if (delegate.string !== res.value) { + delegate._editBoxTextChanged(res.value); + } + } + function onComplete(res) { + self.endEditing(); + } + jsb.inputBox.onInput(onInput); + jsb.inputBox.onConfirm(onConfirm); + jsb.inputBox.onComplete(onComplete); + if (!cc.sys.isMobile) { + delegate._hideLabels(); + } + const editLabel = delegate.textLabel; + jsb.inputBox.show({ + defaultValue: delegate.string, + maxLength: self._maxLength, + multiple: multiline, + confirmHold: false, + confirmType: getKeyboardReturnType(delegate.returnType), + inputType: inputTypeString, + originX: rect.x, + originY: rect.y, + width: rect.width, + height: rect.height, + isBold: editLabel.isBold, + isItalic: editLabel.isItalic, + isUnderline: editLabel.isUnderline, + underlineColor: 0x00000000 /* Black */, + fontSize: /**number */editLabel.fontSize, + fontColor: /**number */editLabel.color.toRGBValue(), + backColor: 0x00ffffff /*White*/, + backgroundColor: delegate.placeholderLabel.color.toRGBValue(), + textAlignment: /*left = 0, center = 1, right = 2*/editLabel.horizontalAlign + }); + this._editing = true; + delegate._editBoxEditingDidBegan(); + } + endEditing() { + this._editing = false; + if (!cc.sys.isMobile) { + this._delegate._showLabels(); + } + jsb.inputBox.offConfirm(); + jsb.inputBox.offInput(); + jsb.inputBox.offComplete(); + jsb.inputBox.hide(); + this._delegate._editBoxEditingDidEnded(); + } + setMaxLength(maxLength) { + if (!isNaN(maxLength)) { + if (maxLength < 0) { + //we can't set Number.MAX_VALUE to input's maxLength property + //so we use a magic number here, it should works at most use cases. + maxLength = 65535; + } + this._maxLength = maxLength; + } + } + _getRect() { + const node = this._delegate.node; + let viewScaleX = cc.view._scaleX; + let viewScaleY = cc.view._scaleY; + const dpr = jsb.device.getDevicePixelRatio() || 1; + node.getWorldMatrix(worldMat); + const transform = node._uiProps.uiTransformComp; + const vec3 = cc.v3(); + let width = 0; + let height = 0; + if (transform) { + const contentSize = transform.contentSize; + const anchorPoint = transform.anchorPoint; + width = contentSize.width; + height = contentSize.height; + vec3.x = -anchorPoint.x * width; + vec3.y = -anchorPoint.y * height; + } + const translate = new cc.Mat4(); + cc.Mat4.fromTranslation(translate, vec3); + cc.Mat4.multiply(worldMat, translate, worldMat); + viewScaleX /= dpr; + viewScaleY /= dpr; + const finalScaleX = worldMat.m00 * viewScaleX; + const finaleScaleY = worldMat.m05 * viewScaleY; + const viewportRect = cc.view._viewportRect; + const offsetX = viewportRect.x / dpr; + const offsetY = viewportRect.y / dpr; + return { + x: worldMat.m12 * viewScaleX + offsetX, + y: worldMat.m13 * viewScaleY + offsetY, + width: width * finalScaleX, + height: height * finaleScaleY + }; + } + } + EditBox._EditBoxImpl = JsbEditBoxImpl; +})(); + +},{}],6:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +// @ts-expect-error jsb polyfills +(function () { + if (!globalThis.middleware) return; + const middleware = globalThis.middleware; + const middlewareMgr = middleware.MiddlewareManager.getInstance(); + let reference = 0; + const director = cc.director; + const game = cc.game; + middleware.reset = function () { + middleware.preRenderComponent = null; + middleware.preRenderBufferIndex = 0; + middleware.indicesStart = 0; + middleware.resetIndicesStart = false; + }; + middleware.reset(); + middleware.retain = function () { + reference++; + }; + middleware.release = function () { + if (reference === 0) { + cc.warn('middleware reference error: reference count should be greater than 0'); + return; + } + reference--; + }; + director.on(cc.Director.EVENT_BEFORE_UPDATE, () => { + if (reference === 0) return; + middlewareMgr.update(game.deltaTime); + }); + director.on(cc.Director.EVENT_BEFORE_DRAW, () => { + if (reference === 0) return; + middlewareMgr.render(game.deltaTime); + + // reset render order + middleware.reset(); + + //const batcher2D = director.root.batcher2D; + if (globalThis.dragonBones) { + const armaSystem = cc.internal.ArmatureSystem.getInstance(); + armaSystem.prepareRenderData(); + } + if (globalThis.spine) { + const skeletonSystem = cc.internal.SpineSkeletonSystem.getInstance(); + skeletonSystem.prepareRenderData(); + } + }); + const attachInfoMgr = middlewareMgr.getAttachInfoMgr(); + attachInfoMgr.attachInfo = attachInfoMgr.getSharedBuffer(); + attachInfoMgr.setResizeCallback(function () { + this.attachInfo = this.getSharedBuffer(); + }); + middleware.attachInfoMgr = attachInfoMgr; + + // generate get set function + middleware.generateGetSet = function (moduleObj) { + for (const classKey in moduleObj) { + const classProto = moduleObj[classKey] && moduleObj[classKey].prototype; + if (!classProto) continue; + for (const getName in classProto) { + const getPos = getName.search(/^get/); + if (getPos === -1) continue; + let propName = getName.replace(/^get/, ''); + const nameArr = propName.split(''); + const lowerFirst = nameArr[0].toLowerCase(); + const upperFirst = nameArr[0].toUpperCase(); + nameArr.splice(0, 1); + const left = nameArr.join(''); + propName = lowerFirst + left; + const setName = `set${upperFirst}${left}`; + // eslint-disable-next-line no-prototype-builtins + if (classProto.hasOwnProperty(propName)) continue; + const setFunc = classProto[setName]; + const hasSetFunc = typeof setFunc === 'function'; + if (hasSetFunc) { + Object.defineProperty(classProto, propName, { + get() { + return this[getName](); + }, + set(val) { + this[setName](val); + }, + configurable: true + }); + } else { + Object.defineProperty(classProto, propName, { + get() { + return this[getName](); + }, + configurable: true + }); + } + } + } + }; +})(); + +},{}],7:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd. + https://www.cocos.com/ + Permission is hereby granted, free of charge, to any person obtaining a copy + of fsUtils software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + The software or tools in fsUtils License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +const fs = jsb.fileUtils; +let jsb_downloader = null; +const downloading = new cc.AssetManager.Cache(); +let tempDir = ''; +jsb.Downloader.prototype._ctor = function () { + this.__nativeRefs = {}; +}; +const fsUtils = { + fs, + initJsbDownloader(jsbDownloaderMaxTasks, jsbDownloaderTimeout) { + jsb_downloader = new jsb.Downloader({ + countOfMaxProcessingTasks: jsbDownloaderMaxTasks || 32, + timeoutInSeconds: jsbDownloaderTimeout || 30, + tempFileNameSuffix: '.tmp' + }); + tempDir = `${fsUtils.getUserDataPath()}/temp`; + !fs.isDirectoryExist(tempDir) && fs.createDirectory(tempDir); + jsb_downloader.onSuccess = task => { + if (!downloading.has(task.requestURL)) return; + const { + onComplete + } = downloading.remove(task.requestURL); + onComplete && onComplete(null, task.storagePath); + }; + jsb_downloader.onError = (task, errorCode, errorCodeInternal, errorStr) => { + if (!downloading.has(task.requestURL)) return; + const { + onComplete + } = downloading.remove(task.requestURL); + cc.error(`Download file failed: path: ${task.requestURL} message: ${errorStr}, ${errorCode}`); + onComplete(new Error(errorStr), null); + }; + jsb_downloader.onProgress = (task, bytesReceived, totalBytesReceived, totalBytesExpected) => { + if (!downloading.has(task.requestURL)) return; + const { + onProgress + } = downloading.get(task.requestURL); + onProgress && onProgress(totalBytesReceived, totalBytesExpected); + }; + }, + getUserDataPath() { + return fs.getWritablePath().replace(/[\/\\]*$/, ''); + }, + checkFsValid() { + if (!fs) { + cc.warn('can not get the file system!'); + return false; + } + return true; + }, + deleteFile(filePath, onComplete) { + const result = fs.removeFile(filePath); + if (result === true) { + onComplete && onComplete(null); + } else { + cc.warn(`Delete file failed: path: ${filePath}`); + onComplete && onComplete(new Error('delete file failed')); + } + }, + downloadFile(remoteUrl, filePath, header, onProgress, onComplete) { + downloading.add(remoteUrl, { + onProgress, + onComplete + }); + let storagePath = filePath; + if (!storagePath) storagePath = `${tempDir}/${performance.now()}${cc.path.extname(remoteUrl)}`; + jsb_downloader.createDownloadTask(remoteUrl, storagePath, header); + }, + saveFile(srcPath, destPath, onComplete) { + let err = null; + const result = fs.writeDataToFile(fs.getDataFromFile(srcPath), destPath); + fs.removeFile(srcPath); + if (!result) { + err = new Error(`Save file failed: path: ${srcPath}`); + cc.warn(err.message); + } + onComplete && onComplete(err); + }, + copyFile(srcPath, destPath, onComplete) { + let err = null; + const result = fs.writeDataToFile(fs.getDataFromFile(srcPath), destPath); + if (!result) { + err = new Error(`Copy file failed: path: ${srcPath}`); + cc.warn(err.message); + } + onComplete && onComplete(err); + }, + writeFile(path, data, encoding, onComplete) { + let result = null; + let err = null; + if (encoding === 'utf-8' || encoding === 'utf8') { + result = fs.writeStringToFile(data, path); + } else { + result = fs.writeDataToFile(data, path); + } + if (!result) { + err = new Error(`Write file failed: path: ${path}`); + cc.warn(err.message); + } + onComplete && onComplete(err); + }, + writeFileSync(path, data, encoding) { + let result = null; + if (encoding === 'utf-8' || encoding === 'utf8') { + result = fs.writeStringToFile(data, path); + } else { + result = fs.writeDataToFile(data, path); + } + if (!result) { + cc.warn(`Write file failed: path: ${path}`); + return new Error(`Write file failed: path: ${path}`); + } + }, + readFile(filePath, encoding, onComplete) { + let content = null; + let err = null; + if (encoding === 'utf-8' || encoding === 'utf8') { + content = fs.getStringFromFile(filePath); + } else { + content = fs.getDataFromFile(filePath); + } + if (!content) { + err = new Error(`Read file failed: path: ${filePath}`); + cc.warn(err.message); + } + onComplete && onComplete(err, content); + }, + readDir(filePath, onComplete) { + let files = null; + let err = null; + try { + files = fs.listFiles(filePath); + } catch (e) { + cc.warn(`Read dir failed: path: ${filePath} message: ${e.message}`); + err = new Error(e.message); + } + onComplete && onComplete(err, files); + }, + readText(filePath, onComplete) { + fsUtils.readFile(filePath, 'utf8', onComplete); + }, + readArrayBuffer(filePath, onComplete) { + fsUtils.readFile(filePath, '', onComplete); + }, + readJson(filePath, onComplete) { + fsUtils.readFile(filePath, 'utf8', (err, text) => { + let out = null; + if (!err) { + try { + out = JSON.parse(text); + } catch (e) { + cc.warn(`Read json failed: path: ${filePath} message: ${e.message}`); + err = new Error(e.message); + } + } + onComplete && onComplete(err, out); + }); + }, + readJsonSync(path) { + try { + const str = fs.getStringFromFile(path); + return JSON.parse(str); + } catch (e) { + cc.warn(`Read json failed: path: ${path} message: ${e.message}`); + return new Error(e.message); + } + }, + makeDirSync(path, recursive) { + const result = fs.createDirectory(path); + if (!result) { + cc.warn(`Make directory failed: path: ${path}`); + return new Error(`Make directory failed: path: ${path}`); + } + }, + rmdirSync(dirPath, recursive) { + const result = fs.removeDirectory(dirPath); + if (!result) { + cc.warn(`rm directory failed: path: ${dirPath}`); + return new Error(`rm directory failed: path: ${dirPath}`); + } + }, + exists(filePath, onComplete) { + const result = fs.isFileExist(filePath); + onComplete && onComplete(result); + }, + loadSubpackage(name, onProgress, onComplete) { + throw new Error('not implement'); + } +}; +globalThis.fsUtils = module.exports = fsUtils; + +},{}],8:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +cc.game.restart = function () { + // Need to clear scene, or native object destructor won't be invoke. + cc.director.getScene().destroy(); + cc.Object._deferredDestroy(); + __restartVM(); +}; +jsb.onError(function (location, message, stack) { + console.error(location, message, stack); +}); +jsb.onMemoryWarning = function () { + cc.game.emit(cc.Game.EVENT_LOW_MEMORY); +}; + +},{}],9:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +/* global gfx */ + +const deviceProto = gfx.Device.prototype; +const swapchainProto = gfx.Swapchain.prototype; +const bufferProto = gfx.Buffer.prototype; +const textureProto = gfx.Texture.prototype; +const descriptorSetProto = gfx.DescriptorSet.prototype; +const jsbWindow = require('../jsbWindow'); +///////////////////////////// handle different paradigms ///////////////////////////// + +const oldCopyTexImagesToTextureFunc = deviceProto.copyTexImagesToTexture; +deviceProto.copyTexImagesToTexture = function (texImages, texture, regions) { + const images = []; + if (texImages) { + for (let i = 0; i < texImages.length; ++i) { + const texImage = texImages[i]; + if (texImage instanceof jsbWindow.HTMLCanvasElement) { + // Refer to HTMLCanvasElement and ImageData implementation + images.push(texImage._data.data); + } else if (texImage instanceof jsbWindow.HTMLImageElement) { + // Refer to HTMLImageElement implementation + images.push(texImage._data); + } else { + console.log('copyTexImagesToTexture: Convert texImages to data buffers failed'); + return; + } + } + } + oldCopyTexImagesToTextureFunc.call(this, images, texture, regions); +}; +const oldDeviceCreateSwapchainFunc = deviceProto.createSwapchain; +deviceProto.createSwapchain = function (info) { + info.windowHandle = jsbWindow.windowHandle; + return oldDeviceCreateSwapchainFunc.call(this, info); +}; +const oldSwapchainInitializeFunc = swapchainProto.initialize; +swapchainProto.initialize = function (info) { + info.windowHandle = jsbWindow.windowHandler; + oldSwapchainInitializeFunc.call(this, info); +}; +const oldUpdate = bufferProto.update; +bufferProto.update = function (buffer, size) { + if (buffer.byteLength === 0) return; + let buffSize; + if (this.cachedUsage & 0x40) { + // BufferUsageBit.INDIRECT + // It is a IIndirectBuffer object. + const { + drawInfos + } = buffer; + buffer = new Uint32Array(drawInfos.length * 7); + let baseIndex = 0; + let drawInfo; + for (let i = 0; i < drawInfos.length; ++i) { + baseIndex = i * 7; + drawInfo = drawInfos[i]; + buffer[baseIndex] = drawInfo.vertexCount; + buffer[baseIndex + 1] = drawInfo.firstVertex; + buffer[baseIndex + 2] = drawInfo.indexCount; + buffer[baseIndex + 3] = drawInfo.firstIndex; + buffer[baseIndex + 4] = drawInfo.vertexOffset; + buffer[baseIndex + 5] = drawInfo.instanceCount; + buffer[baseIndex + 6] = drawInfo.firstInstance; + } + buffSize = buffer.byteLength; + } else if (size !== undefined) { + buffSize = size; + } else { + buffSize = buffer.byteLength; + } + oldUpdate.call(this, buffer, buffSize); +}; +const oldDeviceCreateBufferFun = deviceProto.createBuffer; +deviceProto.createBuffer = function (info) { + let buffer; + if (info.buffer) { + buffer = oldDeviceCreateBufferFun.call(this, info, true); + } else { + buffer = oldDeviceCreateBufferFun.call(this, info, false); + } + buffer.cachedUsage = info.usage; + return buffer; +}; +const oldBufferInitializeFunc = bufferProto.initialize; +bufferProto.initialize = function (info) { + if (info.buffer) { + oldBufferInitializeFunc.call(this, info, true); + } else { + oldBufferInitializeFunc.call(this, info, false); + } +}; +const oldDeviceCreateTextureFun = deviceProto.createTexture; +deviceProto.createTexture = function (info) { + if (info.texture) { + return oldDeviceCreateTextureFun.call(this, info, true); + } + return oldDeviceCreateTextureFun.call(this, info, false); +}; +const oldTextureInitializeFunc = textureProto.initialize; +textureProto.initialize = function (info) { + if (info.texture) { + oldTextureInitializeFunc.call(this, info, true); + } else { + oldTextureInitializeFunc.call(this, info, false); + } +}; + +///////////////////////////// optimizations ///////////////////////////// + +// Cache dirty to avoid invoking gfx.DescriptorSet.update(). +descriptorSetProto.bindBuffer = function (binding, buffer, index) { + this.dirtyJSB = descriptorSetProto.bindBufferJSB.call(this, binding, buffer, index || 0); +}; +descriptorSetProto.bindSampler = function (binding, sampler, index) { + this.dirtyJSB = descriptorSetProto.bindSamplerJSB.call(this, binding, sampler, index || 0); +}; +descriptorSetProto.bindTexture = function (bindding, texture, index, flags) { + this.dirtyJSB = descriptorSetProto.bindTextureJSB.call(this, bindding, texture, index || 0, flags || 0); +}; +const oldDSUpdate = descriptorSetProto.update; +descriptorSetProto.update = function () { + if (!this.dirtyJSB) return; + oldDSUpdate.call(this); + this.dirtyJSB = false; +}; +Object.defineProperty(deviceProto, 'uboOffsetAlignment', { + get() { + if (this.cachedUboOffsetAlignment === undefined) { + this.cachedUboOffsetAlignment = this.getUboOffsetAlignment(); + } + return this.cachedUboOffsetAlignment; + } +}); + +},{"../jsbWindow":16}],10:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +const jsbWindow = require('../jsbWindow'); +const cacheManager = require('./jsb-cache-manager'); +const { + downloadFile, + readText, + readArrayBuffer, + readJson, + getUserDataPath, + initJsbDownloader +} = require('./jsb-fs-utils'); +const REGEX = /^\w+:\/\/.*/; +const downloader = cc.assetManager.downloader; +const parser = cc.assetManager.parser; +const presets = cc.assetManager.presets; +downloader.maxConcurrency = 30; +downloader.maxRequestsPerFrame = 60; +presets.preload.maxConcurrency = 15; +presets.preload.maxRequestsPerFrame = 30; +presets.scene.maxConcurrency = 32; +presets.scene.maxRequestsPerFrame = 64; +presets.bundle.maxConcurrency = 32; +presets.bundle.maxRequestsPerFrame = 64; +let suffix = 0; +const failureMap = {}; +const maxRetryCountFromBreakpoint = 5; +const loadedScripts = {}; +function downloadScript(url, options, onComplete) { + if (typeof options === 'function') { + onComplete = options; + options = null; + } + if (loadedScripts[url]) return onComplete && onComplete(); + download(url, (src, options, onComplete) => { + if (window.oh && window.scriptEngineType === 'napi') { + // TODO(qgh):OpenHarmony does not currently support dynamic require expressions + window.oh.loadModule(src); + } else if (__EDITOR__) { + // in editor mode,require is from electron,__require is from engine + globalThis.__require(src); + } else { + globalThis.require(src); + } + loadedScripts[url] = true; + onComplete && onComplete(null); + }, options, options.onFileProgress, onComplete); +} +function download(url, func, options, onFileProgress, onComplete) { + const result = transformUrl(url, options); + if (result.inLocal) { + func(result.url, options, onComplete); + } else if (result.inCache) { + cacheManager.updateLastTime(url); + func(result.url, options, (err, data) => { + if (err) { + cacheManager.removeCache(url); + } + onComplete(err, data); + }); + } else { + const time = Date.now(); + let storagePath = ''; + const failureRecord = failureMap[url]; + if (failureRecord) { + storagePath = failureRecord.storagePath; + } else if (options.__cacheBundleRoot__) { + storagePath = `${options.__cacheBundleRoot__}/${time}${suffix++}${cc.path.extname(url)}`; + } else { + storagePath = `${time}${suffix++}${cc.path.extname(url)}`; + } + downloadFile(url, `${cacheManager.cacheDir}/${storagePath}`, options.header, onFileProgress, (err, path) => { + if (err) { + if (failureRecord) { + failureRecord.retryCount++; + if (failureRecord.retryCount >= maxRetryCountFromBreakpoint) { + delete failureMap[url]; + } + } else { + failureMap[url] = { + retryCount: 0, + storagePath + }; + } + onComplete(err, null); + return; + } + delete failureMap[url]; + func(path, options, (err, data) => { + if (!err) { + cacheManager.cacheFile(url, storagePath, options.__cacheBundleRoot__); + } + onComplete(err, data); + }); + }); + } +} +function transformUrl(url, options) { + let inLocal = false; + let inCache = false; + if (REGEX.test(url) && !url.startsWith('file://')) { + if (options.reload) { + return { + url + }; + } else { + const cache = cacheManager.getCache(url); + if (cache) { + inCache = true; + url = cache; + } + } + } else { + inLocal = true; + if (url.startsWith('file://')) { + url = url.replace(/^file:\/\//, ''); + } + } + return { + url, + inLocal, + inCache + }; +} +function doNothing(content, options, onComplete) { + onComplete(null, content); +} +function downloadAsset(url, options, onComplete) { + download(url, doNothing, options, options.onFileProgress, onComplete); +} +function _getFontFamily(fontHandle) { + const ttfIndex = fontHandle.lastIndexOf('.ttf'); + if (ttfIndex === -1) return fontHandle; + const slashPos = fontHandle.lastIndexOf('/'); + let fontFamilyName; + if (slashPos === -1) { + fontFamilyName = `${fontHandle.substring(0, ttfIndex)}_LABEL`; + } else { + fontFamilyName = `${fontHandle.substring(slashPos + 1, ttfIndex)}_LABEL`; + } + if (fontFamilyName.indexOf(' ') !== -1) { + fontFamilyName = `"${fontFamilyName}"`; + } + return fontFamilyName; +} +function parseText(url, options, onComplete) { + readText(url, onComplete); +} +function parseJson(url, options, onComplete) { + readJson(url, onComplete); +} +function downloadText(url, options, onComplete) { + download(url, parseText, options, options.onFileProgress, onComplete); +} +function parseArrayBuffer(url, options, onComplete) { + readArrayBuffer(url, onComplete); +} +function downloadJson(url, options, onComplete) { + download(url, parseJson, options, options.onFileProgress, onComplete); +} +function downloadBundle(nameOrUrl, options, onComplete) { + const bundleName = cc.path.basename(nameOrUrl); + const version = options.version || downloader.bundleVers[bundleName]; + let url; + if (REGEX.test(nameOrUrl) || nameOrUrl.startsWith(getUserDataPath())) { + url = nameOrUrl; + cacheManager.makeBundleFolder(bundleName); + } else if (downloader.remoteBundles.indexOf(bundleName) !== -1) { + url = `${downloader.remoteServerAddress}remote/${bundleName}`; + cacheManager.makeBundleFolder(bundleName); + } else { + url = `assets/${bundleName}`; + } + const config = `${url}/cc.config.${version ? `${version}.` : ''}json`; + options.__cacheBundleRoot__ = bundleName; + downloadJson(config, options, (err, response) => { + if (err) { + return onComplete(err, null); + } + const out = response; + out && (out.base = `${url}/`); + if (out.hasPreloadScript) { + const js = `${url}/index.${version ? `${version}.` : ''}${out.encrypted ? 'jsc' : `js`}`; + downloadScript(js, options, err => { + if (err) { + return onComplete(err, null); + } + onComplete(null, out); + }); + } else { + onComplete(null, out); + } + }); +} +function downloadArrayBuffer(url, options, onComplete) { + download(url, parseArrayBuffer, options, options.onFileProgress, onComplete); +} +function loadFont(url, options, onComplete) { + const fontFamilyName = _getFontFamily(url); + const fontFace = new jsbWindow.FontFace(fontFamilyName, `url('${url}')`); + jsbWindow.document.fonts.add(fontFace); + fontFace.load(); + fontFace.loaded.then(() => { + onComplete(null, fontFamilyName); + }, () => { + cc.warnID(4933, fontFamilyName); + onComplete(null, fontFamilyName); + }); +} +const originParsePlist = parser.parsePlist; +const parsePlist = function (url, options, onComplete) { + readText(url, (err, file) => { + if (err) return onComplete(err); + originParsePlist(file, options, onComplete); + }); +}; +parser.parsePVRTex = downloader.downloadDomImage; +parser.parsePKMTex = downloader.downloadDomImage; +parser.parseASTCTex = downloader.downloadDomImage; +parser.parsePlist = parsePlist; +downloader.downloadScript = downloadScript; +downloader._downloadArrayBuffer = downloadArrayBuffer; +downloader._downloadJson = downloadJson; +function loadAudioPlayer(url, options, onComplete) { + cc.AudioPlayer.load(url).then(player => { + const audioMeta = { + player, + url, + duration: player.duration, + type: player.type + }; + onComplete(null, audioMeta); + }).catch(err => { + onComplete(err); + }); +} +downloader.register({ + // JS + '.js': downloadScript, + '.jsc': downloadScript, + // Images + '.png': downloadAsset, + '.jpg': downloadAsset, + '.bmp': downloadAsset, + '.jpeg': downloadAsset, + '.gif': downloadAsset, + '.ico': downloadAsset, + '.tiff': downloadAsset, + '.webp': downloadAsset, + '.image': downloadAsset, + '.pvr': downloadAsset, + '.pkm': downloadAsset, + '.astc': downloadAsset, + // Audio + '.mp3': downloadAsset, + '.ogg': downloadAsset, + '.wav': downloadAsset, + '.m4a': downloadAsset, + // Video + '.mp4': downloadAsset, + '.avi': downloadAsset, + '.mov': downloadAsset, + '.mpg': downloadAsset, + '.mpeg': downloadAsset, + '.rm': downloadAsset, + '.rmvb': downloadAsset, + // Text + '.txt': downloadAsset, + '.xml': downloadAsset, + '.vsh': downloadAsset, + '.fsh': downloadAsset, + '.atlas': downloadAsset, + '.tmx': downloadAsset, + '.tsx': downloadAsset, + '.fnt': downloadAsset, + '.plist': downloadAsset, + '.json': downloadJson, + '.ExportJson': downloadAsset, + '.binary': downloadAsset, + '.bin': downloadAsset, + '.dbbin': downloadAsset, + '.skel': downloadAsset, + // Font + '.font': downloadAsset, + '.eot': downloadAsset, + '.ttf': downloadAsset, + '.woff': downloadAsset, + '.svg': downloadAsset, + '.ttc': downloadAsset, + bundle: downloadBundle, + default: downloadText +}); +parser.register({ + // Images + '.png': downloader.downloadDomImage, + '.jpg': downloader.downloadDomImage, + '.bmp': downloader.downloadDomImage, + '.jpeg': downloader.downloadDomImage, + '.gif': downloader.downloadDomImage, + '.ico': downloader.downloadDomImage, + '.tiff': downloader.downloadDomImage, + '.webp': downloader.downloadDomImage, + '.image': downloader.downloadDomImage, + // Audio + '.mp3': loadAudioPlayer, + '.ogg': loadAudioPlayer, + '.wav': loadAudioPlayer, + '.m4a': loadAudioPlayer, + // compressed texture + '.pvr': downloader.downloadDomImage, + '.pkm': downloader.downloadDomImage, + '.astc': downloader.downloadDomImage, + '.binary': parseArrayBuffer, + '.bin': parseArrayBuffer, + '.dbbin': parseArrayBuffer, + '.skel': parseArrayBuffer, + // Text + '.txt': parseText, + '.xml': parseText, + '.vsh': parseText, + '.fsh': parseText, + '.atlas': parseText, + '.tmx': parseText, + '.tsx': parseText, + '.fnt': parseText, + '.plist': parsePlist, + // Font + '.font': loadFont, + '.eot': loadFont, + '.ttf': loadFont, + '.woff': loadFont, + '.svg': loadFont, + '.ttc': loadFont, + '.ExportJson': parseJson +}); +if (CC_BUILD) { + cc.assetManager.transformPipeline.append(task => { + const input = task.output = task.input; + for (let i = 0, l = input.length; i < l; i++) { + const item = input[i]; + if (item.config) { + item.options.__cacheBundleRoot__ = item.config.name; + } + if (item.ext === '.cconb') { + item.url = item.url.replace(item.ext, '.bin'); + } else if (item.ext === '.ccon') { + item.url = item.url.replace(item.ext, '.json'); + } + } + }); +} +const originInit = cc.assetManager.init; +cc.assetManager.init = function (options) { + originInit.call(cc.assetManager, options); + const jsbDownloaderMaxTasks = cc.settings.querySettings('assets', 'jsbDownloaderMaxTasks'); + const jsbDownloaderTimeout = cc.settings.querySettings('assets', 'jsbDownloaderTimeout'); + initJsbDownloader(jsbDownloaderMaxTasks, jsbDownloaderTimeout); + cacheManager.init(); +}; + +},{"../jsbWindow":16,"./jsb-cache-manager":3,"./jsb-fs-utils":7}],11:[function(require,module,exports){ +"use strict"; + +const jsbPhy = globalThis['jsb.physics']; +jsbPhy.CACHE = { + trimesh: {}, + convex: {}, + height: {}, + material: {} +}; +jsbPhy.OBJECT = { + books: [], + ptrToObj: {}, + raycastOptions: { + origin: null, + unitDir: null, + distance: 0, + mask: 0, + queryTrigger: true + } +}; +jsbPhy.CONFIG = { + heightScale: 1 / 512 +}; +const books = jsbPhy.OBJECT.books; +const ptrToObj = jsbPhy.OBJECT.ptrToObj; +const raycastOptions = jsbPhy.OBJECT.raycastOptions; +const TriggerEventObject = { + type: 'onTriggerEnter', + selfCollider: null, + otherCollider: null, + impl: null +}; +const CollisionEventObject = { + type: 'onCollisionEnter', + selfCollider: null, + otherCollider: null, + contacts: [], + impl: null +}; +const CCTShapeEventObject = { + type: 'onControllerColliderHit', + controller: null, + collider: null, + worldPosition: null, + worldNormal: null, + motionDirection: null, + motionLength: 0 +}; +const CharacterTriggerEventObject = { + type: 'onControllerTriggerEnter', + characterController: null, + collider: null, + impl: null +}; +function emitTriggerEvent(t, c0, c1, impl) { + TriggerEventObject.type = t; + TriggerEventObject.impl = impl; + if (c0.needTriggerEvent) { + TriggerEventObject.selfCollider = c0; + TriggerEventObject.otherCollider = c1; + c0.emit(t, TriggerEventObject); + } + if (c1.needTriggerEvent) { + TriggerEventObject.selfCollider = c1; + TriggerEventObject.otherCollider = c0; + c1.emit(t, TriggerEventObject); + } +} +function emitCCTTriggerEvent(t, cct, collider, impl) { + CharacterTriggerEventObject.type = t; + CharacterTriggerEventObject.impl = impl; + CharacterTriggerEventObject.characterController = cct; + CharacterTriggerEventObject.collider = collider; + if (collider.needTriggerEvent) { + collider.emit(t, CharacterTriggerEventObject); + } + if (cct.needTriggerEvent) { + cct.emit(t, CharacterTriggerEventObject); + } +} +const quat = new cc.Quat(); +const contactsPool = []; +const contactBufferElementLength = 12; +class ContactPoint { + constructor(e) { + this.event = e; + this.impl = null; + this.colliderA = null; + this.colliderB = null; + this.index = 0; + } + get isBodyA() { + return this.colliderA.uuid === this.event.selfCollider.uuid; + } + getLocalPointOnA(o) { + this.getWorldPointOnB(o); + cc.Vec3.subtract(o, o, this.colliderA.node.worldPosition); + } + getLocalPointOnB(o) { + this.getWorldPointOnB(o); + cc.Vec3.subtract(o, o, this.colliderB.node.worldPosition); + } + getWorldPointOnA(o) { + this.getWorldPointOnB(o); + } + getWorldPointOnB(o) { + const i = this.index * contactBufferElementLength; + o.x = this.impl[i]; + o.y = this.impl[i + 1]; + o.z = this.impl[i + 2]; + } + getLocalNormalOnA(o) { + this.getWorldNormalOnA(o); + cc.Quat.conjugate(quat, this.colliderA.node.worldRotation); + cc.Vec3.transformQuat(o, o, quat); + } + getLocalNormalOnB(o) { + this.getWorldNormalOnB(o); + cc.Quat.conjugate(quat, this.colliderB.node.worldRotation); + cc.Vec3.transformQuat(out, out, quat); + } + getWorldNormalOnA(o) { + this.getWorldNormalOnB(o); + if (!this.isBodyA) cc.Vec3.negate(o, o); + } + getWorldNormalOnB(o) { + const i = this.index * contactBufferElementLength + 3; + o.x = this.impl[i]; + o.y = this.impl[i + 1]; + o.z = this.impl[i + 2]; + } +} +function emitCollisionEvent(t, c0, c1, impl, b) { + CollisionEventObject.type = t; + CollisionEventObject.impl = impl; + const contacts = CollisionEventObject.contacts; + contactsPool.push.apply(contactsPool, contacts); + contacts.length = 0; + const contactCount = b.length / contactBufferElementLength; + for (let i = 0; i < contactCount; i++) { + const c = contactsPool.length > 0 ? contactsPool.pop() : new ContactPoint(CollisionEventObject); + c.colliderA = c0; + c.colliderB = c1; + c.impl = b; + c.index = i; + contacts.push(c); + } + if (c0.needCollisionEvent) { + CollisionEventObject.selfCollider = c0; + CollisionEventObject.otherCollider = c1; + c0.emit(t, CollisionEventObject); + } + if (c1.needCollisionEvent) { + CollisionEventObject.selfCollider = c1; + CollisionEventObject.otherCollider = c0; + c1.emit(t, CollisionEventObject); + } +} +function emitCCTCollisionEvent(t, cct, collider, b) { + CCTShapeEventObject.type = t; + const contactCount = b.length / 10; + CCTShapeEventObject.worldPosition = new cc.Vec3(b[0], b[1], b[2]); + CCTShapeEventObject.worldNormal = new cc.Vec3(b[3], b[4], b[5]); + CCTShapeEventObject.motionDirection = new cc.Vec3(b[6], b[7], b[8]); + CCTShapeEventObject.motionLength = b[9]; + CCTShapeEventObject.controller = cct; + CCTShapeEventObject.collider = collider; + cct.emit(t, CCTShapeEventObject); +} +class PhysicsWorld { + get impl() { + return this._impl; + } + constructor() { + this._impl = new jsbPhy.World(); + } + setGravity(v) { + this._impl.setGravity(v.x, v.y, v.z); + } + setAllowSleep(v) { + this._impl.setAllowSleep(v); + } + setDefaultMaterial(v) {} + step(f, t, m) { + // books.forEach((v) => { v.syncToNativeTransform(); }); + this._impl.step(f); + } + set debugDrawFlags(v) { + this._impl.setDebugDrawFlags(v); + } + get debugDrawFlags() { + return this._impl.getDebugDrawFlags(); + } + set debugDrawConstraintSize(v) { + this._impl.setDebugDrawConstraintSize(v); + } + get debugDrawConstraintSize() { + return this._impl.getDebugDrawConstraintSize(); + } + raycast(r, o, p, rs) { + raycastOptions.origin = r.o; + raycastOptions.unitDir = r.d; + raycastOptions.mask = o.mask >>> 0; + raycastOptions.distance = o.maxDistance; + raycastOptions.queryTrigger = !!o.queryTrigger; + const isHit = this._impl.raycast(raycastOptions); + if (isHit) { + const hits = this._impl.raycastResult(); + for (let i = 0; i < hits.length; i++) { + const hit = hits[i]; + const out = p.add(); + out._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + rs.push(out); + } + } + return isHit; + } + raycastClosest(r, o, out) { + raycastOptions.origin = r.o; + raycastOptions.unitDir = r.d; + raycastOptions.mask = o.mask >>> 0; + raycastOptions.distance = o.maxDistance; + raycastOptions.queryTrigger = !!o.queryTrigger; + const isHit = this._impl.raycastClosest(raycastOptions); + if (isHit) { + const hit = this._impl.raycastClosestResult(); + out._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + } + return isHit; + } + sweepBox(worldRay, halfExtent, orientation, options, pool, results) { + raycastOptions.origin = worldRay.o; + raycastOptions.unitDir = worldRay.d; + raycastOptions.mask = options.mask >>> 0; + raycastOptions.distance = options.maxDistance; + raycastOptions.queryTrigger = !!options.queryTrigger; + const isHit = this._impl.sweepBox(raycastOptions, halfExtent.x, halfExtent.y, halfExtent.z, orientation.w, orientation.x, orientation.y, orientation.z); + if (isHit) { + const hits = this._impl.sweepResult(); + for (let i = 0; i < hits.length; i++) { + const hit = hits[i]; + const out = pool.add(); + out._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + results.push(out); + } + } + return isHit; + } + sweepBoxClosest(worldRay, halfExtent, orientation, options, result) { + raycastOptions.origin = worldRay.o; + raycastOptions.unitDir = worldRay.d; + raycastOptions.mask = options.mask >>> 0; + raycastOptions.distance = options.maxDistance; + raycastOptions.queryTrigger = !!options.queryTrigger; + const isHit = this._impl.sweepBoxClosest(raycastOptions, halfExtent.x, halfExtent.y, halfExtent.z, orientation.w, orientation.x, orientation.y, orientation.z); + if (isHit) { + const hit = this._impl.sweepClosestResult(); + result._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + } + return isHit; + } + sweepSphere(worldRay, radius, options, pool, results) { + raycastOptions.origin = worldRay.o; + raycastOptions.unitDir = worldRay.d; + raycastOptions.mask = options.mask >>> 0; + raycastOptions.distance = options.maxDistance; + raycastOptions.queryTrigger = !!options.queryTrigger; + const isHit = this._impl.sweepSphere(raycastOptions, radius); + if (isHit) { + const hits = this._impl.sweepResult(); + for (let i = 0; i < hits.length; i++) { + const hit = hits[i]; + const out = pool.add(); + out._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + results.push(out); + } + } + return isHit; + } + sweepSphereClosest(worldRay, radius, options, result) { + raycastOptions.origin = worldRay.o; + raycastOptions.unitDir = worldRay.d; + raycastOptions.mask = options.mask >>> 0; + raycastOptions.distance = options.maxDistance; + raycastOptions.queryTrigger = !!options.queryTrigger; + const isHit = this._impl.sweepSphereClosest(raycastOptions, radius); + if (isHit) { + const hit = this._impl.sweepClosestResult(); + result._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + } + return isHit; + } + sweepCapsule(worldRay, radius, height, orientation, options, pool, results) { + raycastOptions.origin = worldRay.o; + raycastOptions.unitDir = worldRay.d; + raycastOptions.mask = options.mask >>> 0; + raycastOptions.distance = options.maxDistance; + raycastOptions.queryTrigger = !!options.queryTrigger; + const isHit = this._impl.sweepCapsule(raycastOptions, radius, height, orientation.w, orientation.x, orientation.y, orientation.z); + if (isHit) { + const hits = this._impl.sweepResult(); + for (let i = 0; i < hits.length; i++) { + const hit = hits[i]; + const out = pool.add(); + out._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + results.push(out); + } + } + return isHit; + } + sweepCapsuleClosest(worldRay, radius, height, orientation, options, result) { + raycastOptions.origin = worldRay.o; + raycastOptions.unitDir = worldRay.d; + raycastOptions.mask = options.mask >>> 0; + raycastOptions.distance = options.maxDistance; + raycastOptions.queryTrigger = !!options.queryTrigger; + const isHit = this._impl.sweepCapsuleClosest(raycastOptions, radius, height, orientation.w, orientation.x, orientation.y, orientation.z); + if (isHit) { + const hit = this._impl.sweepClosestResult(); + result._assign(hit.hitPoint, hit.distance, ptrToObj[hit.shape].collider, hit.hitNormal); + } + return isHit; + } + emitEvents() { + this.emitTriggerEvent(); + this.emitCollisionEvent(); + this.emitCCTCollisionEvent(); + this.emitCCTTriggerEvent(); + this._impl.emitEvents(); + } + syncSceneToPhysics() { + this._impl.syncSceneToPhysics(); + } + syncAfterEvents() { + // this._impl.syncSceneToPhysics() + } + destroy() { + this._impl.destroy(); + } + emitTriggerEvent() { + const teps = this._impl.getTriggerEventPairs(); + const len = teps.length / 3; + for (let i = 0; i < len; i++) { + const t = i * 3; + const sa = ptrToObj[teps[t + 0]]; + const sb = ptrToObj[teps[t + 1]]; + if (!sa || !sb) continue; + const c0 = sa.collider; + const c1 = sb.collider; + if (!(c0 && c0.isValid && c1 && c1.isValid)) continue; + if (!c0.needTriggerEvent && !c1.needTriggerEvent) continue; + const state = teps[t + 2]; + if (state === 1) { + emitTriggerEvent('onTriggerStay', c0, c1, teps); + } else if (state === 0) { + emitTriggerEvent('onTriggerEnter', c0, c1, teps); + } else { + emitTriggerEvent('onTriggerExit', c0, c1, teps); + } + } + } + emitCollisionEvent() { + const ceps = this._impl.getContactEventPairs(); + const len2 = ceps.length / 4; + for (let i = 0; i < len2; i++) { + const t = i * 4; + const sa = ptrToObj[ceps[t + 0]]; + const sb = ptrToObj[ceps[t + 1]]; + if (!sa || !sb) continue; + const c0 = sa.collider; + const c1 = sb.collider; + if (!(c0 && c0.isValid && c1 && c1.isValid)) continue; + if (!c0.needCollisionEvent && !c1.needCollisionEvent) continue; + const state = ceps[t + 2]; + if (state === 1) { + emitCollisionEvent('onCollisionStay', c0, c1, ceps, ceps[t + 3]); + } else if (state === 0) { + emitCollisionEvent('onCollisionEnter', c0, c1, ceps, ceps[t + 3]); + } else { + emitCollisionEvent('onCollisionExit', c0, c1, ceps, ceps[t + 3]); + } + } + } + emitCCTCollisionEvent() { + const events = this._impl.getCCTShapeEventPairs(); + const len2 = events.length / 3; + for (let i = 0; i < len2; i++) { + const t = i * 3; + const cct = ptrToObj[events[t + 0]]; + const shape = ptrToObj[events[t + 1]]; + if (!cct || !shape) continue; + const c0 = cct.characterController; + const c1 = shape.collider; + if (!(c0 && c0.isValid && c1 && c1.isValid)) continue; + emitCCTCollisionEvent('onControllerColliderHit', c0, c1, events[t + 2]); + } + } + emitCCTTriggerEvent() { + const teps = this._impl.getCCTTriggerEventPairs(); + const len = teps.length / 3; + for (let i = 0; i < len; i++) { + const t = i * 3; + const sa = ptrToObj[teps[t + 0]]; + const sb = ptrToObj[teps[t + 1]]; + if (!sa || !sb) continue; + const cct = sa.characterController; + const collider = sb.collider; + if (!(cct && cct.isValid && collider && collider.isValid)) continue; + if (!collider.needTriggerEvent) continue; + const state = teps[t + 2]; + if (state === 1) { + emitCCTTriggerEvent('onControllerTriggerStay', cct, collider, teps); + } else if (state === 0) { + emitCCTTriggerEvent('onControllerTriggerEnter', cct, collider, teps); + } else { + emitCCTTriggerEvent('onControllerTriggerExit', cct, collider, teps); + } + } + } +} +function bookNode(v) { + if (v._physicsBookIndex === undefined) { + v._physicsBookIndex = books.length; + books.push(v); + } +} +function unBookNode(v) { + const index = v._physicsBookIndex; + if (index !== undefined) { + books[index] = books[books.length - 1]; + books[index]._physicsBookIndex = index; + books.length -= 1; + v._physicsBookIndex = undefined; + } +} +function updateCollisionMatrix() { + const phy = cc.PhysicsSystem.instance; + const world = phy.physicsWorld.impl; + const cm = phy.collisionMatrix; + if (cm.updateArray && cm.updateArray.length > 0) { + cm.updateArray.forEach(e => { + const key = `${1 << e}`; + const mask = cm[key]; + world.setCollisionMatrix(e, mask); + }); + cm.updateArray.length = 0; + } +} +class RigidBody { + get impl() { + return this._impl; + } + get rigidBody() { + return this._com; + } + get isAwake() { + return this._impl.isAwake(); + } + get isSleepy() { + return false; + } + get isSleeping() { + return this._impl.isSleeping(); + } + constructor() { + updateCollisionMatrix(); + this._impl = new jsbPhy.RigidBody(); + this._isUsingCCD = false; + } + initialize(v) { + v.node.updateWorldTransform(); + this._com = v; + this._impl.initialize(v.node, v.type, v._group); + bookNode(v.node); + this._impl.setSleepThreshold(cc.PhysicsSystem.instance.sleepThreshold); + } + onEnable() { + this.setType(this._com.type); + this.setMass(this._com.mass); + this.setAllowSleep(this._com.allowSleep); + this.setLinearDamping(this._com.linearDamping); + this.setAngularDamping(this._com.angularDamping); + this.setLinearFactor(this._com.linearFactor); + this.setAngularFactor(this._com.angularFactor); + this.useGravity(this._com.useGravity); + this._impl.onEnable(); + } + onDisable() { + this._impl.onDisable(); + } + onDestroy() { + unBookNode(this._com.node); + this._impl.onDestroy(); + } + setGroup(v) { + this._impl.setGroup(v); + } + getGroup() { + return this._impl.getGroup(); + } + addGroup(v) { + this.setGroup(this.getGroup() | v); + } + removeGroup(v) { + this.setGroup(this.getGroup() & ~v); + } + setMask(v) { + this._impl.setMask(v >>> 0); + } + getMask() { + return this._impl.getMask(); + } + addMask(v) { + this.setMask(this.getMask() | v); + } + removeMask(v) { + this.setMask(this.getMask() & ~v); + } + setType(v) { + this._impl.setType(v); + } + setMass(v) { + this._impl.setMass(v); + } + setAllowSleep(v) { + this._impl.setAllowSleep(v); + } + setLinearDamping(v) { + const dt = cc.PhysicsSystem.instance.fixedTimeStep; + this._impl.setLinearDamping((1 - (1 - v) ** dt) / dt); + } + setAngularDamping(v) { + const dt = cc.PhysicsSystem.instance.fixedTimeStep; + this._impl.setAngularDamping((1 - (1 - v) ** dt) / dt); + } + isUsingCCD() { + return this._isUsingCCD; + } + useCCD(v) { + this._isUsingCCD = v; + return this._impl.useCCD(v); + } + useGravity(v) { + this._impl.useGravity(v); + } + setLinearFactor(v) { + this._impl.setLinearFactor(v.x, v.y, v.z); + } + setAngularFactor(v) { + this._impl.setAngularFactor(v.x, v.y, v.z); + } + wakeUp() { + this._impl.wakeUp(); + } + sleep() { + this._impl.sleep(); + } + clearState() { + this._impl.clearState(); + } + clearForces() { + this._impl.clearForces(); + } + clearVelocity() { + this._impl.clearVelocity(); + } + setSleepThreshold(v) { + this._impl.setSleepThreshold(v); + } + getSleepThreshold() { + return this._impl.getSleepThreshold(); + } + getLinearVelocity(o) { + o.set(this._impl.getLinearVelocity()); + } + setLinearVelocity(v) { + this._impl.setLinearVelocity(v.x, v.y, v.z); + } + getAngularVelocity(o) { + o.set(this._impl.getAngularVelocity()); + } + setAngularVelocity(v) { + this._impl.setAngularVelocity(v.x, v.y, v.z); + } + applyForce(f, p) { + if (p == null) { + p = cc.Vec3.ZERO; + } + this._impl.applyForce(f.x, f.y, f.z, p.x, p.y, p.z); + } + applyLocalForce(f, p) { + if (p == null) { + p = cc.Vec3.ZERO; + } + this._impl.applyLocalForce(f.x, f.y, f.z, p.x, p.y, p.z); + } + applyImpulse(f, p) { + if (p == null) { + p = cc.Vec3.ZERO; + } + this._impl.applyImpulse(f.x, f.y, f.z, p.x, p.y, p.z); + } + applyLocalImpulse(f, p) { + if (p == null) { + p = cc.Vec3.ZERO; + } + this._impl.applyLocalImpulse(f.x, f.y, f.z, p.x, p.y, p.z); + } + applyTorque(t) { + this._impl.applyTorque(t.x, t.y, t.z); + } + applyLocalTorque(t) { + this._impl.applyLocalTorque(t.x, t.y, t.z); + } +} +const ESHAPE_FLAG = { + NONE: 0, + QUERY_FILTER: 1 << 0, + QUERY_SINGLE_HIT: 1 << 2, + DETECT_TRIGGER_EVENT: 1 << 3, + DETECT_CONTACT_EVENT: 1 << 4, + DETECT_CONTACT_POINT: 1 << 5, + DETECT_CONTACT_CCD: 1 << 6 +}; +class Shape { + get impl() { + return this._impl; + } + get collider() { + return this._com; + } + get attachedRigidBody() { + return this._attachedRigidBody; + } + constructor() { + updateCollisionMatrix(); + } + initialize(v) { + v.node.updateWorldTransform(); + this._com = v; + this._impl.initialize(v.node); + ptrToObj[this._impl.getObjectID()] = this; + bookNode(v.node); + } + onLoad() { + this.setMaterial(this._com.sharedMaterial); + this.setCenter(this._com.center); + this.setAsTrigger(this._com.isTrigger); + } + onEnable() { + this._impl.onEnable(); + } + onDisable() { + this._impl.onDisable(); + } + onDestroy() { + unBookNode(this._com.node); + delete ptrToObj[this._impl.getObjectID()]; + ptrToObj[this._impl.getObjectID()] = null; + this._impl.onDestroy(); + } + setMaterial(v) { + const ins = cc.PhysicsSystem.instance; + if (!v) v = ins.defaultMaterial; + if (!jsbPhy.CACHE.material[v.id]) { + jsbPhy.CACHE.material[v.id] = ins.physicsWorld.impl.createMaterial(v.id, v.friction, v.friction, v.restitution, 2, 2); + } + this._impl.setMaterial(v.id, v.friction, v.friction, v.restitution, 2, 2); + } + setAsTrigger(v) { + this._impl.setAsTrigger(v); + } + setCenter(v) { + this._impl.setCenter(v.x, v.y, v.z); + } + getAABB(v) { + v.copy(this._impl.getAABB()); + } + getBoundingSphere(v) { + v.copy(this._impl.getBoundingSphere()); + } + updateEventListener() { + let flag = 0; + flag |= ESHAPE_FLAG.DETECT_CONTACT_CCD; + if (this._com.isTrigger) flag |= ESHAPE_FLAG.IS_TRIGGER; + if (this._com.needTriggerEvent || this._com.needCollisionEvent) flag |= ESHAPE_FLAG.NEED_EVENT; + this._impl.updateEventListener(flag); + } + setGroup(v) { + this._impl.setGroup(v); + } + getGroup() { + return this._impl.getGroup(); + } + addGroup(v) { + this.setGroup(this.getGroup() | v); + } + removeGroup(v) { + this.setGroup(this.getGroup() & ~v); + } + setMask(v) { + this._impl.setMask(v >>> 0); + } + getMask() { + return this._impl.getMask(); + } + addMask(v) { + this.setMask(this.getMask() | v); + } + removeMask(v) { + this.setMask(this.getMask() & ~v); + } +} +class SphereShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.SphereShape(); + } + updateRadius() { + this._impl.setRadius(this.collider.radius); + } + onLoad() { + super.onLoad(); + this.updateRadius(); + } +} +class BoxShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.BoxShape(); + } + updateSize() { + const v = this.collider.size; + this._impl.setSize(v.x, v.y, v.z); + } + onLoad() { + super.onLoad(); + this.updateSize(); + } +} +class CapsuleShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.CapsuleShape(); + } + setRadius(v) { + this._impl.setRadius(v); + } + setDirection(v) { + this._impl.setDirection(v); + } + setCylinderHeight(v) { + this._impl.setCylinderHeight(v); + } + onLoad() { + super.onLoad(); + this.setRadius(this._com.radius); + this.setDirection(this._com.direction); + this.setCylinderHeight(this._com.cylinderHeight); + } +} +class PlaneShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.PlaneShape(); + } + setConstant(v) { + this._impl.setConstant(v); + } + setNormal(v) { + this._impl.setNormal(v.x, v.y, v.z); + } + onLoad() { + super.onLoad(); + this.setNormal(this._com.normal); + this.setConstant(this._com.constant); + } +} +function getConvexMesh(v) { + if (!jsbPhy.CACHE.convex[v._uuid]) { + const posArr = cc.physics.utils.shrinkPositions(v.renderingSubMeshes[0].geometricInfo.positions); + const world = cc.PhysicsSystem.instance.physicsWorld.impl; + const convex = { + positions: new Float32Array(posArr), + positionLength: posArr.length / 3 + }; + jsbPhy.CACHE.convex[v._uuid] = world.createConvex(convex); + } + return jsbPhy.CACHE.convex[v._uuid]; +} +function getTriangleMesh(v) { + if (!jsbPhy.CACHE.trimesh[v._uuid]) { + const posArr = v.renderingSubMeshes[0].geometricInfo.positions; + const indArr = v.renderingSubMeshes[0].geometricInfo.indices; + const world = cc.PhysicsSystem.instance.physicsWorld.impl; + const trimesh = { + positions: new Float32Array(posArr), + positionLength: posArr.length / 3, + triangles: new Uint16Array(indArr), + triangleLength: indArr.length / 3, + isU16: true + }; + jsbPhy.CACHE.trimesh[v._uuid] = world.createTrimesh(trimesh); + } + return jsbPhy.CACHE.trimesh[v._uuid]; +} +function getHeightField(v) { + if (!jsbPhy.CACHE.height[v._uuid]) { + const rows = v.getVertexCountI(); + const columns = v.getVertexCountJ(); + const samples = new Int16Array(rows * columns); + const heightScale = jsbPhy.CONFIG.heightScale; + for (let i = 0; i < rows; i++) { + for (let j = 0; j < columns; j++) { + samples[j + i * columns] = v.getHeight(i, j) / heightScale; + } + } + const height = { + rows, + columns, + samples + }; + const world = cc.PhysicsSystem.instance.physicsWorld.impl; + jsbPhy.CACHE.height[v._uuid] = world.createHeightField(height); + } + return jsbPhy.CACHE.height[v._uuid]; +} +class CylinderShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.CylinderShape(); + } + setRadius(v) { + this.updateGeometry(); + } + setDirection(v) { + this.updateGeometry(); + } + setHeight(v) { + this.updateGeometry(); + } + updateGeometry() { + this._impl.setCylinder(this._com.radius, this._com.height, this._com.direction); + } + initialize(v) { + if (!jsbPhy.CACHE.convex.CYLINDER) { + const primitive = cc.physics.utils.cylinder(0.5, 0.5, 2, { + radialSegments: 32, + heightSegments: 1 + }); + const posArr = cc.physics.utils.shrinkPositions(primitive.positions); + const convex = { + positions: new Float32Array(posArr), + positionLength: posArr.length / 3 + }; + const pxObjectID = cc.PhysicsSystem.instance.physicsWorld.impl.createConvex(convex); + jsbPhy.CACHE.convex.CYLINDER = pxObjectID; + } + this._com = v; + this._impl.setCylinder(v.radius, v.height, v.direction); + this._impl.setConvex(jsbPhy.CACHE.convex.CYLINDER); + super.initialize(v); + } +} +class ConeShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.ConeShape(); + } + setRadius(v) { + this.updateGeometry(); + } + setDirection(v) { + this.updateGeometry(); + } + setHeight(v) { + this.updateGeometry(); + } + updateGeometry() { + this._impl.setCone(this._com.radius, this._com.height, this._com.direction); + } + initialize(v) { + if (!jsbPhy.CACHE.convex.CONE) { + const primitive = cc.physics.utils.cylinder(0, 0.5, 1, { + radialSegments: 32, + heightSegments: 1 + }); + const posArr = cc.physics.utils.shrinkPositions(primitive.positions); + const convex = { + positions: new Float32Array(posArr), + positionLength: posArr.length / 3 + }; + const pxObjectID = cc.PhysicsSystem.instance.physicsWorld.impl.createConvex(convex); + jsbPhy.CACHE.convex.CONE = pxObjectID; + } + this._com = v; + this._impl.setCone(v.radius, v.height, v.direction); + this._impl.setConvex(jsbPhy.CACHE.convex.CONE); + super.initialize(v); + } +} +class TrimeshShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.TrimeshShape(); + } + setConvex(v) { + this._impl.useConvex(v); + } + setMesh(v) { + if (!v) return; + const isConvex = this._com.convex; + this._impl.useConvex(isConvex); + const pxObjectID = isConvex ? getConvexMesh(v) : getTriangleMesh(v); + this._impl.setMesh(pxObjectID); + } + initialize(v) { + this._com = v; + this.setConvex(v.convex); + this.setMesh(v.mesh); + super.initialize(v); + } +} +class TerrainShape extends Shape { + constructor() { + super(); + this._impl = new jsbPhy.TerrainShape(); + } + setTerrain(v) { + if (!v) return; + const pxObjectID = getHeightField(v); + this._impl.setTerrain(pxObjectID, v.tileSize, v.tileSize, jsbPhy.CONFIG.heightScale); + } + initialize(v) { + this._com = v; + this.setTerrain(v.terrain); + super.initialize(v); + } +} +class Joint { + get impl() { + return this._impl; + } + get joint() { + return this._com; + } + setEnableCollision(v) { + this._impl.setEnableCollision(v); + } + setConnectedBody(v) { + this._impl.setConnectedBody(v ? v.body.impl.getObjectID() : 0); + } + initialize(v) { + this._com = v; + this._impl.initialize(v.node); + ptrToObj[this._impl.getObjectID()] = this; + this.onLoad(); + } + onLoad() { + this.setConnectedBody(this._com.connectedBody); + this.setEnableCollision(this._com.enableCollision); + } + onEnable() { + this._impl.onEnable(); + } + onDisable() { + this._impl.onDisable(); + } + onDestroy() { + delete ptrToObj[this._impl.getObjectID()]; + ptrToObj[this._impl.getObjectID()] = null; + this._impl.onDestroy(); + } +} +class SphericalJoint extends Joint { + constructor() { + super(); + this._impl = new jsbPhy.SphericalJoint(); + } + setPivotA(v) { + this._impl.setPivotA(v.x, v.y, v.z); + } + setPivotB(v) { + this._impl.setPivotB(v.x, v.y, v.z); + } + onLoad() { + super.onLoad(); + this.setPivotA(this._com.pivotA); + this.setPivotB(this._com.pivotB); + } +} +class RevoluteJoint extends Joint { + constructor() { + super(); + this._impl = new jsbPhy.RevoluteJoint(); + } + setAxis(v) { + this._impl.setAxis(v.x, v.y, v.z); + } + setPivotA(v) { + this._impl.setPivotA(v.x, v.y, v.z); + } + setPivotB(v) { + this._impl.setPivotB(v.x, v.y, v.z); + } + setLimitEnabled(v) { + this._impl.setLimitEnabled(v); + } + setLowerLimit(v) { + this._impl.setLowerLimit(v); + } + setUpperLimit(v) { + this._impl.setUpperLimit(v); + } + setMotorEnabled(v) { + this._impl.setMotorEnabled(v); + } + setMotorVelocity(v) { + this._impl.setMotorVelocity(v); + } + setMotorForceLimit(v) { + this._impl.setMotorForceLimit(v); + } + onLoad() { + super.onLoad(); + this.setAxis(this._com.axis); + this.setPivotA(this._com.pivotA); + this.setPivotB(this._com.pivotB); + this.setLimitEnabled(this._com.limitEnabled); + this.setLowerLimit(this._com.lowerLimit); + this.setUpperLimit(this._com.upperLimit); + this.setMotorEnabled(this._com.motorEnabled); + this.setMotorVelocity(this._com.motorVelocity); + this.setMotorForceLimit(this._com.motorForceLimit); + } +} +class FixedJoint extends Joint { + constructor() { + super(); + this._impl = new jsbPhy.FixedJoint(); + } + setBreakForce(v) { + this._impl.setBreakForce(v); + } + setBreakTorque(v) { + this._impl.setBreakTorque(v); + } + onLoad() { + super.onLoad(); + this.setBreakForce(this._com.breakForce); + this.setBreakTorque(this._com.breakTorque); + } +} +class ConfigurableJoint extends Joint { + constructor() { + super(); + this._impl = new jsbPhy.GenericJoint(); + } + setConstraintMode(idx, v) { + this._impl.setConstraintMode(idx, v); + } + setLinearLimit(idx, upper, lower) { + this._impl.setLinearLimit(idx, upper, lower); + } + setAngularExtent(twist, swing1, swing2) { + this._impl.setAngularExtent(twist, swing1, swing2); + } + setLinearSoftConstraint(v) { + this._impl.setLinearSoftConstraint(v); + } + setLinearStiffness(v) { + this._impl.setLinearStiffness(v); + } + setLinearDamping(v) { + this._impl.setLinearDamping(v); + } + setLinearRestitution(v) { + this._impl.setLinearRestitution(v); + } + setSwingSoftConstraint(v) { + this._impl.setSwingSoftConstraint(v); + } + setTwistSoftConstraint(v) { + this._impl.setTwistSoftConstraint(v); + } + setSwingStiffness(v) { + this._impl.setSwingStiffness(v); + } + setSwingDamping(v) { + this._impl.setSwingDamping(v); + } + setSwingRestitution(v) { + this._impl.setSwingRestitution(v); + } + setTwistStiffness(v) { + this._impl.setTwistStiffness(v); + } + setTwistDamping(v) { + this._impl.setTwistDamping(v); + } + setTwistRestitution(v) { + this._impl.setTwistRestitution(v); + } + + // motor + setDriverMode(idx, v) { + this._impl.setDriverMode(idx, v); + } + setLinearMotorTarget(v) { + this._impl.setLinearMotorTarget(v.x, v.y, v.z); + } + setLinearMotorVelocity(v) { + this._impl.setLinearMotorVelocity(v.x, v.y, v.z); + } + setLinearMotorForceLimit(v) { + this._impl.setLinearMotorForceLimit(v); + } + setAngularMotorTarget(v) { + this._impl.setAngularMotorTarget(v.x, v.y, v.z); + } + setAngularMotorVelocity(v) { + this._impl.setAngularMotorVelocity(v.x, v.y, v.z); + } + setAngularMotorForceLimit(v) { + this._impl.setAngularMotorForceLimit(v); + } + setPivotA(v) { + this._impl.setPivotA(v.x, v.y, v.z); + } + setPivotB(v) { + this._impl.setPivotB(v.x, v.y, v.z); + } + setAutoPivotB(v) { + this._impl.setAutoPivotB(v); + } + setAxis(v) { + this._impl.setAxis(v.x, v.y, v.z); + } + setSecondaryAxis(v) { + this._impl.setSecondaryAxis(v.x, v.y, v.z); + } + setBreakForce(v) { + this._impl.setBreakForce(v); + } + setBreakTorque(v) { + this._impl.setBreakTorque(v); + } + onLoad() { + super.onLoad(); + this.setBreakForce(this._com.breakForce); + this.setBreakTorque(this._com.breakTorque); + const com = this._com; + const linearLimit = com.linearLimitSettings; + const angularLimit = com.angularLimitSettings; + this.setConstraintMode(0, linearLimit.xMotion); + this.setConstraintMode(1, linearLimit.yMotion); + this.setConstraintMode(2, linearLimit.zMotion); + this.setConstraintMode(3, angularLimit.twistMotion); + this.setConstraintMode(4, angularLimit.swingMotion1); + this.setConstraintMode(5, angularLimit.swingMotion2); + this.setLinearLimit(0, linearLimit.lower.x, linearLimit.upper.x); + this.setLinearLimit(1, linearLimit.lower.y, linearLimit.upper.y); + this.setLinearLimit(2, linearLimit.lower.z, linearLimit.upper.z); + this.setAngularExtent(angularLimit.twistExtent, angularLimit.swingExtent1, angularLimit.swingExtent2); + this.setLinearSoftConstraint(linearLimit.enableSoftConstraint); + this.setLinearStiffness(linearLimit.stiffness); + this.setLinearDamping(linearLimit.damping); + this.setLinearRestitution(linearLimit.restitution); + this.setSwingSoftConstraint(angularLimit.enableSoftConstraintSwing); + this.setTwistSoftConstraint(angularLimit.enableSoftConstraintTwist); + this.setSwingStiffness(angularLimit.swingStiffness); + this.setSwingDamping(angularLimit.swingDamping); + this.setSwingRestitution(angularLimit.swingRestitution); + this.setTwistStiffness(angularLimit.twistStiffness); + this.setTwistDamping(angularLimit.twistDamping); + this.setTwistRestitution(angularLimit.twistRestitution); + const linearMotor = com.linearDriverSettings; + const angularMotor = com.angularDriverSettings; + this.setDriverMode(0, linearMotor.xDrive); + this.setDriverMode(1, linearMotor.yDrive); + this.setDriverMode(2, linearMotor.zDrive); + this.setDriverMode(3, angularMotor.twistDrive); + this.setDriverMode(4, angularMotor.swingDrive1); + this.setDriverMode(5, angularMotor.swingDrive2); + this.setLinearMotorTarget(linearMotor.targetPosition); + this.setLinearMotorVelocity(linearMotor.targetVelocity); + this.setLinearMotorForceLimit(linearMotor.strength); + this.setAngularMotorTarget(angularMotor.targetOrientation); + this.setAngularMotorVelocity(angularMotor.targetVelocity); + this.setAngularMotorForceLimit(angularMotor.strength); + this.setPivotA(com.pivotA); + this.setPivotB(com.pivotB); + this.setAutoPivotB(com.autoPivotB); + this.setAxis(com.axis); + this.setSecondaryAxis(com.secondaryAxis); + this.setBreakForce(com.breakForce); + this.setBreakTorque(com.breakTorque); + } +} +class CharacterController { + get impl() { + return this._impl; + } + get characterController() { + return this._com; + } + constructor() { + updateCollisionMatrix(); + } + initialize(com) { + this._com = com; + const inited = this._impl.initialize(com.node); + ptrToObj[this._impl.getObjectID()] = this; + return inited; + } + onLoad() { + this.setGroup(this._com.group); + const cm = cc.PhysicsSystem.instance.collisionMatrix; + const mask = cm[this._com.group]; + this.setMask(mask); + this.setCenter(this._com.center); + this.setStepOffset(this._com.stepOffset); + this.setSlopeLimit(this._com.slopeLimit); + this.setContactOffset(this._com.skinWidth); + this.setDetectCollisions(true); //this._com.detectCollisions); + this.setOverlapRecovery(true); //this._com.enableOverlapRecovery); + } + + onEnable() { + this._impl.onEnable(); + } + onDisable() { + this._impl.onDisable(); + } + onDestroy() { + delete ptrToObj[this._impl.getObjectID()]; + ptrToObj[this._impl.getObjectID()] = null; + this._impl.onDestroy(); + } + onGround() { + return this._impl.onGround(); + } + move(v, minDist, dt) { + return this._impl.move(v.x, v.y, v.z, minDist, dt); + } + syncPhysicsToScene() { + this._impl.syncPhysicsToScene(); + } + setPosition(v) { + this._impl.setPosition(v.x, v.y, v.z); + } + getPosition() { + return this._impl.getPosition(); + } + setStepOffset(v) { + this._impl.setStepOffset(v); + } + getStepOffset() { + return this._impl.getStepOffset(); + } + setSlopeLimit(v) { + this._impl.setSlopeLimit(v); + } + getSlopeLimit() { + return this._impl.getSlopeLimit(); + } + setContactOffset(v) { + this._impl.setContactOffset(v); + } + getContactOffset() { + return this._impl.getContactOffset(); + } + setDetectCollisions(v) { + this._impl.setDetectCollisions(v); + } + setOverlapRecovery(v) { + this._impl.setOverlapRecovery(v); + } + setCenter(v) { + this._impl.setCenter(v.x, v.y, v.z); + } + updateEventListener() { + let flag = 0; + if (this._com.needTriggerEvent) flag |= ESHAPE_FLAG.DETECT_TRIGGER_EVENT; + this._impl.updateEventListener(flag); + } + setGroup(v) { + this._impl.setGroup(v); + } + getGroup() { + return this._impl.getGroup(); + } + addGroup(v) { + this.setGroup(this.getGroup() | v); + } + removeGroup(v) { + this.setGroup(this.getGroup() & ~v); + } + setMask(v) { + this._impl.setMask(v >>> 0); + } + getMask() { + return this._impl.getMask(); + } + addMask(v) { + this.setMask(this.getMask() | v); + } + removeMask(v) { + this.setMask(this.getMask() & ~v); + } +} +class CapsuleCharacterController extends CharacterController { + constructor() { + super(); + this._impl = new jsbPhy.CapsuleCharacterController(); + } + setRadius(v) { + this._impl.setRadius(v); + } + setHeight(v) { + this._impl.setHeight(v); + } + onLoad() { + super.onLoad(); + this.setRadius(this._com.radius); + this.setHeight(this._com.height); + } +} +class BoxCharacterController extends CharacterController { + constructor() { + super(); + this._impl = new jsbPhy.BoxCharacterController(); + } + setHalfHeight(v) { + this._impl.setHalfHeight(v); + } + setHalfSideExtent(v) { + this._impl.setHalfSideExtent(v); + } + setHalfForwardExtent(v) { + this._impl.setHalfForwardExtent(v); + } + onLoad() { + super.onLoad(); + this.setHalfHeight(this._com.halfHeight); + this.setHalfSideExtent(this._com.halfSideExtent); + this.setHalfForwardExtent(this._com.halfForwardExtent); + } +} +cc.physics.selector.register('physx', { + PhysicsWorld, + RigidBody, + SphereShape, + BoxShape, + PlaneShape, + CapsuleShape, + ConeShape, + CylinderShape, + TrimeshShape, + TerrainShape, + PointToPointConstraint: SphericalJoint, + HingeConstraint: RevoluteJoint, + FixedConstraint: FixedJoint, + ConfigurableConstraint: ConfigurableJoint, + CapsuleCharacterController, + BoxCharacterController +}); + +},{}],12:[function(require,module,exports){ +"use strict"; + +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +const cacheManager = require('./jsb-cache-manager'); + +// @ts-expect-error jsb polyfills +(function () { + if (globalThis.spine === undefined || globalThis.middleware === undefined) return; + if (cc.internal.SpineSkeletonData === undefined) return; + const spine = globalThis.spine; + const middleware = globalThis.middleware; + middleware.generateGetSet(spine); + + // spine global time scale + Object.defineProperty(spine, 'timeScale', { + get() { + return this._timeScale; + }, + set(value) { + this._timeScale = value; + spine.SkeletonAnimation.setGlobalTimeScale(value); + }, + configurable: true + }); + const _slotColor = cc.color(0, 0, 255, 255); + const _boneColor = cc.color(255, 0, 0, 255); + const _meshColor = cc.color(255, 255, 0, 255); + const _originColor = cc.color(0, 255, 0, 255); + const skeletonDataProto = cc.internal.SpineSkeletonData.prototype; + let _gTextureIdx = 1; + const _textureKeyMap = {}; + const _textureMap = new WeakMap(); + const skeletonDataMgr = spine.SkeletonDataMgr.getInstance(); + spine.skeletonDataMgr = skeletonDataMgr; + skeletonDataMgr.setDestroyCallback(textureIndex => { + if (!textureIndex) return; + const texKey = _textureKeyMap[textureIndex]; + if (texKey && _textureMap.has(texKey)) { + _textureMap.delete(texKey); + delete _textureKeyMap[textureIndex]; + } + }); + const skeletonCacheMgr = spine.SkeletonCacheMgr.getInstance(); + spine.skeletonCacheMgr = skeletonCacheMgr; + skeletonDataProto.destroy = function () { + this.reset(); + skeletonCacheMgr.removeSkeletonCache(this._uuid); + cc.Asset.prototype.destroy.call(this); + }; + skeletonDataProto.reset = function () { + if (this._skeletonCache) { + spine.disposeSkeletonData(this._uuid); + this._jsbTextures = null; + this._skeletonCache = null; + } + this._atlasCache = null; + }; + skeletonDataProto.getRuntimeData = function () { + if (!this._skeletonCache) { + this.init(); + } + return this._skeletonCache; + }; + skeletonDataProto.init = function () { + if (this._skeletonCache) return; + const uuid = this._uuid; + if (!uuid) { + cc.errorID(7504); + return; + } + const atlasText = this.atlasText; + if (!atlasText) { + cc.errorID(7508, this.name); + return; + } + const textures = this.textures; + const textureNames = this.textureNames; + if (!(textures && textures.length > 0 && textureNames && textureNames.length > 0)) { + cc.errorID(7507, this.name); + return; + } + const jsbTextures = {}; + for (let i = 0; i < textures.length; ++i) { + const texture = textures[i]; + const textureIdx = this.recordTexture(texture); + const spTex = new middleware.Texture2D(); + spTex.setRealTextureIndex(textureIdx); + spTex.setPixelsWide(texture.width); + spTex.setPixelsHigh(texture.height); + spTex.setRealTexture(texture); + jsbTextures[textureNames[i]] = spTex; + } + this._jsbTextures = jsbTextures; + let filePath = null; + if (this.skeletonJsonStr) { + filePath = this.skeletonJsonStr; + } else { + filePath = cacheManager.getCache(this.nativeUrl) || this.nativeUrl; + } + this._skeletonCache = spine.initSkeletonData(uuid, filePath, atlasText, jsbTextures, this.scale); + if (this._skeletonCache) { + this.width = this._skeletonCache.width; + this.height = this._skeletonCache.height; + } + }; + skeletonDataProto.recordTexture = function (texture) { + const index = _gTextureIdx; + const texKey = _textureKeyMap[index] = { + key: index + }; + _textureMap.set(texKey, texture); + _gTextureIdx++; + return index; + }; + skeletonDataProto.getTextureByIndex = function (textureIdx) { + const texKey = _textureKeyMap[textureIdx]; + if (!texKey) return null; + return _textureMap.get(texKey); + }; + const animation = spine.SkeletonAnimation.prototype; + // The methods are added to be compatibility with old versions. + animation.setCompleteListener = function (listener) { + this._compeleteListener = listener; + this.setCompleteListenerNative(function (trackEntry) { + const loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd); + this._compeleteListener && this._compeleteListener(trackEntry, loopCount); + }); + }; + + // The methods are added to be compatibility with old versions. + animation.setTrackCompleteListener = function (trackEntry, listener) { + this._trackCompeleteListener = listener; + this.setTrackCompleteListenerNative(trackEntry, function (trackEntryNative) { + const loopCount = Math.floor(trackEntryNative.trackTime / trackEntryNative.animationEnd); + this._trackCompeleteListener && this._trackCompeleteListener(trackEntryNative, loopCount); + }); + }; + + // Temporary solution before upgrade the Spine API + animation.setAnimationListener = function (target, callback) { + this._target = target; + this._callback = callback; + + // eslint-disable-next-line no-undef + const AnimationEventType = legacyCC.internal.SpineAnimationEventType; + this.setStartListener(function (trackEntry) { + if (this._target && this._callback) { + this._callback.call(this._target, this, trackEntry, AnimationEventType.START, null, 0); + } + }); + this.setInterruptListener(function (trackEntry) { + if (this._target && this._callback) { + this._callback.call(this._target, this, trackEntry, AnimationEventType.INTERRUPT, null, 0); + } + }); + this.setEndListener(function (trackEntry) { + if (this._target && this._callback) { + this._callback.call(this._target, this, trackEntry, AnimationEventType.END, null, 0); + } + }); + this.setDisposeListener(function (trackEntry) { + if (this._target && this._callback) { + this._callback.call(this._target, this, trackEntry, AnimationEventType.DISPOSE, null, 0); + } + }); + this.setCompleteListener(function (trackEntry, loopCount) { + if (this._target && this._callback) { + this._callback.call(this._target, this, trackEntry, AnimationEventType.COMPLETE, null, loopCount); + } + }); + this.setEventListener(function (trackEntry, event) { + if (this._target && this._callback) { + this._callback.call(this._target, this, trackEntry, AnimationEventType.EVENT, event, 0); + } + }); + }; + const skeleton = cc.internal.SpineSkeleton.prototype; + const AnimationCacheMode = cc.internal.SpineSkeleton.AnimationCacheMode; + Object.defineProperty(skeleton, 'paused', { + get() { + return this._paused || false; + }, + set(value) { + this._paused = value; + if (this._nativeSkeleton) { + this._nativeSkeleton.paused(value); + } + } + }); + Object.defineProperty(skeleton, 'premultipliedAlpha', { + get() { + if (this._premultipliedAlpha === undefined) { + return true; + } + return this._premultipliedAlpha; + }, + set(value) { + this._premultipliedAlpha = value; + if (this._nativeSkeleton) { + this._nativeSkeleton.setOpacityModifyRGB(this._premultipliedAlpha); + } + } + }); + Object.defineProperty(skeleton, 'timeScale', { + get() { + if (this._timeScale === undefined) return 1.0; + return this._timeScale; + }, + set(value) { + this._timeScale = value; + if (this._nativeSkeleton) { + this._nativeSkeleton.setTimeScale(this._timeScale); + } + } + }); + const _updateMaterial = skeleton.updateMaterial; + skeleton.updateMaterial = function () { + _updateMaterial.call(this); + if (this._nativeSkeleton) { + const mat = this.getMaterialTemplate(); + this._nativeSkeleton.setMaterial(mat); + } + }; + const _updateDebugDraw = skeleton._updateDebugDraw; + skeleton._updateDebugDraw = function () { + _updateDebugDraw.call(this); + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setDebugMeshEnabled(this.debugMesh); + this._nativeSkeleton.setDebugSlotsEnabled(this.debugSlots); + this._nativeSkeleton.setDebugBonesEnabled(this.debugBones); + } + }; + const _updateUseTint = skeleton._updateUseTint; + skeleton._updateUseTint = function () { + _updateUseTint.call(this); + if (this._nativeSkeleton) { + this._nativeSkeleton.setUseTint(this.useTint); + } + }; + skeleton._updateBatch = function () { + if (this._nativeSkeleton) { + this._renderEntity.setUseLocal(!this.enableBatch); + this._nativeSkeleton.setBatchEnabled(this.enableBatch); + this.markForUpdateRenderData(); + } + }; + skeleton.setSkeletonData = function (skeletonData) { + if (skeletonData.width != null && skeletonData.height != null) { + const uiTrans = this.node._uiProps.uiTransformComp; + uiTrans.setContentSize(skeletonData.width, skeletonData.height); + } + const uuid = skeletonData._uuid; + if (!uuid) { + cc.errorID(7504); + return; + } + const texValues = skeletonData.textures; + const texKeys = skeletonData.textureNames; + if (!(texValues && texValues.length > 0 && texKeys && texKeys.length > 0)) { + cc.errorID(7507, skeletonData.name); + return; + } + if (this._nativeSkeleton) { + this._nativeSkeleton.stopSchedule(); + this._nativeSkeleton._comp = null; + this._nativeSkeleton = null; + } + let nativeSkeleton = null; + if (this.isAnimationCached()) { + nativeSkeleton = new spine.SkeletonCacheAnimation(uuid, this._cacheMode === AnimationCacheMode.SHARED_CACHE); + } else { + nativeSkeleton = new spine.SkeletonAnimation(); + try { + spine.initSkeletonRenderer(nativeSkeleton, uuid); + } catch (e) { + cc._throw(e); + return; + } + nativeSkeleton.setDebugSlotsEnabled(this.debugSlots); + nativeSkeleton.setDebugMeshEnabled(this.debugMesh); + nativeSkeleton.setDebugBonesEnabled(this.debugBones); + } + this._nativeSkeleton = nativeSkeleton; + nativeSkeleton._comp = this; + if (this.shouldSchedule) nativeSkeleton.beginSchedule(); + nativeSkeleton.setUseTint(this.useTint); + nativeSkeleton.setOpacityModifyRGB(this.premultipliedAlpha); + nativeSkeleton.setTimeScale(this.timeScale); + nativeSkeleton.setBatchEnabled(this.enableBatch); + const compColor = this.color; + nativeSkeleton.setColor(compColor.r, compColor.g, compColor.b, compColor.a); + const materialTemplate = this.getMaterialTemplate(); + nativeSkeleton.setMaterial(materialTemplate); + this._renderEntity.setUseLocal(!this.enableBatch); + nativeSkeleton.setRenderEntity(this._renderEntity.nativeObj); + this._skeleton = nativeSkeleton.getSkeleton(); + + // init skeleton listener + this._startListener && this.setStartListener(this._startListener); + this._endListener && this.setEndListener(this._endListener); + this._completeListener && this.setCompleteListener(this._completeListener); + this._eventListener && this.setEventListener(this._eventListener); + this._interruptListener && this.setInterruptListener(this._interruptListener); + this._disposeListener && this.setDisposeListener(this._disposeListener); + this._sharedBufferOffset = nativeSkeleton.getSharedBufferOffset(); + this._useAttach = false; + this.markForUpdateRenderData(); + }; + skeleton._updateColor = function () { + if (this._nativeSkeleton) { + const compColor = this.color; + this._nativeSkeleton.setColor(compColor.r, compColor.g, compColor.b, compColor.a); + this.markForUpdateRenderData(); + } + }; + skeleton.setAnimationStateData = function (stateData) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._stateData = stateData; + this._nativeSkeleton.setAnimationStateData(stateData); + } + }; + const _onEnable = skeleton.onEnable; + skeleton.onEnable = function () { + if (_onEnable) { + _onEnable.call(this); + } + this.shouldSchedule = true; + if (this._nativeSkeleton) { + this._nativeSkeleton.onEnable(); + } + middleware.retain(); + }; + const _onDisable = skeleton.onDisable; + skeleton.onDisable = function () { + if (_onDisable) { + _onDisable.call(this); + } + if (this._nativeSkeleton) { + this._nativeSkeleton.onDisable(); + } + middleware.release(); + }; + skeleton.setVertexEffectDelegate = function (effectDelegate) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setVertexEffectDelegate(effectDelegate); + } + }; + + // eslint-disable-next-line no-unused-vars + skeleton.updateAnimation = function (dt) { + const nativeSkeleton = this._nativeSkeleton; + if (!nativeSkeleton) return; + const node = this.node; + if (!node) return; + if (this.__preColor__ === undefined || !this.color.equals(this.__preColor__)) { + const compColor = this.color; + nativeSkeleton.setColor(compColor.r, compColor.g, compColor.b, compColor.a); + this.__preColor__ = compColor; + } + const socketNodes = this.socketNodes; + if (!this._useAttach && socketNodes.size > 0) { + this._useAttach = true; + nativeSkeleton.setAttachEnabled(true); + } + }; + skeleton.updateWorldTransform = function () { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.updateWorldTransform(); + } + }; + skeleton.setToSetupPose = function () { + if (this._nativeSkeleton) { + this._nativeSkeleton.setToSetupPose(); + } + }; + skeleton.setBonesToSetupPose = function () { + if (this._nativeSkeleton) { + this._nativeSkeleton.setBonesToSetupPose(); + } + }; + skeleton.setSlotsToSetupPose = function () { + if (this._nativeSkeleton) { + this._nativeSkeleton.setSlotsToSetupPose(); + } + }; + skeleton.setSlotsRange = function (startSlotIndex, endSlotIndex) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setSlotsRange(startSlotIndex, endSlotIndex); + } + }; + skeleton.updateAnimationCache = function (animName) { + if (!this.isAnimationCached()) return; + if (this._nativeSkeleton) { + if (animName) { + this._nativeSkeleton.updateAnimationCache(animName); + } else { + this._nativeSkeleton.updateAllAnimationCache(); + } + } + }; + skeleton.invalidAnimationCache = function () { + if (!this.isAnimationCached()) return; + if (this._nativeSkeleton) { + this._nativeSkeleton.updateAllAnimationCache(); + } + }; + skeleton.findBone = function (boneName) { + if (this._nativeSkeleton) return this._nativeSkeleton.findBone(boneName); + return null; + }; + skeleton.findSlot = function (slotName) { + if (this._nativeSkeleton) return this._nativeSkeleton.findSlot(slotName); + return null; + }; + skeleton.setSkin = function (skinName) { + if (this._nativeSkeleton) return this._nativeSkeleton.setSkin(skinName); + return null; + }; + skeleton.getAttachment = function (slotName, attachmentName) { + if (this._nativeSkeleton) return this._nativeSkeleton.getAttachment(slotName, attachmentName); + return null; + }; + skeleton.setAttachment = function (slotName, attachmentName) { + this._nativeSkeleton && this._nativeSkeleton.setAttachment(slotName, attachmentName); + }; + + // eslint-disable-next-line no-unused-vars + skeleton.getTextureAtlas = function (regionAttachment) { + cc.warn('Spine Skeleton getTextureAtlas not support in native'); + return null; + }; + skeleton.setMix = function (fromAnimation, toAnimation, duration) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setMix(fromAnimation, toAnimation, duration); + } + }; + skeleton.setAnimation = function (trackIndex, name, loop) { + const strName = name.toString(); + this._playTimes = loop ? 0 : 1; + let res = null; + if (this._nativeSkeleton) { + if (!this._nativeSkeleton.findAnimation(strName)) return res; + this._animationName = strName; + if (this.isAnimationCached()) { + res = this._nativeSkeleton.setAnimation(strName, loop); + } else { + res = this._nativeSkeleton.setAnimation(trackIndex, strName, loop); + } + /** + * note: since native spine animation update called after Director.EVENT_BEFORE_UPDATE + * and before setAnimation. it's need to update native animation to first frame directly. + */ + this._nativeSkeleton.update(0); + } + return res; + }; + skeleton.addAnimation = function (trackIndex, name, loop, delay) { + if (this._nativeSkeleton) { + delay = delay || 0; + if (this.isAnimationCached()) { + return this._nativeSkeleton.addAnimation(name, loop, delay); + } else { + return this._nativeSkeleton.addAnimation(trackIndex, name, loop, delay); + } + } + return null; + }; + skeleton.findAnimation = function (name) { + if (this._nativeSkeleton) return this._nativeSkeleton.findAnimation(name); + return null; + }; + skeleton.getCurrent = function (trackIndex) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + return this._nativeSkeleton.getCurrent(trackIndex); + } + return null; + }; + skeleton.clearTracks = function () { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.clearTracks(); + } + }; + skeleton.clearTrack = function (trackIndex) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.clearTrack(trackIndex); + } + }; + skeleton.setStartListener = function (listener) { + this._startListener = listener; + if (this._nativeSkeleton) { + if (this.isAnimationCached()) { + this._nativeSkeleton.setStartListener(function (animationName) { + const self = this._comp; + self._startEntry.animation.name = animationName; + self._startListener && self._startListener(self._startEntry); + }); + } else { + this._nativeSkeleton.setStartListener(listener); + } + } + }; + skeleton.setInterruptListener = function (listener) { + this._interruptListener = listener; + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setInterruptListener(listener); + } + }; + skeleton.setEndListener = function (listener) { + this._endListener = listener; + if (this._nativeSkeleton) { + if (this.isAnimationCached()) { + this._nativeSkeleton.setEndListener(function (animationName) { + const self = this._comp; + self._endEntry.animation.name = animationName; + self._endListener && self._endListener(self._endEntry); + }); + } else { + this._nativeSkeleton.setEndListener(listener); + } + } + }; + skeleton.setDisposeListener = function (listener) { + this._disposeListener = listener; + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setDisposeListener(listener); + } + }; + skeleton.setCompleteListener = function (listener) { + this._completeListener = listener; + if (this._nativeSkeleton) { + if (this.isAnimationCached()) { + this._nativeSkeleton.setCompleteListener(function (animationName) { + const self = this._comp; + self._endEntry.animation.name = animationName; + self._completeListener && self._completeListener(self._endEntry); + }); + } else { + this._nativeSkeleton.setCompleteListener(listener); + } + } + }; + skeleton.setEventListener = function (listener) { + this._eventListener = listener; + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setEventListener(listener); + } + }; + skeleton.setTrackStartListener = function (entry, listener) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setTrackStartListener(entry, listener); + } + }; + skeleton.setTrackInterruptListener = function (entry, listener) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setTrackInterruptListener(entry, listener); + } + }; + skeleton.setTrackEndListener = function (entry, listener) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setTrackEndListener(entry, listener); + } + }; + skeleton.setTrackDisposeListener = function (entry, listener) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setTrackDisposeListener(entry, listener); + } + }; + skeleton.setTrackCompleteListener = function (entry, listener) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setTrackCompleteListener(entry, listener); + } + }; + skeleton.setTrackEventListener = function (entry, listener) { + if (this._nativeSkeleton && !this.isAnimationCached()) { + this._nativeSkeleton.setTrackEventListener(entry, listener); + } + }; + skeleton.getState = function () { + if (this._nativeSkeleton && !this.isAnimationCached()) { + return this._nativeSkeleton.getState(); + } + return null; + }; + skeleton._ensureListener = function () { + cc.warn('Spine Skeleton _ensureListener not need in native'); + }; + skeleton._updateSkeletonData = function () { + if (this.skeletonData) { + this.skeletonData.init(); + this.setSkeletonData(this.skeletonData); + this._indexBoneSockets(); + this._updateSocketBindings(); + this.attachUtil.init(this); + this._preCacheMode = this._cacheMode; + this.defaultSkin && this._nativeSkeleton.setSkin(this.defaultSkin); + this.animation = this.defaultAnimation; + } else if (this._nativeSkeleton) { + this._nativeSkeleton.stopSchedule(); + this._nativeSkeleton._comp = null; + this._nativeSkeleton = null; + } + this._needUpdateSkeltonData = false; + }; + const _onDestroy = skeleton.onDestroy; + skeleton.onDestroy = function () { + _onDestroy.call(this); + if (this._nativeSkeleton) { + this._nativeSkeleton.stopSchedule(); + this._nativeSkeleton._comp = null; + this._nativeSkeleton = null; + } + this._stateData = null; + }; + skeleton._render = function () { + const nativeSkeleton = this._nativeSkeleton; + if (!nativeSkeleton) return; + if (!this.isAnimationCached() && (this.debugBones || this.debugSlots || this.debugMesh) && this._debugRenderer) { + const graphics = this._debugRenderer; + graphics.clear(); + graphics.lineWidth = 5; + const debugData = this._debugData || nativeSkeleton.getDebugData(); + if (!debugData) return; + let debugIdx = 0; + let debugType = 0; + let debugLen = 0; + debugType = debugData[debugIdx++]; + while (debugType !== 0) { + debugLen = debugData[debugIdx++]; + switch (debugType) { + case 1: + // slots + graphics.strokeColor = _slotColor; + for (let i = 0; i < debugLen; i += 8) { + graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.close(); + graphics.stroke(); + } + break; + case 2: + // mesh + graphics.strokeColor = _meshColor; + for (let i = 0; i < debugLen; i += 6) { + graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]); + graphics.close(); + graphics.stroke(); + } + break; + case 3: + // bones + graphics.strokeColor = _boneColor; + graphics.fillColor = _slotColor; // Root bone color is same as slot color. + for (let i = 0; i < debugLen; i += 4) { + const bx = debugData[debugIdx++]; + const by = debugData[debugIdx++]; + const x = debugData[debugIdx++]; + const y = debugData[debugIdx++]; + + // Bone lengths. + graphics.moveTo(bx, by); + graphics.lineTo(x, y); + graphics.stroke(); + + // Bone origins. + graphics.circle(bx, by, Math.PI * 1.5); + graphics.fill(); + if (i === 0) { + graphics.fillColor = _originColor; + } + } + break; + default: + return; + } + debugType = debugData[debugIdx++]; + } + } + }; + const _tempAttachMat4 = cc.mat4(); + skeleton.syncAttachedNode = function () { + const nativeSkeleton = this._nativeSkeleton; + if (!nativeSkeleton) return; + const socketNodes = this.socketNodes; + if (socketNodes.size > 0 && this._useAttach) { + const sharedBufferOffset = this._sharedBufferOffset; + if (!sharedBufferOffset) return; + const attachInfoMgr = middleware.attachInfoMgr; + const attachInfo = attachInfoMgr.attachInfo; + const attachInfoOffset = sharedBufferOffset[0]; + // reset attach info offset + sharedBufferOffset[0] = 0; + for (const boneIdx of socketNodes.keys()) { + const boneNode = socketNodes.get(boneIdx); + // Node has been destroy + if (!boneNode || !boneNode.isValid) { + socketNodes.delete(boneIdx); + continue; + } + const tm = _tempAttachMat4; + const matOffset = attachInfoOffset + boneIdx * 16; + tm.m00 = attachInfo[matOffset]; + tm.m01 = attachInfo[matOffset + 1]; + tm.m04 = attachInfo[matOffset + 4]; + tm.m05 = attachInfo[matOffset + 5]; + tm.m12 = attachInfo[matOffset + 12]; + tm.m13 = attachInfo[matOffset + 13]; + boneNode.matrix = tm; + } + } + }; + skeleton.setSlotTexture = function (slotName, tex2d, createNew) { + if (this.isAnimationCached()) { + console.error(`Cached mode can't change texture of slot`); + return; + } + if (!this._nativeSkeleton) return; + const slot = this.findSlot(slotName); + if (!slot) { + console.error(`No slot named:${slotName}`); + return; + } + const createNewAttachment = createNew || false; + this._nativeSkeleton.setSlotTexture(slotName, tex2d, createNewAttachment); + }; + + ////////////////////////////////////////// + // assembler + const assembler = cc.internal.SpineAssembler; + + // eslint-disable-next-line no-unused-vars + assembler.createData = function (comp) {}; + assembler.updateRenderData = function (comp) { + comp._render(); + comp.syncAttachedNode(); + }; + + // eslint-disable-next-line no-unused-vars + assembler.fillBuffers = function (comp, renderer) {}; +})(); + +},{"./jsb-cache-manager":3}],13:[function(require,module,exports){ +/**************************************************************************** + Copyright (c) 2022 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +'use strict'; + +if (cc.internal.VideoPlayer) { + const { + EventType + } = cc.internal.VideoPlayer; + let vec3 = cc.Vec3; + let mat4 = cc.Mat4; + let _mat4_temp = new mat4(); + let _topLeft = new vec3(); + let _bottomRight = new vec3(); + let kWebViewTag = 0; + let videoPlayers = []; + const VideoEvent = { + PLAYING: 0, + PAUSED: 1, + STOPPED: 2, + COMPLETED: 3, + META_LOADED: 4, + CLICKED: 5, + READY_TO_PLAY: 6, + UPDATE: 7, + QUIT_FULLSCREEN: 1000 + }; + cc.internal.VideoPlayerImplManager.getImpl = function (componenet) { + return new VideoPlayerImplOpenHarmony(componenet); + }; + window.oh.onVideoEvent = (tag, ev, args) => { + videoPlayers.forEach(player => { + if (player.index == tag) { + player.dispatchEvent(ev, args); + } + }); + }; + class VideoPlayer { + constructor() { + this._events = {}; + this._currentTime = 0; + this._duration = 0; + this._videoIndex = kWebViewTag++; + this._matViewProj_temp = new mat4(); + window.oh.postMessage("createVideo", this._videoIndex); + videoPlayers.push(this); + } + get index() { + return this._videoIndex; + } + play() { + window.oh.postMessage("startVideo", this._videoIndex); + } + setURL(url) { + window.oh.postMessage("setVideoUrl", { + tag: this._videoIndex, + url: url + }); + } + pause() { + window.oh.postMessage("pauseVideo", this._videoIndex); + } + setVisible(visible) { + window.oh.postMessage("setVideoVisible", { + tag: this._videoIndex, + visible: visible + }); + } + resume() { + window.oh.postMessage("resumeVideo", this._videoIndex); + } + currentTime() { + window.oh.postSyncMessage("currentTime", this._videoIndex).then(result => { + this._currentTime = result; + }); + return this._currentTime; + } + stop() { + window.oh.postMessage("stopVideo", this._videoIndex); + } + seekTo(val) { + window.oh.postMessage("seekVideoTo", { + tag: this._videoIndex, + time: val + }); + } + duration() { + window.oh.postSyncMessage("getVideoDuration", this._videoIndex).then(result => { + this._duration = result; + }); + return this._duration; + } + destroy() { + window.oh.postMessage("removeVideo", this._videoIndex); + } + setFullScreenEnabled(enable) { + window.oh.postMessage("setFullScreenEnabled", { + tag: this._videoIndex, + fullScreen: enable + }); + } + setKeepAspectRatioEnabled(enable) { + cc.warn('The platform does not support'); + } + setFrame(x, y, w, h) { + window.oh.postMessage("setVideoRect", { + tag: this._videoIndex, + x: x, + y: y, + w: w, + h: h + }); + } + eventTypeToEventName(ev) { + let evString; + switch (ev) { + case VideoEvent.PLAYING: + evString = "play"; + break; + case VideoEvent.PAUSED: + evString = "pause"; + break; + case VideoEvent.STOPPED: + evString = "stoped"; + break; + case VideoEvent.COMPLETED: + evString = "ended"; + break; + case VideoEvent.META_LOADED: + evString = "loadedmetadata"; + break; + case VideoEvent.CLICKED: + evString = "click"; + break; + case VideoEvent.READY_TO_PLAY: + evString = "suspend"; + break; + case VideoEvent.UPDATE: + evString = "update"; + break; + case VideoEvent.QUIT_FULLSCREEN: + evString = "suspend"; + break; + default: + evString = "none"; + break; + } + return evString; + } + dispatchEvent(type, args) { + let eventName = this.eventTypeToEventName(type); + const listeners = this._events[eventName]; + if (listeners) { + for (let i = 0; i < listeners.length; i++) { + listeners[i](args); + } + } + } + addEventListener(name, listener) { + if (!this._events[name]) { + this._events[name] = []; + } + this._events[name].push(listener); + } + removeEventListener(name, listener) { + const listeners = this._events[name]; + if (listeners && listeners.length > 0) { + for (let i = listeners.length; i--; i > 0) { + if (listeners[i] === listener) { + listeners.splice(i, 1); + break; + } + } + } + } + } + class VideoPlayerImplOpenHarmony extends cc.internal.VideoPlayerImpl { + constructor(componenet) { + super(componenet); + this._matViewProj_temp = new mat4(); + } + syncClip(clip) { + this.removeVideoPlayer(); + if (!clip) { + return; + } + this.createVideoPlayer(clip._nativeAsset); + } + syncURL(url) { + this.removeVideoPlayer(); + if (!url) { + return; + } + this.createVideoPlayer(url); + } + onCanplay() { + if (this._loaded) { + return; + } + this._loaded = true; + this.video.setVisible(this._visible); + this.dispatchEvent(EventType.READY_TO_PLAY); + this.delayedPlay(); + } + _bindEvent() { + this.video.addEventListener('loadedmetadata', this.onLoadedMetadata.bind(this)); + this.video.addEventListener('suspend', this.onCanPlay.bind(this)); + this.video.addEventListener('play', this.onPlay.bind(this)); + this.video.addEventListener('pause', this.onPause.bind(this)); + this.video.addEventListener('stoped', this.onStoped.bind(this)); + this.video.addEventListener('click', this.onClick.bind(this)); + this.video.addEventListener('ended', this.onEnded.bind(this)); + } + onLoadedMetadata() { + this._loadedMeta = true; + this._forceUpdate = true; + if (this._visible) { + this.enable(); + } else { + this.disable(); + } + this.dispatchEvent(EventType.META_LOADED); + this.delayedFullScreen(); + this.delayedPlay(); + } + createVideoPlayer(url) { + this._video = new VideoPlayer(); + this._bindEvent(); + this._video.setVisible(this._visible); + this._video.setURL(url); + this._forceUpdate = true; + } + removeVideoPlayer() { + let video = this.video; + if (video) { + video.stop(); + video.setVisible(false); + video.destroy(); + this._playing = false; + this._loaded = false; + this._loadedMeta = false; + this._ignorePause = false; + this._cachedCurrentTime = 0; + this._video = null; + } + } + getDuration() { + if (!this.video) { + return -1; + } + return this.video.duration(); + } + syncPlaybackRate() { + cc.warn('The platform does not support'); + } + syncVolume() { + cc.warn('The platform does not support'); + } + syncMute() { + cc.warn('The platform does not support'); + } + syncLoop() { + cc.warn('The platform does not support'); + } + syncStayOnBottom() { + cc.warn('The platform does not support'); + } + getCurrentTime() { + if (this.video) { + this._cachedCurrentTime = this.video.currentTime(); + return this._cachedCurrentTime; + } + return -1; + } + seekTo(val) { + let video = this._video; + if (!video) return; + video.seekTo(val); + this._cachedCurrentTime = val; + } + disable(noPause) { + if (this.video) { + if (!noPause) { + this.video.pause(); + } + this.video.setVisible(false); + this._visible = false; + } + } + enable() { + if (this.video) { + this.video.setVisible(true); + this._visible = true; + } + } + canPlay() { + this.video.play(); + this.syncCurrentTime(); + } + resume() { + if (this.video) { + this.video.resume(); + this.syncCurrentTime(); + this._playing = true; + } + } + pause() { + if (this.video) { + this._cachedCurrentTime = this.video.currentTime(); + this.video.pause(); + } + } + stop() { + if (this.video) { + this._ignorePause = true; + this.video.seekTo(0); + this._cachedCurrentTime = 0; + this.video.stop(); + } + } + canFullScreen(enabled) { + if (this.video) { + this.video.setFullScreenEnabled(enabled); + } + } + syncKeepAspectRatio(enabled) { + if (this.video) { + this.video.setKeepAspectRatioEnabled(enabled); + } + } + syncMatrix() { + if (!this._video || !this._component || !this._uiTrans) return; + const camera = this.UICamera; + if (!camera) { + return; + } + this._component.node.getWorldMatrix(_mat4_temp); + const { + width, + height + } = this._uiTrans.contentSize; + if (!this._forceUpdate && camera.matViewProj.equals(this._matViewProj_temp) && this._m00 === _mat4_temp.m00 && this._m01 === _mat4_temp.m01 && this._m04 === _mat4_temp.m04 && this._m05 === _mat4_temp.m05 && this._m12 === _mat4_temp.m12 && this._m13 === _mat4_temp.m13 && this._w === width && this._h === height) { + return; + } + this._matViewProj_temp.set(camera.matViewProj); + // update matrix cache + this._m00 = _mat4_temp.m00; + this._m01 = _mat4_temp.m01; + this._m04 = _mat4_temp.m04; + this._m05 = _mat4_temp.m05; + this._m12 = _mat4_temp.m12; + this._m13 = _mat4_temp.m13; + this._w = width; + this._h = height; + let canvas_width = cc.game.canvas.width; + let canvas_height = cc.game.canvas.height; + let ap = this._uiTrans.anchorPoint; + // Vectors in node space + vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0); + vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); + // Convert to world space + vec3.transformMat4(_topLeft, _topLeft, _mat4_temp); + vec3.transformMat4(_bottomRight, _bottomRight, _mat4_temp); + // need update camera data + camera.update(); + // Convert to Screen space + camera.worldToScreen(_topLeft, _topLeft); + camera.worldToScreen(_bottomRight, _bottomRight); + let finalWidth = _bottomRight.x - _topLeft.x; + let finalHeight = _topLeft.y - _bottomRight.y; + this._video.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight); + this._forceUpdate = false; + } + } +} + +},{}],14:[function(require,module,exports){ +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +'use strict'; + +if (cc.internal.VideoPlayer) { + const { + EventType + } = cc.internal.VideoPlayer; + let vec3 = cc.Vec3; + let mat4 = cc.Mat4; + let _mat4_temp = new mat4(); + let _topLeft = new vec3(); + let _bottomRight = new vec3(); + cc.internal.VideoPlayerImplManager.getImpl = function (componenet) { + return new VideoPlayerImplJSB(componenet); + }; + class VideoPlayerImplJSB extends cc.internal.VideoPlayerImpl { + constructor(componenet) { + super(componenet); + this._matViewProj_temp = new mat4(); + } + syncClip(clip) { + this.removeVideoPlayer(); + if (!clip) { + return; + } + this.createVideoPlayer(clip._nativeAsset); + } + syncURL(url) { + this.removeVideoPlayer(); + if (!url) { + return; + } + this.createVideoPlayer(url); + } + onCanplay() { + if (this._loaded) { + return; + } + this._loaded = true; + this.video.setVisible(this._visible); + this.dispatchEvent(EventType.READY_TO_PLAY); + this.delayedPlay(); + } + _bindEvent() { + this.video.addEventListener('loadedmetadata', this.onLoadedMetadata.bind(this)); + this.video.addEventListener('suspend', this.onCanPlay.bind(this)); + this.video.addEventListener('play', this.onPlay.bind(this)); + this.video.addEventListener('pause', this.onPause.bind(this)); + this.video.addEventListener('stoped', this.onStoped.bind(this)); + this.video.addEventListener('click', this.onClick.bind(this)); + this.video.addEventListener('ended', this.onEnded.bind(this)); + } + onLoadedMetadata() { + this._loadedMeta = true; + this._forceUpdate = true; + if (this._visible) { + this.enable(); + } else { + this.disable(); + } + this.dispatchEvent(EventType.META_LOADED); + this.delayedFullScreen(); + this.delayedPlay(); + } + createVideoPlayer(url) { + this._video = new jsb.VideoPlayer(); + this._bindEvent(); + this._video.setVisible(this._visible); + this._video.setURL(url); + this._forceUpdate = true; + } + removeVideoPlayer() { + let video = this.video; + if (video) { + video.stop(); + video.setVisible(false); + video.destroy(); + this._playing = false; + this._loaded = false; + this._loadedMeta = false; + this._ignorePause = false; + this._cachedCurrentTime = 0; + this._video = null; + } + } + getDuration() { + if (!this.video) { + return -1; + } + return this.video.duration(); + } + syncPlaybackRate(value) { + if (this.video) { + this.video.setPlaybackRate(value); + } + } + syncVolume() { + cc.warn('The platform does not support'); + } + syncMute(enable) { + if (this.video && this.video.muted !== enable) { + this.video.setMute(enable); + } + } + syncLoop(enable) { + if (this.video && this.video.loop !== enable) { + this.video.setLoop(enable); + } + } + syncStayOnBottom() { + cc.warn('The platform does not support'); + } + getCurrentTime() { + if (this.video) { + this._cachedCurrentTime = this.video.currentTime(); + return this._cachedCurrentTime; + } + return -1; + } + seekTo(val) { + let video = this._video; + if (!video) return; + video.seekTo(val); + this._cachedCurrentTime = val; + } + disable(noPause) { + if (this.video) { + if (!noPause) { + this.video.pause(); + } + this.video.setVisible(false); + this._visible = false; + } + } + enable() { + if (this.video) { + this.video.setVisible(true); + this._visible = true; + } + } + canPlay() { + this.video.play(); + this.syncCurrentTime(); + } + resume() { + if (this.video) { + this.video.resume(); + this.syncCurrentTime(); + this._playing = true; + } + } + pause() { + if (this.video) { + this._cachedCurrentTime = this.video.currentTime(); + this.video.pause(); + } + } + stop() { + if (this.video) { + this._ignorePause = true; + this.video.seekTo(0); + this._cachedCurrentTime = 0; + this.video.stop(); + } + } + canFullScreen(enabled) { + if (this.video) { + this.video.setFullScreenEnabled(enabled); + } + } + syncKeepAspectRatio(enabled) { + if (this.video) { + this.video.setKeepAspectRatioEnabled(enabled); + } + } + syncMatrix() { + if (!this._video || !this._component || !this._uiTrans) return; + const camera = this.UICamera; + if (!camera) { + return; + } + this._component.node.getWorldMatrix(_mat4_temp); + const { + width, + height + } = this._uiTrans.contentSize; + if (!this._forceUpdate && camera.matViewProj.equals(this._matViewProj_temp) && this._m00 === _mat4_temp.m00 && this._m01 === _mat4_temp.m01 && this._m04 === _mat4_temp.m04 && this._m05 === _mat4_temp.m05 && this._m12 === _mat4_temp.m12 && this._m13 === _mat4_temp.m13 && this._w === width && this._h === height) { + return; + } + this._matViewProj_temp.set(camera.matViewProj); + // update matrix cache + this._m00 = _mat4_temp.m00; + this._m01 = _mat4_temp.m01; + this._m04 = _mat4_temp.m04; + this._m05 = _mat4_temp.m05; + this._m12 = _mat4_temp.m12; + this._m13 = _mat4_temp.m13; + this._w = width; + this._h = height; + let canvas_width = cc.game.canvas.width; + let canvas_height = cc.game.canvas.height; + let ap = this._uiTrans.anchorPoint; + // Vectors in node space + vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0); + vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); + // Convert to world space + vec3.transformMat4(_topLeft, _topLeft, _mat4_temp); + vec3.transformMat4(_bottomRight, _bottomRight, _mat4_temp); + // need update camera data + camera.update(); + // Convert to Screen space + camera.worldToScreen(_topLeft, _topLeft); + camera.worldToScreen(_bottomRight, _bottomRight); + let finalWidth = _bottomRight.x - _topLeft.x; + let finalHeight = _topLeft.y - _bottomRight.y; + this._video.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight); + this._forceUpdate = false; + } + } +} + +},{}],15:[function(require,module,exports){ +/**************************************************************************** + Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +'use strict'; + +if (cc.internal.WebView) { + const { + EventType + } = cc.internal.WebView; + let vec3 = cc.Vec3; + let mat4 = cc.Mat4; + let _mat4_temp = new mat4(); + let _topLeft = new vec3(); + let _bottomRight = new vec3(); + cc.internal.WebViewImplManager.getImpl = function (componenet) { + return new WebViewImplJSB(componenet); + }; + class WebViewImplJSB extends cc.internal.WebViewImpl { + constructor(componenet) { + super(componenet); + this.jsCallback = null; + this.interfaceSchema = null; + this._matViewProj_temp = new mat4(); + } + _bindEvent() { + let onLoaded = () => { + this._forceUpdate = true; + this.dispatchEvent(EventType.LOADED); + }; + let onError = () => { + this.dispatchEvent(EventType.ERROR); + }; + this.webview.setOnDidFinishLoading(onLoaded); + this.webview.setOnDidFailLoading(onError); + this.jsCallback && this.setOnJSCallback(this.jsCallback); + this.interfaceSchema && this.setJavascriptInterfaceScheme(this.interfaceSchema); + // remove obj + this.jsCallback = null; + this.interfaceSchema = null; + } + createWebView() { + if (!jsb.WebView) { + console.warn('jsb.WebView is null'); + return; + } + this._webview = jsb.WebView.create(); + this._bindEvent(); + } + removeWebView() { + let webview = this.webview; + if (webview) { + this.webview.destroy(); + this.reset(); + } + } + disable() { + if (this.webview) { + this.webview.setVisible(false); + } + } + enable() { + if (this.webview) { + this.webview.setVisible(true); + } + } + setOnJSCallback(callback) { + let webview = this.webview; + if (webview) { + webview.setOnJSCallback(callback); + } else { + this.jsCallback = callback; + } + } + setJavascriptInterfaceScheme(scheme) { + let webview = this.webview; + if (webview) { + webview.setJavascriptInterfaceScheme(scheme); + } else { + this.interfaceSchema = scheme; + } + } + loadURL(url) { + let webview = this.webview; + if (webview) { + webview.src = url; + webview.loadURL(url); + this.dispatchEvent(EventType.LOADING); + } + } + evaluateJS(str) { + let webview = this.webview; + if (webview) { + return webview.evaluateJS(str); + } + } + syncMatrix() { + if (!this._webview || !this._component || !this._uiTrans) return; + const camera = this.UICamera; + if (!camera) { + return; + } + this._component.node.getWorldMatrix(_mat4_temp); + const { + width, + height + } = this._uiTrans.contentSize; + if (!this._forceUpdate && camera.matViewProj.equals(this._matViewProj_temp) && this._m00 === _mat4_temp.m00 && this._m01 === _mat4_temp.m01 && this._m04 === _mat4_temp.m04 && this._m05 === _mat4_temp.m05 && this._m12 === _mat4_temp.m12 && this._m13 === _mat4_temp.m13 && this._w === width && this._h === height) { + return; + } + this._matViewProj_temp.set(camera.matViewProj); + // update matrix cache + this._m00 = _mat4_temp.m00; + this._m01 = _mat4_temp.m01; + this._m04 = _mat4_temp.m04; + this._m05 = _mat4_temp.m05; + this._m12 = _mat4_temp.m12; + this._m13 = _mat4_temp.m13; + this._w = width; + this._h = height; + let canvas_width = cc.game.canvas.width; + let canvas_height = cc.game.canvas.height; + let ap = this._uiTrans.anchorPoint; + // Vectors in node space + vec3.set(_topLeft, -ap.x * this._w, (1.0 - ap.y) * this._h, 0); + vec3.set(_bottomRight, (1 - ap.x) * this._w, -ap.y * this._h, 0); + // Convert to world space + vec3.transformMat4(_topLeft, _topLeft, _mat4_temp); + vec3.transformMat4(_bottomRight, _bottomRight, _mat4_temp); + // need update camera data + camera.update(); + // Convert to Screen space + camera.worldToScreen(_topLeft, _topLeft); + camera.worldToScreen(_bottomRight, _bottomRight); + let finalWidth = _bottomRight.x - _topLeft.x; + let finalHeight = _topLeft.y - _bottomRight.y; + this._webview.setFrame(_topLeft.x, canvas_height - _topLeft.y, finalWidth, finalHeight); + this._forceUpdate = false; + } + } +} + +},{}],16:[function(require,module,exports){ +"use strict"; + +const jsbWindow = globalThis.jsb.window = globalThis.jsb.window || {}; //TODO(PatriceJiang): + +module.exports = jsbWindow; + +},{}]},{},[1]); diff --git a/cocos_view_pod/Assets/jsb-adapter/web-adapter.js b/cocos_view_pod/Assets/jsb-adapter/web-adapter.js new file mode 100644 index 0000000..017cae9 --- /dev/null +++ b/cocos_view_pod/Assets/jsb-adapter/web-adapter.js @@ -0,0 +1,5793 @@ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],2:[function(require,module,exports){ +(function (setImmediate,clearImmediate){(function (){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) +},{"process/browser.js":1,"timers":2}],3:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +/* Blob.js + * A Blob implementation. + * 2017-11-15 + * + * By Eli Grey, http://eligrey.com + * By Devin Samarin, https://github.com/dsamarin + * License: MIT + * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md + */ + +/*global self, unescape */ +/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, + plusplus: true */ + +/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */ + +(function (global) { + (function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['exports'], factory); + } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { + // CommonJS + factory(exports); + } else { + // Browser globals + factory(global); + } + })(exports => { + exports.URL = global.URL || global.webkitURL; + if (global.Blob && global.URL) { + try { + new Blob(); + return; + } catch (e) {} + } + + // Internally we use a BlobBuilder implementation to base Blob off of + // in order to support older browsers that only have BlobBuilder + const BlobBuilder = global.BlobBuilder || global.WebKitBlobBuilder || global.MozBlobBuilder || function () { + const get_class = function (object) { + return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1]; + }; + const FakeBlobBuilder = function BlobBuilder() { + this.data = []; + }; + const FakeBlob = function Blob(data, type, encoding) { + this.data = data; + this.size = data.length; + this.type = type; + this.encoding = encoding; + }; + const FBB_proto = FakeBlobBuilder.prototype; + const FB_proto = FakeBlob.prototype; + const FileReaderSync = global.FileReaderSync; + const FileException = function (type) { + this.code = this[this.name = type]; + }; + const file_ex_codes = ('NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR ' + 'NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR').split(' '); + let file_ex_code = file_ex_codes.length; + const real_URL = global.URL || global.webkitURL || exports; + const real_create_object_URL = real_URL.createObjectURL; + const real_revoke_object_URL = real_URL.revokeObjectURL; + let URL = real_URL; + const btoa = global.btoa; + const atob = global.atob; + const ArrayBuffer = global.ArrayBuffer; + const Uint8Array = global.Uint8Array; + const origin = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/; + FakeBlob.fake = FB_proto.fake = true; + while (file_ex_code--) { + FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; + } + // Polyfill URL + if (!real_URL.createObjectURL) { + URL = exports.URL = function (uri) { + const uri_info = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); + let uri_origin; + uri_info.href = uri; + if (!('origin' in uri_info)) { + if (uri_info.protocol.toLowerCase() === 'data:') { + uri_info.origin = null; + } else { + uri_origin = uri.match(origin); + uri_info.origin = uri_origin && uri_origin[1]; + } + } + return uri_info; + }; + } + URL.createObjectURL = function (blob) { + let type = blob.type; + let data_URI_header; + if (type === null) { + type = 'application/octet-stream'; + } + if (blob instanceof FakeBlob) { + data_URI_header = `data:${type}`; + if (blob.encoding === 'base64') { + return `${data_URI_header};base64,${blob.data}`; + } else if (blob.encoding === 'URI') { + return `${data_URI_header},${decodeURIComponent(blob.data)}`; + } + if (btoa) { + return `${data_URI_header};base64,${btoa(blob.data)}`; + } else { + return `${data_URI_header},${encodeURIComponent(blob.data)}`; + } + } else if (real_create_object_URL) { + return real_create_object_URL.call(real_URL, blob); + } + }; + URL.revokeObjectURL = function (object_URL) { + if (object_URL.substring(0, 5) !== 'data:' && real_revoke_object_URL) { + real_revoke_object_URL.call(real_URL, object_URL); + } + }; + FBB_proto.append = function (data /*, endings*/) { + const bb = this.data; + // decode data to a binary string + if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) { + let str = ''; + const buf = new Uint8Array(data); + let i = 0; + const buf_len = buf.length; + for (; i < buf_len; i++) { + str += String.fromCharCode(buf[i]); + } + bb.push(str); + } else if (get_class(data) === 'Blob' || get_class(data) === 'File') { + if (FileReaderSync) { + const fr = new FileReaderSync(); + bb.push(fr.readAsBinaryString(data)); + } else { + // async FileReader won't work as BlobBuilder is sync + throw new FileException('NOT_READABLE_ERR'); + } + } else if (data instanceof FakeBlob) { + if (data.encoding === 'base64' && atob) { + bb.push(atob(data.data)); + } else if (data.encoding === 'URI') { + bb.push(decodeURIComponent(data.data)); + } else if (data.encoding === 'raw') { + bb.push(data.data); + } + } else { + if (typeof data !== 'string') { + data += ''; // convert unsupported types to strings + } + // decode UTF-16 to binary string + bb.push(unescape(encodeURIComponent(data))); + } + }; + FBB_proto.getBlob = function (type) { + if (!arguments.length) { + type = null; + } + return new FakeBlob(this.data.join(''), type, 'raw'); + }; + FBB_proto.toString = function () { + return '[object BlobBuilder]'; + }; + FB_proto.slice = function (start, end, type) { + const args = arguments.length; + if (args < 3) { + type = null; + } + return new FakeBlob(this.data.slice(start, args > 1 ? end : this.data.length), type, this.encoding); + }; + FB_proto.toString = function () { + return '[object Blob]'; + }; + FB_proto.close = function () { + this.size = 0; + delete this.data; + }; + return FakeBlobBuilder; + }(); + exports.Blob = function (blobParts, options) { + const type = options ? options.type || '' : ''; + const builder = new BlobBuilder(); + if (blobParts) { + for (let i = 0, len = blobParts.length; i < len; i++) { + if (Uint8Array && blobParts[i] instanceof Uint8Array) { + builder.append(blobParts[i].buffer); + } else { + builder.append(blobParts[i]); + } + } + } + const blob = builder.getBlob(type); + if (!blob.slice && blob.webkitSlice) { + blob.slice = blob.webkitSlice; + } + return blob; + }; + const getPrototypeOf = Object.getPrototypeOf || function (object) { + return object.__proto__; + }; + exports.Blob.prototype = getPrototypeOf(new exports.Blob()); + }); +})(typeof self !== 'undefined' && self || typeof window !== 'undefined' && window || typeof global !== 'undefined' && global || typeof globalThis !== 'undefined' && globalThis || (void 0).content || void 0); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],4:[function(require,module,exports){ +"use strict"; + +!function () { + function e(e) { + this.message = e; + } + var t = "undefined" != typeof exports ? exports : "undefined" != typeof self ? self : $.global, + r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + e.prototype = new Error(), e.prototype.name = "InvalidCharacterError", t.btoa || (t.btoa = function (t) { + for (var o, n, a = String(t), i = 0, f = r, c = ""; a.charAt(0 | i) || (f = "=", i % 1); c += f.charAt(63 & o >> 8 - i % 1 * 8)) { + if (n = a.charCodeAt(i += .75), n > 255) throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); + o = o << 8 | n; + } + return c; + }), t.atob || (t.atob = function (t) { + var o = String(t).replace(/[=]+$/, ""); + if (o.length % 4 == 1) throw new e("'atob' failed: The string to be decoded is not correctly encoded."); + for (var n, a, i = 0, f = 0, c = ""; a = o.charAt(f++); ~a && (n = i % 4 ? 64 * n + a : a, i++ % 4) ? c += String.fromCharCode(255 & n >> (-2 * i & 6)) : 0) a = r.indexOf(a); + return c; + }); +}(); + +},{}],5:[function(require,module,exports){ +"use strict"; + +globalThis.__EDITOR__ = globalThis.process && 'electron' in globalThis.process.versions; +require('./wasm'); +const jsbWindow = require('../jsbWindow'); +jsb.device = jsb.Device; // cc namespace will be reset to {} in creator, use jsb namespace instead. + +const { + btoa, + atob +} = require('./base64/base64.min'); +jsbWindow.btoa = btoa; +jsbWindow.atob = atob; +const { + Blob, + URL +} = require('./Blob'); +jsbWindow.Blob = Blob; +jsbWindow.URL = URL; +jsbWindow.DOMParser = require('./xmldom/dom-parser').DOMParser; +jsbWindow.XMLHttpRequest = jsb.XMLHttpRequest; +jsbWindow.SocketIO = jsb.SocketIO; +jsbWindow.WebSocket = jsb.WebSocket; +require('./jsb_prepare'); +require('./jsb-adapter'); +require('./jsb_audioengine'); +require('./jsb_input'); +let _oldRequestFrameCallback = null; +let _requestAnimationFrameID = 0; +const _requestAnimationFrameCallbacks = {}; +let _firstTick = true; +jsbWindow.requestAnimationFrame = function (cb) { + const id = ++_requestAnimationFrameID; + _requestAnimationFrameCallbacks[id] = cb; + return id; +}; +jsbWindow.cancelAnimationFrame = function (id) { + delete _requestAnimationFrameCallbacks[id]; +}; +function tick(nowMilliSeconds) { + if (_firstTick) { + _firstTick = false; + if (jsbWindow.onload) { + const event = new Event('load'); + event._target = globalThis; + jsbWindow.onload(event); + } + } + fireTimeout(nowMilliSeconds); + for (const id in _requestAnimationFrameCallbacks) { + _oldRequestFrameCallback = _requestAnimationFrameCallbacks[id]; + if (_oldRequestFrameCallback) { + delete _requestAnimationFrameCallbacks[id]; + _oldRequestFrameCallback(nowMilliSeconds); + } + } +} +let _timeoutIDIndex = 0; +class TimeoutInfo { + constructor(cb, delay, isRepeat, target, args) { + this.cb = cb; + this.id = ++_timeoutIDIndex; + this.start = performance.now(); + this.delay = delay; + this.isRepeat = isRepeat; + this.target = target; + this.args = args; + } +} +const _timeoutInfos = {}; +function fireTimeout(nowMilliSeconds) { + let info; + for (const id in _timeoutInfos) { + info = _timeoutInfos[id]; + if (info && info.cb) { + if (nowMilliSeconds - info.start >= info.delay) { + // console.log(`fireTimeout: id ${id}, start: ${info.start}, delay: ${info.delay}, now: ${nowMilliSeconds}`); + if (typeof info.cb === 'string') { + Function(info.cb)(); + } else if (typeof info.cb === 'function') { + info.cb.apply(info.target, info.args); + } + if (info.isRepeat) { + info.start = nowMilliSeconds; + } else { + delete _timeoutInfos[id]; + } + } + } + } +} +function createTimeoutInfo(prevFuncArgs, isRepeat) { + const cb = prevFuncArgs[0]; + if (!cb) { + console.error('createTimeoutInfo doesn\'t pass a callback ...'); + return 0; + } + const delay = prevFuncArgs.length > 1 ? prevFuncArgs[1] : 0; + let args; + if (prevFuncArgs.length > 2) { + args = Array.prototype.slice.call(prevFuncArgs, 2); + } + const info = new TimeoutInfo(cb, delay, isRepeat, this, args); + _timeoutInfos[info.id] = info; + return info.id; +} +if (window.oh && window.scriptEngineType === 'napi') { + console.log(`Openharmony with napi has alreay implemented setTimeout/setInterval`); +} else { + // In openharmony, the setTimeout function will conflict with the timer of the worker thread and cause a crash, + // so you need to use the default timer + jsbWindow.setTimeout = function (cb) { + return createTimeoutInfo(arguments, false); + }; + jsbWindow.clearTimeout = function (id) { + delete _timeoutInfos[id]; + }; + jsbWindow.setInterval = function (cb) { + return createTimeoutInfo(arguments, true); + }; + jsbWindow.clearInterval = jsbWindow.clearTimeout; +} +jsbWindow.alert = console.error.bind(console); + +// File utils (Temporary, won't be accessible) +if (typeof jsb.FileUtils !== 'undefined') { + jsb.fileUtils = jsb.FileUtils.getInstance(); + delete jsb.FileUtils; +} +jsbWindow.XMLHttpRequest.prototype.addEventListener = function (eventName, listener, options) { + this[`on${eventName}`] = listener; +}; +jsbWindow.XMLHttpRequest.prototype.removeEventListener = function (eventName, listener, options) { + this[`on${eventName}`] = null; +}; + +// SocketIO +if (jsbWindow.SocketIO) { + jsbWindow.io = jsbWindow.SocketIO; + jsbWindow.SocketIO.prototype._Emit = jsbWindow.SocketIO.prototype.emit; + jsbWindow.SocketIO.prototype.emit = function (uri, delegate) { + if (typeof delegate === 'object') { + delegate = JSON.stringify(delegate); + } + this._Emit(uri, delegate); + }; +} +jsbWindow.gameTick = tick; + +// generate get set function +jsb.generateGetSet = function (moduleObj) { + for (const classKey in moduleObj) { + const classProto = moduleObj[classKey] && moduleObj[classKey].prototype; + if (!classProto) continue; + for (const getName in classProto) { + const getPos = getName.search(/^get/); + if (getPos == -1) continue; + let propName = getName.replace(/^get/, ''); + const nameArr = propName.split(''); + const lowerFirst = nameArr[0].toLowerCase(); + const upperFirst = nameArr[0].toUpperCase(); + nameArr.splice(0, 1); + const left = nameArr.join(''); + propName = lowerFirst + left; + const setName = `set${upperFirst}${left}`; + if (classProto.hasOwnProperty(propName)) continue; + const setFunc = classProto[setName]; + const hasSetFunc = typeof setFunc === 'function'; + if (hasSetFunc) { + Object.defineProperty(classProto, propName, { + get() { + return this[getName](); + }, + set(val) { + this[setName](val); + }, + configurable: true + }); + } else { + Object.defineProperty(classProto, propName, { + get() { + return this[getName](); + }, + configurable: true + }); + } + } + } +}; +for (const key in jsbWindow) { + if (globalThis[key] === undefined) { + globalThis[key] = jsbWindow[key]; + } +} + +// In the openharmony platform, XMLHttpRequest is not undefined, but there are problems to using it. +// So the native implementation is forced to be used. +if (window.oh && typeof globalThis.XMLHttpRequest !== 'undefined') { + globalThis.XMLHttpRequest = jsbWindow.XMLHttpRequest; +} +if (typeof globalThis.window === 'undefined') { + globalThis.window = globalThis; +} + +// promise polyfill relies on setTimeout implementation +require('./promise.min'); + +},{"../jsbWindow":44,"./Blob":3,"./base64/base64.min":4,"./jsb-adapter":30,"./jsb_audioengine":35,"./jsb_input":36,"./jsb_prepare":37,"./promise.min":38,"./wasm":39,"./xmldom/dom-parser":40}],6:[function(require,module,exports){ +"use strict"; + +const ImageData = require('./ImageData'); +class Context2DAttribute { + constructor() { + this.lineWidth = undefined; + this.lineJoin = undefined; + this.fillStyle = undefined; + this.font = undefined; + this.lineCap = undefined; + this.textAlign = undefined; + this.textBaseline = undefined; + this.strokeStyle = undefined; + this.globalCompositeOperation = undefined; + this.shadowBlur = undefined; + this.shadowColor = undefined; + this.shadowOffsetX = undefined; + this.shadowOffsetY = undefined; + } +} +jsb.CanvasRenderingContext2D.prototype._ctor = function () { + this.__nativeRefs = {}; +}; +class CanvasRenderingContext2D { + constructor(width, height) { + this._nativeObj = new jsb.CanvasRenderingContext2D(width, height); + this._attris = new Context2DAttribute(); + } + + // Do not cache width and height, as they will change buffer and sync to JS. + get width() { + return this._nativeObj.width; + } + set width(val) { + this._nativeObj.width = val; + } + get height() { + return this._nativeObj.height; + } + set height(val) { + this._nativeObj.height = val; + } + get lineWidth() { + return this._attris.lineWidth; + } + set lineWidth(val) { + this._attris.lineWidth = val; + } + get lineJoin() { + return this._attris.lineJoin; + } + set lineJoin(val) { + this._attris.lineJoin = val; + } + get fillStyle() { + return this._attris.fillStyle; + } + set fillStyle(val) { + this._attris.fillStyle = val; + } + get font() { + return this._attris.font; + } + set font(val) { + this._attris.font = val; + } + get lineCap() { + return this._attris.lineCap; + } + set lineCap(val) { + this._attris.lineCap = val; + } + get textAlign() { + return this._attris.textAlign; + } + set textAlign(val) { + this._attris.textAlign = val; + } + get textBaseline() { + return this._attris.textBaseline; + } + set textBaseline(val) { + this._attris.textBaseline = val; + } + get strokeStyle() { + return this._attris.strokeStyle; + } + set strokeStyle(val) { + this._attris.strokeStyle = val; + } + get globalCompositeOperation() { + return this._attris.globalCompositeOperation; + } + set globalCompositeOperation(val) { + this._attris.globalCompositeOperation = val; + } + get shadowBlur() { + return this._attris.shadowBlur; + } + set shadowBlur(val) { + this._attris.shadowBlur = val; + } + get shadowColor() { + return this._attris.shadowColor; + } + set shadowColor(val) { + this._attris.shadowColor = val; + } + get shadowOffsetX() { + return this._attris.shadowOffsetX; + } + set shadowOffsetX(val) { + this._attris.shadowOffsetX = val; + } + get shadowOffsetY() { + return this._attris.shadowOffsetY; + } + set shadowOffsetY(val) { + this._attris.shadowOffsetY = val; + } + restore() { + this._nativeObj.restore(); + } + moveTo(x, y) { + this._nativeObj.moveTo(x, y); + } + lineTo(x, y) { + this._nativeObj.lineTo(x, y); + } + setTransform(a, b, c, d, e, f) { + this._nativeObj.setTransform(a, b, c, d, e, f); + } + stroke() { + this._canvas._dataInner = null; + this._nativeObj.stroke(); + } + measureText(text) { + return this._nativeObj.measureText(text, this._attris); + } + fill() { + this._canvas._dataInner = null; + this._nativeObj.fill(); + } + _fillImageData(data, width, height, offsetX, offsetY) { + this._canvas._dataInner = null; + this._nativeObj._fillImageData(data, width, height, offsetX, offsetY); + } + scale(x, y) { + this._nativeObj.scale(x, y); + } + clearRect(x, y, width, height) { + this._canvas._dataInner = null; + this._nativeObj.clearRect(x, y, width, height); + } + transform(a, b, c, d, e, f) { + this._nativeObj.transform(a, b, c, d, e, f); + } + fillText(text, x, y, maxWidth) { + this._canvas._dataInner = null; + this._nativeObj.fillText(text, x, y, maxWidth, this._attris); + } + strokeText(text, x, y, maxWidth) { + this._canvas._dataInner = null; + this._nativeObj.strokeText(text, x, y, maxWidth, this._attris); + } + save() { + this._nativeObj.save(); + } + fillRect(x, y, width, height) { + this._canvas._dataInner = null; + this._nativeObj.fillRect(x, y, width, height, this._attris); + } + fetchData() { + if (typeof this._nativeObj.fetchData !== 'undefined') { + this._nativeObj.fetchData(); + } + } + rotate(angle) { + this._nativeObj.rotate(angle); + } + beginPath() { + this._nativeObj.beginPath(); + } + rect(x, y, width, height) { + this._nativeObj.rect(x, y, width, height); + } + translate(x, y) { + this._nativeObj.translate(x, y); + } + createLinearGradient(x0, y0, x1, y1) { + return this._nativeObj.createLinearGradient(x0, y0, x1, y1); + } + closePath() { + this._nativeObj.closePath(); + } + + // void ctx.putImageData(imagedata, dx, dy); + // void ctx.putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight); + putImageData(imageData, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) { + this._canvas._data = imageData; + } + + // ImageData ctx.createImageData(imagedata); + // ImageData ctx.createImageData(width, height); + createImageData(args1, args2) { + if (typeof args1 === 'number' && typeof args2 === 'number') { + return new ImageData(args1, args2); + } else if (args1 instanceof ImageData) { + return new ImageData(args1.data, args1.width, args1.height); + } + } + + // Comment it seems it is not used. + // // ImageData ctx.getImageData(sx, sy, sw, sh); + // getImageData (sx, sy, sw, sh) { + // var canvasWidth = this._canvas._width; + // var canvasHeight = this._canvas._height; + // var canvasBuffer = this._canvas._data.data; + // // image rect may bigger that canvas rect + // var maxValidSH = (sh + sy) < canvasHeight ? sh : (canvasHeight - sy); + // var maxValidSW = (sw + sx) < canvasWidth ? sw : (canvasWidth - sx); + // var imgBuffer = new Uint8ClampedArray(sw * sh * 4); + // for (var y = 0; y < maxValidSH; y++) { + // for (var x = 0; x < maxValidSW; x++) { + // var canvasPos = (y + sy) * canvasWidth + (x + sx); + // var imgPos = y * sw + x; + // imgBuffer[imgPos * 4 + 0] = canvasBuffer[canvasPos * 4 + 0]; + // imgBuffer[imgPos * 4 + 1] = canvasBuffer[canvasPos * 4 + 1]; + // imgBuffer[imgPos * 4 + 2] = canvasBuffer[canvasPos * 4 + 2]; + // imgBuffer[imgPos * 4 + 3] = canvasBuffer[canvasPos * 4 + 3]; + // } + // } + // return new ImageData(imgBuffer, sw, sh); + // } + + _setCanvasBufferUpdatedCallback(func) { + this._nativeObj._setCanvasBufferUpdatedCallback(func); + } +} +module.exports = CanvasRenderingContext2D; + +},{"./ImageData":22}],7:[function(require,module,exports){ +"use strict"; + +class DOMRect { + constructor(x, y, width, height) { + this.x = x ? x : 0; + this.y = y ? y : 0; + this.width = width ? width : 0; + this.height = height ? height : 0; + this.left = this.x; + this.top = this.y; + this.right = this.x + this.width; + this.bottom = this.y + this.height; + } +} +module.exports = DOMRect; + +},{}],8:[function(require,module,exports){ +"use strict"; + +const Event = require('./Event'); +class DeviceMotionEvent extends Event { + constructor(initArgs) { + super('devicemotion'); + if (initArgs) { + this._acceleration = initArgs.acceleration ? initArgs.acceleration : { + x: 0, + y: 0, + z: 0 + }; + this._accelerationIncludingGravity = initArgs.accelerationIncludingGravity ? initArgs.accelerationIncludingGravity : { + x: 0, + y: 0, + z: 0 + }; + this._rotationRate = initArgs.rotationRate ? initArgs.rotationRate : { + alpha: 0, + beta: 0, + gamma: 0 + }; + this._interval = initArgs.interval; + } else { + this._acceleration = { + x: 0, + y: 0, + z: 0 + }; + this._accelerationIncludingGravity = { + x: 0, + y: 0, + z: 0 + }; + this._rotationRate = { + alpha: 0, + beta: 0, + gamma: 0 + }; + this._interval = 0; + } + } + get acceleration() { + return this._acceleration; + } + get accelerationIncludingGravity() { + return this._accelerationIncludingGravity; + } + get rotationRate() { + return this._rotationRate; + } + get interval() { + return this._interval; + } +} +module.exports = DeviceMotionEvent; + +},{"./Event":10}],9:[function(require,module,exports){ +"use strict"; + +const Node = require('./Node'); +const DOMRect = require('./DOMRect'); +const jsbWindow = require('../../jsbWindow'); +class Element extends Node { + constructor() { + super(); + this.className = ''; + this.children = []; + this.clientLeft = 0; + this.clientTop = 0; + this.scrollLeft = 0; + this.scrollTop = 0; + } + get clientWidth() { + return 0; + } + get clientHeight() { + return 0; + } + getBoundingClientRect() { + return new DOMRect(0, 0, jsbWindow.innerWidth, jsbWindow.innerHeight); + } + + // attrName is a string that names the attribute to be removed from element. + removeAttribute(attrName) {} +} +module.exports = Element; + +},{"../../jsbWindow":44,"./DOMRect":7,"./Node":26}],10:[function(require,module,exports){ +"use strict"; + +/** + * @see https://dom.spec.whatwg.org/#interface-event + * @private + */ +/** + * The event wrapper. + * @constructor + * @param {EventTarget} eventTarget The event target of this dispatching. + * @param {Event|{type:string}} event The original event to wrap. + */ +class Event { + constructor(type, eventInit) { + this._type = type; + this._target = null; + this._eventPhase = 2; + this._currentTarget = null; + this._canceled = false; + this._stopped = false; // The flag to stop propagation immediately. + this._passiveListener = null; + this._timeStamp = Date.now(); + } + + /** + * The type of this event. + * @type {string} + */ + get type() { + return this._type; + } + + /** + * The target of this event. + * @type {EventTarget} + */ + get target() { + return this._target; + } + + /** + * The target of this event. + * @type {EventTarget} + */ + get currentTarget() { + return this._currentTarget; + } + get isTrusted() { + // https://heycam.github.io/webidl/#Unforgeable + return false; + } + get timeStamp() { + return this._timeStamp; + } + + /** + * @returns {EventTarget[]} The composed path of this event. + */ + composedPath() { + const currentTarget = this._currentTarget; + if (currentTarget === null) { + return []; + } + return [currentTarget]; + } + + /** + * The target of this event. + * @type {number} + */ + get eventPhase() { + return this._eventPhase; + } + + /** + * Stop event bubbling. + * @returns {void} + */ + stopPropagation() {} + + /** + * Stop event bubbling. + * @returns {void} + */ + stopImmediatePropagation() { + this._stopped = true; + } + + /** + * The flag to be bubbling. + * @type {boolean} + */ + get bubbles() { + return false; + } + + /** + * The flag to be cancelable. + * @type {boolean} + */ + get cancelable() { + return true; + } + + /** + * Cancel this event. + * @returns {void} + */ + preventDefault() { + if (this._passiveListener !== null) { + console.warn("Event#preventDefault() was called from a passive listener:", this._passiveListener); + return; + } + if (!this.cancelable) { + return; + } + this._canceled = true; + } + + /** + * The flag to indicate cancellation state. + * @type {boolean} + */ + get defaultPrevented() { + return this._canceled; + } + + /** + * The flag to be composed. + * @type {boolean} + */ + get composed() { + return false; + } + + /** + * The unix time of this event. + * @type {number} + */ + get timeStamp() { + return this._timeStamp; + } +} + +/** + * Constant of NONE. + * @type {number} + */ +Event.NONE = 0; + +/** + * Constant of CAPTURING_PHASE. + * @type {number} + */ +Event.CAPTURING_PHASE = 1; + +/** + * Constant of AT_TARGET. + * @type {number} + */ +Event.AT_TARGET = 2; + +/** + * Constant of BUBBLING_PHASE. + * @type {number} + */ +Event.BUBBLING_PHASE = 3; +module.exports = Event; + +},{}],11:[function(require,module,exports){ +"use strict"; + +var __targetID = 0; +var __listenerMap = { + touch: {}, + mouse: {}, + keyboard: {}, + devicemotion: {} +}; +var __listenerCountMap = { + touch: 0, + mouse: 0, + keyboard: 0, + devicemotion: 0 +}; +var __enableCallbackMap = { + touch: null, + mouse: null, + keyboard: null, + //FIXME: Cocos Creator invokes addEventListener('devicemotion') when engine initializes, it will active sensor hardware. + // In that case, CPU and temperature cost will increase. Therefore, we require developer to invoke 'jsb.device.setMotionEnabled(true)' + // on native platforms since most games will not listen motion event. + devicemotion: null + // devicemotion: function() { + // jsb.device.setMotionEnabled(true); + // } +}; + +var __disableCallbackMap = { + touch: null, + mouse: null, + //FIXME: Cocos Creator invokes addEventListener('devicemotion') when engine initializes, it will active sensor hardware. + // In that case, CPU and temperature cost will increase. Therefore, we require developer to invoke 'jsb.device.setMotionEnabled(true)' + // on native platforms since most games will not listen motion event. + keyboard: null, + devicemotion: null + // devicemotion: function() { + // jsb.device.setMotionEnabled(false); + // } +}; + +const __handleEventNames = { + touch: ['touchstart', 'touchmove', 'touchend', 'touchcancel'], + mouse: ['mousedown', 'mousemove', 'mouseup', 'mousewheel'], + keyboard: ['keydown', 'keyup', 'keypress'], + devicemotion: ['devicemotion'] +}; + +// Listener types +const CAPTURE = 1; +const BUBBLE = 2; +const ATTRIBUTE = 3; + +/** + * Check whether a given value is an object or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is an object. + */ +function isObject(x) { + return x && typeof x === "object"; //eslint-disable-line no-restricted-syntax +} + +/** + * EventTarget. + * + * - This is constructor if no arguments. + * - This is a function which returns a CustomEventTarget constructor if there are arguments. + * + * For example: + * + * class A extends EventTarget {} + */ +class EventTarget { + constructor() { + this._targetID = ++__targetID; + this._listenerCount = { + touch: 0, + mouse: 0, + keyboard: 0, + devicemotion: 0 + }; + this._listeners = new Map(); + } + _associateSystemEventListener(eventName) { + var handleEventNames; + for (var key in __handleEventNames) { + handleEventNames = __handleEventNames[key]; + if (handleEventNames.indexOf(eventName) > -1) { + if (__enableCallbackMap[key] && __listenerCountMap[key] === 0) { + __enableCallbackMap[key](); + } + if (this._listenerCount[key] === 0) __listenerMap[key][this._targetID] = this; + ++this._listenerCount[key]; + ++__listenerCountMap[key]; + break; + } + } + } + _dissociateSystemEventListener(eventName) { + var handleEventNames; + for (var key in __handleEventNames) { + handleEventNames = __handleEventNames[key]; + if (handleEventNames.indexOf(eventName) > -1) { + if (this._listenerCount[key] <= 0) delete __listenerMap[key][this._targetID]; + --__listenerCountMap[key]; + if (__disableCallbackMap[key] && __listenerCountMap[key] === 0) { + __disableCallbackMap[key](); + } + break; + } + } + } + + /** + * Add a given listener to this event target. + * @param {string} eventName The event name to add. + * @param {Function} listener The listener to add. + * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. + * @returns {boolean} `true` if the listener was added actually. + */ + addEventListener(eventName, listener, options) { + if (!listener) { + return false; + } + if (typeof listener !== "function" && !isObject(listener)) { + throw new TypeError("'listener' should be a function or an object."); + } + const listeners = this._listeners; + const optionsIsObj = isObject(options); + const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + const newNode = { + listener, + listenerType, + passive: optionsIsObj && Boolean(options.passive), + once: optionsIsObj && Boolean(options.once), + next: null + }; + + // Set it as the first node if the first node is null. + let node = listeners.get(eventName); + if (node === undefined) { + listeners.set(eventName, newNode); + this._associateSystemEventListener(eventName); + return true; + } + + // Traverse to the tail while checking duplication.. + let prev = null; + while (node) { + if (node.listener === listener && node.listenerType === listenerType) { + // Should ignore duplication. + return false; + } + prev = node; + node = node.next; + } + + // Add it. + prev.next = newNode; + this._associateSystemEventListener(eventName); + return true; + } + + /** + * Remove a given listener from this event target. + * @param {string} eventName The event name to remove. + * @param {Function} listener The listener to remove. + * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. + * @returns {boolean} `true` if the listener was removed actually. + */ + removeEventListener(eventName, listener, options) { + if (!listener) { + return false; + } + const listeners = this._listeners; + const capture = isObject(options) ? Boolean(options.capture) : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + let prev = null; + let node = listeners.get(eventName); + while (node) { + if (node.listener === listener && node.listenerType === listenerType) { + if (prev) { + prev.next = node.next; + } else if (node.next) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + this._dissociateSystemEventListener(eventName); + return true; + } + prev = node; + node = node.next; + } + return false; + } + + /** + * Dispatch a given event. + * @param {Event|{type:string}} event The event to dispatch. + * @returns {boolean} `false` if canceled. + */ + dispatchEvent(event) { + if (!event || typeof event.type !== "string") { + throw new TypeError("\"event.type\" should be a string."); + } + const eventName = event.type; + var onFunc = this['on' + eventName]; + if (onFunc && typeof onFunc === 'function') { + event._target = event._currentTarget = this; + onFunc.call(this, event); + event._target = event._currentTarget = null; + event._eventPhase = 0; + event._passiveListener = null; + if (event.defaultPrevented) return false; + } + + // If listeners aren't registered, terminate. + const listeners = this._listeners; + let node = listeners.get(eventName); + if (!node) { + return true; + } + event._target = event._currentTarget = this; + + // This doesn't process capturing phase and bubbling phase. + // This isn't participating in a tree. + let prev = null; + while (node) { + // Remove this listener if it's once + if (node.once) { + if (prev) { + prev.next = node.next; + } else if (node.next) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + + // Call this listener + event._passiveListener = node.passive ? node.listener : null; + if (typeof node.listener === "function") { + node.listener.call(this, event); + } + + // Break if `event.stopImmediatePropagation` was called. + if (event._stopped) { + break; + } + node = node.next; + } + event._target = event._currentTarget = null; + event._eventPhase = 0; + event._passiveListener = null; + return !event.defaultPrevented; + } +} +module.exports = EventTarget; + +},{}],12:[function(require,module,exports){ +"use strict"; + +const EventTarget = require('./EventTarget'); +const Event = require('./Event'); +const jsbWindow = require('../../jsbWindow'); +class FileReader extends EventTarget { + construct() { + this.result = null; + } + + // Aborts the read operation. Upon return, the readyState will be DONE. + abort() {} + + // Starts reading the contents of the specified Blob, once finished, the result attribute contains an ArrayBuffer representing the file's data. + readAsArrayBuffer() {} + + // Starts reading the contents of the specified Blob, once finished, the result attribute contains a data: URL representing the file's data. + readAsDataURL(blob) { + this.result = `data:image/png;base64,${jsbWindow.btoa(blob)}`; + const event = new Event('load'); + this.dispatchEvent(event); + } + + // Starts reading the contents of the specified Blob, once finished, the result attribute contains the contents of the file as a text string. + readAsText() {} +} +module.exports = FileReader; + +},{"../../jsbWindow":44,"./Event":10,"./EventTarget":11}],13:[function(require,module,exports){ +"use strict"; + +class FontFace { + constructor(family, source, descriptors) { + this.family = family; + this.source = source; + this.descriptors = descriptors; + this._status = 'unloaded'; + this._loaded = new Promise((resolve, reject) => { + this._resolveCB = resolve; + this._rejectCB = reject; + }); + } + load() { + // class FontFaceSet, add(fontFace) have done the load work + } + get status() { + return this._status; + } + get loaded() { + return this._loaded; + } +} +module.exports = FontFace; + +},{}],14:[function(require,module,exports){ +"use strict"; + +const EventTarget = require('./EventTarget'); +const Event = require('./Event'); +class FontFaceSet extends EventTarget { + constructor() { + super(); + this._status = 'loading'; + } + get status() { + return this._status; + } + set onloading(listener) { + this.addEventListener('loading', listener); + } + set onloadingdone(listener) { + this.addEventListener('loadingdone', listener); + } + set onloadingerror(listener) { + this.addEventListener('loadingerror', listener); + } + add(fontFace) { + this._status = fontFace._status = 'loading'; + this.dispatchEvent(new Event('loading')); + // Call native binding method to set the ttf font to native platform. + let family = jsb.loadFont(fontFace.family, fontFace.source); + setTimeout(() => { + if (family) { + fontFace._status = this._status = 'loaded'; + fontFace._resolveCB(); + this.dispatchEvent(new Event('loadingdone')); + } else { + fontFace._status = this._status = 'error'; + fontFace._rejectCB(); + this.dispatchEvent(new Event('loadingerror')); + } + }, 0); + } + clear() {} + delete() {} + load() {} + ready() {} +} +module.exports = FontFaceSet; + +},{"./Event":10,"./EventTarget":11}],15:[function(require,module,exports){ +"use strict"; + +const HTMLElement = require('./HTMLElement'); +const ImageData = require('./ImageData'); +const DOMRect = require('./DOMRect'); +const CanvasRenderingContext2D = require('./CanvasRenderingContext2D'); +const jsbWindow = require('../../jsbWindow'); +const clamp = function (value) { + value = Math.round(value); + return value < 0 ? 0 : value < 255 ? value : 255; +}; +class CanvasGradient { + constructor() { + console.log('==> CanvasGradient constructor'); + } + addColorStop(offset, color) { + console.log('==> CanvasGradient addColorStop'); + } +} +class TextMetrics { + constructor(width) { + this._width = width; + } + get width() { + return this._width; + } +} +class HTMLCanvasElement extends HTMLElement { + constructor(width, height) { + super('canvas'); + this.id = 'glcanvas'; + this.type = 'canvas'; + this.top = 0; + this.left = 0; + this._width = width ? Math.ceil(width) : 0; + this._height = height ? Math.ceil(height) : 0; + this._context2D = null; + this._dataInner = null; + } + + //REFINE: implement opts. + getContext(name, opts) { + const self = this; + if (name === '2d') { + if (!this._context2D) { + this._context2D = new CanvasRenderingContext2D(this._width, this._height); + this._context2D._canvas = this; + this._context2D._setCanvasBufferUpdatedCallback(data => { + // FIXME: Canvas's data will take 2x memory size, one in C++, another is obtained by Uint8Array here. + self._dataInner = new ImageData(data, self._width, self._height); + }); + } + return this._context2D; + } + return null; + } + get _data() { + if (this._context2D === null) { + return null; + } + if (!this._dataInner) { + this._context2D.fetchData(); + } + return this._dataInner; + } + set _data(data) { + this._dataInner = data; + } + set width(width) { + width = Math.ceil(width); + if (this._width !== width) { + this._dataInner = null; + this._width = width; + if (this._context2D) { + this._context2D.width = width; + } + } + } + get width() { + return this._width; + } + set height(height) { + height = Math.ceil(height); + if (this._height !== height) { + this._dataInner = null; + this._height = height; + if (this._context2D) { + this._context2D.height = height; + } + } + } + get height() { + return this._height; + } + get clientWidth() { + return jsbWindow.innerWidth; + } + get clientHeight() { + return jsbWindow.innerHeight; + } + get data() { + if (this._data) { + return this._data.data; + } + return null; + } + getBoundingClientRect() { + return new DOMRect(0, 0, jsbWindow.innerWidth, jsbWindow.innerHeight); + } + requestPointerLock() { + jsb.setCursorEnabled(false); + } +} +module.exports = HTMLCanvasElement; + +},{"../../jsbWindow":44,"./CanvasRenderingContext2D":6,"./DOMRect":7,"./HTMLElement":16,"./ImageData":22}],16:[function(require,module,exports){ +"use strict"; + +const Element = require('./Element'); +const { + noop +} = require('./util'); +const jsbWindow = require('../../jsbWindow'); +class HTMLElement extends Element { + constructor(tagName = '') { + super(); + this.tagName = tagName.toUpperCase(); + this.className = ''; + this.children = []; + this.style = { + width: `${jsbWindow.innerWidth}px`, + height: `${jsbWindow.innerHeight}px` + }; + this.innerHTML = ''; + this.parentElement = jsbWindow.__canvas; + } + setAttribute(name, value) { + this[name] = value; + } + getAttribute(name) { + return this[name]; + } + focus() {} +} +module.exports = HTMLElement; + +},{"../../jsbWindow":44,"./Element":9,"./util":33}],17:[function(require,module,exports){ +"use strict"; + +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +const HTMLElement = require('./HTMLElement'); +const Event = require('./Event'); +class HTMLImageElement extends HTMLElement { + constructor(width, height, isCalledFromImage) { + if (!isCalledFromImage) { + throw new TypeError("Illegal constructor, use 'new Image(w, h); instead!'"); + } + super('img'); + _defineProperty(this, "_mipmapLevelDataSize", []); + this.width = width ? width : 0; + this.height = height ? height : 0; + this._data = null; + this._src = null; + this.complete = false; + this.crossOrigin = null; + } + destroy() { + if (this._data) { + jsb.destroyImage(this._data); + this._data = null; + } + this._src = null; + } + set src(src) { + this._src = src; + if (src === '') return; + jsb.loadImage(src, info => { + if (!info) { + this._data = null; + var event = new Event('error'); + this.dispatchEvent(event); + return; + } + this.width = this.naturalWidth = info.width; + this.height = this.naturalHeight = info.height; + this._data = info.data; + this.complete = true; + this._mipmapLevelDataSize = info.mipmapLevelDataSize; + var event = new Event('load'); + this.dispatchEvent(event); + }); + } + get src() { + return this._src; + } + get clientWidth() { + return this.width; + } + get clientHeight() { + return this.height; + } + getBoundingClientRect() { + return new DOMRect(0, 0, this.width, this.height); + } +} +module.exports = HTMLImageElement; + +},{"./Event":10,"./HTMLElement":16}],18:[function(require,module,exports){ +"use strict"; + +const HTMLElement = require('./HTMLElement'); +const MediaError = require('./MediaError'); +const HAVE_NOTHING = 0; +const HAVE_METADATA = 1; +const HAVE_CURRENT_DATA = 2; +const HAVE_FUTURE_DATA = 3; +const HAVE_ENOUGH_DATA = 4; +class HTMLMediaElement extends HTMLElement { + constructor(type) { + super(type); + this._volume = 1.0; + this._duration = 0; + this._isEnded = false; + this._isMute = false; + this._readyState = HAVE_NOTHING; + this._error = new MediaError(); + } + addTextTrack() {} + captureStream() {} + fastSeek() {} + load() {} + pause() {} + play() {} + canPlayType(mediaType) { + return ''; + } + set volume(volume) { + this._volume = volume; + } + get volume() { + return this._volume; + } + get duration() { + return this._duration; + } + get ended() { + return this._isEnded; + } + get muted() { + return this._isMute; + } + get readyState() { + return this._readyState; + } + get error() { + return this._error; + } + get currentTime() { + return 0; + } +} +module.exports = HTMLMediaElement; + +},{"./HTMLElement":16,"./MediaError":24}],19:[function(require,module,exports){ +"use strict"; + +const HTMLElement = require('./HTMLElement'); +const Event = require('./Event'); +const _importmaps = []; +class HTMLScriptElement extends HTMLElement { + constructor(width, height) { + super('script'); + } + set type(type) { + if (type === "systemjs-importmap") { + if (_importmaps.indexOf(this) === -1) { + _importmaps.push(this); + } + } + } + set src(url) { + setTimeout(() => { + require(url); + this.dispatchEvent(new Event('load')); + }, 0); + } +} +HTMLScriptElement._getAllScriptElementsSystemJSImportType = function () { + return _importmaps; +}; +module.exports = HTMLScriptElement; + +},{"./Event":10,"./HTMLElement":16}],20:[function(require,module,exports){ +"use strict"; + +const HTMLMediaElement = require('./HTMLMediaElement'); +class HTMLVideoElement extends HTMLMediaElement { + constructor() { + super('video'); + } + canPlayType(type) { + if (type === 'video/mp4') return true; + return false; + } +} +module.exports = HTMLVideoElement; + +},{"./HTMLMediaElement":18}],21:[function(require,module,exports){ +"use strict"; + +let HTMLImageElement = require('./HTMLImageElement'); +class Image extends HTMLImageElement { + constructor(width, height) { + super(width, height, true); + } +} +module.exports = Image; + +},{"./HTMLImageElement":17}],22:[function(require,module,exports){ +"use strict"; + +class ImageData { + // var imageData = new ImageData(array, width, height); + // var imageData = new ImageData(width, height); + constructor(array, width, height) { + if (typeof array === 'number' && typeof width == 'number') { + height = width; + width = array; + array = null; + } + if (array === null) { + this._data = new Uint8ClampedArray(width * height * 4); + } else { + this._data = array; + } + this._width = width; + this._height = height; + } + get data() { + return this._data; + } + get width() { + return this._width; + } + get height() { + return this._height; + } +} +module.exports = ImageData; + +},{}],23:[function(require,module,exports){ +"use strict"; + +const Event = require('./Event'); +const __numberShiftMap = { + '48': ')', + // 0 + '49': '!', + // 1 + '50': '@', + // 2 + '51': '#', + // 3 + '52': '$', + // 4 + '53': '%', + // 5 + '54': '^', + // 6 + '55': '&', + // 7 + '56': '*', + // 8 + '57': '(' // 9 +}; + +var __capsLockActive = false; +class KeyboardEvent extends Event { + constructor(type, KeyboardEventInit) { + super(type); + if (typeof KeyboardEventInit === 'object') { + this._altKeyActive = KeyboardEventInit.altKey ? KeyboardEventInit.altKey : false; + this._ctrlKeyActive = KeyboardEventInit.ctrlKey ? KeyboardEventInit.ctrlKey : false; + this._metaKeyActive = KeyboardEventInit.metaKey ? KeyboardEventInit.metaKey : false; + this._shiftKeyActive = KeyboardEventInit.shiftKey ? KeyboardEventInit.shiftKey : false; + this._keyCode = KeyboardEventInit.keyCode ? KeyboardEventInit.keyCode : -1; + this._repeat = KeyboardEventInit.repeat ? KeyboardEventInit.repeat : false; + } else { + this._altKeyActive = false; + this._ctrlKeyActive = false; + this._metaKeyActive = false; + this._shiftKeyActive = false; + this._keyCode = -1; + this._repeat = false; + } + var keyCode = this._keyCode; + if (keyCode >= 48 && keyCode <= 57) { + // 0 ~ 9 + var number = keyCode - 48; + this._code = 'Digit' + number; + this._key = this._shiftKeyActive ? __numberShiftMap[keyCode] : '' + number; + } else if (keyCode >= 10048 && keyCode <= 10057) { + // Numberpad 0 ~ 9 + // reset to web keyCode since it's a hack in C++ for distinguish numbers in Numberpad. + keyCode = this._keyCode = keyCode - 10000; + var number = keyCode - 48; + this._code = 'Numpad' + number; + this._key = '' + number; + } else if (keyCode >= 65 && keyCode <= 90) { + // A ~ Z + var charCode = String.fromCharCode(keyCode); + this._code = 'Key' + charCode; + this._key = this._shiftKeyActive ^ __capsLockActive ? charCode : charCode.toLowerCase(); + } else if (keyCode >= 97 && keyCode <= 122) { + // a ~ z + var charCode = String.fromCharCode(keyCode); + this._keyCode = keyCode - (97 - 65); // always return uppercase keycode for backward-compatibility + this._code = 'Key' + charCode; + this._key = this._shiftKeyActive ^ __capsLockActive ? charCode.toUpperCase() : charCode; + } else if (keyCode >= 112 && keyCode <= 123) { + // F1 ~ F12 + this._code = this._key = 'F' + (keyCode - 111); + } else if (keyCode === 27) { + this._code = this._key = 'Escape'; + } else if (keyCode === 189) { + this._code = 'Minus'; + this._key = this._shiftKeyActive ? '_' : '-'; + } else if (keyCode === 187) { + this._code = 'Equal'; + this._key = this._shiftKeyActive ? '+' : '='; + } else if (keyCode === 220) { + this._code = 'Backslash'; + this._key = this._shiftKeyActive ? '|' : '\\'; + } else if (keyCode === 192) { + this._code = 'Backquote'; + this._key = this._shiftKeyActive ? '~' : '`'; + } else if (keyCode === 8) { + this._code = this._key = 'Backspace'; + } else if (keyCode === 13) { + this._code = this._key = 'Enter'; + } else if (keyCode === 219) { + this._code = 'BracketLeft'; + this._key = this._shiftKeyActive ? '{' : '['; + } else if (keyCode === 221) { + this._code = 'BracketRight'; + this._key = this._shiftKeyActive ? '}' : ']'; + } else if (keyCode === 186) { + this._code = 'Semicolon'; + this._key = this._shiftKeyActive ? ':' : ';'; + } else if (keyCode === 222) { + this._code = 'Quote'; + this._key = this._shiftKeyActive ? '"' : "'"; + } else if (keyCode === 9) { + this._code = this._key = 'Tab'; + } else if (keyCode === 17) { + this._code = 'ControlLeft'; + this._key = 'Control'; + } else if (keyCode === 20017) { + this._keyCode = 17; // Reset to the real value. + this._code = 'ControlRight'; + this._key = 'Control'; + } else if (keyCode === 16) { + this._code = 'ShiftLeft'; + this._key = 'Shift'; + } else if (keyCode === 20016) { + this._keyCode = 16; // Reset to the real value. + this._code = 'ShiftRight'; + this._key = 'Shift'; + } else if (keyCode === 18) { + this._code = 'AltLeft'; + this._key = 'Alt'; + } else if (keyCode === 20018) { + this._keyCode = 18; // Reset to the real value. + this._code = 'AltRight'; + this._key = 'Alt'; + } else if (keyCode === 91) { + this._code = 'MetaLeft'; + this._key = 'Meta'; + } else if (keyCode === 93) { + this._code = 'MetaRight'; + this._key = 'Meta'; + } else if (keyCode === 37) { + this._code = this._key = 'ArrowLeft'; + } else if (keyCode === 38) { + this._code = this._key = 'ArrowUp'; + } else if (keyCode === 39) { + this._code = this._key = 'ArrowRight'; + } else if (keyCode === 40) { + this._code = this._key = 'ArrowDown'; + } else if (keyCode === 20093) { + this._keyCode = 93; // Bug of brower since its keycode is the same as MetaRight. + this._code = this._key = 'ContextMenu'; + } else if (keyCode === 20013) { + this._keyCode = 13; + this._code = 'NumpadEnter'; + this._key = 'Enter'; + } else if (keyCode === 107) { + this._code = 'NumpadAdd'; + this._key = '+'; + } else if (keyCode === 109) { + this._code = 'NumpadSubtract'; + this._key = '-'; + } else if (keyCode === 106) { + this._code = 'NumpadMultiply'; + this._key = '*'; + } else if (keyCode === 111) { + this._code = 'NumpadDivide'; + this._key = '/'; + } else if (keyCode === 12) { + this._code = 'NumLock'; + this._key = 'Clear'; + } else if (keyCode === 124) { + this._code = this._key = 'F13'; + } else if (keyCode === 36) { + this._code = this._key = 'Home'; + } else if (keyCode === 33) { + this._code = this._key = 'PageUp'; + } else if (keyCode === 34) { + this._code = this._key = 'PageDown'; + } else if (keyCode === 35) { + this._code = this._key = 'End'; + } else if (keyCode === 188) { + this._code = 'Comma'; + this._key = this._shiftKeyActive ? '<' : ','; + } else if (keyCode === 190) { + this._code = 'Period'; + this._key = this._shiftKeyActive ? '>' : '.'; + } else if (keyCode === 191) { + this._code = 'Slash'; + this._key = this._shiftKeyActive ? '?' : '/'; + } else if (keyCode === 32) { + this._code = 'Space'; + this._key = ' '; + } else if (keyCode === 46) { + this._code = this._key = 'Delete'; + } else if (keyCode === 110) { + this._code = 'NumpadDecimal'; + this._key = '.'; + } else if (keyCode === 20) { + this._code = this._key = 'CapsLock'; + if (type === 'keyup') { + __capsLockActive = !__capsLockActive; + } + } else { + console.log("Unknown keyCode: " + this._keyCode); + } + } + + // Returns a Boolean indicating if the modifier key, like Alt, Shift, Ctrl, or Meta, was pressed when the event was created. + getModifierState() { + return false; + } + + // Returns a Boolean that is true if the Alt ( Option or ⌥ on OS X) key was active when the key event was generated. + get altKey() { + return this._altKeyActive; + } + + // Returns a DOMString with the code value of the key represented by the event. + get code() { + return this._code; + } + + // Returns a Boolean that is true if the Ctrl key was active when the key event was generated. + get ctrlKey() { + return this._ctrlKeyActive; + } + + // Returns a Boolean that is true if the event is fired between after compositionstart and before compositionend. + get isComposing() { + return false; + } + + // Returns a DOMString representing the key value of the key represented by the event. + get key() { + return this._key; + } + get keyCode() { + return this._keyCode; + } + + // Returns a Number representing the location of the key on the keyboard or other input device. + get location() { + return 0; + } + + // Returns a Boolean that is true if the Meta key (on Mac keyboards, the ⌘ Command key; on Windows keyboards, the Windows key (⊞)) was active when the key event was generated. + get metaKey() { + return this._metaKeyActive; + } + + // Returns a Boolean that is true if the key is being held down such that it is automatically repeating. + get repeat() { + return this._repeat; + } + + // Returns a Boolean that is true if the Shift key was active when the key event was generated. + get shiftKey() { + return this._shiftKeyActive; + } +} +module.exports = KeyboardEvent; + +},{"./Event":10}],24:[function(require,module,exports){ +"use strict"; + +const MEDIA_ERR_ABORTED = 1; +const MEDIA_ERR_NETWORK = 2; +const MEDIA_ERR_DECODE = 3; +const MEDIA_ERR_SRC_NOT_SUPPORTED = 4; +class MediaError { + constructor() {} + get code() { + return MEDIA_ERR_ABORTED; + } + get message() { + return ""; + } +} +module.exports = MediaError; + +},{}],25:[function(require,module,exports){ +"use strict"; + +const Event = require('./Event'); +class MouseEvent extends Event { + constructor(type, initArgs) { + super(type); + this._button = initArgs.button; + this._which = initArgs.which; + this._wheelDelta = initArgs.wheelDelta; + this._clientX = initArgs.clientX; + this._clientY = initArgs.clientY; + this._screenX = initArgs.screenX; + this._screenY = initArgs.screenY; + this._pageX = initArgs.pageX; + this._pageY = initArgs.pageY; + } + get button() { + return this._button; + } + get which() { + return this._which; + } + get wheelDelta() { + return this._wheelDelta; + } + get clientX() { + return this._clientX; + } + get clientY() { + return this._clientY; + } + get screenX() { + return this._screenX; + } + get screenY() { + return this._screenY; + } + get pageX() { + return this._pageX; + } + get pageY() { + return this._pageY; + } +} +module.exports = MouseEvent; + +},{"./Event":10}],26:[function(require,module,exports){ +"use strict"; + +const EventTarget = require('./EventTarget'); +const jsbWindow = require('../../jsbWindow'); +class Node extends EventTarget { + constructor() { + super(); + this.childNodes = []; + this.parentNode = jsbWindow.__canvas; + } + appendChild(node) { + if (node instanceof Node) { + this.childNodes.push(node); + } else { + throw new TypeError('Failed to executed \'appendChild\' on \'Node\': parameter 1 is not of type \'Node\'.'); + } + } + insertBefore(newNode, referenceNode) { + //REFINE: + return newNode; + } + replaceChild(newChild, oldChild) { + //REFINE: + return oldChild; + } + cloneNode() { + const copyNode = Object.create(this); + Object.assign(copyNode, this); + return copyNode; + } + removeChild(node) { + const index = this.childNodes.findIndex(child => child === node); + if (index > -1) { + return this.childNodes.splice(index, 1); + } + return null; + } + contains(node) { + return this.childNodes.indexOf(node) > -1; + } +} +module.exports = Node; + +},{"../../jsbWindow":44,"./EventTarget":11}],27:[function(require,module,exports){ +"use strict"; + +const Event = require('./Event'); +class TouchEvent extends Event { + constructor(type, touchEventInit) { + super(type); + this.touches = []; + this.targetTouches = []; + this.changedTouches = []; + } +} +module.exports = TouchEvent; + +},{"./Event":10}],28:[function(require,module,exports){ +"use strict"; + +const HTMLElement = require('./HTMLElement'); +const Image = require('./Image'); +const HTMLCanvasElement = require('./HTMLCanvasElement'); +const HTMLVideoElement = require('./HTMLVideoElement'); +const HTMLScriptElement = require('./HTMLScriptElement'); +const Node = require('./Node'); +const FontFaceSet = require('./FontFaceSet'); +const jsbWindow = require('../../jsbWindow'); +class Document extends Node { + constructor() { + super(); + this.readyState = 'complete'; + this.visibilityState = 'visible'; + this.documentElement = globalThis; + this.hidden = false; + this.style = {}; + this.location = require('./location'); + this.head = new HTMLElement('head'); + this.body = new HTMLElement('body'); + this.fonts = new FontFaceSet(); + this.scripts = []; + } + createElementNS(namespaceURI, qualifiedName, options) { + return this.createElement(qualifiedName); + } + createElement(tagName) { + if (tagName === 'canvas') { + return new HTMLCanvasElement(1, 1); + } else if (tagName === 'img') { + return new Image(); + } else if (tagName === 'video') { + return new HTMLVideoElement(); + } else if (tagName === 'script') { + return new HTMLScriptElement(); + } + return new HTMLElement(tagName); + } + getElementById(id) { + if (id === jsbWindow.__canvas.id || id === 'canvas') { + return jsbWindow.__canvas; + } + return new HTMLElement(id); + } + getElementsByTagName(tagName) { + if (tagName === 'head') { + return [document.head]; + } else if (tagName === 'body') { + return [document.body]; + } else if (tagName === 'canvas') { + return [jsbWindow.__canvas]; + } + return [new HTMLElement(tagName)]; + } + getElementsByName(tagName) { + if (tagName === 'head') { + return [document.head]; + } else if (tagName === 'body') { + return [document.body]; + } else if (tagName === 'canvas') { + return [jsbWindow.__canvas]; + } + return [new HTMLElement(tagName)]; + } + querySelector(query) { + if (query === 'head') { + return document.head; + } else if (query === 'body') { + return document.body; + } else if (query === 'canvas') { + return jsbWindow.__canvas; + } else if (query === `#${jsbWindow.__canvas.id}`) { + return jsbWindow.__canvas; + } + return new HTMLElement(query); + } + querySelectorAll(query) { + if (query === 'head') { + return [document.head]; + } else if (query === 'body') { + return [document.body]; + } else if (query === 'canvas') { + return [jsbWindow.__canvas]; + } else if (query.startsWith('script[type="systemjs-importmap"]')) { + return HTMLScriptElement._getAllScriptElementsSystemJSImportType(); + } + return [new HTMLElement(query)]; + } + createTextNode() { + return new HTMLElement('text'); + } + elementFromPoint() { + return jsbWindow.canvas; + } + createEvent(type) { + if (jsbWindow[type]) { + return new jsbWindow[type](); + } + return null; + } + exitPointerLock() { + jsb.setCursorEnabled(true); + } +} +let document = new Document(); +module.exports = document; + +},{"../../jsbWindow":44,"./FontFaceSet":14,"./HTMLCanvasElement":15,"./HTMLElement":16,"./HTMLScriptElement":19,"./HTMLVideoElement":20,"./Image":21,"./Node":26,"./location":31}],29:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DOMException = void 0; +exports.Headers = Headers; +exports.Request = Request; +exports.Response = Response; +exports.fetch = fetch; +const self = globalThis; +const support = { + searchParams: 'URLSearchParams' in self, + iterable: 'Symbol' in self && 'iterator' in Symbol, + blob: false, + // do not support blob in native + formData: 'FormData' in self, + arrayBuffer: 'ArrayBuffer' in self +}; +function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj); +} +if (support.arrayBuffer) { + const viewClasses = ['[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]']; + var isArrayBufferView = ArrayBuffer.isView || function (obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; + }; +} +function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name); + } + if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name) || name === '') { + throw new TypeError('Invalid character in header field name'); + } + return name.toLowerCase(); +} +function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value); + } + return value; +} + +// Build a destructive iterator for the value list +function iteratorFor(items) { + const iterator = { + next() { + const value = items.shift(); + return { + done: value === undefined, + value + }; + } + }; + if (support.iterable) { + iterator[Symbol.iterator] = function () { + return iterator; + }; + } + return iterator; +} +function Headers(headers) { + this.map = {}; + if (headers instanceof Headers) { + headers.forEach(function (value, name) { + this.append(name, value); + }, this); + } else if (Array.isArray(headers)) { + headers.forEach(function (header) { + this.append(header[0], header[1]); + }, this); + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function (name) { + this.append(name, headers[name]); + }, this); + } +} +Headers.prototype.append = function (name, value) { + name = normalizeName(name); + value = normalizeValue(value); + const oldValue = this.map[name]; + this.map[name] = oldValue ? `${oldValue}, ${value}` : value; +}; +Headers.prototype.delete = function (name) { + delete this.map[normalizeName(name)]; +}; +Headers.prototype.get = function (name) { + name = normalizeName(name); + return this.has(name) ? this.map[name] : null; +}; +Headers.prototype.has = function (name) { + return this.map.hasOwnProperty(normalizeName(name)); +}; +Headers.prototype.set = function (name, value) { + this.map[normalizeName(name)] = normalizeValue(value); +}; +Headers.prototype.forEach = function (callback, thisArg) { + for (const name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this); + } + } +}; +Headers.prototype.keys = function () { + const items = []; + this.forEach((value, name) => { + items.push(name); + }); + return iteratorFor(items); +}; +Headers.prototype.values = function () { + const items = []; + this.forEach(value => { + items.push(value); + }); + return iteratorFor(items); +}; +Headers.prototype.entries = function () { + const items = []; + this.forEach((value, name) => { + items.push([name, value]); + }); + return iteratorFor(items); +}; +if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries; +} +function consumed(body) { + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')); + } + body.bodyUsed = true; +} +function fileReaderReady(reader) { + return new Promise((resolve, reject) => { + reader.onload = function () { + resolve(reader.result); + }; + reader.onerror = function () { + reject(reader.error); + }; + }); +} +function readBlobAsArrayBuffer(blob) { + const reader = new FileReader(); + const promise = fileReaderReady(reader); + reader.readAsArrayBuffer(blob); + return promise; +} +function readBlobAsText(blob) { + const reader = new FileReader(); + const promise = fileReaderReady(reader); + reader.readAsText(blob); + return promise; +} +function readArrayBufferAsText(buf) { + const view = new Uint8Array(buf); + const chars = new Array(view.length); + for (let i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]); + } + return chars.join(''); +} +function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0); + } else { + const view = new Uint8Array(buf.byteLength); + view.set(new Uint8Array(buf)); + return view.buffer; + } +} +function Body() { + this.bodyUsed = false; + this._initBody = function (body) { + this._bodyInit = body; + if (!body) { + this._bodyText = ''; + } else if (typeof body === 'string') { + this._bodyText = body; + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body; + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body; + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString(); + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer); + // IE 10-11 can't handle a DataView body. + this._bodyInit = new Blob([this._bodyArrayBuffer]); + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body); + } else { + this._bodyText = body = Object.prototype.toString.call(body); + } + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8'); + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type); + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + } + } + }; + if (support.blob) { + this.blob = function () { + const rejected = consumed(this); + if (rejected) { + return rejected; + } + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob); + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])); + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob'); + } else { + return Promise.resolve(new Blob([this._bodyText])); + } + }; + this.arrayBuffer = function () { + if (this._bodyArrayBuffer) { + return consumed(this) || Promise.resolve(this._bodyArrayBuffer); + } else { + return this.blob().then(readBlobAsArrayBuffer); + } + }; + } + this.text = function () { + const rejected = consumed(this); + if (rejected) { + return rejected; + } + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob); + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)); + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text'); + } else { + return Promise.resolve(this._bodyText); + } + }; + if (support.formData) { + this.formData = function () { + return this.text().then(decode); + }; + } + this.json = function () { + return this.text().then(JSON.parse); + }; + return this; +} + +// HTTP methods whose capitalization should be normalized +const methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'PATCH']; +function normalizeMethod(method) { + const upcased = method.toUpperCase(); + return methods.indexOf(upcased) > -1 ? upcased : method; +} +function Request(input, options) { + options = options || {}; + let body = options.body; + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read'); + } + this.url = input.url; + this.credentials = input.credentials; + if (!options.headers) { + this.headers = new Headers(input.headers); + } + this.method = input.method; + this.mode = input.mode; + this.signal = input.signal; + if (!body && input._bodyInit != null) { + body = input._bodyInit; + input.bodyUsed = true; + } + } else { + this.url = String(input); + } + this.credentials = options.credentials || this.credentials || 'same-origin'; + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers); + } + this.method = normalizeMethod(options.method || this.method || 'GET'); + this.mode = options.mode || this.mode || null; + this.signal = options.signal || this.signal; + this.referrer = null; + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests'); + } + this._initBody(body); +} +Request.prototype.clone = function () { + return new Request(this, { + body: this._bodyInit + }); +}; +function decode(body) { + const form = new FormData(); + body.trim().split('&').forEach(bytes => { + if (bytes) { + const split = bytes.split('='); + const name = split.shift().replace(/\+/g, ' '); + const value = split.join('=').replace(/\+/g, ' '); + form.append(decodeURIComponent(name), decodeURIComponent(value)); + } + }); + return form; +} +function parseHeaders(rawHeaders) { + const headers = new Headers(); + // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + // https://tools.ietf.org/html/rfc7230#section-3.2 + const preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); + preProcessedHeaders.split(/\r?\n/).forEach(line => { + const parts = line.split(':'); + const key = parts.shift().trim(); + if (key) { + const value = parts.join(':').trim(); + headers.append(key, value); + } + }); + return headers; +} +Body.call(Request.prototype); +function Response(bodyInit, options) { + if (!options) { + options = {}; + } + this.type = 'default'; + this.status = options.status === undefined ? 200 : options.status; + this.ok = this.status >= 200 && this.status < 300; + this.statusText = 'statusText' in options ? options.statusText : 'OK'; + this.headers = new Headers(options.headers); + this.url = options.url || ''; + this._initBody(bodyInit); +} +Body.call(Response.prototype); +Response.prototype.clone = function () { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }); +}; +Response.error = function () { + const response = new Response(null, { + status: 0, + statusText: '' + }); + response.type = 'error'; + return response; +}; +const redirectStatuses = [301, 302, 303, 307, 308]; +Response.redirect = function (url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code'); + } + return new Response(null, { + status, + headers: { + location: url + } + }); +}; +var DOMException = self.DOMException; +exports.DOMException = DOMException; +try { + new DOMException(); +} catch (err) { + exports.DOMException = DOMException = function (message, name) { + this.message = message; + this.name = name; + const error = Error(message); + this.stack = error.stack; + }; + DOMException.prototype = Object.create(Error.prototype); + DOMException.prototype.constructor = DOMException; +} +function fetch(input, init) { + return new Promise((resolve, reject) => { + const request = new Request(input, init); + if (request.signal && request.signal.aborted) { + return reject(new DOMException('Aborted', 'AbortError')); + } + const xhr = new XMLHttpRequest(); + function abortXhr() { + xhr.abort(); + } + xhr.onload = function () { + const options = { + status: xhr.status, + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + }; + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); + const body = 'response' in xhr ? xhr.response : xhr.responseText; + resolve(new Response(body, options)); + }; + xhr.onerror = function () { + reject(new TypeError('Network request failed')); + }; + xhr.ontimeout = function () { + reject(new TypeError('Network request failed')); + }; + xhr.onabort = function () { + reject(new DOMException('Aborted', 'AbortError')); + }; + xhr.open(request.method, request.url, true); + if (request.credentials === 'include') { + xhr.withCredentials = true; + } else if (request.credentials === 'omit') { + xhr.withCredentials = false; + } + if ('responseType' in xhr && support.blob) { + xhr.responseType = 'blob'; + } + request.headers.forEach((value, name) => { + xhr.setRequestHeader(name, value); + }); + if (request.signal) { + request.signal.addEventListener('abort', abortXhr); + xhr.onreadystatechange = function () { + // DONE (success or failure) + if (xhr.readyState === 4) { + request.signal.removeEventListener('abort', abortXhr); + } + }; + } + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); + }); +} +fetch.polyfill = true; + +},{}],30:[function(require,module,exports){ +"use strict"; + +require('./window'); + +},{"./window":34}],31:[function(require,module,exports){ +"use strict"; + +const location = { + href: 'game.js', + pathname: 'game.js', + search: '', + hash: '', + protocol: '', + reload() {} +}; +module.exports = location; + +},{}],32:[function(require,module,exports){ +"use strict"; + +let { + noop +} = require('./util'); +const navigator = { + platform: __getOS(), + language: __getCurrentLanguage(), + appVersion: '5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 NetType/WIFI Language/zh_CN', + onLine: true, + //FIXME: + + geolocation: { + getCurrentPosition: noop, + watchPosition: noop, + clearWatch: noop + }, + maxTouchPoints: 10 //FIXME: getting the number from OS. +}; + +module.exports = navigator; + +},{"./util":33}],33:[function(require,module,exports){ +"use strict"; + +function noop() {} +module.exports = noop; + +},{}],34:[function(require,module,exports){ +"use strict"; + +const jsbWindow = require('../../jsbWindow'); +function inject() { + jsbWindow.ontouchstart = null; + jsbWindow.ontouchmove = null; + jsbWindow.ontouchend = null; + jsbWindow.ontouchcancel = null; + jsbWindow.pageXOffset = jsbWindow.pageYOffset = jsbWindow.clientTop = jsbWindow.clientLeft = 0; + jsbWindow.outerWidth = jsbWindow.innerWidth; + jsbWindow.outerHeight = jsbWindow.innerHeight; + jsbWindow.clientWidth = jsbWindow.innerWidth; + jsbWindow.clientHeight = jsbWindow.innerHeight; + // if (!__EDITOR__) { + jsbWindow.top = jsbWindow.parent = jsbWindow; + jsbWindow.location = require('./location'); + jsbWindow.document = require('./document'); + jsbWindow.navigator = require('./navigator'); + // } + + jsbWindow.CanvasRenderingContext2D = require('./CanvasRenderingContext2D'); + jsbWindow.Element = require('./Element'); + jsbWindow.HTMLElement = require('./HTMLElement'); + jsbWindow.HTMLCanvasElement = require('./HTMLCanvasElement'); + jsbWindow.HTMLImageElement = require('./HTMLImageElement'); + jsbWindow.HTMLMediaElement = require('./HTMLMediaElement'); + jsbWindow.HTMLVideoElement = require('./HTMLVideoElement'); + jsbWindow.HTMLScriptElement = require('./HTMLScriptElement'); + jsbWindow.__canvas = new jsbWindow.HTMLCanvasElement(); + jsbWindow.__canvas._width = jsbWindow.innerWidth; + jsbWindow.__canvas._height = jsbWindow.innerHeight; + jsbWindow.Image = require('./Image'); + jsbWindow.FileReader = require('./FileReader'); + jsbWindow.FontFace = require('./FontFace'); + jsbWindow.FontFaceSet = require('./FontFaceSet'); + jsbWindow.EventTarget = require('./EventTarget'); + jsbWindow.Event = jsbWindow.Event || require('./Event'); + jsbWindow.TouchEvent = require('./TouchEvent'); + jsbWindow.MouseEvent = require('./MouseEvent'); + jsbWindow.KeyboardEvent = require('./KeyboardEvent'); + jsbWindow.DeviceMotionEvent = require('./DeviceMotionEvent'); + + // ES6 + const m_fetch = require('./fetch'); + jsbWindow.fetch = m_fetch.fetch; + jsbWindow.Headers = m_fetch.Headers; + jsbWindow.Request = m_fetch.Request; + jsbWindow.Response = m_fetch.Response; + + // const PORTRAIT = 0; + // const LANDSCAPE_LEFT = -90; + // const PORTRAIT_UPSIDE_DOWN = 180; + // const LANDSCAPE_RIGHT = 90; + jsbWindow.orientation = jsb.device.getDeviceOrientation(); + + // jsb.window.devicePixelRatio is readonly + if (!__EDITOR__) { + Object.defineProperty(jsbWindow, 'devicePixelRatio', { + get() { + return jsb.device.getDevicePixelRatio ? jsb.device.getDevicePixelRatio() : 1; + }, + set(_dpr) {/* ignore */}, + enumerable: true, + configurable: true + }); + } + jsbWindow.screen = { + availTop: 0, + availLeft: 0, + availHeight: jsbWindow.innerWidth, + availWidth: jsbWindow.innerHeight, + colorDepth: 8, + pixelDepth: 8, + left: 0, + top: 0, + width: jsbWindow.innerWidth, + height: jsbWindow.innerHeight, + orientation: { + //FIXME:cjh + type: 'portrait-primary' // portrait-primary, portrait-secondary, landscape-primary, landscape-secondary + }, + + onorientationchange(event) {} + }; + jsbWindow.addEventListener = function (eventName, listener, options) { + jsbWindow.__canvas.addEventListener(eventName, listener, options); + }; + jsbWindow.removeEventListener = function (eventName, listener, options) { + jsbWindow.__canvas.removeEventListener(eventName, listener, options); + }; + jsbWindow.dispatchEvent = function (event) { + jsbWindow.__canvas.dispatchEvent(event); + }; + jsbWindow.getComputedStyle = function (element) { + return { + position: 'absolute', + left: '0px', + top: '0px', + height: '0px' + }; + }; + jsbWindow.resize = function (width, height) { + jsbWindow.innerWidth = width; + jsbWindow.innerHeight = height; + jsbWindow.outerWidth = jsbWindow.innerWidth; + jsbWindow.outerHeight = jsbWindow.innerHeight; + jsbWindow.__canvas._width = jsbWindow.innerWidth; + jsbWindow.__canvas._height = jsbWindow.innerHeight; + jsbWindow.screen.availWidth = jsbWindow.innerWidth; + jsbWindow.screen.availHeight = jsbWindow.innerHeight; + jsbWindow.screen.width = jsbWindow.innerWidth; + jsbWindow.screen.height = jsbWindow.innerHeight; + jsbWindow.clientWidth = jsbWindow.innerWidth; + jsbWindow.clientHeight = jsbWindow.innerHeight; + // emit resize consistent with web behavior + const resizeEvent = new jsbWindow.Event('resize'); + resizeEvent._target = jsbWindow; + jsbWindow.dispatchEvent(resizeEvent); + }; + jsbWindow.focus = function () {}; + jsbWindow.scroll = function () {}; + jsbWindow._isInjected = true; +} +if (!jsbWindow._isInjected) { + inject(); +} +if (!__EDITOR__) { + jsbWindow.localStorage = sys.localStorage; +} + +},{"../../jsbWindow":44,"./CanvasRenderingContext2D":6,"./DeviceMotionEvent":8,"./Element":9,"./Event":10,"./EventTarget":11,"./FileReader":12,"./FontFace":13,"./FontFaceSet":14,"./HTMLCanvasElement":15,"./HTMLElement":16,"./HTMLImageElement":17,"./HTMLMediaElement":18,"./HTMLScriptElement":19,"./HTMLVideoElement":20,"./Image":21,"./KeyboardEvent":23,"./MouseEvent":25,"./TouchEvent":27,"./document":28,"./fetch":29,"./location":31,"./navigator":32}],35:[function(require,module,exports){ +"use strict"; + +(function (jsb) { + if (!jsb || !jsb.AudioEngine) return; + jsb.AudioEngine.AudioState = { + ERROR: -1, + INITIALZING: 0, + PLAYING: 1, + PAUSED: 2, + STOPPED: 3 + }; + jsb.AudioEngine.INVALID_AUDIO_ID = -1; + jsb.AudioEngine.TIME_UNKNOWN = -1; + + // Adapt to normal runtime based API + jsb.AudioEngine.play = jsb.AudioEngine.play2d; + jsb.AudioEngine.setErrorCallback = () => {}; +})(jsb); + +},{}],36:[function(require,module,exports){ +"use strict"; + +const EventTarget = require('./jsb-adapter/EventTarget'); +const Event = require('./jsb-adapter/Event'); +const eventTarget = new EventTarget(); +const callbackWrappers = {}; +const callbacks = {}; +let index = 1; +const callbackWrapper = function (cb) { + if (!cb) { + return null; + } + const func = function (event) { + cb({ + value: event.text + }); + }; + cb.___index = index++; + callbackWrappers[cb.___index] = func; + return func; +}; +const getCallbackWrapper = function (cb) { + if (cb && cb.___index) { + const ret = callbackWrappers[cb.___index]; + delete callbackWrappers[cb.___index]; + return ret; + } else { + return null; + } +}; +const removeListener = function (name, cb) { + if (cb) { + eventTarget.removeEventListener(name, getCallbackWrapper(cb)); + } else { + // remove all listeners of name + const cbs = callbacks[name]; + if (!cbs) { + return; + } + for (let i = 0, len = cbs.length; i < len; ++i) { + eventTarget.removeEventListener(name, cbs[i]); + } + delete callbacks[name]; + } +}; +const recordCallback = function (name, cb) { + if (!cb || !name || name === '') { + return; + } + if (!callbacks[name]) { + callbacks[name] = []; + } + callbacks[name].push(cb); +}; +jsb.inputBox = { + onConfirm(cb) { + const newCb = callbackWrapper(cb); + eventTarget.addEventListener('confirm', newCb); + recordCallback('confirm', newCb); + }, + offConfirm(cb) { + removeListener('confirm', cb); + }, + onComplete(cb) { + const newCb = callbackWrapper(cb); + eventTarget.addEventListener('complete', newCb); + recordCallback('complete', newCb); + }, + offComplete(cb) { + removeListener('complete', cb); + }, + onInput(cb) { + const newCb = callbackWrapper(cb); + eventTarget.addEventListener('input', newCb); + recordCallback('input', newCb); + }, + offInput(cb) { + removeListener('input', cb); + }, + /** + * @param {string} options.defaultValue + * @param {number} options.maxLength + * @param {bool} options.multiple + * @param {bool} options.confirmHold + * @param {string} options.confirmType + * @param {string} options.inputType + * + * Values of options.confirmType can be [done|next|search|go|send]. + * Values of options.inputType can be [text|email|number|phone|password]. + */ + show(options) { + jsb.showInputBox(options); + }, + hide() { + jsb.hideInputBox(); + } +}; +jsb.onTextInput = function (eventName, text) { + const event = new Event(eventName); + event.text = text; + eventTarget.dispatchEvent(event); +}; + +},{"./jsb-adapter/Event":10,"./jsb-adapter/EventTarget":11}],37:[function(require,module,exports){ +"use strict"; + +jsb.__obj_ref_id = 0; +jsb.registerNativeRef = function (owner, target) { + if (owner && target && owner !== target) { + let targetID = target.__jsb_ref_id; + if (targetID === undefined) targetID = target.__jsb_ref_id = jsb.__obj_ref_id++; + let refs = owner.__nativeRefs; + if (!refs) { + refs = owner.__nativeRefs = {}; + } + refs[targetID] = target; + } +}; +jsb.unregisterNativeRef = function (owner, target) { + if (owner && target && owner !== target) { + let targetID = target.__jsb_ref_id; + if (targetID === undefined) return; + let refs = owner.__nativeRefs; + if (!refs) { + return; + } + delete refs[targetID]; + } +}; +jsb.unregisterAllNativeRefs = function (owner) { + if (!owner) return; + delete owner.__nativeRefs; +}; +jsb.unregisterChildRefsForNode = function (node, recursive) { + recursive = !!recursive; + let children = node.getChildren(), + i, + l, + child; + for (i = 0, l = children.length; i < l; ++i) { + child = children[i]; + jsb.unregisterNativeRef(node, child); + if (recursive) { + jsb.unregisterChildRefsForNode(child, recursive); + } + } +}; + +},{}],38:[function(require,module,exports){ +(function (global,setImmediate){(function (){ +"use strict"; + +/* promise.min.js + * A Promise polyfill implementation. + * 2018-11-16 + * + * By taylorhakes, https://github.com/taylorhakes + * License: MIT + * See https://github.com/taylorhakes/promise-polyfill/blob/master/LICENSE + */ + +/*! @source https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.js */ +!function (e, n) { + typeof exports === 'object' && typeof module !== 'undefined' ? n() : typeof define === 'function' && define.amd ? define(n) : n(); +}(0, () => { + function e(e) { + const n = this.constructor; + return this.then(t => n.resolve(e()).then(() => t), t => n.resolve(e()).then(() => n.reject(t))); + } + function n() {} + function t(e) { + if (!(this instanceof t)) throw new TypeError('Promises must be constructed via new'); + if (typeof e !== 'function') throw new TypeError('not a function'); + this._state = 0, this._handled = !1, this._value = undefined, this._deferreds = [], u(e, this); + } + function o(e, n) { + for (; e._state === 3;) e = e._value; + e._state !== 0 ? (e._handled = !0, t._immediateFn(() => { + const t = e._state === 1 ? n.onFulfilled : n.onRejected; + if (t !== null) { + let o; + try { + o = t(e._value); + } catch (f) { + return void i(n.promise, f); + } + r(n.promise, o); + } else (e._state === 1 ? r : i)(n.promise, e._value); + })) : e._deferreds.push(n); + } + function r(e, n) { + try { + if (n === e) throw new TypeError('A promise cannot be resolved with itself.'); + if (n && (typeof n === 'object' || typeof n === 'function')) { + const o = n.then; + if (n instanceof t) return e._state = 3, e._value = n, void f(e); + if (typeof o === 'function') return void u(function (e, n) { + return function () { + e.apply(n, arguments); + }; + }(o, n), e); + } + e._state = 1, e._value = n, f(e); + } catch (r) { + i(e, r); + } + } + function i(e, n) { + e._state = 2, e._value = n, f(e); + } + function f(e) { + e._state === 2 && e._deferreds.length === 0 && t._immediateFn(() => { + e._handled || t._unhandledRejectionFn(e._value); + }); + for (let n = 0, r = e._deferreds.length; r > n; n++) o(e, e._deferreds[n]); + e._deferreds = null; + } + function u(e, n) { + let t = !1; + try { + e(e => { + t || (t = !0, r(n, e)); + }, e => { + t || (t = !0, i(n, e)); + }); + } catch (o) { + if (t) return; + t = !0, i(n, o); + } + } + const c = setTimeout; + t.prototype.catch = function (e) { + return this.then(null, e); + }, t.prototype.then = function (e, t) { + const r = new this.constructor(n); + return o(this, new function (e, n, t) { + this.onFulfilled = typeof e === 'function' ? e : null, this.onRejected = typeof n === 'function' ? n : null, this.promise = t; + }(e, t, r)), r; + }, t.prototype.finally = e, t.all = function (e) { + return new t((n, t) => { + function o(e, f) { + try { + if (f && (typeof f === 'object' || typeof f === 'function')) { + const u = f.then; + if (typeof u === 'function') return void u.call(f, n => { + o(e, n); + }, t); + } + r[e] = f, --i == 0 && n(r); + } catch (c) { + t(c); + } + } + if (!e || typeof e.length === 'undefined') throw new TypeError('Promise.all accepts an array'); + var r = Array.prototype.slice.call(e); + if (r.length === 0) return n([]); + for (var i = r.length, f = 0; r.length > f; f++) o(f, r[f]); + }); + }, t.resolve = function (e) { + return e && typeof e === 'object' && e.constructor === t ? e : new t(n => { + n(e); + }); + }, t.reject = function (e) { + return new t((n, t) => { + t(e); + }); + }, t.race = function (e) { + return new t((n, t) => { + for (let o = 0, r = e.length; r > o; o++) e[o].then(n, t); + }); + }, t._immediateFn = typeof setImmediate === 'function' && function (e) { + setImmediate(e); + } || function (e) { + c(e, 0); + }, t._unhandledRejectionFn = function (e) { + void 0 !== console && console && console.warn('Possible Unhandled Promise Rejection:', e); + }; + const l = function () { + if (typeof self !== 'undefined') return self; + if (typeof window !== 'undefined') return window; + if (typeof global !== 'undefined') return global; + throw Error('unable to locate global object'); + }(); + 'Promise' in l ? l.Promise.prototype.finally || (l.Promise.prototype.finally = e) : l.Promise = t; +}); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) +},{"timers":2}],39:[function(require,module,exports){ +"use strict"; + +/* + Copyright (c) 2023 Xiamen Yaji Software Co., Ltd. + + https://www.cocos.com/ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +// fix: WebAssembly.instantiate not working well on V8. +(function injectWebAssembly() { + if (!globalThis.WebAssembly) { + console.warn('WebAssembly is not supported!'); + return; + } + console.info('injectWebAssembly ...'); + const oldWebAssemblyInstantiate = WebAssembly.instantiate; + const oldWebAssemblyCompile = WebAssembly.compile; + WebAssembly.compile = function (bufferSource) { + return new Promise((resolve, reject) => { + if (!bufferSource) { + reject('WebAssembly.compile: Invalid buffer source!'); + } else if (CC_EDITOR) { + // FIX EDITOR ERROR: WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread. + resolve(oldWebAssemblyCompile.call(WebAssembly, bufferSource)); + } else { + resolve(new WebAssembly.Module(bufferSource)); + } + }); + }; + WebAssembly.instantiate = function (bufferSourceOrModule, importObject) { + let ret; + if (bufferSourceOrModule instanceof WebAssembly.Module) { + ret = oldWebAssemblyInstantiate(bufferSourceOrModule, importObject); + } else { + ret = new Promise((resolve, reject) => { + WebAssembly.compile(bufferSourceOrModule).then(mod => { + oldWebAssemblyInstantiate(mod, importObject).then(instance => { + resolve({ + instance: instance, + module: mod + }); + }).catch(reject); + }).catch(reject); + }); + } + return ret; + }; +})(); + +},{}],40:[function(require,module,exports){ +"use strict"; + +function DOMParser(options) { + this.options = options || { + locator: {} + }; +} +DOMParser.prototype.parseFromString = function (source, mimeType) { + var options = this.options; + var sax = new XMLReader(); + var domBuilder = options.domBuilder || new DOMHandler(); //contentHandler and LexicalHandler + var errorHandler = options.errorHandler; + var locator = options.locator; + var defaultNSMap = options.xmlns || {}; + var isHTML = /\/x?html?$/.test(mimeType); //mimeType.toLowerCase().indexOf('html') > -1; + var entityMap = isHTML ? htmlEntity.entityMap : { + 'lt': '<', + 'gt': '>', + 'amp': '&', + 'quot': '"', + 'apos': "'" + }; + if (locator) { + domBuilder.setDocumentLocator(locator); + } + sax.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator); + sax.domBuilder = options.domBuilder || domBuilder; + if (isHTML) { + defaultNSMap[''] = 'http://www.w3.org/1999/xhtml'; + } + defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; + if (source) { + sax.parse(source, defaultNSMap, entityMap); + } else { + sax.errorHandler.error("invalid doc source"); + } + return domBuilder.doc; +}; +function buildErrorHandler(errorImpl, domBuilder, locator) { + if (!errorImpl) { + if (domBuilder instanceof DOMHandler) { + return domBuilder; + } + errorImpl = domBuilder; + } + var errorHandler = {}; + var isCallback = errorImpl instanceof Function; + locator = locator || {}; + function build(key) { + var fn = errorImpl[key]; + if (!fn && isCallback) { + fn = errorImpl.length == 2 ? function (msg) { + errorImpl(key, msg); + } : errorImpl; + } + errorHandler[key] = fn && function (msg) { + fn('[xmldom ' + key + ']\t' + msg + _locator(locator)); + } || function () {}; + } + build('warning'); + build('error'); + build('fatalError'); + return errorHandler; +} + +//console.log('#\n\n\n\n\n\n\n####') +/** + * +ContentHandler+ErrorHandler + * +LexicalHandler+EntityResolver2 + * -DeclHandler-DTDHandler + * + * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler + * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 + * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html + */ +function DOMHandler() { + this.cdata = false; +} +function position(locator, node) { + node.lineNumber = locator.lineNumber; + node.columnNumber = locator.columnNumber; +} +/** + * @see org.xml.sax.ContentHandler#startDocument + * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ +DOMHandler.prototype = { + startDocument: function () { + this.doc = new DOMImplementation().createDocument(null, null, null); + if (this.locator) { + this.doc.documentURI = this.locator.systemId; + } + }, + startElement: function (namespaceURI, localName, qName, attrs) { + var doc = this.doc; + var el = doc.createElementNS(namespaceURI, qName || localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; + this.locator && position(this.locator, el); + for (var i = 0; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value = attrs.getValue(i); + var qName = attrs.getQName(i); + var attr = doc.createAttributeNS(namespaceURI, qName); + this.locator && position(attrs.getLocator(i), attr); + attr.value = attr.nodeValue = value; + el.setAttributeNode(attr); + } + }, + endElement: function (namespaceURI, localName, qName) { + var current = this.currentElement; + var tagName = current.tagName; + this.currentElement = current.parentNode; + }, + startPrefixMapping: function (prefix, uri) {}, + endPrefixMapping: function (prefix) {}, + processingInstruction: function (target, data) { + var ins = this.doc.createProcessingInstruction(target, data); + this.locator && position(this.locator, ins); + appendElement(this, ins); + }, + ignorableWhitespace: function (ch, start, length) {}, + characters: function (chars, start, length) { + chars = _toString.apply(this, arguments); + //console.log(chars) + if (chars) { + if (this.cdata) { + var charNode = this.doc.createCDATASection(chars); + } else { + var charNode = this.doc.createTextNode(chars); + } + if (this.currentElement) { + this.currentElement.appendChild(charNode); + } else if (/^\s*$/.test(chars)) { + this.doc.appendChild(charNode); + //process xml + } + + this.locator && position(this.locator, charNode); + } + }, + skippedEntity: function (name) {}, + endDocument: function () { + this.doc.normalize(); + }, + setDocumentLocator: function (locator) { + if (this.locator = locator) { + // && !('lineNumber' in locator)){ + locator.lineNumber = 0; + } + }, + //LexicalHandler + comment: function (chars, start, length) { + chars = _toString.apply(this, arguments); + var comm = this.doc.createComment(chars); + this.locator && position(this.locator, comm); + appendElement(this, comm); + }, + startCDATA: function () { + //used in characters() methods + this.cdata = true; + }, + endCDATA: function () { + this.cdata = false; + }, + startDTD: function (name, publicId, systemId) { + var impl = this.doc.implementation; + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId); + this.locator && position(this.locator, dt); + appendElement(this, dt); + } + }, + /** + * @see org.xml.sax.ErrorHandler + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + warning: function (error) { + console.warn('[xmldom warning]\t' + error, _locator(this.locator)); + }, + error: function (error) { + console.error('[xmldom error]\t' + error, _locator(this.locator)); + }, + fatalError: function (error) { + console.error('[xmldom fatalError]\t' + error, _locator(this.locator)); + throw error; + } +}; +function _locator(l) { + if (l) { + return '\n@' + (l.systemId || '') + '#[line:' + l.lineNumber + ',col:' + l.columnNumber + ']'; + } +} +function _toString(chars, start, length) { + if (typeof chars == 'string') { + return chars.substr(start, length); + } else { + //java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") + if (chars.length >= start + length || start) { + return new java.lang.String(chars, start, length) + ''; + } + return chars; + } +} + +/* + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html + * used method of org.xml.sax.ext.LexicalHandler: + * #comment(chars, start, length) + * #startCDATA() + * #endCDATA() + * #startDTD(name, publicId, systemId) + * + * + * IGNORED method of org.xml.sax.ext.LexicalHandler: + * #endDTD() + * #startEntity(name) + * #endEntity(name) + * + * + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html + * IGNORED method of org.xml.sax.ext.DeclHandler + * #attributeDecl(eName, aName, type, mode, value) + * #elementDecl(name, model) + * #externalEntityDecl(name, publicId, systemId) + * #internalEntityDecl(name, value) + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html + * IGNORED method of org.xml.sax.EntityResolver2 + * #resolveEntity(String name,String publicId,String baseURI,String systemId) + * #resolveEntity(publicId, systemId) + * #getExternalSubset(name, baseURI) + * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html + * IGNORED method of org.xml.sax.DTDHandler + * #notationDecl(name, publicId, systemId) {}; + * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; + */ +"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function (key) { + DOMHandler.prototype[key] = function () { + return null; + }; +}); + +/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ +function appendElement(hander, node) { + if (!hander.currentElement) { + hander.doc.appendChild(node); + } else { + hander.currentElement.appendChild(node); + } +} //appendChild and setAttributeNS are preformance key + +//if(typeof require == 'function'){ +var htmlEntity = require('./entities'); +var XMLReader = require('./sax').XMLReader; +var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; +exports.XMLSerializer = require('./dom').XMLSerializer; +exports.DOMParser = DOMParser; +//} + +},{"./dom":41,"./entities":42,"./sax":43}],41:[function(require,module,exports){ +"use strict"; + +/* + * DOM Level 2 + * Object DOMException + * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html + */ + +function copy(src, dest) { + for (var p in src) { + dest[p] = src[p]; + } +} +/** +^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));? +^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));? + */ +function _extends(Class, Super) { + var pt = Class.prototype; + if (!(pt instanceof Super)) { + function t() {} + ; + t.prototype = Super.prototype; + t = new t(); + copy(pt, t); + Class.prototype = pt = t; + } + if (pt.constructor != Class) { + if (typeof Class != 'function') { + console.error("unknow Class:" + Class); + } + pt.constructor = Class; + } +} +var htmlns = 'http://www.w3.org/1999/xhtml'; +// Node Types +var NodeType = {}; +var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; +var TEXT_NODE = NodeType.TEXT_NODE = 3; +var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = NodeType.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = NodeType.COMMENT_NODE = 8; +var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = NodeType.NOTATION_NODE = 12; + +// ExceptionCode +var ExceptionCode = {}; +var ExceptionMessage = {}; +var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1); +var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2); +var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3); +var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4); +var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5); +var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6); +var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7); +var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8); +var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9); +var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10); +//level2 +var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11); +var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12); +var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13); +var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14); +var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15); +function DOMException(code, message) { + if (message instanceof Error) { + var error = message; + } else { + error = this; + Error.call(this, ExceptionMessage[code]); + this.message = ExceptionMessage[code]; + if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException); + } + error.code = code; + if (message) this.message = this.message + ": " + message; + return error; +} +; +DOMException.prototype = Error.prototype; +copy(ExceptionCode, DOMException); +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177 + * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. + * The items in the NodeList are accessible via an integral index, starting from 0. + */ +function NodeList() {} +; +NodeList.prototype = { + /** + * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. + * @standard level1 + */ + length: 0, + /** + * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. + * @standard level1 + * @param index unsigned long + * Index into the collection. + * @return Node + * The node at the indexth position in the NodeList, or null if that is not a valid index. + */ + item: function (index) { + return this[index] || null; + }, + toString: function (isHTML, nodeFilter) { + for (var buf = [], i = 0; i < this.length; i++) { + serializeToString(this[i], buf, isHTML, nodeFilter); + } + return buf.join(''); + } +}; +function LiveNodeList(node, refresh) { + this._node = node; + this._refresh = refresh; + _updateLiveList(this); +} +function _updateLiveList(list) { + var inc = list._node._inc || list._node.ownerDocument._inc; + if (list._inc != inc) { + var ls = list._refresh(list._node); + //console.log(ls.length) + __set__(list, 'length', ls.length); + copy(ls, list); + list._inc = inc; + } +} +LiveNodeList.prototype.item = function (i) { + _updateLiveList(this); + return this[i]; +}; +_extends(LiveNodeList, NodeList); +/** + * + * Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes. + * NamedNodeMap objects in the DOM are live. + * used for attributes or DocumentType entities + */ +function NamedNodeMap() {} +; +function _findNodeIndex(list, node) { + var i = list.length; + while (i--) { + if (list[i] === node) { + return i; + } + } +} +function _addNamedNode(el, list, newAttr, oldAttr) { + if (oldAttr) { + list[_findNodeIndex(list, oldAttr)] = newAttr; + } else { + list[list.length++] = newAttr; + } + if (el) { + newAttr.ownerElement = el; + var doc = el.ownerDocument; + if (doc) { + oldAttr && _onRemoveAttribute(doc, el, oldAttr); + _onAddAttribute(doc, el, newAttr); + } + } +} +function _removeNamedNode(el, list, attr) { + //console.log('remove attr:'+attr) + var i = _findNodeIndex(list, attr); + if (i >= 0) { + var lastIndex = list.length - 1; + while (i < lastIndex) { + list[i] = list[++i]; + } + list.length = lastIndex; + if (el) { + var doc = el.ownerDocument; + if (doc) { + _onRemoveAttribute(doc, el, attr); + attr.ownerElement = null; + } + } + } else { + throw DOMException(NOT_FOUND_ERR, new Error(el.tagName + '@' + attr)); + } +} +NamedNodeMap.prototype = { + length: 0, + item: NodeList.prototype.item, + getNamedItem: function (key) { + // if(key.indexOf(':')>0 || key == 'xmlns'){ + // return null; + // } + //console.log() + var i = this.length; + while (i--) { + var attr = this[i]; + //console.log(attr.nodeName,key) + if (attr.nodeName == key) { + return attr; + } + } + }, + setNamedItem: function (attr) { + var el = attr.ownerElement; + if (el && el != this._ownerElement) { + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + var oldAttr = this.getNamedItem(attr.nodeName); + _addNamedNode(this._ownerElement, this, attr, oldAttr); + return oldAttr; + }, + /* returns Node */ + setNamedItemNS: function (attr) { + // raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR + var el = attr.ownerElement, + oldAttr; + if (el && el != this._ownerElement) { + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName); + _addNamedNode(this._ownerElement, this, attr, oldAttr); + return oldAttr; + }, + /* returns Node */ + removeNamedItem: function (key) { + var attr = this.getNamedItem(key); + _removeNamedNode(this._ownerElement, this, attr); + return attr; + }, + // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR + + //for level2 + removeNamedItemNS: function (namespaceURI, localName) { + var attr = this.getNamedItemNS(namespaceURI, localName); + _removeNamedNode(this._ownerElement, this, attr); + return attr; + }, + getNamedItemNS: function (namespaceURI, localName) { + var i = this.length; + while (i--) { + var node = this[i]; + if (node.localName == localName && node.namespaceURI == namespaceURI) { + return node; + } + } + return null; + } +}; +/** + * @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 + */ +function DOMImplementation( /* Object */features) { + this._features = {}; + if (features) { + for (var feature in features) { + this._features = features[feature]; + } + } +} +; +DOMImplementation.prototype = { + hasFeature: function ( /* string */feature, /* string */version) { + var versions = this._features[feature.toLowerCase()]; + if (versions && (!version || version in versions)) { + return true; + } else { + return false; + } + }, + // Introduced in DOM Level 2: + createDocument: function (namespaceURI, qualifiedName, doctype) { + // raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR + var doc = new Document(); + doc.implementation = this; + doc.childNodes = new NodeList(); + doc.doctype = doctype; + if (doctype) { + doc.appendChild(doctype); + } + if (qualifiedName) { + var root = doc.createElementNS(namespaceURI, qualifiedName); + doc.appendChild(root); + } + return doc; + }, + // Introduced in DOM Level 2: + createDocumentType: function (qualifiedName, publicId, systemId) { + // raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR + var node = new DocumentType(); + node.name = qualifiedName; + node.nodeName = qualifiedName; + node.publicId = publicId; + node.systemId = systemId; + // Introduced in DOM Level 2: + //readonly attribute DOMString internalSubset; + + //REFINE:.. + // readonly attribute NamedNodeMap entities; + // readonly attribute NamedNodeMap notations; + return node; + } +}; + +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 + */ + +function Node() {} +; +Node.prototype = { + firstChild: null, + lastChild: null, + previousSibling: null, + nextSibling: null, + attributes: null, + parentNode: null, + childNodes: null, + ownerDocument: null, + nodeValue: null, + namespaceURI: null, + prefix: null, + localName: null, + // Modified in DOM Level 2: + insertBefore: function (newChild, refChild) { + //raises + return _insertBefore(this, newChild, refChild); + }, + replaceChild: function (newChild, oldChild) { + //raises + this.insertBefore(newChild, oldChild); + if (oldChild) { + this.removeChild(oldChild); + } + }, + removeChild: function (oldChild) { + return _removeChild(this, oldChild); + }, + appendChild: function (newChild) { + return this.insertBefore(newChild, null); + }, + hasChildNodes: function () { + return this.firstChild != null; + }, + cloneNode: function (deep) { + return cloneNode(this.ownerDocument || this, this, deep); + }, + // Modified in DOM Level 2: + normalize: function () { + var child = this.firstChild; + while (child) { + var next = child.nextSibling; + if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) { + this.removeChild(next); + child.appendData(next.data); + } else { + child.normalize(); + child = next; + } + } + }, + // Introduced in DOM Level 2: + isSupported: function (feature, version) { + return this.ownerDocument.implementation.hasFeature(feature, version); + }, + // Introduced in DOM Level 2: + hasAttributes: function () { + return this.attributes.length > 0; + }, + lookupPrefix: function (namespaceURI) { + var el = this; + while (el) { + var map = el._nsMap; + //console.dir(map) + if (map) { + for (var n in map) { + if (map[n] == namespaceURI) { + return n; + } + } + } + el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + lookupNamespaceURI: function (prefix) { + var el = this; + while (el) { + var map = el._nsMap; + //console.dir(map) + if (map) { + if (prefix in map) { + return map[prefix]; + } + } + el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + isDefaultNamespace: function (namespaceURI) { + var prefix = this.lookupPrefix(namespaceURI); + return prefix == null; + } +}; +function _xmlEncoder(c) { + return c == '<' && '<' || c == '>' && '>' || c == '&' && '&' || c == '"' && '"' || '&#' + c.charCodeAt() + ';'; +} +copy(NodeType, Node); +copy(NodeType, Node.prototype); + +/** + * @param callback return true for continue,false for break + * @return boolean true: break visit; + */ +function _visitNode(node, callback) { + if (callback(node)) { + return true; + } + if (node = node.firstChild) { + do { + if (_visitNode(node, callback)) { + return true; + } + } while (node = node.nextSibling); + } +} +function Document() {} +function _onAddAttribute(doc, el, newAttr) { + doc && doc._inc++; + var ns = newAttr.namespaceURI; + if (ns == 'http://www.w3.org/2000/xmlns/') { + //update namespace + el._nsMap[newAttr.prefix ? newAttr.localName : ''] = newAttr.value; + } +} +function _onRemoveAttribute(doc, el, newAttr, remove) { + doc && doc._inc++; + var ns = newAttr.namespaceURI; + if (ns == 'http://www.w3.org/2000/xmlns/') { + //update namespace + delete el._nsMap[newAttr.prefix ? newAttr.localName : '']; + } +} +function _onUpdateChild(doc, el, newChild) { + if (doc && doc._inc) { + doc._inc++; + //update childNodes + var cs = el.childNodes; + if (newChild) { + cs[cs.length++] = newChild; + } else { + //console.log(1) + var child = el.firstChild; + var i = 0; + while (child) { + cs[i++] = child; + child = child.nextSibling; + } + cs.length = i; + } + } +} + +/** + * attributes; + * children; + * + * writeable properties: + * nodeValue,Attr:value,CharacterData:data + * prefix + */ +function _removeChild(parentNode, child) { + var previous = child.previousSibling; + var next = child.nextSibling; + if (previous) { + previous.nextSibling = next; + } else { + parentNode.firstChild = next; + } + if (next) { + next.previousSibling = previous; + } else { + parentNode.lastChild = previous; + } + _onUpdateChild(parentNode.ownerDocument, parentNode); + return child; +} +/** + * preformance key(refChild == null) + */ +function _insertBefore(parentNode, newChild, nextChild) { + var cp = newChild.parentNode; + if (cp) { + cp.removeChild(newChild); //remove and update + } + + if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { + var newFirst = newChild.firstChild; + if (newFirst == null) { + return newChild; + } + var newLast = newChild.lastChild; + } else { + newFirst = newLast = newChild; + } + var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild; + newFirst.previousSibling = pre; + newLast.nextSibling = nextChild; + if (pre) { + pre.nextSibling = newFirst; + } else { + parentNode.firstChild = newFirst; + } + if (nextChild == null) { + parentNode.lastChild = newLast; + } else { + nextChild.previousSibling = newLast; + } + do { + newFirst.parentNode = parentNode; + } while (newFirst !== newLast && (newFirst = newFirst.nextSibling)); + _onUpdateChild(parentNode.ownerDocument || parentNode, parentNode); + //console.log(parentNode.lastChild.nextSibling == null) + if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { + newChild.firstChild = newChild.lastChild = null; + } + return newChild; +} +function _appendSingleChild(parentNode, newChild) { + var cp = newChild.parentNode; + if (cp) { + var pre = parentNode.lastChild; + cp.removeChild(newChild); //remove and update + var pre = parentNode.lastChild; + } + var pre = parentNode.lastChild; + newChild.parentNode = parentNode; + newChild.previousSibling = pre; + newChild.nextSibling = null; + if (pre) { + pre.nextSibling = newChild; + } else { + parentNode.firstChild = newChild; + } + parentNode.lastChild = newChild; + _onUpdateChild(parentNode.ownerDocument, parentNode, newChild); + return newChild; + //console.log("__aa",parentNode.lastChild.nextSibling == null) +} + +Document.prototype = { + //implementation : null, + nodeName: '#document', + nodeType: DOCUMENT_NODE, + doctype: null, + documentElement: null, + _inc: 1, + insertBefore: function (newChild, refChild) { + //raises + if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { + var child = newChild.firstChild; + while (child) { + var next = child.nextSibling; + this.insertBefore(child, refChild); + child = next; + } + return newChild; + } + if (this.documentElement == null && newChild.nodeType == ELEMENT_NODE) { + this.documentElement = newChild; + } + return _insertBefore(this, newChild, refChild), newChild.ownerDocument = this, newChild; + }, + removeChild: function (oldChild) { + if (this.documentElement == oldChild) { + this.documentElement = null; + } + return _removeChild(this, oldChild); + }, + // Introduced in DOM Level 2: + importNode: function (importedNode, deep) { + return importNode(this, importedNode, deep); + }, + // Introduced in DOM Level 2: + getElementById: function (id) { + var rtv = null; + _visitNode(this.documentElement, function (node) { + if (node.nodeType == ELEMENT_NODE) { + if (node.getAttribute('id') == id) { + rtv = node; + return true; + } + } + }); + return rtv; + }, + //document factory method: + createElement: function (tagName) { + var node = new Element(); + node.ownerDocument = this; + node.nodeName = tagName; + node.tagName = tagName; + node.childNodes = new NodeList(); + var attrs = node.attributes = new NamedNodeMap(); + attrs._ownerElement = node; + return node; + }, + createDocumentFragment: function () { + var node = new DocumentFragment(); + node.ownerDocument = this; + node.childNodes = new NodeList(); + return node; + }, + createTextNode: function (data) { + var node = new Text(); + node.ownerDocument = this; + node.appendData(data); + return node; + }, + createComment: function (data) { + var node = new Comment(); + node.ownerDocument = this; + node.appendData(data); + return node; + }, + createCDATASection: function (data) { + var node = new CDATASection(); + node.ownerDocument = this; + node.appendData(data); + return node; + }, + createProcessingInstruction: function (target, data) { + var node = new ProcessingInstruction(); + node.ownerDocument = this; + node.tagName = node.target = target; + node.nodeValue = node.data = data; + return node; + }, + createAttribute: function (name) { + var node = new Attr(); + node.ownerDocument = this; + node.name = name; + node.nodeName = name; + node.localName = name; + node.specified = true; + return node; + }, + createEntityReference: function (name) { + var node = new EntityReference(); + node.ownerDocument = this; + node.nodeName = name; + return node; + }, + // Introduced in DOM Level 2: + createElementNS: function (namespaceURI, qualifiedName) { + var node = new Element(); + var pl = qualifiedName.split(':'); + var attrs = node.attributes = new NamedNodeMap(); + node.childNodes = new NodeList(); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.tagName = qualifiedName; + node.namespaceURI = namespaceURI; + if (pl.length == 2) { + node.prefix = pl[0]; + node.localName = pl[1]; + } else { + //el.prefix = null; + node.localName = qualifiedName; + } + attrs._ownerElement = node; + return node; + }, + // Introduced in DOM Level 2: + createAttributeNS: function (namespaceURI, qualifiedName) { + var node = new Attr(); + var pl = qualifiedName.split(':'); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.name = qualifiedName; + node.namespaceURI = namespaceURI; + node.specified = true; + if (pl.length == 2) { + node.prefix = pl[0]; + node.localName = pl[1]; + } else { + //el.prefix = null; + node.localName = qualifiedName; + } + return node; + } +}; +_extends(Document, Node); +function Element() { + this._nsMap = {}; +} +; +Element.prototype = { + nodeType: ELEMENT_NODE, + hasAttribute: function (name) { + return this.getAttributeNode(name) != null; + }, + getAttribute: function (name) { + var attr = this.getAttributeNode(name); + return attr && attr.value || ''; + }, + getAttributeNode: function (name) { + return this.attributes.getNamedItem(name); + }, + setAttribute: function (name, value) { + var attr = this.ownerDocument.createAttribute(name); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr); + }, + removeAttribute: function (name) { + var attr = this.getAttributeNode(name); + attr && this.removeAttributeNode(attr); + }, + //four real opeartion method + appendChild: function (newChild) { + if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { + return this.insertBefore(newChild, null); + } else { + return _appendSingleChild(this, newChild); + } + }, + setAttributeNode: function (newAttr) { + return this.attributes.setNamedItem(newAttr); + }, + setAttributeNodeNS: function (newAttr) { + return this.attributes.setNamedItemNS(newAttr); + }, + removeAttributeNode: function (oldAttr) { + //console.log(this == oldAttr.ownerElement) + return this.attributes.removeNamedItem(oldAttr.nodeName); + }, + //get real attribute name,and remove it by removeAttributeNode + removeAttributeNS: function (namespaceURI, localName) { + var old = this.getAttributeNodeNS(namespaceURI, localName); + old && this.removeAttributeNode(old); + }, + hasAttributeNS: function (namespaceURI, localName) { + return this.getAttributeNodeNS(namespaceURI, localName) != null; + }, + getAttributeNS: function (namespaceURI, localName) { + var attr = this.getAttributeNodeNS(namespaceURI, localName); + return attr && attr.value || ''; + }, + setAttributeNS: function (namespaceURI, qualifiedName, value) { + var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr); + }, + getAttributeNodeNS: function (namespaceURI, localName) { + return this.attributes.getNamedItemNS(namespaceURI, localName); + }, + getElementsByTagName: function (tagName) { + return new LiveNodeList(this, function (base) { + var ls = []; + _visitNode(base, function (node) { + if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)) { + ls.push(node); + } + }); + return ls; + }); + }, + getElementsByTagNameNS: function (namespaceURI, localName) { + return new LiveNodeList(this, function (base) { + var ls = []; + _visitNode(base, function (node) { + if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)) { + ls.push(node); + } + }); + return ls; + }); + } +}; +Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; +Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; +_extends(Element, Node); +function Attr() {} +; +Attr.prototype.nodeType = ATTRIBUTE_NODE; +_extends(Attr, Node); +function CharacterData() {} +; +CharacterData.prototype = { + data: '', + substringData: function (offset, count) { + return this.data.substring(offset, offset + count); + }, + appendData: function (text) { + text = this.data + text; + this.nodeValue = this.data = text; + this.length = text.length; + }, + insertData: function (offset, text) { + this.replaceData(offset, 0, text); + }, + appendChild: function (newChild) { + throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]); + }, + deleteData: function (offset, count) { + this.replaceData(offset, count, ""); + }, + replaceData: function (offset, count, text) { + var start = this.data.substring(0, offset); + var end = this.data.substring(offset + count); + text = start + text + end; + this.nodeValue = this.data = text; + this.length = text.length; + } +}; +_extends(CharacterData, Node); +function Text() {} +; +Text.prototype = { + nodeName: "#text", + nodeType: TEXT_NODE, + splitText: function (offset) { + var text = this.data; + var newText = text.substring(offset); + text = text.substring(0, offset); + this.data = this.nodeValue = text; + this.length = text.length; + var newNode = this.ownerDocument.createTextNode(newText); + if (this.parentNode) { + this.parentNode.insertBefore(newNode, this.nextSibling); + } + return newNode; + } +}; +_extends(Text, CharacterData); +function Comment() {} +; +Comment.prototype = { + nodeName: "#comment", + nodeType: COMMENT_NODE +}; +_extends(Comment, CharacterData); +function CDATASection() {} +; +CDATASection.prototype = { + nodeName: "#cdata-section", + nodeType: CDATA_SECTION_NODE +}; +_extends(CDATASection, CharacterData); +function DocumentType() {} +; +DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; +_extends(DocumentType, Node); +function Notation() {} +; +Notation.prototype.nodeType = NOTATION_NODE; +_extends(Notation, Node); +function Entity() {} +; +Entity.prototype.nodeType = ENTITY_NODE; +_extends(Entity, Node); +function EntityReference() {} +; +EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; +_extends(EntityReference, Node); +function DocumentFragment() {} +; +DocumentFragment.prototype.nodeName = "#document-fragment"; +DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; +_extends(DocumentFragment, Node); +function ProcessingInstruction() {} +ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; +_extends(ProcessingInstruction, Node); +function XMLSerializer() {} +XMLSerializer.prototype.serializeToString = function (node, isHtml, nodeFilter) { + return nodeSerializeToString.call(node, isHtml, nodeFilter); +}; +Node.prototype.toString = nodeSerializeToString; +function nodeSerializeToString(isHtml, nodeFilter) { + var buf = []; + var refNode = this.nodeType == 9 && this.documentElement || this; + var prefix = refNode.prefix; + var uri = refNode.namespaceURI; + if (uri && prefix == null) { + //console.log(prefix) + var prefix = refNode.lookupPrefix(uri); + if (prefix == null) { + //isHTML = true; + var visibleNamespaces = [{ + namespace: uri, + prefix: null + } + //{namespace:uri,prefix:''} + ]; + } + } + + serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces); + //console.log('###',this.nodeType,uri,prefix,buf.join('')) + return buf.join(''); +} +function needNamespaceDefine(node, isHTML, visibleNamespaces) { + var prefix = node.prefix || ''; + var uri = node.namespaceURI; + if (!prefix && !uri) { + return false; + } + if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace" || uri == 'http://www.w3.org/2000/xmlns/') { + return false; + } + var i = visibleNamespaces.length; + //console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces) + while (i--) { + var ns = visibleNamespaces[i]; + // get namespace prefix + //console.log(node.nodeType,node.tagName,ns.prefix,prefix) + if (ns.prefix == prefix) { + return ns.namespace != uri; + } + } + //console.log(isHTML,uri,prefix=='') + //if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){ + // return false; + //} + //node.flag = '11111' + //console.error(3,true,node.flag,node.prefix,node.namespaceURI) + return true; +} +function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) { + if (nodeFilter) { + node = nodeFilter(node); + if (node) { + if (typeof node == 'string') { + buf.push(node); + return; + } + } else { + return; + } + //buf.sort.apply(attrs, attributeSorter); + } + + switch (node.nodeType) { + case ELEMENT_NODE: + if (!visibleNamespaces) visibleNamespaces = []; + var startVisibleNamespaces = visibleNamespaces.length; + var attrs = node.attributes; + var len = attrs.length; + var child = node.firstChild; + var nodeName = node.tagName; + isHTML = htmlns === node.namespaceURI || isHTML; + buf.push('<', nodeName); + for (var i = 0; i < len; i++) { + // add namespaces for attributes + var attr = attrs.item(i); + if (attr.prefix == 'xmlns') { + visibleNamespaces.push({ + prefix: attr.localName, + namespace: attr.value + }); + } else if (attr.nodeName == 'xmlns') { + visibleNamespaces.push({ + prefix: '', + namespace: attr.value + }); + } + } + for (var i = 0; i < len; i++) { + var attr = attrs.item(i); + if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) { + var prefix = attr.prefix || ''; + var uri = attr.namespaceURI; + var ns = prefix ? ' xmlns:' + prefix : " xmlns"; + buf.push(ns, '="', uri, '"'); + visibleNamespaces.push({ + prefix: prefix, + namespace: uri + }); + } + serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces); + } + // add namespace for current node + if (needNamespaceDefine(node, isHTML, visibleNamespaces)) { + var prefix = node.prefix || ''; + var uri = node.namespaceURI; + var ns = prefix ? ' xmlns:' + prefix : " xmlns"; + buf.push(ns, '="', uri, '"'); + visibleNamespaces.push({ + prefix: prefix, + namespace: uri + }); + } + if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) { + buf.push('>'); + //if is cdata child node + if (isHTML && /^script$/i.test(nodeName)) { + while (child) { + if (child.data) { + buf.push(child.data); + } else { + serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces); + } + child = child.nextSibling; + } + } else { + while (child) { + serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces); + child = child.nextSibling; + } + } + buf.push(''); + } else { + buf.push('/>'); + } + // remove added visible namespaces + //visibleNamespaces.length = startVisibleNamespaces; + return; + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + var child = node.firstChild; + while (child) { + serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces); + child = child.nextSibling; + } + return; + case ATTRIBUTE_NODE: + return buf.push(' ', node.name, '="', node.value.replace(/[<&"]/g, _xmlEncoder), '"'); + case TEXT_NODE: + return buf.push(node.data.replace(/[<&]/g, _xmlEncoder)); + case CDATA_SECTION_NODE: + return buf.push(''); + case COMMENT_NODE: + return buf.push(""); + case DOCUMENT_TYPE_NODE: + var pubid = node.publicId; + var sysid = node.systemId; + buf.push(''); + } else if (sysid && sysid != '.') { + buf.push(' SYSTEM "', sysid, '">'); + } else { + var sub = node.internalSubset; + if (sub) { + buf.push(" [", sub, "]"); + } + buf.push(">"); + } + return; + case PROCESSING_INSTRUCTION_NODE: + return buf.push(""); + case ENTITY_REFERENCE_NODE: + return buf.push('&', node.nodeName, ';'); + //case ENTITY_NODE: + //case NOTATION_NODE: + default: + buf.push('??', node.nodeName); + } +} +function importNode(doc, node, deep) { + var node2; + switch (node.nodeType) { + case ELEMENT_NODE: + node2 = node.cloneNode(false); + node2.ownerDocument = doc; + //var attrs = node2.attributes; + //var len = attrs.length; + //for(var i=0;i', + amp: '&', + quot: '"', + apos: "'", + Agrave: "À", + Aacute: "Á", + Acirc: "Â", + Atilde: "Ã", + Auml: "Ä", + Aring: "Å", + AElig: "Æ", + Ccedil: "Ç", + Egrave: "È", + Eacute: "É", + Ecirc: "Ê", + Euml: "Ë", + Igrave: "Ì", + Iacute: "Í", + Icirc: "Î", + Iuml: "Ï", + ETH: "Ð", + Ntilde: "Ñ", + Ograve: "Ò", + Oacute: "Ó", + Ocirc: "Ô", + Otilde: "Õ", + Ouml: "Ö", + Oslash: "Ø", + Ugrave: "Ù", + Uacute: "Ú", + Ucirc: "Û", + Uuml: "Ü", + Yacute: "Ý", + THORN: "Þ", + szlig: "ß", + agrave: "à", + aacute: "á", + acirc: "â", + atilde: "ã", + auml: "ä", + aring: "å", + aelig: "æ", + ccedil: "ç", + egrave: "è", + eacute: "é", + ecirc: "ê", + euml: "ë", + igrave: "ì", + iacute: "í", + icirc: "î", + iuml: "ï", + eth: "ð", + ntilde: "ñ", + ograve: "ò", + oacute: "ó", + ocirc: "ô", + otilde: "õ", + ouml: "ö", + oslash: "ø", + ugrave: "ù", + uacute: "ú", + ucirc: "û", + uuml: "ü", + yacute: "ý", + thorn: "þ", + yuml: "ÿ", + nbsp: " ", + iexcl: "¡", + cent: "¢", + pound: "£", + curren: "¤", + yen: "¥", + brvbar: "¦", + sect: "§", + uml: "¨", + copy: "©", + ordf: "ª", + laquo: "«", + not: "¬", + shy: "­­", + reg: "®", + macr: "¯", + deg: "°", + plusmn: "±", + sup2: "²", + sup3: "³", + acute: "´", + micro: "µ", + para: "¶", + middot: "·", + cedil: "¸", + sup1: "¹", + ordm: "º", + raquo: "»", + frac14: "¼", + frac12: "½", + frac34: "¾", + iquest: "¿", + times: "×", + divide: "÷", + forall: "∀", + part: "∂", + exist: "∃", + empty: "∅", + nabla: "∇", + isin: "∈", + notin: "∉", + ni: "∋", + prod: "∏", + sum: "∑", + minus: "−", + lowast: "∗", + radic: "√", + prop: "∝", + infin: "∞", + ang: "∠", + and: "∧", + or: "∨", + cap: "∩", + cup: "∪", + 'int': "∫", + there4: "∴", + sim: "∼", + cong: "≅", + asymp: "≈", + ne: "≠", + equiv: "≡", + le: "≤", + ge: "≥", + sub: "⊂", + sup: "⊃", + nsub: "⊄", + sube: "⊆", + supe: "⊇", + oplus: "⊕", + otimes: "⊗", + perp: "⊥", + sdot: "⋅", + Alpha: "Α", + Beta: "Β", + Gamma: "Γ", + Delta: "Δ", + Epsilon: "Ε", + Zeta: "Ζ", + Eta: "Η", + Theta: "Θ", + Iota: "Ι", + Kappa: "Κ", + Lambda: "Λ", + Mu: "Μ", + Nu: "Ν", + Xi: "Ξ", + Omicron: "Ο", + Pi: "Π", + Rho: "Ρ", + Sigma: "Σ", + Tau: "Τ", + Upsilon: "Υ", + Phi: "Φ", + Chi: "Χ", + Psi: "Ψ", + Omega: "Ω", + alpha: "α", + beta: "β", + gamma: "γ", + delta: "δ", + epsilon: "ε", + zeta: "ζ", + eta: "η", + theta: "θ", + iota: "ι", + kappa: "κ", + lambda: "λ", + mu: "μ", + nu: "ν", + xi: "ξ", + omicron: "ο", + pi: "π", + rho: "ρ", + sigmaf: "ς", + sigma: "σ", + tau: "τ", + upsilon: "υ", + phi: "φ", + chi: "χ", + psi: "ψ", + omega: "ω", + thetasym: "ϑ", + upsih: "ϒ", + piv: "ϖ", + OElig: "Œ", + oelig: "œ", + Scaron: "Š", + scaron: "š", + Yuml: "Ÿ", + fnof: "ƒ", + circ: "ˆ", + tilde: "˜", + ensp: " ", + emsp: " ", + thinsp: " ", + zwnj: "‌", + zwj: "‍", + lrm: "‎", + rlm: "‏", + ndash: "–", + mdash: "—", + lsquo: "‘", + rsquo: "’", + sbquo: "‚", + ldquo: "“", + rdquo: "”", + bdquo: "„", + dagger: "†", + Dagger: "‡", + bull: "•", + hellip: "…", + permil: "‰", + prime: "′", + Prime: "″", + lsaquo: "‹", + rsaquo: "›", + oline: "‾", + euro: "€", + trade: "™", + larr: "←", + uarr: "↑", + rarr: "→", + darr: "↓", + harr: "↔", + crarr: "↵", + lceil: "⌈", + rceil: "⌉", + lfloor: "⌊", + rfloor: "⌋", + loz: "◊", + spades: "♠", + clubs: "♣", + hearts: "♥", + diams: "♦" +}; +//for(var n in exports.entityMap){console.log(exports.entityMap[n].charCodeAt())} + +},{}],43:[function(require,module,exports){ +"use strict"; + +//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] +//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +//[5] Name ::= NameStartChar (NameChar)* +var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; //\u10000-\uEFFFF +var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); +var tagNamePattern = new RegExp('^' + nameStartChar.source + nameChar.source + '*(?:\:' + nameStartChar.source + nameChar.source + '*)?$'); +//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ +//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') + +//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE +//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE +var S_TAG = 0; //tag name offerring +var S_ATTR = 1; //attr name offerring +var S_ATTR_SPACE = 2; //attr name end and space offer +var S_EQ = 3; //=space? +var S_ATTR_NOQUOT_VALUE = 4; //attr value(no quot value only) +var S_ATTR_END = 5; //attr value end and no space(quot end) +var S_TAG_SPACE = 6; //(attr value end || tag end ) && (space offer) +var S_TAG_CLOSE = 7; //closed el + +function XMLReader() {} +XMLReader.prototype = { + parse: function (source, defaultNSMap, entityMap) { + var domBuilder = this.domBuilder; + domBuilder.startDocument(); + _copy(defaultNSMap, defaultNSMap = {}); + parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler); + domBuilder.endDocument(); + } +}; +function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) { + function fixedFromCharCode(code) { + // String.prototype.fromCharCode does not supports + // > 2 bytes unicode chars directly + if (code > 0xffff) { + code -= 0x10000; + var surrogate1 = 0xd800 + (code >> 10), + surrogate2 = 0xdc00 + (code & 0x3ff); + return String.fromCharCode(surrogate1, surrogate2); + } else { + return String.fromCharCode(code); + } + } + function entityReplacer(a) { + var k = a.slice(1, -1); + if (k in entityMap) { + return entityMap[k]; + } else if (k.charAt(0) === '#') { + return fixedFromCharCode(parseInt(k.substr(1).replace('x', '0x'))); + } else { + errorHandler.error('entity not found:' + a); + return a; + } + } + function appendText(end) { + //has some bugs + if (end > start) { + var xt = source.substring(start, end).replace(/&#?\w+;/g, entityReplacer); + locator && position(start); + domBuilder.characters(xt, 0, end - start); + start = end; + } + } + function position(p, m) { + while (p >= lineEnd && (m = linePattern.exec(source))) { + lineStart = m.index; + lineEnd = lineStart + m[0].length; + locator.lineNumber++; + //console.log('line++:',locator,startPos,endPos) + } + + locator.columnNumber = p - lineStart + 1; + } + var lineStart = 0; + var lineEnd = 0; + var linePattern = /.*(?:\r\n?|\n)|.*$/g; + var locator = domBuilder.locator; + var parseStack = [{ + currentNSMap: defaultNSMapCopy + }]; + var closeMap = {}; + var start = 0; + while (true) { + try { + var tagStart = source.indexOf('<', start); + if (tagStart < 0) { + if (!source.substr(start).match(/^\s*$/)) { + var doc = domBuilder.doc; + var text = doc.createTextNode(source.substr(start)); + doc.appendChild(text); + domBuilder.currentElement = text; + } + return; + } + if (tagStart > start) { + appendText(tagStart); + } + switch (source.charAt(tagStart + 1)) { + case '/': + var end = source.indexOf('>', tagStart + 3); + var tagName = source.substring(tagStart + 2, end); + var config = parseStack.pop(); + if (end < 0) { + tagName = source.substring(tagStart + 2).replace(/[\s<].*/, ''); + //console.error('#@@@@@@'+tagName) + errorHandler.error("end tag name: " + tagName + ' is not complete:' + config.tagName); + end = tagStart + 1 + tagName.length; + } else if (tagName.match(/\s + locator && position(tagStart); + end = parseInstruction(source, tagStart, domBuilder); + break; + case '!': + // start) { + start = end; + } else { + //REFINE: 这里有可能sax回退,有位置错误风险 + appendText(Math.max(tagStart, start) + 1); + } + } +} +function copyLocator(f, t) { + t.lineNumber = f.lineNumber; + t.columnNumber = f.columnNumber; + return t; +} + +/** + * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); + * @return end of the elementStartPart(end of elementEndPart for selfClosed el) + */ +function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) { + var attrName; + var value; + var p = ++start; + var s = S_TAG; //status + while (true) { + var c = source.charAt(p); + switch (c) { + case '=': + if (s === S_ATTR) { + //attrName + attrName = source.slice(start, p); + s = S_EQ; + } else if (s === S_ATTR_SPACE) { + s = S_EQ; + } else { + //fatalError: equal must after attrName or space after attrName + throw new Error('attribute equal must after attrName'); + } + break; + case '\'': + case '"': + if (s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE + ) { + //equal + if (s === S_ATTR) { + errorHandler.warning('attribute value must after "="'); + attrName = source.slice(start, p); + } + start = p + 1; + p = source.indexOf(c, start); + if (p > 0) { + value = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer); + el.add(attrName, value, start - 1); + s = S_ATTR_END; + } else { + //fatalError: no end quot match + throw new Error('attribute value no end \'' + c + '\' match'); + } + } else if (s == S_ATTR_NOQUOT_VALUE) { + value = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer); + //console.log(attrName,value,start,p) + el.add(attrName, value, start); + //console.dir(el) + errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ')!!'); + start = p + 1; + s = S_ATTR_END; + } else { + //fatalError: no equal before + throw new Error('attribute value must after "="'); + } + break; + case '/': + switch (s) { + case S_TAG: + el.setTagName(source.slice(start, p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + s = S_TAG_CLOSE; + el.closed = true; + case S_ATTR_NOQUOT_VALUE: + case S_ATTR: + case S_ATTR_SPACE: + break; + //case S_EQ: + default: + throw new Error("attribute invalid close char('/')"); + } + break; + case '': + //end document + //throw new Error('unexpected end of input') + errorHandler.error('unexpected end of input'); + if (s == S_TAG) { + el.setTagName(source.slice(start, p)); + } + return p; + case '>': + switch (s) { + case S_TAG: + el.setTagName(source.slice(start, p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + break; + //normal + case S_ATTR_NOQUOT_VALUE: //Compatible state + case S_ATTR: + value = source.slice(start, p); + if (value.slice(-1) === '/') { + el.closed = true; + value = value.slice(0, -1); + } + case S_ATTR_SPACE: + if (s === S_ATTR_SPACE) { + value = attrName; + } + if (s == S_ATTR_NOQUOT_VALUE) { + errorHandler.warning('attribute "' + value + '" missed quot(")!!'); + el.add(attrName, value.replace(/&#?\w+;/g, entityReplacer), start); + } else { + if (currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)) { + errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!'); + } + el.add(value, value, start); + } + break; + case S_EQ: + throw new Error('attribute value missed!!'); + } + // console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) + return p; + /*xml space '\x20' | #x9 | #xD | #xA; */ + case '\u0080': + c = ' '; + default: + if (c <= ' ') { + //space + switch (s) { + case S_TAG: + el.setTagName(source.slice(start, p)); //tagName + s = S_TAG_SPACE; + break; + case S_ATTR: + attrName = source.slice(start, p); + s = S_ATTR_SPACE; + break; + case S_ATTR_NOQUOT_VALUE: + var value = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer); + errorHandler.warning('attribute "' + value + '" missed quot(")!!'); + el.add(attrName, value, start); + case S_ATTR_END: + s = S_TAG_SPACE; + break; + //case S_TAG_SPACE: + //case S_EQ: + //case S_ATTR_SPACE: + // void();break; + //case S_TAG_CLOSE: + //ignore warning + } + } else { + //not space + //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE + //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE + switch (s) { + //case S_TAG:void();break; + //case S_ATTR:void();break; + //case S_ATTR_NOQUOT_VALUE:void();break; + case S_ATTR_SPACE: + var tagName = el.tagName; + if (currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)) { + errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!'); + } + el.add(attrName, attrName, start); + start = p; + s = S_ATTR; + break; + case S_ATTR_END: + errorHandler.warning('attribute space is required"' + attrName + '"!!'); + case S_TAG_SPACE: + s = S_ATTR; + start = p; + break; + case S_EQ: + s = S_ATTR_NOQUOT_VALUE; + start = p; + break; + case S_TAG_CLOSE: + throw new Error("elements closed character '/' and '>' must be connected to"); + } + } + } //end outer switch + //console.log('p++',p) + p++; + } +} +/** + * @return true if has new namespace define + */ +function appendElement(el, domBuilder, currentNSMap) { + var tagName = el.tagName; + var localNSMap = null; + //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; + var i = el.length; + while (i--) { + var a = el[i]; + var qName = a.qName; + var value = a.value; + var nsp = qName.indexOf(':'); + if (nsp > 0) { + var prefix = a.prefix = qName.slice(0, nsp); + var localName = qName.slice(nsp + 1); + var nsPrefix = prefix === 'xmlns' && localName; + } else { + localName = qName; + prefix = null; + nsPrefix = qName === 'xmlns' && ''; + } + //can not set prefix,because prefix !== '' + a.localName = localName; + //prefix == null for no ns prefix attribute + if (nsPrefix !== false) { + //hack!! + if (localNSMap == null) { + localNSMap = {}; + //console.log(currentNSMap,0) + _copy(currentNSMap, currentNSMap = {}); + //console.log(currentNSMap,1) + } + + currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; + a.uri = 'http://www.w3.org/2000/xmlns/'; + domBuilder.startPrefixMapping(nsPrefix, value); + } + } + var i = el.length; + while (i--) { + a = el[i]; + var prefix = a.prefix; + if (prefix) { + //no prefix attribute has no namespace + if (prefix === 'xml') { + a.uri = 'http://www.w3.org/XML/1998/namespace'; + } + if (prefix !== 'xmlns') { + a.uri = currentNSMap[prefix || '']; + + //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} + } + } + } + + var nsp = tagName.indexOf(':'); + if (nsp > 0) { + prefix = el.prefix = tagName.slice(0, nsp); + localName = el.localName = tagName.slice(nsp + 1); + } else { + prefix = null; //important!! + localName = el.localName = tagName; + } + //no prefix element has default namespace + var ns = el.uri = currentNSMap[prefix || '']; + domBuilder.startElement(ns, localName, tagName, el); + //endPrefixMapping and startPrefixMapping have not any help for dom builder + //localNSMap = null + if (el.closed) { + domBuilder.endElement(ns, localName, tagName); + if (localNSMap) { + for (prefix in localNSMap) { + domBuilder.endPrefixMapping(prefix); + } + } + } else { + el.currentNSMap = currentNSMap; + el.localNSMap = localNSMap; + //parseStack.push(el); + return true; + } +} +function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) { + if (/^(?:script|textarea)$/i.test(tagName)) { + var elEndStart = source.indexOf('', elStartEnd); + var text = source.substring(elStartEnd + 1, elEndStart); + if (/[&<]/.test(text)) { + if (/^script$/i.test(tagName)) { + //if(!/\]\]>/.test(text)){ + //lexHandler.startCDATA(); + domBuilder.characters(text, 0, text.length); + //lexHandler.endCDATA(); + return elEndStart; + //} + } //}else{//text area + text = text.replace(/&#?\w+;/g, entityReplacer); + domBuilder.characters(text, 0, text.length); + return elEndStart; + //} + } + } + + return elStartEnd + 1; +} +function fixSelfClosed(source, elStartEnd, tagName, closeMap) { + //if(tagName in closeMap){ + var pos = closeMap[tagName]; + if (pos == null) { + //console.log(tagName) + pos = source.lastIndexOf(''); + if (pos < elStartEnd) { + //忘记闭合 + pos = source.lastIndexOf('', start + 4); + //append comment source.substring(4,end)//