protected float transferFunction( float f ) { f = ImageMath.gain(f, gain); f = ImageMath.bias(f, bias); return f; }
public float evaluate(float x, float y) { float v = original.evaluate( x, y ); switch ( bumpShape ) { case 1: // v = v > 0.5f ? 0.5f : v; v *= ImageMath.smoothStep( 0.45f, 0.55f, v ); break; case 2: v = v < 0.5f ? 0.5f : v; break; case 3: v = ImageMath.triangle( v ); break; case 4: v = ImageMath.circleDown( v ); break; case 5: v = ImageMath.gain( v, 0.75f ); break; } return v; } };
public int filterRGB(int x, int y, int rgb) { float nx = m00*x + m01*y; float ny = m10*x + m11*y; nx /= scale; ny /= scale * stretch; float f = fBm.evaluate(nx, ny); // Normalize to 0..1 f = (f-min)/(max-min); f = ImageMath.gain(f, gain); f = ImageMath.bias(f, bias); f *= amount; int a = rgb & 0xff000000; int v; if (colormap != null) v = colormap.getColor(f); else { v = PixelUtils.clamp((int)(f*255)); int r = v << 16; int g = v << 8; int b = v; v = a|r|g|b; } if (operation != PixelUtils.REPLACE) v = PixelUtils.combinePixels(rgb, v, operation); return v; }
public int filterRGB(int x, int y, int rgb) { float nx = m00*x + m01*y; float ny = m10*x + m11*y; nx /= scale; ny /= scale * stretch; float f = turbulence == 1.0 ? Noise.noise2(nx, ny) : Noise.turbulence2(nx, ny, turbulence); f = (f * 0.5f) + 0.5f; f = ImageMath.gain(f, gain); f = ImageMath.bias(f, bias); f *= amount; int a = rgb & 0xff000000; int v; if (colormap != null) v = colormap.getColor(f); else { v = PixelUtils.clamp((int)(f*255)); int r = v << 16; int g = v << 8; int b = v; v = a|r|g|b; } if (operation != PixelUtils.REPLACE) v = PixelUtils.combinePixels(rgb, v, operation); return v; }