public void ExecuteRow( Vector2 screenUV, Vector2 objUV, int cols, float screenUVdx, float objUVdx, Color[] backbuffer, int backbufferOffset, ref Texture texture, ref ShaderGlobals globals) { int texY = Shaders.SampleTextureY(texture, objUV); float darkXfac = -0.5f + globals.CosTime1000 * 0.1f; screenUV.x += darkXfac; float darkY = screenUV.y - 0.5f + globals.CosTime600 * 0.1f; float darkY2 = darkY * darkY; float darkFac = 1.0f - 4.0f * darkY2; uint ditherOffset = (uint)(backbufferOffset + (int)globals.Time); for (int x = 0; x < cols; ++x, screenUV.x += screenUVdx, objUV.x += objUVdx, backbufferOffset++, ++ditherOffset) { Color result = new Color(0xFF000000); float darkX = screenUV.x; float dark = darkFac - 4f * darkX * darkX; if (dark > 0.0f) { result = Shaders.SampleTextureX(texture, texY, objUV); uint darkI = (uint)(dark * 255.0f); result.Scale(darkI); result = Shaders.Dither(result, ditherOffset); } backbuffer[backbufferOffset] = result; } }
public void ExecuteRow( Vector2 screenUV, Vector2 objUV, int cols, float screenUVdx, float objUVdx, Color[] backbuffer, int backbufferOffset, ref Texture texture, ref ShaderGlobals globals) { int texY = Shaders.SampleTextureY(texture, objUV); for (int x = 0; x < cols; ++x, objUV.x += objUVdx, backbufferOffset++) { Color result = Shaders.SampleTextureX(texture, texY, objUV); if (result.A > 0) { backbuffer[backbufferOffset] = result; } } }