debug.json 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. [
  2. 1,
  3. 0,
  4. 0,
  5. [
  6. [
  7. "cc.EffectAsset",
  8. [
  9. "_name",
  10. "shaders",
  11. "techniques"
  12. ],
  13. 0
  14. ]
  15. ],
  16. [
  17. [
  18. 0,
  19. 0,
  20. 1,
  21. 2,
  22. 4
  23. ]
  24. ],
  25. [
  26. [
  27. 0,
  28. "pipeline/planar-shadow",
  29. [
  30. {
  31. "hash": 3680218420,
  32. "name": "pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag",
  33. "blocks": [],
  34. "samplerTextures": [],
  35. "samplers": [],
  36. "textures": [],
  37. "buffers": [],
  38. "images": [],
  39. "subpassInputs": [],
  40. "attributes": [
  41. {
  42. "name": "a_position",
  43. "format": 32,
  44. "location": 0,
  45. "defines": []
  46. },
  47. {
  48. "name": "a_normal",
  49. "format": 32,
  50. "location": 1,
  51. "defines": []
  52. },
  53. {
  54. "name": "a_texCoord",
  55. "format": 21,
  56. "location": 2,
  57. "defines": []
  58. },
  59. {
  60. "name": "a_tangent",
  61. "format": 44,
  62. "location": 3,
  63. "defines": []
  64. },
  65. {
  66. "name": "a_joints",
  67. "location": 4,
  68. "defines": [
  69. "CC_USE_SKINNING"
  70. ]
  71. },
  72. {
  73. "name": "a_weights",
  74. "format": 44,
  75. "location": 5,
  76. "defines": [
  77. "CC_USE_SKINNING"
  78. ]
  79. },
  80. {
  81. "name": "a_jointAnimInfo",
  82. "format": 44,
  83. "isInstanced": true,
  84. "location": 6,
  85. "defines": [
  86. "USE_INSTANCING",
  87. "CC_USE_BAKED_ANIMATION"
  88. ]
  89. },
  90. {
  91. "name": "a_matWorld0",
  92. "format": 44,
  93. "isInstanced": true,
  94. "location": 7,
  95. "defines": [
  96. "USE_INSTANCING"
  97. ]
  98. },
  99. {
  100. "name": "a_matWorld1",
  101. "format": 44,
  102. "isInstanced": true,
  103. "location": 8,
  104. "defines": [
  105. "USE_INSTANCING"
  106. ]
  107. },
  108. {
  109. "name": "a_matWorld2",
  110. "format": 44,
  111. "isInstanced": true,
  112. "location": 9,
  113. "defines": [
  114. "USE_INSTANCING"
  115. ]
  116. },
  117. {
  118. "name": "a_lightingMapUVParam",
  119. "format": 44,
  120. "isInstanced": true,
  121. "location": 10,
  122. "defines": [
  123. "USE_INSTANCING",
  124. "CC_USE_LIGHTMAP"
  125. ]
  126. },
  127. {
  128. "name": "a_localShadowBiasAndProbeId",
  129. "format": 44,
  130. "isInstanced": true,
  131. "location": 11,
  132. "defines": [
  133. "USE_INSTANCING"
  134. ]
  135. },
  136. {
  137. "name": "a_reflectionProbeData",
  138. "format": 44,
  139. "isInstanced": true,
  140. "location": 12,
  141. "defines": [
  142. "USE_INSTANCING",
  143. "CC_USE_REFLECTION_PROBE"
  144. ]
  145. },
  146. {
  147. "name": "a_sh_linear_const_r",
  148. "format": 44,
  149. "isInstanced": true,
  150. "location": 13,
  151. "defines": [
  152. "USE_INSTANCING",
  153. "CC_USE_LIGHT_PROBE"
  154. ]
  155. },
  156. {
  157. "name": "a_sh_linear_const_g",
  158. "format": 44,
  159. "isInstanced": true,
  160. "location": 14,
  161. "defines": [
  162. "USE_INSTANCING",
  163. "CC_USE_LIGHT_PROBE"
  164. ]
  165. },
  166. {
  167. "name": "a_sh_linear_const_b",
  168. "format": 44,
  169. "isInstanced": true,
  170. "location": 15,
  171. "defines": [
  172. "USE_INSTANCING",
  173. "CC_USE_LIGHT_PROBE"
  174. ]
  175. },
  176. {
  177. "name": "a_vertexId",
  178. "format": 11,
  179. "location": 16,
  180. "defines": [
  181. "CC_USE_MORPH"
  182. ]
  183. }
  184. ],
  185. "fragColors": [
  186. {
  187. "name": "cc_FragColor",
  188. "typename": "vec4",
  189. "type": 16,
  190. "count": 1,
  191. "stageFlags": 16,
  192. "location": 0,
  193. "defines": []
  194. }
  195. ],
  196. "descriptors": [
  197. {
  198. "rate": 0,
  199. "blocks": [
  200. {
  201. "name": "CCMorph",
  202. "stageFlags": 1,
  203. "tags": {
  204. "builtin": "local"
  205. },
  206. "members": [
  207. {
  208. "name": "cc_displacementWeights",
  209. "typename": "vec4",
  210. "type": 16,
  211. "count": 15,
  212. "isArray": true
  213. },
  214. {
  215. "name": "cc_displacementTextureInfo",
  216. "typename": "vec4",
  217. "type": 16,
  218. "count": 1
  219. }
  220. ],
  221. "defines": [
  222. "CC_USE_MORPH"
  223. ]
  224. },
  225. {
  226. "name": "CCSkinningTexture",
  227. "stageFlags": 1,
  228. "tags": {
  229. "builtin": "local"
  230. },
  231. "members": [
  232. {
  233. "name": "cc_jointTextureInfo",
  234. "typename": "vec4",
  235. "type": 16,
  236. "count": 1,
  237. "precision": "highp "
  238. }
  239. ],
  240. "defines": [
  241. "CC_USE_SKINNING",
  242. "CC_USE_BAKED_ANIMATION"
  243. ]
  244. },
  245. {
  246. "name": "CCSkinningAnimation",
  247. "stageFlags": 1,
  248. "tags": {
  249. "builtin": "local"
  250. },
  251. "members": [
  252. {
  253. "name": "cc_jointAnimInfo",
  254. "typename": "vec4",
  255. "type": 16,
  256. "count": 1,
  257. "precision": "highp "
  258. }
  259. ],
  260. "defines": [
  261. "CC_USE_SKINNING",
  262. "CC_USE_BAKED_ANIMATION"
  263. ]
  264. },
  265. {
  266. "name": "CCSkinning",
  267. "stageFlags": 1,
  268. "tags": {
  269. "builtin": "local"
  270. },
  271. "members": [
  272. {
  273. "name": "cc_joints",
  274. "typename": "vec4",
  275. "type": 16,
  276. "count": 0,
  277. "precision": "highp ",
  278. "isArray": true
  279. }
  280. ],
  281. "defines": [
  282. "CC_USE_SKINNING",
  283. "!CC_USE_BAKED_ANIMATION",
  284. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  285. ]
  286. },
  287. {
  288. "name": "CCLocal",
  289. "stageFlags": 1,
  290. "tags": {
  291. "builtin": "local"
  292. },
  293. "members": [
  294. {
  295. "name": "cc_matWorld",
  296. "typename": "mat4",
  297. "type": 25,
  298. "count": 1,
  299. "precision": "highp "
  300. },
  301. {
  302. "name": "cc_matWorldIT",
  303. "typename": "mat4",
  304. "type": 25,
  305. "count": 1,
  306. "precision": "highp "
  307. },
  308. {
  309. "name": "cc_lightingMapUVParam",
  310. "typename": "vec4",
  311. "type": 16,
  312. "count": 1,
  313. "precision": "highp "
  314. },
  315. {
  316. "name": "cc_localShadowBias",
  317. "typename": "vec4",
  318. "type": 16,
  319. "count": 1,
  320. "precision": "highp "
  321. },
  322. {
  323. "name": "cc_reflectionProbeData1",
  324. "typename": "vec4",
  325. "type": 16,
  326. "count": 1,
  327. "precision": "highp "
  328. },
  329. {
  330. "name": "cc_reflectionProbeData2",
  331. "typename": "vec4",
  332. "type": 16,
  333. "count": 1,
  334. "precision": "highp "
  335. },
  336. {
  337. "name": "cc_reflectionProbeBlendData1",
  338. "typename": "vec4",
  339. "type": 16,
  340. "count": 1,
  341. "precision": "highp "
  342. },
  343. {
  344. "name": "cc_reflectionProbeBlendData2",
  345. "typename": "vec4",
  346. "type": 16,
  347. "count": 1,
  348. "precision": "highp "
  349. }
  350. ],
  351. "defines": [
  352. "!USE_INSTANCING"
  353. ]
  354. }
  355. ],
  356. "samplerTextures": [
  357. {
  358. "name": "cc_PositionDisplacements",
  359. "typename": "sampler2D",
  360. "type": 28,
  361. "count": 1,
  362. "stageFlags": 1,
  363. "tags": {
  364. "builtin": "local"
  365. },
  366. "defines": [
  367. "CC_USE_MORPH",
  368. "CC_MORPH_TARGET_HAS_POSITION"
  369. ]
  370. },
  371. {
  372. "name": "cc_NormalDisplacements",
  373. "typename": "sampler2D",
  374. "type": 28,
  375. "count": 1,
  376. "stageFlags": 1,
  377. "tags": {
  378. "builtin": "local"
  379. },
  380. "defines": [
  381. "CC_USE_MORPH",
  382. "CC_MORPH_TARGET_HAS_NORMAL"
  383. ]
  384. },
  385. {
  386. "name": "cc_TangentDisplacements",
  387. "typename": "sampler2D",
  388. "type": 28,
  389. "count": 1,
  390. "stageFlags": 1,
  391. "tags": {
  392. "builtin": "local"
  393. },
  394. "defines": [
  395. "CC_USE_MORPH",
  396. "CC_MORPH_TARGET_HAS_TANGENT"
  397. ]
  398. },
  399. {
  400. "name": "cc_jointTexture",
  401. "typename": "sampler2D",
  402. "type": 28,
  403. "count": 1,
  404. "precision": "highp ",
  405. "stageFlags": 1,
  406. "tags": {
  407. "builtin": "local"
  408. },
  409. "defines": [
  410. "CC_USE_SKINNING",
  411. "CC_USE_BAKED_ANIMATION"
  412. ]
  413. },
  414. {
  415. "name": "cc_realtimeJoint",
  416. "typename": "sampler2D",
  417. "type": 28,
  418. "count": 1,
  419. "precision": "highp ",
  420. "stageFlags": 1,
  421. "tags": {
  422. "builtin": "local"
  423. },
  424. "defines": [
  425. "CC_USE_SKINNING",
  426. "!CC_USE_BAKED_ANIMATION",
  427. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  428. ]
  429. }
  430. ],
  431. "samplers": [],
  432. "textures": [],
  433. "buffers": [],
  434. "images": [],
  435. "subpassInputs": []
  436. },
  437. {
  438. "rate": 1,
  439. "blocks": [],
  440. "samplerTextures": [],
  441. "samplers": [],
  442. "textures": [],
  443. "buffers": [],
  444. "images": [],
  445. "subpassInputs": []
  446. },
  447. {
  448. "rate": 2,
  449. "blocks": [],
  450. "samplerTextures": [],
  451. "samplers": [],
  452. "textures": [],
  453. "buffers": [],
  454. "images": [],
  455. "subpassInputs": []
  456. },
  457. {
  458. "rate": 3,
  459. "blocks": [
  460. {
  461. "name": "CCGlobal",
  462. "stageFlags": 17,
  463. "tags": {
  464. "builtin": "global"
  465. },
  466. "members": [
  467. {
  468. "name": "cc_time",
  469. "typename": "vec4",
  470. "type": 16,
  471. "count": 1,
  472. "precision": "highp "
  473. },
  474. {
  475. "name": "cc_screenSize",
  476. "typename": "vec4",
  477. "type": 16,
  478. "count": 1,
  479. "precision": "mediump "
  480. },
  481. {
  482. "name": "cc_nativeSize",
  483. "typename": "vec4",
  484. "type": 16,
  485. "count": 1,
  486. "precision": "mediump "
  487. },
  488. {
  489. "name": "cc_probeInfo",
  490. "typename": "vec4",
  491. "type": 16,
  492. "count": 1,
  493. "precision": "mediump "
  494. },
  495. {
  496. "name": "cc_debug_view_mode",
  497. "typename": "vec4",
  498. "type": 16,
  499. "count": 1,
  500. "precision": "mediump "
  501. }
  502. ],
  503. "defines": []
  504. },
  505. {
  506. "name": "CCCamera",
  507. "stageFlags": 17,
  508. "tags": {
  509. "builtin": "global"
  510. },
  511. "members": [
  512. {
  513. "name": "cc_matView",
  514. "typename": "mat4",
  515. "type": 25,
  516. "count": 1,
  517. "precision": "highp "
  518. },
  519. {
  520. "name": "cc_matViewInv",
  521. "typename": "mat4",
  522. "type": 25,
  523. "count": 1,
  524. "precision": "highp "
  525. },
  526. {
  527. "name": "cc_matProj",
  528. "typename": "mat4",
  529. "type": 25,
  530. "count": 1,
  531. "precision": "highp "
  532. },
  533. {
  534. "name": "cc_matProjInv",
  535. "typename": "mat4",
  536. "type": 25,
  537. "count": 1,
  538. "precision": "highp "
  539. },
  540. {
  541. "name": "cc_matViewProj",
  542. "typename": "mat4",
  543. "type": 25,
  544. "count": 1,
  545. "precision": "highp "
  546. },
  547. {
  548. "name": "cc_matViewProjInv",
  549. "typename": "mat4",
  550. "type": 25,
  551. "count": 1,
  552. "precision": "highp "
  553. },
  554. {
  555. "name": "cc_cameraPos",
  556. "typename": "vec4",
  557. "type": 16,
  558. "count": 1,
  559. "precision": "highp "
  560. },
  561. {
  562. "name": "cc_surfaceTransform",
  563. "typename": "vec4",
  564. "type": 16,
  565. "count": 1,
  566. "precision": "mediump "
  567. },
  568. {
  569. "name": "cc_screenScale",
  570. "typename": "vec4",
  571. "type": 16,
  572. "count": 1,
  573. "precision": "mediump "
  574. },
  575. {
  576. "name": "cc_exposure",
  577. "typename": "vec4",
  578. "type": 16,
  579. "count": 1,
  580. "precision": "mediump "
  581. },
  582. {
  583. "name": "cc_mainLitDir",
  584. "typename": "vec4",
  585. "type": 16,
  586. "count": 1,
  587. "precision": "mediump "
  588. },
  589. {
  590. "name": "cc_mainLitColor",
  591. "typename": "vec4",
  592. "type": 16,
  593. "count": 1,
  594. "precision": "mediump "
  595. },
  596. {
  597. "name": "cc_ambientSky",
  598. "typename": "vec4",
  599. "type": 16,
  600. "count": 1,
  601. "precision": "mediump "
  602. },
  603. {
  604. "name": "cc_ambientGround",
  605. "typename": "vec4",
  606. "type": 16,
  607. "count": 1,
  608. "precision": "mediump "
  609. },
  610. {
  611. "name": "cc_fogColor",
  612. "typename": "vec4",
  613. "type": 16,
  614. "count": 1,
  615. "precision": "mediump "
  616. },
  617. {
  618. "name": "cc_fogBase",
  619. "typename": "vec4",
  620. "type": 16,
  621. "count": 1,
  622. "precision": "mediump "
  623. },
  624. {
  625. "name": "cc_fogAdd",
  626. "typename": "vec4",
  627. "type": 16,
  628. "count": 1,
  629. "precision": "mediump "
  630. },
  631. {
  632. "name": "cc_nearFar",
  633. "typename": "vec4",
  634. "type": 16,
  635. "count": 1,
  636. "precision": "mediump "
  637. },
  638. {
  639. "name": "cc_viewPort",
  640. "typename": "vec4",
  641. "type": 16,
  642. "count": 1,
  643. "precision": "mediump "
  644. }
  645. ],
  646. "defines": []
  647. },
  648. {
  649. "name": "CCShadow",
  650. "stageFlags": 17,
  651. "tags": {
  652. "builtin": "global"
  653. },
  654. "members": [
  655. {
  656. "name": "cc_matLightView",
  657. "typename": "mat4",
  658. "type": 25,
  659. "count": 1,
  660. "precision": "highp "
  661. },
  662. {
  663. "name": "cc_matLightViewProj",
  664. "typename": "mat4",
  665. "type": 25,
  666. "count": 1,
  667. "precision": "highp "
  668. },
  669. {
  670. "name": "cc_shadowInvProjDepthInfo",
  671. "typename": "vec4",
  672. "type": 16,
  673. "count": 1,
  674. "precision": "highp "
  675. },
  676. {
  677. "name": "cc_shadowProjDepthInfo",
  678. "typename": "vec4",
  679. "type": 16,
  680. "count": 1,
  681. "precision": "highp "
  682. },
  683. {
  684. "name": "cc_shadowProjInfo",
  685. "typename": "vec4",
  686. "type": 16,
  687. "count": 1,
  688. "precision": "highp "
  689. },
  690. {
  691. "name": "cc_shadowNFLSInfo",
  692. "typename": "vec4",
  693. "type": 16,
  694. "count": 1,
  695. "precision": "mediump "
  696. },
  697. {
  698. "name": "cc_shadowWHPBInfo",
  699. "typename": "vec4",
  700. "type": 16,
  701. "count": 1,
  702. "precision": "mediump "
  703. },
  704. {
  705. "name": "cc_shadowLPNNInfo",
  706. "typename": "vec4",
  707. "type": 16,
  708. "count": 1,
  709. "precision": "mediump "
  710. },
  711. {
  712. "name": "cc_shadowColor",
  713. "typename": "vec4",
  714. "type": 16,
  715. "count": 1,
  716. "precision": "lowp "
  717. },
  718. {
  719. "name": "cc_planarNDInfo",
  720. "typename": "vec4",
  721. "type": 16,
  722. "count": 1,
  723. "precision": "mediump "
  724. }
  725. ],
  726. "defines": []
  727. }
  728. ],
  729. "samplerTextures": [],
  730. "samplers": [],
  731. "textures": [],
  732. "buffers": [],
  733. "images": [],
  734. "subpassInputs": []
  735. }
  736. ],
  737. "glsl3": {
  738. "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)\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};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\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(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n 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(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n 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 uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) 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(std140) 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(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_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(std140) 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(std140) 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}\nout 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(); }",
  739. "frag": "\nprecision highp float;\nlayout(std140) 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(std140) 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(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_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}\nin 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(); }"
  740. },
  741. "glsl1": {
  742. "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)\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};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\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 uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n 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 elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n 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 uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n 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 uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\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 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #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 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(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(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(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}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_nearFar;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\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}\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\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}\nvarying 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(); }",
  743. "frag": "\nprecision highp float;\nuniform lowp vec4 cc_shadowColor;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nvoid main() { gl_FragColor = frag(); }"
  744. },
  745. "builtins": {
  746. "globals": {
  747. "blocks": [
  748. {
  749. "name": "CCGlobal",
  750. "defines": []
  751. },
  752. {
  753. "name": "CCCamera",
  754. "defines": []
  755. },
  756. {
  757. "name": "CCShadow",
  758. "defines": []
  759. }
  760. ],
  761. "samplerTextures": [],
  762. "buffers": [],
  763. "images": []
  764. },
  765. "locals": {
  766. "blocks": [
  767. {
  768. "name": "CCMorph",
  769. "defines": [
  770. "CC_USE_MORPH"
  771. ]
  772. },
  773. {
  774. "name": "CCSkinningTexture",
  775. "defines": [
  776. "CC_USE_SKINNING",
  777. "CC_USE_BAKED_ANIMATION"
  778. ]
  779. },
  780. {
  781. "name": "CCSkinningAnimation",
  782. "defines": [
  783. "CC_USE_SKINNING",
  784. "CC_USE_BAKED_ANIMATION"
  785. ]
  786. },
  787. {
  788. "name": "CCSkinning",
  789. "defines": [
  790. "CC_USE_SKINNING",
  791. "!CC_USE_BAKED_ANIMATION",
  792. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  793. ]
  794. },
  795. {
  796. "name": "CCLocal",
  797. "defines": [
  798. "!USE_INSTANCING"
  799. ]
  800. }
  801. ],
  802. "samplerTextures": [
  803. {
  804. "name": "cc_PositionDisplacements",
  805. "defines": [
  806. "CC_USE_MORPH",
  807. "CC_MORPH_TARGET_HAS_POSITION"
  808. ]
  809. },
  810. {
  811. "name": "cc_NormalDisplacements",
  812. "defines": [
  813. "CC_USE_MORPH",
  814. "CC_MORPH_TARGET_HAS_NORMAL"
  815. ]
  816. },
  817. {
  818. "name": "cc_TangentDisplacements",
  819. "defines": [
  820. "CC_USE_MORPH",
  821. "CC_MORPH_TARGET_HAS_TANGENT"
  822. ]
  823. },
  824. {
  825. "name": "cc_jointTexture",
  826. "defines": [
  827. "CC_USE_SKINNING",
  828. "CC_USE_BAKED_ANIMATION"
  829. ]
  830. },
  831. {
  832. "name": "cc_realtimeJoint",
  833. "defines": [
  834. "CC_USE_SKINNING",
  835. "!CC_USE_BAKED_ANIMATION",
  836. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  837. ]
  838. }
  839. ],
  840. "buffers": [],
  841. "images": []
  842. },
  843. "statistics": {
  844. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 90,
  845. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 58
  846. }
  847. },
  848. "defines": [
  849. {
  850. "name": "USE_INSTANCING",
  851. "type": "boolean"
  852. },
  853. {
  854. "name": "CC_USE_SKINNING",
  855. "type": "boolean"
  856. },
  857. {
  858. "name": "CC_USE_BAKED_ANIMATION",
  859. "type": "boolean"
  860. },
  861. {
  862. "name": "CC_USE_LIGHTMAP",
  863. "type": "boolean"
  864. },
  865. {
  866. "name": "CC_USE_REFLECTION_PROBE",
  867. "type": "boolean"
  868. },
  869. {
  870. "name": "CC_RECEIVE_SHADOW",
  871. "type": "boolean"
  872. },
  873. {
  874. "name": "CC_USE_LIGHT_PROBE",
  875. "type": "boolean"
  876. },
  877. {
  878. "name": "CC_USE_MORPH",
  879. "type": "boolean"
  880. },
  881. {
  882. "name": "CC_MORPH_TARGET_COUNT",
  883. "type": "number",
  884. "range": [
  885. 2,
  886. 8
  887. ]
  888. },
  889. {
  890. "name": "CC_MORPH_TARGET_HAS_POSITION",
  891. "type": "boolean"
  892. },
  893. {
  894. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  895. "type": "boolean"
  896. },
  897. {
  898. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  899. "type": "boolean"
  900. },
  901. {
  902. "name": "CC_MORPH_PRECOMPUTED",
  903. "type": "boolean"
  904. },
  905. {
  906. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  907. "type": "boolean"
  908. }
  909. ]
  910. }
  911. ],
  912. [
  913. {
  914. "passes": [
  915. {
  916. "phase": "planarShadow",
  917. "program": "pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag",
  918. "blendState": {
  919. "targets": [
  920. {
  921. "blend": true,
  922. "blendSrc": 2,
  923. "blendDst": 4,
  924. "blendDstAlpha": 4
  925. }
  926. ]
  927. },
  928. "depthStencilState": {
  929. "depthTest": true,
  930. "depthWrite": false,
  931. "stencilTestFront": true,
  932. "stencilFuncFront": 5,
  933. "stencilPassOpFront": 2,
  934. "stencilRefBack": 128,
  935. "stencilRefFront": 128,
  936. "stencilReadMaskBack": 128,
  937. "stencilReadMaskFront": 128,
  938. "stencilWriteMaskBack": 128,
  939. "stencilWriteMaskFront": 128
  940. }
  941. }
  942. ]
  943. }
  944. ]
  945. ]
  946. ],
  947. 0,
  948. 0,
  949. [],
  950. [],
  951. []
  952. ]