| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- CCEffect %{
- temporaries:
- b1: &b1
- targets:
- - blend: true
- blendSrc: src_alpha
- blendDst: one
- blendSrcAlpha: src_alpha
- blendDstAlpha: one
- b2: &b2
- targets:
- - blend: true
- blendSrc: src_alpha
- blendDst: one_minus_src_alpha
- blendSrcAlpha: zero
- blendDstAlpha: one
- blendAlphaEq: max
- b3: &b3
- targets:
- - blend: true
- blendSrc: dst_color
- blendDst: one
- blendSrcAlpha: zero
- blendDstAlpha: dst_alpha
- d1: &d1 { depthTest: true, depthWrite: false }
- r1: &r1 { cullMode: none }
- p1: &p1
- mainTexture: { value: grey }
- mainTiling_Offset: { value: [1, 1, 0, 0] }
- p2: &p2
- <<: *p1
- tintColor: { value: [0.5, 0.5, 0.5, 0.5], editor: { type: color } }
- techniques:
- - name: add
- passes:
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: tinted-fs:add
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b1
- properties: *p2
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: tinted-fs:add
- phase: deferred-forward
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b1
- propertyIndex: 0
- - name: alpha-blend
- passes:
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: tinted-fs:add
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b2
- properties: *p2
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: tinted-fs:add
- phase: deferred-forward
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b2
- propertyIndex: 0
- - name: add-multiply
- passes:
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: tinted-fs:multiply
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b3
- properties: *p2
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: tinted-fs:multiply
- phase: deferred-forward
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b3
- propertyIndex: 0
- - name: add-smooth
- passes:
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: no-tint-fs:addSmooth
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b1
- properties: *p1
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: no-tint-fs:addSmooth
- phase: deferred-forward
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b1
- propertyIndex: 0
- - name: premultiply-blend
- passes:
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: no-tint-fs:premultiplied
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b2
- properties: *p1
- - vert: builtin/internal/particle-vs-legacy:lpvs_main
- frag: no-tint-fs:premultiplied
- phase: deferred-forward
- rasterizerState: *r1
- depthStencilState: *d1
- blendState: *b2
- propertyIndex: 0
- }%
- // TODO: soft particle
- CCProgram tinted-fs %{
- precision mediump float;
- #include <legacy/output>
- #include <builtin/internal/embedded-alpha>
- in vec2 uv;
- in vec4 color;
- uniform sampler2D mainTexture;
- uniform FragConstants {
- vec4 tintColor;
- };
- vec4 add () {
- vec4 col = 2.0 * color * tintColor * CCSampleWithAlphaSeparated(mainTexture, uv);
- return CCFragOutput(col);
- }
- vec4 multiply () {
- vec4 col;
- vec4 texColor = CCSampleWithAlphaSeparated(mainTexture, uv);
- col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);
- return CCFragOutput(col);
- }
- }%
- CCProgram no-tint-fs %{
- precision mediump float;
- #include <legacy/output>
- #include <builtin/internal/embedded-alpha>
- in vec2 uv;
- in vec4 color;
- uniform sampler2D mainTexture;
- vec4 addSmooth () {
- vec4 col = color * CCSampleWithAlphaSeparated(mainTexture, uv);
- col.rgb *= col.a;
- return CCFragOutput(col);
- }
- vec4 premultiplied () {
- vec4 col = color * CCSampleWithAlphaSeparated(mainTexture, uv) * color.a;
- return CCFragOutput(col);
- }
- }%
|