forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
250 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. | ||
https://www.cocos.com/ | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated engine source code (the "Software"), a limited, | ||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license | ||
to use Cocos Creator solely to develop games on your target platforms. You shall | ||
not use Cocos Creator software for developing other software or tools that's | ||
used for developing games. You are not granted to publish, distribute, | ||
sublicense, and/or sell copies of Cocos Creator. | ||
The software or tools in this License Agreement are licensed, not sold. | ||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
import { ParticleEmitterParams, ParticleExecContext } from "./particle-base"; | ||
import { ParticleDataSet } from "./particle-data-set"; | ||
|
||
export abstract class Expression { | ||
public abstract tick (particles: ParticleDataSet, params: ParticleEmitterParams, context: ParticleExecContext); | ||
public abstract bind (particles: ParticleDataSet, params: ParticleEmitterParams, context: ParticleExecContext); | ||
public abstract evaluate (index: number); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"ver": "1.0.7", | ||
"importer": "effect-header", | ||
"imported": true, | ||
"uuid": "a58971af-4c9f-4223-b2ae-3dfbc6696f62", | ||
"files": [], | ||
"subMetas": {}, | ||
"userData": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
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/vfx-common:vfx_vs_main | ||
frag: tinted-fs:add | ||
rasterizerState: *r1 | ||
depthStencilState: *d1 | ||
blendState: *b1 | ||
properties: *p2 | ||
- name: alpha-blend | ||
passes: | ||
- vert: builtin/internal/vfx-common:vfx_vs_main | ||
frag: tinted-fs:add | ||
rasterizerState: *r1 | ||
depthStencilState: *d1 | ||
blendState: *b2 | ||
properties: *p2 | ||
- name: add-multiply | ||
passes: | ||
- vert: builtin/internal/vfx-common:vfx_vs_main | ||
frag: tinted-fs:multiply | ||
rasterizerState: *r1 | ||
depthStencilState: *d1 | ||
blendState: *b3 | ||
properties: *p2 | ||
- name: add-smooth | ||
passes: | ||
- vert: builtin/internal/vfx-common:vfx_vs_main | ||
frag: no-tint-fs:addSmooth | ||
rasterizerState: *r1 | ||
depthStencilState: *d1 | ||
blendState: *b1 | ||
properties: *p1 | ||
- name: premultiply-blend | ||
passes: | ||
- vert: builtin/internal/vfx-common:vfx_vs_main | ||
frag: no-tint-fs:premultiplied | ||
rasterizerState: *r1 | ||
depthStencilState: *d1 | ||
blendState: *b2 | ||
properties: *p1 | ||
}% | ||
|
||
// TODO: soft particle | ||
|
||
CCProgram tinted-fs %{ | ||
precision mediump float; | ||
#include <legacy/output> | ||
|
||
in vec2 uv; | ||
in vec4 color; | ||
|
||
uniform sampler2D mainTexture; | ||
uniform FragConstants { | ||
vec4 tintColor; | ||
}; | ||
|
||
vec4 add () { | ||
vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv); | ||
return CCFragOutput(col); | ||
} | ||
|
||
vec4 multiply () { | ||
vec4 col; | ||
vec4 texColor = texture(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> | ||
|
||
in vec2 uv; | ||
in vec4 color; | ||
|
||
uniform sampler2D mainTexture; | ||
|
||
vec4 addSmooth () { | ||
vec4 col = color * texture(mainTexture, uv); | ||
col.rgb *= col.a; | ||
return CCFragOutput(col); | ||
} | ||
|
||
vec4 premultiplied () { | ||
vec4 col = color * texture(mainTexture, uv) * color.a; | ||
return CCFragOutput(col); | ||
} | ||
}% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters