完成双贴图效果,修改闪退的bug,换成赴宴的贴图
This commit is contained in:
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 |
@@ -6,6 +6,7 @@ layout (binding = 2) uniform sampler2D samplerColor_ex;
|
|||||||
layout (location = 0) in vec2 inUV;
|
layout (location = 0) in vec2 inUV;
|
||||||
layout (location = 1) in vec3 inNormal;
|
layout (location = 1) in vec3 inNormal;
|
||||||
|
|
||||||
|
|
||||||
layout (location = 0) out vec4 outFragColor;
|
layout (location = 0) out vec4 outFragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@@ -24,9 +25,9 @@ void main()
|
|||||||
// 重新映射ndot值,让中间2/3部分进行融合
|
// 重新映射ndot值,让中间2/3部分进行融合
|
||||||
// 当ndot在[0.166, 0.833]范围内时进行混合,两端保持不变
|
// 当ndot在[0.166, 0.833]范围内时进行混合,两端保持不变
|
||||||
float blendFactor;
|
float blendFactor;
|
||||||
if (ndot < 0.166) {
|
if (ndot < 0.266) {
|
||||||
blendFactor = 0.0; // 完全使用color_ex
|
blendFactor = 0.0; // 完全使用color_ex
|
||||||
} else if (ndot > 0.833) {
|
} else if (ndot > 0.733) {
|
||||||
blendFactor = 1.0; // 完全使用color
|
blendFactor = 1.0; // 完全使用color
|
||||||
} else {
|
} else {
|
||||||
// 在中间2/3部分进行平滑过渡
|
// 在中间2/3部分进行平滑过渡
|
||||||
@@ -42,4 +43,6 @@ void main()
|
|||||||
vec4 blendedColor = mix(color_ex, color, blendFactor);
|
vec4 blendedColor = mix(color_ex, color, blendFactor);
|
||||||
|
|
||||||
outFragColor = blendedColor;
|
outFragColor = blendedColor;
|
||||||
|
|
||||||
|
// outFragColor = vec4(1, 0, 0, 1);
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -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)
|
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);
|
std::unique_lock<std::mutex> lock(mtx);
|
||||||
if (out_texture.image == VK_NULL_HANDLE)
|
if (out_texture.image == VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,8 +28,11 @@ void ReceiveFacePoint(float* pos, int pointCount, int width, int height)
|
|||||||
|
|
||||||
void TextureLoadProcessWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize)
|
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;
|
Texture& tex_bg = FaceApp::Get()->tex_bg;
|
||||||
FaceApp::Get()->processWithVulkan(data, width, height, rowStride, dataSize, tex_bg, false);
|
FaceApp::Get()->processWithVulkan(data, width, height, rowStride, dataSize, tex_bg, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FaceApp::LoadOBJ(const std::string& filename,
|
bool FaceApp::LoadOBJ(const std::string& filename,
|
||||||
|
|||||||
Reference in New Issue
Block a user