//Uniforms uniform sampler2D tex; //Incoming texture uniform float inv_width; //1.0 / screen_width uniform float inv_height; uniform int effect_type; //Value used in a switch statement to determine which effect to use uniform float delta_time; //time since launch (glfwGetTime()), see www.opengl-tutorial.org/miscellaneous/an-fps-counter/ uniform vec3 eye_pos; //camera position //Layouts (I/O) layout(location = 0) in vec2 tex_coord; layout(location = 1) in vec3 vertex_position; layout(location = 0) out vec4 out_colour; //A useful function for some interesting things you can do with coordinates bool logicalXOR(bool a, bool b) { if (!a != !b) return true; return false; } //Some filters were taken from (adapted from) Mojang's game, Minecraft, so they require this variable vec2 oneTexel = vec2(inv_width, inv_height); //Pixel coordinates int positionX = int(tex_coord.x / inv_width); int positionY = int(tex_coord.y / inv_height); //Variables used in Mojang sobel calculations vec4 centre = texture(tex, tex_coord); vec4 lef = texture(tex, tex_coord - vec2(oneTexel.x, 0.0)); vec4 rig = texture(tex, tex_coord + vec2(oneTexel.x, 0.0)); vec4 up = texture(tex, tex_coord - vec2(0.0, oneTexel.y)); vec4 dow = texture(tex, tex_coord + vec2(0.0, oneTexel.y)); //Use to reduce or increase the risk of causing an epileptic seizure. int scaledTime = int(floor(delta_time * 24));
0 Comments
Leave a Reply. |
AuthorHi there, the name's Matthew Jenkinson and I'm currently working at Firesprite. In my spare time I work on programming projects like you see here. Archives
March 2021
CategoriesLinks to each effect in order:
|