diff --git a/compare_med.glsl b/compare_med.glsl deleted file mode 100644 index 2ab82d5..0000000 --- a/compare_med.glsl +++ /dev/null @@ -1,20 +0,0 @@ -// Compute the pixelwise diff between two textures. -// Computes the diff for each color chanel separately (r, g, b). -// Assumes both images are not transparent. - -// try isampler2D, ivec4 etc.? Probably not -uniform vec2 size; -uniform vec2 offs; -uniform sampler2D base; -uniform sampler2D curr; - -void main(void) -{ - vec2 pos = (gl_FragCoord.xy-offs)/size; - pos.y = 1.0 - pos.y; - vec4 color = texture2D(curr, pos); - vec4 basecolor = texture2D(base, pos); - color.xyz = color.xyz - basecolor.xyz; - color.xyz = (vec3(1.0, 1.0, 1.0) + color.xyz)/2.0; - gl_FragColor = color; -} diff --git a/fire.glsl b/fire.glsl deleted file mode 100644 index 9f73a96..0000000 --- a/fire.glsl +++ /dev/null @@ -1,38 +0,0 @@ -#ifdef GL_ES -precision mediump float; -#endif - -uniform float time; -uniform vec2 mouse; -uniform vec2 resolution; - -float smove(float value) -{ - return (value + 1.0)/2.0; -} - -float rand(vec2 co){ - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); -} - -void main(void) -{ - vec2 pos = gl_FragCoord.xy; // rename for more meaty code - mouse.y = -mouse.y; -// vec2 uv = pos/resolution.xy; -// vec2 muv = mouse/resolution.xy; - - float scale = 100; - float modifier = sin(pos.x/scale + time)*sin(pos.y/scale - time); - modifier = smove(modifier); - - float dist = distance(gl_FragCoord.xy, mouse); - float radius = smove(sin(time))*50 + 100; - - float value = max(1 - dist/radius, 0); - value = value + modifier*0.3; - - value = value + (rand(pos.x*pos.y)-0.5)*0.03; - - gl_FragColor = vec4(value); -} diff --git a/src/Fitness.cpp b/src/Fitness.cpp index f6e9319..8508cbc 100644 --- a/src/Fitness.cpp +++ b/src/Fitness.cpp @@ -4,9 +4,6 @@ -Fitness::Fitness() {} - - Fitness::Fitness(sf::Texture target, float scale) { this->target = target; @@ -36,7 +33,7 @@ bool Fitness::loadShader(std::string filename) } -double Fitness::of(Chromosome chr) +unsigned long long Fitness::of(Chromosome chr) { // first, render a reduced, shaderized version to RenderTextures this->tex.clear(); @@ -52,7 +49,7 @@ double Fitness::of(Chromosome chr) // then, download the result as an image and add the pixels sf::Image image = this->comp.getTexture().copyToImage(); sf::Vector2u size = image.getSize(); - double fitness = 0; + unsigned long long fitness = 0; for (unsigned int x=0; x