-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
320 additions
and
197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd. | ||
CCEffect %{ | ||
techniques: | ||
- passes: | ||
- vert: sprite-vs:vert | ||
frag: sprite-fs:frag | ||
depthStencilState: | ||
depthTest: false | ||
depthWrite: false | ||
blendState: | ||
targets: | ||
- blend: true | ||
blendSrc: src_alpha | ||
blendDst: one_minus_src_alpha | ||
blendDstAlpha: one_minus_src_alpha | ||
rasterizerState: | ||
cullMode: none | ||
properties: | ||
noiseMap: { value: white } | ||
alphaThreshold: { value: 0.5 } | ||
}% | ||
|
||
CCProgram sprite-vs %{ | ||
precision highp float; | ||
#include <builtin/uniforms/cc-global> | ||
#if USE_LOCAL | ||
#include <builtin/uniforms/cc-local> | ||
#endif | ||
#if SAMPLE_FROM_RT | ||
#include <common/common-define> | ||
#endif | ||
in vec3 a_position; | ||
in vec2 a_texCoord; | ||
in vec4 a_color; | ||
|
||
out vec4 color; | ||
out vec2 uv0; | ||
|
||
vec4 vert () { | ||
vec4 pos = vec4(a_position, 1); | ||
|
||
#if USE_LOCAL | ||
pos = cc_matWorld * pos; | ||
#endif | ||
|
||
#if USE_PIXEL_ALIGNMENT | ||
pos = cc_matView * pos; | ||
pos.xyz = floor(pos.xyz); | ||
pos = cc_matProj * pos; | ||
#else | ||
pos = cc_matViewProj * pos; | ||
#endif | ||
|
||
uv0 = a_texCoord; | ||
#if SAMPLE_FROM_RT | ||
CC_HANDLE_RT_SAMPLE_FLIP(uv0); | ||
#endif | ||
color = a_color; | ||
|
||
return pos; | ||
} | ||
}% | ||
|
||
CCProgram sprite-fs %{ | ||
precision highp float; | ||
#include <builtin/internal/embedded-alpha> | ||
#include <builtin/uniforms/cc-global> | ||
#include <builtin/internal/alpha-test> | ||
|
||
in vec4 color; | ||
|
||
in vec2 uv0; | ||
#pragma builtin(local) | ||
layout(set = 2, binding = 11) uniform sampler2D cc_spriteTexture; | ||
uniform sampler2D noiseMap; | ||
|
||
vec4 frag () { | ||
vec4 o = vec4(1, 1, 1, 1); | ||
|
||
vec2 uv = uv0 * 2.0 - 1.0; | ||
uv.x += cc_time.x; | ||
vec4 color = texture(noiseMap, uv); | ||
ALPHA_TEST(o); | ||
return o; | ||
} | ||
}% |
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,11 @@ | ||
{ | ||
"ver": "1.6.0", | ||
"importer": "effect", | ||
"imported": true, | ||
"uuid": "1fb49540-f4c8-45e1-a1e7-48b00b1028a4", | ||
"files": [ | ||
".json" | ||
], | ||
"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,12 @@ | ||
{ | ||
"__type__": "cc.Material", | ||
"_name": "", | ||
"_objFlags": 0, | ||
"_native": "", | ||
"_effectAsset": { | ||
"__uuid__": "1baf0fc9-befa-459c-8bdd-af1a450a0319" | ||
}, | ||
"_techIdx": 0, | ||
"_defines": [], | ||
"_props": [] | ||
} |
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,11 @@ | ||
{ | ||
"ver": "1.0.16", | ||
"importer": "material", | ||
"imported": true, | ||
"uuid": "707673eb-08fb-4874-b7fa-d97917853461", | ||
"files": [ | ||
".json" | ||
], | ||
"subMetas": {}, | ||
"userData": {} | ||
} |
Oops, something went wrong.