-
Creator 版本:2.4.5
-
目标平台:
-
重现方式:
-
首个报错:
-
之前哪个版本是正常的:
-
手机型号:
-
手机浏览器:
-
编辑器操作系统:
-
重现概率:
// Copyright © 2017-2018 Xiamen Yaji Software Co., Ltd.
// Note: Current format version is experiment, the format may be changed.
// The future format may not be compatible, you may need to update the script manually.
// 注意:当前版本的格式是实验性的,之后还会进行修改。
// 后续版本的格式不保证兼容当前格式,可能需要手动升级到最新版本。,
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
rasterizerState:
cullMode: none
blendState:
targets:- blend: true
layer: 0
properties:
texture:
type: sampler2D
value: ‘’
color:
type: vec4
displayName: ‘颜色’
value: - 1
- 1
- 1
- 1
width:
type: float
displayName: ‘流光的宽度范围’
value: 0.08
time:
type: float
displayName: ‘时间’
value: 1
strength:
type: float
displayName: ‘流光增亮强度’
value: 0.008
offset:
type: float
displayName: ‘偏移值’
value: 0.5
}%
- blend: true
- vert: vs
CCProgram vs %{
precision highp float;
#include
#include
in vec3 a_position;
in vec2 a_uv0;
out vec2 uv0;
void main () {
vec4 pos = cc_matViewProj * vec4(a_position, 1);
gl_Position = pos;
uv0 = a_uv0;
}
}%
CCProgram fs %{
precision highp float;
#include
uniform sampler2D texture;
uniform vec4 color;
uniform float time;
uniform float width;
uniform float strength;
uniform float offset;
in vec2 uv0;
void main()
{
vec4 src_color = color * texture2D(texture, uv0).rgba;
float start = tan(time/1.414); //流光的起始x坐标
if(uv0.x < (start - offset * uv0.y) && uv0.x > (start - offset * uv0.y - width))
{
vec3 improve = strength * vec3(255, 255, 255);
vec3 result = improve * vec3( src_color.r, src_color.g, src_color.b);
gl_FragColor = vec4(result, src_color.a);
}else{
gl_FragColor = src_color;
}
}
}%
