修改为单纹理,在android上编译通过,apk修改为日期名字

This commit is contained in:
xsl
2025-10-27 21:48:15 +08:00
parent 300340bb19
commit 10505c616f
12 changed files with 158 additions and 82 deletions
+1 -40
View File
@@ -1,7 +1,6 @@
#version 450
layout (binding = 1) uniform sampler2D samplerColor;
layout (binding = 2) uniform sampler2D samplerColor_ex;
layout (location = 0) in vec2 inUV;
layout (location = 1) in vec3 inNormal;
@@ -12,45 +11,7 @@ layout (location = 0) out vec4 outFragColor;
void main()
{
vec4 color = texture(samplerColor, inUV);
vec4 color_ex = texture(samplerColor_ex, inUV);
vec3 N = normalize(inNormal);
outFragColor = color;
// 计算与 (0,0,1) 的点乘
float ndot = dot(N, vec3(0.0, 0.0, -1.0));
// 保证结果 >= 0
ndot = max(ndot, 0.0);
// 重新映射ndot值,让中间2/3部分进行融合
// 当ndot在[0.166, 0.833]范围内时进行混合,两端保持不变
float blendFactor;
if (ndot < 0.0) {
blendFactor = 0.0; // 完全使用color_ex
} else if (ndot > 0.1) {
blendFactor = 1.0; // 完全使用color
} else {
// 在中间2/3部分进行平滑过渡
blendFactor = (ndot - 0.0) / (1 - 0);
}
// 使用smoothstep创建中间2/3的融合区域
// 参数说明:smoothstep(edge0, edge1, x)
// 当x < edge0时返回0,当x > edge1时返回1,在中间时平滑过渡
//float blendFactor = smoothstep(0.166, 0.833, ndot);
// vec4 blendedColor = mix(color_ex, color, ndot);
// outFragColor = blendedColor;
if (ndot < 0.3){
outFragColor = color_ex;
}
else
{
outFragColor = color;
}
// outFragColor = vec4(1, 0, 0, 1);
}
Binary file not shown.
@@ -0,0 +1,56 @@
#version 450
layout (binding = 1) uniform sampler2D samplerColor;
layout (binding = 2) uniform sampler2D samplerColor_ex;
layout (location = 0) in vec2 inUV;
layout (location = 1) in vec3 inNormal;
layout (location = 0) out vec4 outFragColor;
void main()
{
vec4 color = texture(samplerColor, inUV);
vec4 color_ex = texture(samplerColor_ex, inUV);
vec3 N = normalize(inNormal);
// 计算与 (0,0,1) 的点乘
float ndot = dot(N, vec3(0.0, 0.0, -1.0));
// 保证结果 >= 0
ndot = max(ndot, 0.0);
// 重新映射ndot值,让中间2/3部分进行融合
// 当ndot在[0.166, 0.833]范围内时进行混合,两端保持不变
float blendFactor;
if (ndot < 0.0) {
blendFactor = 0.0; // 完全使用color_ex
} else if (ndot > 0.1) {
blendFactor = 1.0; // 完全使用color
} else {
// 在中间2/3部分进行平滑过渡
blendFactor = (ndot - 0.0) / (1 - 0);
}
// 使用smoothstep创建中间2/3的融合区域
// 参数说明:smoothstep(edge0, edge1, x)
// 当x < edge0时返回0,当x > edge1时返回1,在中间时平滑过渡
//float blendFactor = smoothstep(0.166, 0.833, ndot);
// vec4 blendedColor = mix(color_ex, color, ndot);
// outFragColor = blendedColor;
if (ndot < 0.3){
outFragColor = color_ex;
}
else
{
outFragColor = color;
}
// outFragColor = vec4(1, 0, 0, 1);
}
Binary file not shown.