mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-13 06:46:10 +00:00
Implement CFluidPlaneGPU for GPU-computed water ripples
This commit is contained in:
@@ -14,7 +14,7 @@ static const char* LightingMetal =
|
||||
"};\n"
|
||||
"struct Fog\n"
|
||||
"{\n"
|
||||
" uint mode;\n"
|
||||
" int mode;\n"
|
||||
" float4 color;\n"
|
||||
" float rangeScale;\n"
|
||||
" float start;\n"
|
||||
@@ -31,13 +31,13 @@ static const char* LightingMetal =
|
||||
" Fog fog;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"static float4 LightingFunc(constant LightingUniform& lu, float4 mvPosIn, float4 mvNormIn, thread VertToFrag& vtf)\n"
|
||||
"static float4 LightingFunc(constant LightingUniform& lu, float3 mvPosIn, float3 mvNormIn, thread VertToFrag& vtf)\n"
|
||||
"{\n"
|
||||
" float4 ret = lu.ambient;\n"
|
||||
" \n"
|
||||
" for (int i=0 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
||||
" {\n"
|
||||
" float3 delta = mvPosIn.xyz - lu.lights[i].pos.xyz;\n"
|
||||
" float3 delta = mvPosIn - lu.lights[i].pos.xyz;\n"
|
||||
" float dist = length(delta);\n"
|
||||
" float angDot = saturate(dot(normalize(delta), lu.lights[i].dir.xyz));\n"
|
||||
" float att = 1.0 / (lu.lights[i].linAtt[2] * dist * dist +\n"
|
||||
@@ -46,7 +46,7 @@ static const char* LightingMetal =
|
||||
" float angAtt = lu.lights[i].angAtt[2] * angDot * angDot +\n"
|
||||
" lu.lights[i].angAtt[1] * angDot +\n"
|
||||
" lu.lights[i].angAtt[0];\n"
|
||||
" ret += lu.lights[i].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn.xyz));\n"
|
||||
" ret += lu.lights[i].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn));\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" return ret;\n"
|
||||
@@ -63,7 +63,7 @@ static const char* LightingShadowMetal =
|
||||
"};\n"
|
||||
"struct Fog\n"
|
||||
"{\n"
|
||||
" uint mode;\n"
|
||||
" int mode;\n"
|
||||
" float4 color;\n"
|
||||
" float rangeScale;\n"
|
||||
" float start;\n"
|
||||
@@ -80,12 +80,12 @@ static const char* LightingShadowMetal =
|
||||
" Fog fog;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"static float4 EXTLightingShadowFunc(constant LightingUniform& lu, float4 mvPosIn, float4 mvNormIn,\n"
|
||||
"static float4 EXTLightingShadowFunc(constant LightingUniform& lu, float3 mvPosIn, float3 mvNormIn,\n"
|
||||
" thread VertToFrag& vtf, sampler samp, sampler clampSamp, texture2d<float> extTex7)\n"
|
||||
"{\n"
|
||||
" float4 ret = lu.ambient;\n"
|
||||
" \n"
|
||||
" float3 delta = mvPosIn.xyz - lu.lights[0].pos.xyz;\n"
|
||||
" float3 delta = mvPosIn - lu.lights[0].pos.xyz;\n"
|
||||
" float dist = length(delta);\n"
|
||||
" float angDot = saturate(dot(normalize(delta), lu.lights[0].dir.xyz));\n"
|
||||
" float att = 1.0 / (lu.lights[0].linAtt[2] * dist * dist +\n"
|
||||
@@ -94,12 +94,12 @@ static const char* LightingShadowMetal =
|
||||
" float angAtt = lu.lights[0].angAtt[2] * angDot * angDot +\n"
|
||||
" lu.lights[0].angAtt[1] * angDot +\n"
|
||||
" lu.lights[0].angAtt[0];\n"
|
||||
" ret += lu.lights[0].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn.xyz)) *\n"
|
||||
" ret += lu.lights[0].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn)) *\n"
|
||||
" extTex7.sample(clampSamp, vtf.extTcgs0).r;\n"
|
||||
" \n"
|
||||
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
||||
" {\n"
|
||||
" float3 delta = mvPosIn.xyz - lu.lights[i].pos.xyz;\n"
|
||||
" float3 delta = mvPosIn - lu.lights[i].pos.xyz;\n"
|
||||
" float dist = length(delta);\n"
|
||||
" float angDot = saturate(dot(normalize(delta), lu.lights[i].dir.xyz));\n"
|
||||
" float att = 1.0 / (lu.lights[i].linAtt[2] * dist * dist +\n"
|
||||
@@ -108,7 +108,7 @@ static const char* LightingShadowMetal =
|
||||
" float angAtt = lu.lights[i].angAtt[2] * angDot * angDot +\n"
|
||||
" lu.lights[i].angAtt[1] * angDot +\n"
|
||||
" lu.lights[i].angAtt[0];\n"
|
||||
" ret += lu.lights[i].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn.xyz));\n"
|
||||
" ret += lu.lights[i].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn));\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" return ret;\n"
|
||||
|
||||
Reference in New Issue
Block a user