2
0
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:
Jack Andersen
2018-06-06 18:43:26 -10:00
parent e63102e180
commit ac424ff9eb
31 changed files with 1651 additions and 1060 deletions

View File

@@ -15,7 +15,7 @@ static const char* LightingGLSL =
"};\n"
"struct Fog\n"
"{\n"
" uint mode;\n"
" int mode;\n"
" vec4 color;\n"
" float rangeScale;\n"
" float start;\n"
@@ -32,13 +32,13 @@ static const char* LightingGLSL =
" Fog fog;\n"
"};\n"
"\n"
"vec4 LightingFunc(vec4 mvPosIn, vec4 mvNormIn)\n"
"vec4 LightingFunc(vec3 mvPosIn, vec3 mvNormIn)\n"
"{\n"
" vec4 ret = ambient;\n"
" \n"
" for (int i=0 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
" {\n"
" vec3 delta = mvPosIn.xyz - lights[i].pos.xyz;\n"
" vec3 delta = mvPosIn - lights[i].pos.xyz;\n"
" float dist = length(delta);\n"
" float angDot = clamp(dot(normalize(delta), lights[i].dir.xyz), 0.0, 1.0);\n"
" float att = 1.0 / (lights[i].linAtt[2] * dist * dist +\n"
@@ -47,7 +47,7 @@ static const char* LightingGLSL =
" float angAtt = lights[i].angAtt[2] * angDot * angDot +\n"
" lights[i].angAtt[1] * angDot +\n"
" lights[i].angAtt[0];\n"
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0);\n"
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn), 0.0, 1.0);\n"
" }\n"
" \n"
" return ret;\n"
@@ -64,7 +64,7 @@ static const char* LightingShadowGLSL =
"};\n"
"struct Fog\n"
"{\n"
" uint mode;\n"
" int mode;\n"
" vec4 color;\n"
" float rangeScale;\n"
" float start;\n"
@@ -81,14 +81,14 @@ static const char* LightingShadowGLSL =
" Fog fog;\n"
"};\n"
"\n"
"vec4 LightingShadowFunc(vec4 mvPosIn, vec4 mvNormIn)\n"
"vec4 LightingShadowFunc(vec3 mvPosIn, vec3 mvNormIn)\n"
"{\n"
" vec2 shadowUV = vtf.extTcgs[0];\n"
" shadowUV.y = 1.0 - shadowUV.y;\n"
" \n"
" vec4 ret = ambient;\n"
" \n"
" vec3 delta = mvPosIn.xyz - lights[0].pos.xyz;\n"
" vec3 delta = mvPosIn - lights[0].pos.xyz;\n"
" float dist = length(delta);\n"
" float angDot = clamp(dot(normalize(delta), lights[0].dir.xyz), 0.0, 1.0);\n"
" float att = 1.0 / (lights[0].linAtt[2] * dist * dist +\n"
@@ -97,12 +97,12 @@ static const char* LightingShadowGLSL =
" float angAtt = lights[0].angAtt[2] * angDot * angDot +\n"
" lights[0].angAtt[1] * angDot +\n"
" lights[0].angAtt[0];\n"
" ret += lights[0].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0) *\n"
" ret += lights[0].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn), 0.0, 1.0) *\n"
" texture(extTex7, shadowUV).r;\n"
" \n"
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
" {\n"
" vec3 delta = mvPosIn.xyz - lights[i].pos.xyz;\n"
" vec3 delta = mvPosIn - lights[i].pos.xyz;\n"
" float dist = length(delta);\n"
" float angDot = clamp(dot(normalize(delta), lights[i].dir.xyz), 0.0, 1.0);\n"
" float att = 1.0 / (lights[i].linAtt[2] * dist * dist +\n"
@@ -111,7 +111,7 @@ static const char* LightingShadowGLSL =
" float angAtt = lights[i].angAtt[2] * angDot * angDot +\n"
" lights[i].angAtt[1] * angDot +\n"
" lights[i].angAtt[0];\n"
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0);\n"
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn), 0.0, 1.0);\n"
" }\n"
" \n"
" return ret;\n"