完成双贴图效果,修改闪退的bug,换成赴宴的贴图

This commit is contained in:
xsl
2025-10-23 21:58:11 +08:00
parent afd02550a8
commit 41a659bd6d
8 changed files with 15 additions and 13 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 82 KiB

+5 -2
View File
@@ -6,6 +6,7 @@ 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()
@@ -24,9 +25,9 @@ void main()
// 重新映射ndot值,让中间2/3部分进行融合
// 当ndot在[0.166, 0.833]范围内时进行混合,两端保持不变
float blendFactor;
if (ndot < 0.166) {
if (ndot < 0.266) {
blendFactor = 0.0; // 完全使用color_ex
} else if (ndot > 0.833) {
} else if (ndot > 0.733) {
blendFactor = 1.0; // 完全使用color
} else {
// 在中间2/3部分进行平滑过渡
@@ -42,4 +43,6 @@ void main()
vec4 blendedColor = mix(color_ex, color, blendFactor);
outFragColor = blendedColor;
// outFragColor = vec4(1, 0, 0, 1);
}
Binary file not shown.
-4
View File
@@ -737,10 +737,6 @@ void Application::createTexture(VkDevice device, VkPhysicalDevice physicalDevice
void Application::processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& out_texture, bool srgb)
{
if(!isInited())
{
return;
}
std::unique_lock<std::mutex> lock(mtx);
if (out_texture.image == VK_NULL_HANDLE)
{
+3
View File
@@ -27,10 +27,13 @@ void ReceiveFacePoint(float* pos, int pointCount, int width, int height)
void TextureLoadProcessWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize)
{
if(FaceApp::Get()->isInited())
{
Texture& tex_bg = FaceApp::Get()->tex_bg;
FaceApp::Get()->processWithVulkan(data, width, height, rowStride, dataSize, tex_bg, false);
}
}
bool FaceApp::LoadOBJ(const std::string& filename,
std::vector<TextureLoadingVertexStructure>& vertices,