Looks like we make use of fmod, make a GLSL function for it!

This commit is contained in:
Ryan Houdek 2011-12-11 07:02:13 -06:00 committed by Sonicadvance1
parent ba12c0b4f5
commit 7f12daa014
1 changed files with 9 additions and 0 deletions

View File

@ -582,6 +582,15 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
WRITE(p, "#define saturate(x) clamp(x, 0.0f, 1.0f)\n"); WRITE(p, "#define saturate(x) clamp(x, 0.0f, 1.0f)\n");
WRITE(p, "#define lerp(x, y, z) mix(x, y, z)\n"); WRITE(p, "#define lerp(x, y, z) mix(x, y, z)\n");
// A function here
// Fmod implementation gleaned from Nvidia
// At http://http.developer.nvidia.com/Cg/fmod.html
WRITE(p, "float fmod( float x, float y )\n");
WRITE(p, "{\n");
WRITE(p, "float z = fract( abs( x / y) ) * abs( y );\n");
WRITE(p, "return (x < 0) ? -z : z;\n");
WRITE(p, "}\n");
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
WRITE(p, "%suniform sampler2D samp%d;\n", WriteBinding(ApiType, i), i); WRITE(p, "%suniform sampler2D samp%d;\n", WriteBinding(ApiType, i), i);