package com.haxademic.core.image.filters.shaders;

import com.haxademic.core.system.FileUtil;

import processing.core.PApplet;
import processing.core.PGraphics;
import processing.opengl.PShader;

public class BaseFilter {

	protected PShader shader;

	public BaseFilter(PApplet p, String shaderFilePath) {
		shader = p.loadShader(FileUtil.getFile(shaderFilePath));
		setTime(0);
	}

	public void applyTo(PGraphics pg) {
		pg.filter(shader);
	}
	
	public void applyTo(PApplet p) {
		p.filter(shader);
	}
	
	public void setTime(float time) {
		shader.set("time", time);
	}
	
}

@@ -242,16 +242,39 @@
  shader;
+%0A%09protected float time;
 %0A%0A%09publi
@@ -552,24 +552,44 @@
 oat time) %7B%0A
+%09%09this.time = time;%0A
 %09%09shader.set
@@ -609,10 +609,56 @@
 );%0A%09%7D%0A%09%0A
+%09public float getTime() %7B%0A%09%09return time;%0A%09%7D%0A%09%0A
 %7D%0A

Add time to all shaders, since most of them need it