mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
arrange chunks (#11551)
* arrange chunks * update compiled shaders * code style
This commit is contained in:
@@ -320,11 +320,11 @@ export const effects = [
|
||||
{
|
||||
"name": "particle-gpu",
|
||||
"techniques": [
|
||||
{ "name": "add", "passes": [{ "rasterizerState": { "cullMode": 0 }, "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 1, "blendSrcAlpha": 2, "blendDstAlpha": 1 }] }, "program": "particle-gpu|particle-vs-gpu:gpvs_main|tinted-fs:add", "depthStencilState": { "depthTest": true, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "mainTiling_Offset": { "value": [1, 1, 0, 0], "type": 16 }, "tintColor": { "value": [0.5, 0.5, 0.5, 0.5], "type": 16 } } }] }
|
||||
{ "name": "add", "passes": [{ "rasterizerState": { "cullMode": 0 }, "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 1, "blendSrcAlpha": 2, "blendDstAlpha": 1 }] }, "program": "particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add", "depthStencilState": { "depthTest": true, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "mainTiling_Offset": { "value": [1, 1, 0, 0], "type": 16 }, "tintColor": { "value": [0.5, 0.5, 0.5, 0.5], "type": 16 } } }] }
|
||||
],
|
||||
"shaders": [
|
||||
{
|
||||
"name": "particle-gpu|particle-vs-gpu:gpvs_main|tinted-fs:add",
|
||||
"name": "particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add",
|
||||
"hash": 2375623434,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 69, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
@@ -416,11 +416,11 @@ export const effects = [
|
||||
{
|
||||
"name": "particle-trail",
|
||||
"techniques": [
|
||||
{ "name": "add", "passes": [{ "rasterizerState": { "cullMode": 0 }, "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 1, "blendSrcAlpha": 2, "blendDstAlpha": 1 }] }, "program": "particle-trail|particle-trail:vs_main|tinted-fs:add", "depthStencilState": { "depthTest": true, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "mainTiling_Offset": { "value": [1, 1, 0, 0], "type": 16 }, "frameTile_velLenScale": { "value": [1, 1, 0, 0], "type": 16 }, "tintColor": { "value": [0.5, 0.5, 0.5, 0.5], "type": 16 } } }] }
|
||||
{ "name": "add", "passes": [{ "rasterizerState": { "cullMode": 0 }, "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 1, "blendSrcAlpha": 2, "blendDstAlpha": 1 }] }, "program": "particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add", "depthStencilState": { "depthTest": true, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "mainTiling_Offset": { "value": [1, 1, 0, 0], "type": 16 }, "frameTile_velLenScale": { "value": [1, 1, 0, 0], "type": 16 }, "tintColor": { "value": [0.5, 0.5, 0.5, 0.5], "type": 16 } } }] }
|
||||
],
|
||||
"shaders": [
|
||||
{
|
||||
"name": "particle-trail|particle-trail:vs_main|tinted-fs:add",
|
||||
"name": "particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add",
|
||||
"hash": 1784594556,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 58, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
@@ -464,11 +464,11 @@ export const effects = [
|
||||
{
|
||||
"name": "particle",
|
||||
"techniques": [
|
||||
{ "name": "add", "passes": [{ "rasterizerState": { "cullMode": 0 }, "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 1, "blendSrcAlpha": 2, "blendDstAlpha": 1 }] }, "program": "particle|particle-vs-legacy:lpvs_main|tinted-fs:add", "depthStencilState": { "depthTest": true, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "mainTiling_Offset": { "value": [1, 1, 0, 0], "type": 16 }, "tintColor": { "value": [0.5, 0.5, 0.5, 0.5], "type": 16 } } }] }
|
||||
{ "name": "add", "passes": [{ "rasterizerState": { "cullMode": 0 }, "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 1, "blendSrcAlpha": 2, "blendDstAlpha": 1 }] }, "program": "particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add", "depthStencilState": { "depthTest": true, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "mainTiling_Offset": { "value": [1, 1, 0, 0], "type": 16 }, "tintColor": { "value": [0.5, 0.5, 0.5, 0.5], "type": 16 } } }] }
|
||||
],
|
||||
"shaders": [
|
||||
{
|
||||
"name": "particle|particle-vs-legacy:lpvs_main|tinted-fs:add",
|
||||
"name": "particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add",
|
||||
"hash": 2320189417,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 58, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
@@ -603,9 +603,9 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "standard|standard-vs|standard-fs",
|
||||
"hash": 2720331532,
|
||||
"hash": 439877263,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 286, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 138 },
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 286, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 128 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_environment", "defines": ["CC_USE_IBL"] }, { "name": "cc_diffuseMap", "defines": ["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"] }, { "name": "CCLocalBatched", "defines": ["!USE_INSTANCING", "USE_BATCHING"] }, { "name": "CCLocal", "defines": ["!USE_INSTANCING", "!USE_BATCHING"] }, { "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_lightingMap", "defines": ["CC_USE_LIGHTMAP", "!USE_BATCHING", "!CC_FORWARD_ADD"] }], "buffers": [], "images": [] }
|
||||
},
|
||||
@@ -618,10 +618,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_FOG", "type": "number", "range": [0, 4] },
|
||||
{ "name": "CC_USE_ACCURATE_FOG", "type": "boolean" },
|
||||
{ "name": "USE_VERTEX_COLOR", "type": "boolean" },
|
||||
@@ -697,10 +697,10 @@ export const effects = [
|
||||
},
|
||||
{
|
||||
"name": "standard|shadow-caster-vs:vert|shadow-caster-fs:frag",
|
||||
"hash": 3757997552,
|
||||
"hash": 2647187139,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 242, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 138 },
|
||||
"globals": { "blocks": [{ "name": "CCShadow", "defines": [] }, { "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }], "buffers": [], "images": [] },
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 242, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 128 },
|
||||
"globals": { "blocks": [{ "name": "CCShadow", "defines": [] }, { "name": "CCGlobal", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "CCCamera", "defines": ["CC_RECEIVE_SHADOW"] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "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"] }, { "name": "CCLocalBatched", "defines": ["!USE_INSTANCING", "USE_BATCHING"] }, { "name": "CCLocal", "defines": ["!USE_INSTANCING", "!USE_BATCHING"] }], "samplerTextures": [{ "name": "cc_PositionDisplacements", "defines": ["CC_USE_MORPH", "CC_MORPH_TARGET_HAS_POSITION"] }, { "name": "cc_NormalDisplacements", "defines": ["CC_USE_MORPH", "CC_MORPH_TARGET_HAS_NORMAL"] }, { "name": "cc_TangentDisplacements", "defines": ["CC_USE_MORPH", "CC_MORPH_TARGET_HAS_TANGENT"] }, { "name": "cc_jointTexture", "defines": ["CC_USE_SKINNING", "CC_USE_BAKED_ANIMATION"] }], "buffers": [], "images": [] }
|
||||
},
|
||||
"defines": [
|
||||
@@ -712,10 +712,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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": "HAS_SECOND_UV", "type": "boolean" },
|
||||
{ "name": "USE_ALBEDO_MAP", "type": "boolean" },
|
||||
{ "name": "ALBEDO_UV", "type": "string", "options": ["v_uv", "v_uv1"] },
|
||||
@@ -768,9 +768,9 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "terrain|terrain-vs|terrain-fs",
|
||||
"hash": 2645689133,
|
||||
"hash": 621622282,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 134, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 134 },
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 134, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 124 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_environment", "defines": ["CC_USE_IBL"] }, { "name": "cc_diffuseMap", "defines": ["CC_USE_DIFFUSEMAP"] }], "buffers": [], "images": [] },
|
||||
"locals": { "blocks": [{ "name": "CCLocal", "defines": [] }, { "name": "CCForwardLight", "defines": ["CC_FORWARD_ADD", "CC_ENABLE_CLUSTERED_LIGHT_CULLING"] }], "samplerTextures": [{ "name": "cc_lightingMap", "defines": ["CC_USE_LIGHTMAP", "!USE_BATCHING", "!CC_FORWARD_ADD"] }], "buffers": [], "images": [] }
|
||||
},
|
||||
@@ -861,7 +861,7 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "unlit|unlit-vs:vert|unlit-fs:frag",
|
||||
"hash": 1869067757,
|
||||
"hash": 2284109878,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 203, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 46 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -876,10 +876,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_FOG", "type": "number", "range": [0, 4] },
|
||||
{ "name": "CC_USE_ACCURATE_FOG", "type": "boolean" },
|
||||
{ "name": "USE_VERTEX_COLOR", "type": "boolean" },
|
||||
@@ -934,7 +934,7 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "bloom|bloom-vs|prefilter-fs",
|
||||
"hash": 2455296206,
|
||||
"hash": 1438305237,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 152, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -949,10 +949,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_TARGET_HAS_TANGENT", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" }
|
||||
],
|
||||
"attributes": [
|
||||
{ "name": "a_position", "defines": [], "format": 32, "location": 0 },
|
||||
@@ -986,7 +986,7 @@ export const effects = [
|
||||
},
|
||||
{
|
||||
"name": "bloom|bloom-vs|downsample-fs",
|
||||
"hash": 3888105055,
|
||||
"hash": 3008014650,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 152, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -1001,10 +1001,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_TARGET_HAS_TANGENT", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" }
|
||||
],
|
||||
"attributes": [
|
||||
{ "name": "a_position", "defines": [], "format": 32, "location": 0 },
|
||||
@@ -1038,7 +1038,7 @@ export const effects = [
|
||||
},
|
||||
{
|
||||
"name": "bloom|bloom-vs|upsample-fs",
|
||||
"hash": 2396027849,
|
||||
"hash": 2509006203,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 152, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -1053,10 +1053,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_TARGET_HAS_TANGENT", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" }
|
||||
],
|
||||
"attributes": [
|
||||
{ "name": "a_position", "defines": [], "format": 32, "location": 0 },
|
||||
@@ -1090,7 +1090,7 @@ export const effects = [
|
||||
},
|
||||
{
|
||||
"name": "bloom|bloom-vs|combine-fs",
|
||||
"hash": 1548829094,
|
||||
"hash": 3368363993,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 152, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 45 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -1105,10 +1105,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_TARGET_HAS_TANGENT", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" }
|
||||
],
|
||||
"attributes": [
|
||||
{ "name": "a_position", "defines": [], "format": 32, "location": 0 },
|
||||
@@ -1151,11 +1151,11 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "deferred-lighting|lighting-vs|lighting-fs",
|
||||
"hash": 2415973792,
|
||||
"hash": 411769608,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 44, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 132 },
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 44, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 122 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_environment", "defines": ["CC_USE_IBL"] }, { "name": "cc_diffuseMap", "defines": ["CC_USE_DIFFUSEMAP"] }], "buffers": [], "images": [] },
|
||||
"locals": { "blocks": [{ "name": "CCLocal", "defines": [] }, { "name": "CCForwardLight", "defines": ["CC_ENABLE_CLUSTERED_LIGHT_CULLING"] }], "samplerTextures": [], "buffers": [], "images": [] }
|
||||
"locals": { "blocks": [{ "name": "CCForwardLight", "defines": ["CC_ENABLE_CLUSTERED_LIGHT_CULLING"] }], "samplerTextures": [], "buffers": [], "images": [] }
|
||||
},
|
||||
"defines": [
|
||||
{ "name": "USE_INSTANCING", "type": "boolean" },
|
||||
@@ -1218,7 +1218,7 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag",
|
||||
"hash": 3041637814,
|
||||
"hash": 945434018,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 280, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 122 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -1233,10 +1233,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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_TARGET_HAS_TANGENT", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" }
|
||||
],
|
||||
"attributes": [
|
||||
{ "name": "a_position", "defines": [], "format": 32, "location": 0 },
|
||||
@@ -1272,7 +1272,7 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "post-process|post-process-vs|post-process-fs",
|
||||
"hash": 1183864017,
|
||||
"hash": 761897287,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 152, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 44 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [], "buffers": [], "images": [] },
|
||||
@@ -1287,10 +1287,10 @@ export const effects = [
|
||||
{ "name": "CC_RECEIVE_SHADOW", "type": "boolean" },
|
||||
{ "name": "CC_USE_MORPH", "type": "boolean" },
|
||||
{ "name": "CC_MORPH_TARGET_COUNT", "type": "number", "range": [2, 8] },
|
||||
{ "name": "CC_MORPH_PRECOMPUTED", "type": "boolean" },
|
||||
{ "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": "ANTIALIAS_TYPE", "type": "number", "range": [0, 3] }
|
||||
],
|
||||
"attributes": [
|
||||
@@ -1329,7 +1329,7 @@ export const effects = [
|
||||
"shaders": [
|
||||
{
|
||||
"name": "skybox|sky-vs:vert|sky-fs:frag",
|
||||
"hash": 1150135725,
|
||||
"hash": 992216169,
|
||||
"builtins": {
|
||||
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 44, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 44 },
|
||||
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [{ "name": "cc_environment", "defines": [] }], "buffers": [], "images": [] },
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
#include <cc-global>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <common/effect/fog>
|
||||
|
||||
#pragma define-meta CC_USE_FOG range([0, 4])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "02a04bf3-4c27-4596-81fd-dfc35224f1d1",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <common> // decode32
|
||||
#include <common/common-define> // decode32
|
||||
#include <builtin/uniforms/cc-morph>
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "3adaa06a-e674-487c-9d49-42bc398c255b",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// used for replacing cc-shadow-map-base.chunk
|
||||
#include <cc-shadow>
|
||||
#include <common>
|
||||
#include <builtin/uniforms/cc-shadow>
|
||||
#include <common/common-define>
|
||||
#include <common/math/coordinates>
|
||||
|
||||
float CCGetLinearDepth(vec3 worldPos) {
|
||||
@@ -9,10 +9,10 @@ float CCGetLinearDepth(vec3 worldPos) {
|
||||
}
|
||||
|
||||
#if CC_RECEIVE_SHADOW
|
||||
#include <cc-global>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <builtin/uniforms/cc-shadow-map>
|
||||
|
||||
#include <packing>
|
||||
#include <common/data/packing>
|
||||
#include <common/shadow/native-pcf>
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ float CCGetLinearDepth(vec3 worldPos) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////Directional Light Shadow
|
||||
float CCGetShadowFactorHard (vec4 shadowPosWithDepthBias) {
|
||||
float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {
|
||||
vec3 shadowNDCPos;
|
||||
if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {
|
||||
return 1.0;
|
||||
@@ -200,7 +200,7 @@ float CCGetLinearDepth(vec3 worldPos) {
|
||||
}else if (pcf > 0.9) {
|
||||
realtimeShadow = CCGetDirLightShadowFactorSoft(pos);
|
||||
}else {
|
||||
realtimeShadow = CCGetShadowFactorHard(pos);
|
||||
realtimeShadow = CCGetDirLightShadowFactorHard(pos);
|
||||
}
|
||||
return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ float CCGetLinearDepth(vec3 worldPos) {
|
||||
} else if (pcf > 0.9) {
|
||||
realtimeShadow = CCGetDirLightShadowFactorSoft(pos);
|
||||
}else {
|
||||
realtimeShadow = CCGetShadowFactorHard(pos);
|
||||
realtimeShadow = CCGetDirLightShadowFactorHard(pos);
|
||||
}
|
||||
return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "d4c26490-0a2d-4b6a-9a52-55b5741f18a4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#include <builtin/uniforms/cc-skinning-uniforms>
|
||||
#include <builtin/uniforms/cc-skinning>
|
||||
|
||||
#if CC_USE_BAKED_ANIMATION
|
||||
#if CC_DEVICE_SUPPORT_FLOAT_TEXTURE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "80908463-4566-4fdf-9744-775605cd7ab7",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#include <builtin/uniforms/cc-skinning-uniforms>
|
||||
#include <builtin/uniforms/cc-skinning>
|
||||
|
||||
#if CC_USE_BAKED_ANIMATION
|
||||
#if CC_DEVICE_SUPPORT_FLOAT_TEXTURE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "258a17ce-6c50-4e8a-92aa-8ecec1a6af24",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "c2885f54-4ff2-4284-8bbc-b77bc71965b4",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "16ce72cc-31ca-4b20-86d3-28d643645218",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "2c3da5b6-0202-470a-a915-59f1e2968853",
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
vec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {
|
||||
#if CC_USE_EMBEDDED_ALPHA
|
||||
return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);
|
||||
#else
|
||||
return texture(tex, uv);
|
||||
#endif
|
||||
}
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
vec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {
|
||||
#if CC_USE_EMBEDDED_ALPHA
|
||||
return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);
|
||||
#else
|
||||
return texture(tex, uv);
|
||||
#endif
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "ef4fb7de-9b39-4eeb-9ae8-d292ff94a452",
|
||||
+3
-3
@@ -12,9 +12,9 @@ uniform Constants {
|
||||
vec4 nodeRotation;
|
||||
};
|
||||
|
||||
#include <cc-global>
|
||||
#include <cc-local>
|
||||
#include <transform>
|
||||
#include <builtin/uniforms/cc-global>
|
||||
#include <builtin/uniforms/cc-local>
|
||||
#include <common/math/transform>
|
||||
|
||||
out mediump vec2 uv;
|
||||
out mediump vec4 color;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "7a49db3a-930e-4ffc-8659-a82141dabebb",
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
precision mediump float;
|
||||
#include <particle-common>
|
||||
#include <builtin/internal/particle-common>
|
||||
in vec3 a_position; // center position
|
||||
in vec4 a_texCoord; // x:index y:size zw:texcoord
|
||||
in vec3 a_texCoord1; // xyz:velocity
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "df7d02d8-559a-4c02-9aac-3732cfc83d7a",
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
|
||||
precision mediump float;
|
||||
#include <transform>
|
||||
#include <particle-common>
|
||||
#include <cc-local>
|
||||
#include <common/math/transform>
|
||||
#include <builtin/internal/particle-common>
|
||||
#include <builtin/uniforms/cc-local>
|
||||
|
||||
#pragma define CURVE_MODE_FIX 1
|
||||
#pragma define CURVE_MODE_BLEND 2
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "b4b00c01-eca8-4ae4-a04d-e00bbeb6d0e0",
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
|
||||
precision highp float;
|
||||
#include <transform>
|
||||
#include <particle-common>
|
||||
#include <cc-local>
|
||||
#include <common/math/transform>
|
||||
#include <builtin/internal/particle-common>
|
||||
#include <builtin/uniforms/cc-local>
|
||||
|
||||
in vec3 a_texCoord1; // size
|
||||
in vec3 a_texCoord2; // rotation
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "6e1b48cb-69c8-448c-8055-69ab9793fbab",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "35822e78-bb35-405f-87bd-d42af6ac9ede",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "4b48672e-e044-4035-9029-13afb50c1aee",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "17e8e047-4c5e-412c-85c8-a76a98742f2a",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "cd94308c-6959-4671-9dcb-6c58342273e2",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "5e0f5e6e-5008-497f-b223-4e5f1801d8fd",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "1ea907a3-a36e-432a-ae38-af712c77aaad",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "fa1c0cd1-03c6-45dd-8294-bf7a1e21aad4",
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
highp mat4 cc_matWorlds[BATCHING_COUNT];
|
||||
};
|
||||
#else
|
||||
#include <cc-local>
|
||||
#include <builtin/uniforms/cc-local>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "21b24bc9-a158-488e-b27c-b98a461fb438",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "e835c2d5-a377-4197-bdb8-382037573494",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "94d19070-32c6-4900-a288-2258fda37f29",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "e8411010-e411-43ab-8f2e-4f4865dca4cf",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "69f8ecd8-cdc9-4655-a6ec-d39dacdffc2f",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "99488fd6-220b-4d13-9a41-8b9439cd3944",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "669458fe-c428-40cd-8575-51607aa8edbc",
|
||||
@@ -1,96 +0,0 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#include <cc-global>
|
||||
|
||||
#pragma define-meta CC_USE_FOG range([0, 4])
|
||||
#pragma define CC_FOG_LINEAR 0
|
||||
#pragma define CC_FOG_EXP 1
|
||||
#pragma define CC_FOG_EXP_SQUARED 2
|
||||
#pragma define CC_FOG_LAYERED 3
|
||||
|
||||
float LinearFog(vec4 pos) {
|
||||
vec4 wPos = pos;
|
||||
float cam_dis = distance(cc_cameraPos, wPos);
|
||||
float fogStart = cc_fogBase.x;
|
||||
float fogEnd = cc_fogBase.y;
|
||||
return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);
|
||||
}
|
||||
|
||||
float ExpFog(vec4 pos) {
|
||||
vec4 wPos = pos;
|
||||
float fogAtten = cc_fogAdd.z;
|
||||
float fogStart = cc_fogBase.x;
|
||||
float fogDensity = cc_fogBase.z;
|
||||
float cam_dis = max(distance(cc_cameraPos, wPos) - fogStart, 0.0) / fogAtten * 4.;
|
||||
float f = exp(-cam_dis * fogDensity);
|
||||
return f;
|
||||
}
|
||||
|
||||
float ExpSquaredFog(vec4 pos) {
|
||||
vec4 wPos = pos;
|
||||
float fogAtten = cc_fogAdd.z;
|
||||
float fogStart = cc_fogBase.x;
|
||||
float fogDensity = cc_fogBase.z;
|
||||
float cam_dis = max(distance(cc_cameraPos, wPos) - fogStart, 0.0) / fogAtten * 4.;
|
||||
float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);
|
||||
return f;
|
||||
}
|
||||
|
||||
float LayeredFog(vec4 pos) {
|
||||
vec4 wPos = pos;
|
||||
float fogAtten = cc_fogAdd.z;
|
||||
float _FogTop = cc_fogAdd.x;
|
||||
float _FogRange = cc_fogAdd.y;
|
||||
vec3 camWorldProj = cc_cameraPos.xyz;
|
||||
camWorldProj.y = 0.;
|
||||
vec3 worldPosProj = wPos.xyz;
|
||||
worldPosProj.y = 0.;
|
||||
float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;
|
||||
float fDeltaY, fDensityIntegral;
|
||||
if (cc_cameraPos.y > _FogTop) {
|
||||
if (wPos.y < _FogTop) {
|
||||
fDeltaY = (_FogTop - wPos.y) / _FogRange * 2.0;
|
||||
fDensityIntegral = fDeltaY * fDeltaY * 0.5;
|
||||
} else {
|
||||
fDeltaY = 0.;
|
||||
fDensityIntegral = 0.;
|
||||
}
|
||||
} else {
|
||||
if (wPos.y < _FogTop) {
|
||||
float fDeltaA = (_FogTop - cc_cameraPos.y) / _FogRange * 2.;
|
||||
float fDeltaB = (_FogTop - wPos.y) / _FogRange * 2.;
|
||||
fDeltaY = abs(fDeltaA - fDeltaB);
|
||||
fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));
|
||||
} else {
|
||||
fDeltaY = abs(_FogTop - cc_cameraPos.y) / _FogRange * 2.;
|
||||
fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);
|
||||
}
|
||||
}
|
||||
float fDensity;
|
||||
if (fDeltaY != 0.) {
|
||||
fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;
|
||||
} else {
|
||||
fDensity = 0.;
|
||||
}
|
||||
float f = exp(-fDensity);
|
||||
return f;
|
||||
}
|
||||
|
||||
void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)
|
||||
{
|
||||
#if CC_USE_FOG == CC_FOG_LINEAR
|
||||
factor = LinearFog(pos);
|
||||
#elif CC_USE_FOG == CC_FOG_EXP
|
||||
factor = ExpFog(pos);
|
||||
#elif CC_USE_FOG == CC_FOG_EXP_SQUARED
|
||||
factor = ExpSquaredFog(pos);
|
||||
#elif CC_USE_FOG == CC_FOG_LAYERED
|
||||
factor = LayeredFog(pos);
|
||||
#else
|
||||
factor = 1.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CC_APPLY_FOG_BASE(inout vec4 color, float factor) {
|
||||
color = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#if !USE_INSTANCING
|
||||
#if USE_BATCHING
|
||||
#pragma define BATCHING_COUNT 10
|
||||
#pragma builtin(local)
|
||||
layout(set = 2, binding = 0) uniform CCLocalBatched {
|
||||
highp mat4 cc_matWorlds[BATCHING_COUNT];
|
||||
};
|
||||
#else
|
||||
#include <cc-local>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void CCGetWorldMatrix(out mat4 matWorld)
|
||||
{
|
||||
#if USE_INSTANCING
|
||||
matWorld = mat4(
|
||||
vec4(a_matWorld0.xyz, 0.0),
|
||||
vec4(a_matWorld1.xyz, 0.0),
|
||||
vec4(a_matWorld2.xyz, 0.0),
|
||||
vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)
|
||||
);
|
||||
#elif USE_BATCHING
|
||||
matWorld = cc_matWorlds[int(a_dyn_batch_id)];
|
||||
#else
|
||||
matWorld = cc_matWorld;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)
|
||||
{
|
||||
#if USE_INSTANCING
|
||||
matWorld = mat4(
|
||||
vec4(a_matWorld0.xyz, 0.0),
|
||||
vec4(a_matWorld1.xyz, 0.0),
|
||||
vec4(a_matWorld2.xyz, 0.0),
|
||||
vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)
|
||||
);
|
||||
matWorldIT = matWorld;
|
||||
#elif USE_BATCHING
|
||||
matWorld = cc_matWorlds[int(a_dyn_batch_id)];
|
||||
matWorldIT = matWorld;
|
||||
#else
|
||||
matWorld = cc_matWorld;
|
||||
matWorldIT = cc_matWorldIT;
|
||||
#endif
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "21fbcb1c-648e-4700-b854-2a267fe50933",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -1,660 +0,0 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#include <common>
|
||||
#include <cc-global>
|
||||
#include <cc-shadow>
|
||||
#include <packing>
|
||||
#include <cc-local>
|
||||
|
||||
// When screenSpaceSingY and clipSpaceSignY have different signs, need to flip the uv
|
||||
#pragma define CC_HANDLE_NDC_SAMPLE_FLIP(uv) uv = cc_cameraPos.w == 1.0 ? vec2(uv.x, 1.0 - uv.y) : uv
|
||||
|
||||
#pragma define SHADOWMAP_FORMAT_RGBA8 1
|
||||
#pragma define SHADOWMAP_FORMAT_FLOAT 0
|
||||
|
||||
float CCGetLinearDepthFromViewSpace(vec3 viewPos) {
|
||||
float dist = length(viewPos);
|
||||
return (dist - cc_shadowNFLSInfo.x) / (cc_shadowNFLSInfo.y - cc_shadowNFLSInfo.x);
|
||||
}
|
||||
|
||||
float CCGetLinearDepth(vec3 worldPos) {
|
||||
vec4 viewStartPos = cc_matLightView * vec4(worldPos.xyz, 1.0);
|
||||
return CCGetLinearDepthFromViewSpace(viewStartPos.xyz);
|
||||
}
|
||||
|
||||
#if CC_RECEIVE_SHADOW
|
||||
int CCGetCSMLevel(out vec4 csmPos, out vec2 shadowProjDepthInfo, out vec2 shadowProjInfo, out mat4 matLightView, vec3 worldPos) {
|
||||
for (int i = 0; i < NUMCASCADES; i++) {
|
||||
vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);
|
||||
vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;
|
||||
if (clipPos.x < (0.0 + cc_csmInfo.y) || clipPos.x > (1.0 - cc_csmInfo.y) ||
|
||||
clipPos.y < (0.0 + cc_csmInfo.y) || clipPos.y > (1.0 - cc_csmInfo.y) ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) {
|
||||
continue;
|
||||
}
|
||||
csmPos = cc_matCSMViewProjAtlas[i] * vec4(worldPos.xyz, 1.0);
|
||||
shadowProjDepthInfo = cc_csmProjDepthInfo[i].xy;
|
||||
shadowProjInfo = cc_csmProjInfo[i].xy;
|
||||
matLightView = cc_matCSMView[i];
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#pragma builtin(global)
|
||||
layout(set = 0, binding = 3) uniform highp sampler2D cc_shadowMap;
|
||||
|
||||
#pragma builtin(global)
|
||||
layout(set = 0, binding = 5) uniform highp sampler2D cc_spotLightingMap;
|
||||
|
||||
vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 shadowProjInfo)
|
||||
{
|
||||
vec4 newShadowPos = shadowPos;
|
||||
if(normalBias > EPSILON_LOWP)
|
||||
{
|
||||
vec4 viewNormal = matLightView * vec4(worldNormal, 0.0);
|
||||
if(viewNormal.z < 0.1)
|
||||
newShadowPos.xy += viewNormal.xy * shadowProjInfo.xy * normalBias * clamp(viewNormal.z, 0.001, 0.1);
|
||||
}
|
||||
return newShadowPos;
|
||||
}
|
||||
|
||||
vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)
|
||||
{
|
||||
// Recover the coord in view space: cc_matLightInvProj * shadowPos
|
||||
vec3 viewSpacePos;
|
||||
viewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;
|
||||
viewSpacePos.z = shadowPos.z * cc_shadowInvProjDepthInfo.x + shadowPos.w * cc_shadowInvProjDepthInfo.y;
|
||||
|
||||
// Apply bias
|
||||
viewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;
|
||||
|
||||
// Reconstuct clipspace: cc_matLightProj * viewSpacePos
|
||||
vec4 clipSpacePos;
|
||||
clipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;
|
||||
clipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);
|
||||
|
||||
// enabled linear depth?
|
||||
if (cc_shadowNFLSInfo.z > EPSILON) {
|
||||
clipSpacePos.z = CCGetLinearDepthFromViewSpace(viewSpacePos.xyz);
|
||||
clipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;
|
||||
}
|
||||
|
||||
return clipSpacePos;
|
||||
}
|
||||
|
||||
vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, vec2 shadowProjDepthInfo)
|
||||
{
|
||||
float coeffA = shadowProjDepthInfo.x;
|
||||
float coeffB = shadowProjDepthInfo.y;
|
||||
|
||||
// Recover the Z distance in view space:
|
||||
float viewSpacePos_z = (shadowPos.z - coeffB) / coeffA;
|
||||
|
||||
// Apply bias
|
||||
viewSpacePos_z += viewspaceDepthBias;
|
||||
|
||||
// Reconstuct clipspace
|
||||
vec4 result = shadowPos;
|
||||
result.z = viewSpacePos_z * coeffA + coeffB;
|
||||
return result;
|
||||
}
|
||||
|
||||
float CCGetShadowFactorHard (vec4 shadowPos, float bias) {
|
||||
vec4 clipPosNew = shadowPos;
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float shadow = 0.0;
|
||||
float closestDepth = 0.0;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
closestDepth = unpackRGBAToDepth(texture(cc_shadowMap, clipPos.xy));
|
||||
#else
|
||||
closestDepth = texture(cc_shadowMap, clipPos.xy).x;
|
||||
#endif
|
||||
shadow = step(clipPos.z, closestDepth);
|
||||
|
||||
return shadow;
|
||||
}
|
||||
|
||||
float CCGetShadowFactorSoft (vec4 shadowPos, float bias) {
|
||||
vec4 clipPosNew = shadowPos;
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float offsetDepth = clipPos.z;
|
||||
vec2 mapSize = cc_shadowWHPBInfo.xy;
|
||||
vec2 oneTap = 1.0 / mapSize;
|
||||
vec2 clipPos_offset = clipPos.xy + oneTap;
|
||||
|
||||
float block0, block1, block2, block3;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
block0 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos.x, clipPos.y))));
|
||||
block1 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset.x, clipPos.y))));
|
||||
block2 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos.x, clipPos_offset.y))));
|
||||
block3 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset.x, clipPos_offset.y))));
|
||||
#else
|
||||
block0 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos.x, clipPos.y)).x);
|
||||
block1 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset.x, clipPos.y)).x);
|
||||
block2 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos.x, clipPos_offset.y)).x);
|
||||
block3 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset.x, clipPos_offset.y)).x);
|
||||
#endif
|
||||
|
||||
float coefX = mod(clipPos.x, oneTap.x) * mapSize.x;
|
||||
float resultX = mix(block0, block1, coefX);
|
||||
float resultY = mix(block2, block3, coefX);
|
||||
float coefY = mod(clipPos.y, oneTap.y) * mapSize.y;
|
||||
|
||||
return mix(resultX, resultY, coefY);
|
||||
}
|
||||
|
||||
float CCGetShadowFactorSoft2X (vec4 shadowPos, float bias) {
|
||||
vec4 clipPosNew = shadowPos;
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float offsetDepth = clipPos.z;
|
||||
vec2 mapSize = cc_shadowWHPBInfo.xy;
|
||||
vec2 oneTap = 1.0 / mapSize;
|
||||
float clipPos_offset_L = clipPos.x - oneTap.x;
|
||||
float clipPos_offset_R = clipPos.x + oneTap.x;
|
||||
float clipPos_offset_U = clipPos.y - oneTap.y;
|
||||
float clipPos_offset_D = clipPos.y + oneTap.y;
|
||||
|
||||
float block0, block1, block2, block3, block4, block5, block6, block7, block8;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
block0 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset_L, clipPos_offset_U))));
|
||||
block1 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos.x, clipPos_offset_U))));
|
||||
block2 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset_R, clipPos_offset_U))));
|
||||
block3 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset_L, clipPos.y))));
|
||||
block4 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos.x, clipPos.y))));
|
||||
block5 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset_R, clipPos.y))));
|
||||
block6 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset_L, clipPos_offset_D))));
|
||||
block7 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos.x, clipPos_offset_D))));
|
||||
block8 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, vec2(clipPos_offset_R, clipPos_offset_D))));
|
||||
#else
|
||||
block0 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset_L, clipPos_offset_U)).x);
|
||||
block1 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos.x, clipPos_offset_U)).x);
|
||||
block2 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset_R, clipPos_offset_U)).x);
|
||||
block3 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset_L, clipPos.y)).x);
|
||||
block4 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos.x, clipPos.y)).x);
|
||||
block5 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset_R, clipPos.y)).x);
|
||||
block6 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset_L, clipPos_offset_D)).x);
|
||||
block7 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos.x, clipPos_offset_D)).x);
|
||||
block8 = step(offsetDepth, texture(cc_shadowMap, vec2(clipPos_offset_R, clipPos_offset_D)).x);
|
||||
#endif
|
||||
|
||||
float coefX = mod(clipPos.x, oneTap.x) * mapSize.x;
|
||||
float coefY = mod(clipPos.y, oneTap.y) * mapSize.y;
|
||||
|
||||
float shadow = 0.0;
|
||||
float resultX = mix(block0, block1, coefX);
|
||||
float resultY = mix(block3, block4, coefX);
|
||||
shadow += mix(resultX , resultY, coefY);
|
||||
|
||||
resultX = mix(block1, block2, coefX);
|
||||
resultY = mix(block4, block5, coefX);
|
||||
shadow += mix(resultX , resultY, coefY);
|
||||
|
||||
resultX = mix(block3, block4, coefX);
|
||||
resultY = mix(block6, block7, coefX);
|
||||
shadow += mix(resultX, resultY, coefY);
|
||||
|
||||
resultX = mix(block4, block5, coefX);
|
||||
resultY = mix(block7, block8, coefX);
|
||||
shadow += mix(resultX, resultY, coefY);
|
||||
|
||||
return shadow * 0.25;
|
||||
}
|
||||
|
||||
float CCGetShadowFactorSoft4X (vec4 shadowPos, float bias) {
|
||||
vec4 clipPosNew = shadowPos;
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float offsetDepth = clipPos.z;
|
||||
vec2 mapSize = cc_shadowWHPBInfo.xy;
|
||||
vec2 oneTap = 1.0 / mapSize;
|
||||
|
||||
vec2 twoTap = oneTap * 2.0;
|
||||
vec2 offset1 = clipPos.xy + vec2(-twoTap.x, -twoTap.y);
|
||||
vec2 offset2 = clipPos.xy + vec2(-oneTap.x, -twoTap.y);
|
||||
vec2 offset3 = clipPos.xy + vec2(0.0, -twoTap.y);
|
||||
vec2 offset4 = clipPos.xy + vec2(oneTap.x, -twoTap.y);
|
||||
vec2 offset5 = clipPos.xy + vec2(twoTap.x, -twoTap.y);
|
||||
vec2 offset6 = clipPos.xy + vec2(-twoTap.x, -oneTap.y);
|
||||
vec2 offset7 = clipPos.xy + vec2(-oneTap.x, -oneTap.y);
|
||||
vec2 offset8 = clipPos.xy + vec2(0.0, -oneTap.y);
|
||||
vec2 offset9 = clipPos.xy + vec2(oneTap.x, -oneTap.y);
|
||||
vec2 offset10 = clipPos.xy + vec2(twoTap.x, -oneTap.y);
|
||||
vec2 offset11 = clipPos.xy + vec2(-twoTap.x, 0.0);
|
||||
vec2 offset12 = clipPos.xy + vec2(-oneTap.x, 0.0);
|
||||
vec2 offset13 = clipPos.xy + vec2(0.0, 0.0);
|
||||
vec2 offset14 = clipPos.xy + vec2(oneTap.x, 0.0);
|
||||
vec2 offset15 = clipPos.xy + vec2(twoTap.x, 0.0);
|
||||
vec2 offset16 = clipPos.xy + vec2(-twoTap.x, oneTap.y);
|
||||
vec2 offset17 = clipPos.xy + vec2(-oneTap.x, oneTap.y);
|
||||
vec2 offset18 = clipPos.xy + vec2(0.0, oneTap.y);
|
||||
vec2 offset19 = clipPos.xy + vec2(oneTap.x, oneTap.y);
|
||||
vec2 offset20 = clipPos.xy + vec2(twoTap.x, oneTap.y);
|
||||
vec2 offset21 = clipPos.xy + vec2(-twoTap.x, twoTap.y);
|
||||
vec2 offset22 = clipPos.xy + vec2(-oneTap.x, twoTap.y);
|
||||
vec2 offset23 = clipPos.xy + vec2(0.0, twoTap.y);
|
||||
vec2 offset24 = clipPos.xy + vec2(oneTap.x, twoTap.y);
|
||||
vec2 offset25 = clipPos.xy + vec2(twoTap.x, twoTap.y);
|
||||
|
||||
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;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
block1 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset1)));
|
||||
block2 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset2)));
|
||||
block3 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset3)));
|
||||
block4 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset4)));
|
||||
block5 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset5)));
|
||||
block6 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset6)));
|
||||
block7 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset7)));
|
||||
block8 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset8)));
|
||||
block9 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset9)));
|
||||
block10 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset10)));
|
||||
block11 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset11)));
|
||||
block12 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset12)));
|
||||
block13 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset13)));
|
||||
block14 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset14)));
|
||||
block15 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset15)));
|
||||
block16 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset16)));
|
||||
block17 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset17)));
|
||||
block18 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset18)));
|
||||
block19 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset19)));
|
||||
block20 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset20)));
|
||||
block21 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset21)));
|
||||
block22 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset22)));
|
||||
block23 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset23)));
|
||||
block24 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset24)));
|
||||
block25 = step(offsetDepth, unpackRGBAToDepth(texture(cc_shadowMap, offset25)));
|
||||
#else
|
||||
block1 = step(offsetDepth, texture(cc_shadowMap, offset1).x);
|
||||
block2 = step(offsetDepth, texture(cc_shadowMap, offset2).x);
|
||||
block3 = step(offsetDepth, texture(cc_shadowMap, offset3).x);
|
||||
block4 = step(offsetDepth, texture(cc_shadowMap, offset4).x);
|
||||
block5 = step(offsetDepth, texture(cc_shadowMap, offset5).x);
|
||||
block6 = step(offsetDepth, texture(cc_shadowMap, offset6).x);
|
||||
block7 = step(offsetDepth, texture(cc_shadowMap, offset7).x);
|
||||
block8 = step(offsetDepth, texture(cc_shadowMap, offset8).x);
|
||||
block9 = step(offsetDepth, texture(cc_shadowMap, offset9).x);
|
||||
block10 = step(offsetDepth, texture(cc_shadowMap, offset10).x);
|
||||
block11 = step(offsetDepth, texture(cc_shadowMap, offset11).x);
|
||||
block12 = step(offsetDepth, texture(cc_shadowMap, offset12).x);
|
||||
block13 = step(offsetDepth, texture(cc_shadowMap, offset13).x);
|
||||
block14 = step(offsetDepth, texture(cc_shadowMap, offset14).x);
|
||||
block15 = step(offsetDepth, texture(cc_shadowMap, offset15).x);
|
||||
block16 = step(offsetDepth, texture(cc_shadowMap, offset16).x);
|
||||
block17 = step(offsetDepth, texture(cc_shadowMap, offset17).x);
|
||||
block18 = step(offsetDepth, texture(cc_shadowMap, offset18).x);
|
||||
block19 = step(offsetDepth, texture(cc_shadowMap, offset19).x);
|
||||
block20 = step(offsetDepth, texture(cc_shadowMap, offset20).x);
|
||||
block21 = step(offsetDepth, texture(cc_shadowMap, offset21).x);
|
||||
block22 = step(offsetDepth, texture(cc_shadowMap, offset22).x);
|
||||
block23 = step(offsetDepth, texture(cc_shadowMap, offset23).x);
|
||||
block24 = step(offsetDepth, texture(cc_shadowMap, offset24).x);
|
||||
block25 = step(offsetDepth, texture(cc_shadowMap, offset25).x);
|
||||
#endif
|
||||
|
||||
vec2 coef = fract(clipPos.xy / oneTap);
|
||||
vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);
|
||||
vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);
|
||||
vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);
|
||||
vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);
|
||||
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);
|
||||
vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);
|
||||
vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);
|
||||
vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);
|
||||
vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);
|
||||
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);
|
||||
vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);
|
||||
vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);
|
||||
vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);
|
||||
vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);
|
||||
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);
|
||||
vec2 v4X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);
|
||||
vec2 v4X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);
|
||||
vec2 v4X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);
|
||||
vec2 v4X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);
|
||||
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);
|
||||
vec2 v5X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);
|
||||
vec2 v5X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);
|
||||
vec2 v5X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);
|
||||
vec2 v5X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);
|
||||
float v5 = mix(v5X1.x, v5X1.y, coef.y) + mix(v5X2.x, v5X2.y, coef.y) + mix(v5X3.x, v5X3.y, coef.y) + mix(v5X4.x, v5X4.y, coef.y);
|
||||
float fAvg = (v1 + v2 + v3 + v4 + v5) * 0.05;
|
||||
return fAvg;
|
||||
}
|
||||
|
||||
float CCGetSpotLightShadowFactorHard (vec4 shadowPos, vec3 worldPos, float bias) {
|
||||
vec4 clipPosNew = ApplyShadowDepthBias_Perspective(shadowPos, bias);
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float shadow = 0.0;
|
||||
float closestDepth = 0.0;
|
||||
float depth = clipPos.z;
|
||||
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
closestDepth = unpackRGBAToDepth(texture(cc_spotLightingMap, clipPos.xy));
|
||||
#else
|
||||
closestDepth = texture(cc_spotLightingMap, clipPos.xy).x;
|
||||
#endif
|
||||
shadow = step(depth, closestDepth);
|
||||
|
||||
return shadow;
|
||||
}
|
||||
|
||||
float CCGetSpotLightShadowFactorSoft (vec4 shadowPos, vec3 worldPos, float bias) {
|
||||
vec4 clipPosNew = ApplyShadowDepthBias_Perspective(shadowPos, bias);
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float depth = 0.0;
|
||||
if (cc_shadowNFLSInfo.z > EPSILON) {
|
||||
depth = CCGetLinearDepth(worldPos);
|
||||
} else {
|
||||
depth = clipPos.z;
|
||||
}
|
||||
|
||||
vec2 oneTap = 1.0 / cc_shadowWHPBInfo.xy;
|
||||
vec2 clipPos_offset = clipPos.xy + oneTap;
|
||||
|
||||
float block0, block1, block2, block3;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
block0 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y))));
|
||||
block1 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset.x, clipPos.y))));
|
||||
block2 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos_offset.y))));
|
||||
block3 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset.x, clipPos_offset.y))));
|
||||
#else
|
||||
block0 = step(depth, texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)).x);
|
||||
block1 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset.x, clipPos.y)).x);
|
||||
block2 = step(depth, texture(cc_spotLightingMap, vec2(clipPos.x, clipPos_offset.y)).x);
|
||||
block3 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset.x, clipPos_offset.y)).x);
|
||||
#endif
|
||||
|
||||
float coefX = mod(clipPos.x, oneTap.x) * cc_shadowWHPBInfo.x;
|
||||
float resultX = mix(block0, block1, coefX);
|
||||
float resultY = mix(block2, block3, coefX);
|
||||
float coefY = mod(clipPos.y, oneTap.y) * cc_shadowWHPBInfo.y;
|
||||
|
||||
return mix(resultX, resultY, coefY);
|
||||
}
|
||||
|
||||
float CCGetSpotLightShadowFactorSoft2X (vec4 shadowPos, vec3 worldPos, float bias) {
|
||||
vec4 clipPosNew = ApplyShadowDepthBias_Perspective(shadowPos, bias);
|
||||
vec3 clipPos = clipPosNew.xyz / clipPosNew.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float depth = 0.0;
|
||||
if (cc_shadowNFLSInfo.z > EPSILON) {
|
||||
depth = CCGetLinearDepth(worldPos);
|
||||
} else {
|
||||
depth = clipPos.z;
|
||||
}
|
||||
|
||||
vec2 mapSize = cc_shadowWHPBInfo.xy;
|
||||
vec2 oneTap = 1.0 / mapSize;
|
||||
float clipPos_offset_L = clipPos.x - oneTap.x;
|
||||
float clipPos_offset_R = clipPos.x + oneTap.x;
|
||||
float clipPos_offset_U = clipPos.y - oneTap.y;
|
||||
float clipPos_offset_D = clipPos.y + oneTap.y;
|
||||
|
||||
float block0, block1, block2, block3, block4, block5, block6, block7, block8;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
block0 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset_L, clipPos_offset_U))));
|
||||
block1 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos_offset_U))));
|
||||
block2 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset_R, clipPos_offset_U))));
|
||||
block3 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset_L, clipPos.y))));
|
||||
block4 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y))));
|
||||
block5 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset_R, clipPos.y))));
|
||||
block6 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset_L, clipPos_offset_D))));
|
||||
block7 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos.x, clipPos_offset_D))));
|
||||
block8 = step(depth, unpackRGBAToDepth(texture(cc_spotLightingMap, vec2(clipPos_offset_R, clipPos_offset_D))));
|
||||
#else
|
||||
block0 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset_L, clipPos_offset_U)).x);
|
||||
block1 = step(depth, texture(cc_spotLightingMap, vec2(clipPos.x, clipPos_offset_U)).x);
|
||||
block2 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset_R, clipPos_offset_U)).x);
|
||||
block3 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset_L, clipPos.y)).x);
|
||||
block4 = step(depth, texture(cc_spotLightingMap, vec2(clipPos.x, clipPos.y)).x);
|
||||
block5 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset_R, clipPos.y)).x);
|
||||
block6 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset_L, clipPos_offset_D)).x);
|
||||
block7 = step(depth, texture(cc_spotLightingMap, vec2(clipPos.x, clipPos_offset_D)).x);
|
||||
block8 = step(depth, texture(cc_spotLightingMap, vec2(clipPos_offset_R, clipPos_offset_D)).x);
|
||||
#endif
|
||||
|
||||
float coefX = mod(clipPos.x, oneTap.x) * mapSize.x;
|
||||
float coefY = mod(clipPos.y, oneTap.y) * mapSize.y;
|
||||
|
||||
float shadow = 0.0;
|
||||
float resultX = mix(block0, block1, coefX);
|
||||
float resultY = mix(block3, block4, coefX);
|
||||
shadow += mix(resultX , resultY, coefY);
|
||||
|
||||
resultX = mix(block1, block2, coefX);
|
||||
resultY = mix(block4, block5, coefX);
|
||||
shadow += mix(resultX , resultY, coefY);
|
||||
|
||||
resultX = mix(block3, block4, coefX);
|
||||
resultY = mix(block6, block7, coefX);
|
||||
shadow += mix(resultX, resultY, coefY);
|
||||
|
||||
resultX = mix(block4, block5, coefX);
|
||||
resultY = mix(block7, block8, coefX);
|
||||
shadow += mix(resultX, resultY, coefY);
|
||||
|
||||
return shadow * 0.25;
|
||||
}
|
||||
|
||||
float CCGetSpotLightShadowFactorSoft4X (vec4 shadowPos, vec3 worldPos, float bias) {
|
||||
vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;
|
||||
if (clipPos.x < 0.0 || clipPos.x > 1.0 ||
|
||||
clipPos.y < 0.0 || clipPos.y > 1.0 ||
|
||||
clipPos.z < 0.0 || clipPos.z > 1.0) { return 1.0; }
|
||||
CC_HANDLE_NDC_SAMPLE_FLIP(clipPos.xy);
|
||||
|
||||
float offsetDepth= 0.0;
|
||||
if (cc_shadowNFLSInfo.z > EPSILON) {
|
||||
offsetDepth = CCGetLinearDepth(worldPos);
|
||||
} else {
|
||||
offsetDepth = clipPos.z;
|
||||
}
|
||||
vec2 mapSize = cc_shadowWHPBInfo.xy;
|
||||
vec2 oneTap = 1.0 / mapSize;
|
||||
|
||||
vec2 twoTap = oneTap * 2.0;
|
||||
vec2 offset1 = clipPos.xy + vec2(-twoTap.x, -twoTap.y);
|
||||
vec2 offset2 = clipPos.xy + vec2(-oneTap.x, -twoTap.y);
|
||||
vec2 offset3 = clipPos.xy + vec2(0.0, -twoTap.y);
|
||||
vec2 offset4 = clipPos.xy + vec2(oneTap.x, -twoTap.y);
|
||||
vec2 offset5 = clipPos.xy + vec2(twoTap.x, -twoTap.y);
|
||||
vec2 offset6 = clipPos.xy + vec2(-twoTap.x, -oneTap.y);
|
||||
vec2 offset7 = clipPos.xy + vec2(-oneTap.x, -oneTap.y);
|
||||
vec2 offset8 = clipPos.xy + vec2(0.0, -oneTap.y);
|
||||
vec2 offset9 = clipPos.xy + vec2(oneTap.x, -oneTap.y);
|
||||
vec2 offset10 = clipPos.xy + vec2(twoTap.x, -oneTap.y);
|
||||
vec2 offset11 = clipPos.xy + vec2(-twoTap.x, 0.0);
|
||||
vec2 offset12 = clipPos.xy + vec2(-oneTap.x, 0.0);
|
||||
vec2 offset13 = clipPos.xy + vec2(0.0, 0.0);
|
||||
vec2 offset14 = clipPos.xy + vec2(oneTap.x, 0.0);
|
||||
vec2 offset15 = clipPos.xy + vec2(twoTap.x, 0.0);
|
||||
vec2 offset16 = clipPos.xy + vec2(-twoTap.x, oneTap.y);
|
||||
vec2 offset17 = clipPos.xy + vec2(-oneTap.x, oneTap.y);
|
||||
vec2 offset18 = clipPos.xy + vec2(0.0, oneTap.y);
|
||||
vec2 offset19 = clipPos.xy + vec2(oneTap.x, oneTap.y);
|
||||
vec2 offset20 = clipPos.xy + vec2(twoTap.x, oneTap.y);
|
||||
vec2 offset21 = clipPos.xy + vec2(-twoTap.x, twoTap.y);
|
||||
vec2 offset22 = clipPos.xy + vec2(-oneTap.x, twoTap.y);
|
||||
vec2 offset23 = clipPos.xy + vec2(0.0, twoTap.y);
|
||||
vec2 offset24 = clipPos.xy + vec2(oneTap.x, twoTap.y);
|
||||
vec2 offset25 = clipPos.xy + vec2(twoTap.x, twoTap.y);
|
||||
|
||||
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;
|
||||
#if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
|
||||
block1 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset1)));
|
||||
block2 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset2)));
|
||||
block3 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset3)));
|
||||
block4 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset4)));
|
||||
block5 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset5)));
|
||||
block6 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset6)));
|
||||
block7 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset7)));
|
||||
block8 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset8)));
|
||||
block9 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset9)));
|
||||
block10 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset10)));
|
||||
block11 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset11)));
|
||||
block12 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset12)));
|
||||
block13 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset13)));
|
||||
block14 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset14)));
|
||||
block15 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset15)));
|
||||
block16 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset16)));
|
||||
block17 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset17)));
|
||||
block18 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset18)));
|
||||
block19 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset19)));
|
||||
block20 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset20)));
|
||||
block21 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset21)));
|
||||
block22 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset22)));
|
||||
block23 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset23)));
|
||||
block24 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset24)));
|
||||
block25 = step(offsetDepth, unpackRGBAToDepth(texture(cc_spotLightingMap, offset25)));
|
||||
#else
|
||||
block1 = step(offsetDepth, texture(cc_spotLightingMap, offset1).x);
|
||||
block2 = step(offsetDepth, texture(cc_spotLightingMap, offset2).x);
|
||||
block3 = step(offsetDepth, texture(cc_spotLightingMap, offset3).x);
|
||||
block4 = step(offsetDepth, texture(cc_spotLightingMap, offset4).x);
|
||||
block5 = step(offsetDepth, texture(cc_spotLightingMap, offset5).x);
|
||||
block6 = step(offsetDepth, texture(cc_spotLightingMap, offset6).x);
|
||||
block7 = step(offsetDepth, texture(cc_spotLightingMap, offset7).x);
|
||||
block8 = step(offsetDepth, texture(cc_spotLightingMap, offset8).x);
|
||||
block9 = step(offsetDepth, texture(cc_spotLightingMap, offset9).x);
|
||||
block10 = step(offsetDepth, texture(cc_spotLightingMap, offset10).x);
|
||||
block11 = step(offsetDepth, texture(cc_spotLightingMap, offset11).x);
|
||||
block12 = step(offsetDepth, texture(cc_spotLightingMap, offset12).x);
|
||||
block13 = step(offsetDepth, texture(cc_spotLightingMap, offset13).x);
|
||||
block14 = step(offsetDepth, texture(cc_spotLightingMap, offset14).x);
|
||||
block15 = step(offsetDepth, texture(cc_spotLightingMap, offset15).x);
|
||||
block16 = step(offsetDepth, texture(cc_spotLightingMap, offset16).x);
|
||||
block17 = step(offsetDepth, texture(cc_spotLightingMap, offset17).x);
|
||||
block18 = step(offsetDepth, texture(cc_spotLightingMap, offset18).x);
|
||||
block19 = step(offsetDepth, texture(cc_spotLightingMap, offset19).x);
|
||||
block20 = step(offsetDepth, texture(cc_spotLightingMap, offset20).x);
|
||||
block21 = step(offsetDepth, texture(cc_spotLightingMap, offset21).x);
|
||||
block22 = step(offsetDepth, texture(cc_spotLightingMap, offset22).x);
|
||||
block23 = step(offsetDepth, texture(cc_spotLightingMap, offset23).x);
|
||||
block24 = step(offsetDepth, texture(cc_spotLightingMap, offset24).x);
|
||||
block25 = step(offsetDepth, texture(cc_spotLightingMap, offset25).x);
|
||||
#endif
|
||||
|
||||
vec2 coef = fract(clipPos.xy / oneTap);
|
||||
vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);
|
||||
vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);
|
||||
vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);
|
||||
vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);
|
||||
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);
|
||||
vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);
|
||||
vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);
|
||||
vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);
|
||||
vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);
|
||||
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);
|
||||
vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);
|
||||
vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);
|
||||
vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);
|
||||
vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);
|
||||
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);
|
||||
vec2 v4X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);
|
||||
vec2 v4X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);
|
||||
vec2 v4X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);
|
||||
vec2 v4X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);
|
||||
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);
|
||||
vec2 v5X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);
|
||||
vec2 v5X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);
|
||||
vec2 v5X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);
|
||||
vec2 v5X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);
|
||||
float v5 = mix(v5X1.x, v5X1.y, coef.y) + mix(v5X2.x, v5X2.y, coef.y) + mix(v5X3.x, v5X3.y, coef.y) + mix(v5X4.x, v5X4.y, coef.y);
|
||||
float fAvg = (v1 + v2 + v3 + v4 + v5) * 0.05;
|
||||
return fAvg;
|
||||
}
|
||||
|
||||
float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)
|
||||
{
|
||||
float pcf = cc_shadowWHPBInfo.z;
|
||||
if (pcf > 2.9) {
|
||||
return CCGetSpotLightShadowFactorSoft4X(shadowPos, worldPos, shadowBias.x);
|
||||
} else if (pcf > 1.9) {
|
||||
return CCGetSpotLightShadowFactorSoft2X(shadowPos, worldPos, shadowBias.x);
|
||||
}else if (pcf > 0.9) {
|
||||
return CCGetSpotLightShadowFactorSoft(shadowPos, worldPos, shadowBias.x);
|
||||
}else {
|
||||
return CCGetSpotLightShadowFactorHard(shadowPos, worldPos, shadowBias.x);
|
||||
}
|
||||
}
|
||||
|
||||
float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias)
|
||||
{
|
||||
float realtimeShadow = 1.0;
|
||||
vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);
|
||||
pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.xy);
|
||||
|
||||
float pcf = cc_shadowWHPBInfo.z;
|
||||
if (pcf > 2.9) {
|
||||
realtimeShadow = CCGetShadowFactorSoft4X(pos, shadowBias.x);
|
||||
} else if (pcf > 1.9) {
|
||||
realtimeShadow = CCGetShadowFactorSoft2X(pos, shadowBias.x);
|
||||
}else if (pcf > 0.9) {
|
||||
realtimeShadow = CCGetShadowFactorSoft(pos, shadowBias.x);
|
||||
}else {
|
||||
realtimeShadow = CCGetShadowFactorHard(pos, shadowBias.x);
|
||||
}
|
||||
return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);
|
||||
}
|
||||
|
||||
float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias)
|
||||
{
|
||||
vec4 csmPos = vec4(1.0);
|
||||
vec2 shadowDepthProjInfo;
|
||||
vec2 shadowProjInfo;
|
||||
mat4 matLightView;
|
||||
int level = CCGetCSMLevel(csmPos, shadowDepthProjInfo, shadowProjInfo, matLightView, worldPos);
|
||||
if (level < 0) { return 1.0; }
|
||||
float realtimeShadow = 1.0;
|
||||
|
||||
vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, matLightView, shadowProjInfo);
|
||||
pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowDepthProjInfo);
|
||||
|
||||
float pcf = cc_shadowWHPBInfo.z;
|
||||
if (pcf > 2.9) {
|
||||
realtimeShadow = CCGetShadowFactorSoft4X(pos, shadowBias.x);
|
||||
} else if (pcf > 1.9) {
|
||||
realtimeShadow = CCGetShadowFactorSoft2X(pos, shadowBias.x);
|
||||
} else if (pcf > 0.9) {
|
||||
realtimeShadow = CCGetShadowFactorSoft(pos, shadowBias.x);
|
||||
}else {
|
||||
realtimeShadow = CCGetShadowFactorHard(pos, shadowBias.x);
|
||||
}
|
||||
return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma define CC_TRANSFER_SHADOW_BASE(pos, shadowPos) shadowPos = cc_matLightViewProj * pos
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "9b0e2f60-4c29-47e6-9b4c-ced160a61be6",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
#pragma extension([GL_EXT_shader_explicit_arithmetic_types_int32, __VERSION__ > 310, require])
|
||||
|
||||
#include <common>
|
||||
|
||||
#if CC_USE_BAKED_ANIMATION
|
||||
#pragma builtin(local)
|
||||
layout(set = 2, binding = 3) uniform CCSkinningTexture {
|
||||
highp vec4 cc_jointTextureInfo; // length, totalJoints, offset, invLength
|
||||
};
|
||||
#pragma builtin(local)
|
||||
layout(set = 2, binding = 2) uniform CCSkinningAnimation {
|
||||
highp vec4 cc_jointAnimInfo; // frameID
|
||||
};
|
||||
#pragma builtin(local)
|
||||
layout(set = 2, binding = 6) uniform highp sampler2D cc_jointTexture;
|
||||
/**
|
||||
* Although tempting, don't opt the offset arithmetics out to CPU (could
|
||||
* be reduced to a single MAD). The enlarged numerical range could require
|
||||
* more precision than what's actually provided on some devices.
|
||||
*/
|
||||
void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)
|
||||
{
|
||||
#if USE_INSTANCING
|
||||
highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;
|
||||
#else
|
||||
highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;
|
||||
#endif
|
||||
invSize = cc_jointTextureInfo.w;
|
||||
highp float tempY = floor(temp * invSize);
|
||||
x = floor(temp - tempY * cc_jointTextureInfo.x);
|
||||
y = (tempY + 0.5) * invSize;
|
||||
}
|
||||
#else
|
||||
#pragma define JOINT_UNIFORM_CAPACITY 30
|
||||
#pragma builtin(local)
|
||||
layout(set = 2, binding = 3) uniform CCSkinning {
|
||||
highp vec4 cc_joints[JOINT_UNIFORM_CAPACITY * 3];
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <skinning-lbs>
|
||||
// #include <skinning-dqs>
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "21191d65-d2ba-47a3-b9d2-c4afaaa713cd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "280afbca-66a6-4948-9a32-a207b2415f6d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "7efbe295-0202-4979-8cda-6cfe35e086cf",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "bb213412-2e68-43b3-9de5-73ca332acace",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "9d86a3e4-ec06-4e51-ba68-45f2b7739fbb",
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "23b6d452-21a8-41c8-a910-fdb93eb21c61",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "73866dd2-eaf5-40af-a061-1b9d38782204",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "e3e5d086-acc9-4dd8-98e8-24ac02f547d5",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "9c973ee8-952a-4ee3-a617-ba6397db6bac",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "399f5890-dde1-40de-9751-a7aa91a56b93",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "077cca29-6f66-4aad-a3a7-4f0a7ecd523f",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "3a85eafd-0fd0-468f-8a2e-0c81493230c7",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "d360c347-a546-4967-bdd3-30cae323f123",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "00e591cd-469d-4611-adb9-a5ca965a0552",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "a24fb7a1-f7a5-430c-a8b2-e4c516131086",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "e9d8b3bb-03e4-46b2-be29-ea58fac18c18",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "9f84c121-c61b-499f-b400-81a5448d6078",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "41f91fc1-5aec-45dd-91ca-39ab964f8054",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "0de81d5f-2a3e-467e-bcf5-84f7828edab6",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "f992af76-5145-4f8e-beae-6d88be403e8e",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "cac4ba94-f412-4899-83b1-ce035b0c09e0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "3931bd87-0a7b-4d2d-a5f1-9544227343a8",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "d26f7be9-ac7f-4dfd-88ee-6657dfe3426e",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "355259fc-3a13-4fed-b553-a5e2caeb2e75",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "38c5e61f-5e12-4c1d-8e88-a9d832c48b16",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "ea1a269d-29b3-4ca1-bc48-e2be305a0a71",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
#pragma define-meta USE_INSTANCING editor(elevated: true)
|
||||
#pragma define-meta USE_BATCHING editor(elevated: true)
|
||||
|
||||
#include <common>
|
||||
#include <common/common-define>
|
||||
|
||||
struct StandardVertInput {
|
||||
highp vec4 position;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "e05f440c-0ba5-4c83-a039-5644d248bb87",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
#include <decode-base>
|
||||
#include <legacy/decode-base>
|
||||
|
||||
#pragma define CCDecode(attr) \
|
||||
attr.position = vec4(a_position, 1.0); \
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "8daa33da-9438-4294-aace-2a58d1b183ab",
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
#include <decode-base>
|
||||
#include <legacy/decode-base>
|
||||
|
||||
#pragma define CCDecode(position) \
|
||||
position = vec4(a_position, 1.0)
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.4",
|
||||
"ver": "1.0.5",
|
||||
"importer": "effect-header",
|
||||
"imported": true,
|
||||
"uuid": "385a7ca1-9421-475c-aa02-38d52ef3ba7f",
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user