Files
svn/India/多语言翻译/ru/india_res/material/HighLight.effect
2025-08-04 10:46:00 +08:00

115 lines
1.9 KiB
Plaintext

// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
texture: { value: white }
u_ratio: { value: 0.0 }
}%
CCProgram vs %{
precision highp float;
#include <cc-global>
#include <cc-local>
in vec3 a_position;
in vec4 a_color;
#if USE_TINT
in vec4 a_color0;
#endif
out vec4 v_color;
#if USE_TEXTURE
in vec2 a_uv0;
out vec2 v_uv0;
#endif
#if USE_TINT
out vec4 v_dark;
#endif
void main () {
vec4 pos = vec4(a_position, 1);
#if CC_USE_MODEL
pos = cc_matViewProj * cc_matWorld * pos;
#else
pos = cc_matViewProj * pos;
#endif
#if USE_TEXTURE
v_uv0 = a_uv0;
#endif
v_color = a_color;
#if USE_TINT
v_dark = a_color0;
#endif
gl_Position = pos;
}
}%
CCProgram fs %{
precision highp float;
#include <alpha-test>
#include <texture>
in vec4 v_color;
#if USE_TINT
in vec4 v_dark;
#endif
uniform ARGS {
float u_ratio;
};
#if USE_TEXTURE
in vec2 v_uv0;
uniform sampler2D texture;
#endif
void main () {
vec4 o = vec4(1, 1, 1, 1);
#if USE_TEXTURE
CCTexture(texture, v_uv0, o);
#endif
float ratio = u_ratio + 1.0;
float mid = 1.0 / ratio;
if (o.r <= mid) {
o.r = ratio * o.r * v_color.r;
} else {
o.r = 1.0 - ratio * (1.0 - o.r) * (1.0 - v_color.r);
}
if (o.g <= mid) {
o.g = ratio * o.g * v_color.g;
} else {
o.g = 1.0 - ratio * (1.0 - o.g) * (1.0 - v_color.g);
}
if (o.b <= mid) {
o.b = ratio * o.b * v_color.b;
} else {
o.b = 1.0 - ratio * (1.0 - o.b) * (1.0 - v_color.b);
}
o.a = o.a * v_color.a;
ALPHA_TEST(o);
gl_FragColor = o;
}
}%