feat: Implement color animation in Metal shaders by using diffuse and emissive vertex constants for output color.

This commit is contained in:
aomizu 2025-12-25 15:10:54 +09:00
parent 8fb51991e0
commit 7cf7127810

View File

@ -321,7 +321,11 @@ namespace {
" }\n" " }\n"
" float4 pos4 = c.mvp * float4(skinned, 1.0);\n" " float4 pos4 = c.mvp * float4(skinned, 1.0);\n"
" out.position = pos4;\n" " out.position = pos4;\n"
" out.color = float4(1.0, 1.0, 1.0, 1.0);\n" " // Read diffuse (vc[28]) and emissive (vc[29]) for color animation\n"
" float4 diffuse = vc[28];\n"
" float4 emissive = vc[29];\n"
" float4 color = diffuse + emissive;\n"
" out.color = (diffuse.x > 1e30) ? float4(1.0, 1.0, 1.0, 1.0) : color;\n"
" out.texcoord = float2(0.0, 0.0);\n" " out.texcoord = float2(0.0, 0.0);\n"
" out.texcoord1 = float2(0.0, 0.0);\n" " out.texcoord1 = float2(0.0, 0.0);\n"
" out.viewZ = pos4.w;\n" " out.viewZ = pos4.w;\n"
@ -347,7 +351,11 @@ namespace {
" }\n" " }\n"
" float4 pos4 = c.mvp * float4(skinned, 1.0);\n" " float4 pos4 = c.mvp * float4(skinned, 1.0);\n"
" out.position = pos4;\n" " out.position = pos4;\n"
" out.color = float4(1.0, 1.0, 1.0, 1.0);\n" " // Read diffuse (vc[28]) and emissive (vc[29]) for color animation\n"
" float4 diffuse = vc[28];\n"
" float4 emissive = vc[29];\n"
" float4 color = diffuse + emissive;\n"
" out.color = (diffuse.x > 1e30) ? float4(1.0, 1.0, 1.0, 1.0) : color;\n"
" out.texcoord = in.texcoord;\n" " out.texcoord = in.texcoord;\n"
" out.texcoord1 = in.texcoord;\n" " out.texcoord1 = in.texcoord;\n"
" out.viewZ = pos4.w;\n" " out.viewZ = pos4.w;\n"
@ -373,7 +381,11 @@ namespace {
" }\n" " }\n"
" float4 pos4 = c.mvp * float4(skinned, 1.0);\n" " float4 pos4 = c.mvp * float4(skinned, 1.0);\n"
" out.position = pos4;\n" " out.position = pos4;\n"
" out.color = float4(1.0, 1.0, 1.0, 1.0);\n" " // Read diffuse (vc[28]) and emissive (vc[29]) for color animation\n"
" float4 diffuse = vc[28];\n"
" float4 emissive = vc[29];\n"
" float4 color = diffuse + emissive;\n"
" out.color = (diffuse.x > 1e30) ? float4(1.0, 1.0, 1.0, 1.0) : color;\n"
" out.texcoord = in.texcoord;\n" " out.texcoord = in.texcoord;\n"
" out.texcoord1 = in.texcoord1;\n" " out.texcoord1 = in.texcoord1;\n"
" out.viewZ = pos4.w;\n" " out.viewZ = pos4.w;\n"