test_class.file: runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java
test_class.identifier: SkyboxTest
test_case.body: @Test
  	public void testLoadSimple() throws IOException
  	{
  		Skybox skybox = new Skybox(CharSource.wrap("bounds 0 0 100 100 #00F // R 0 0 100 100\r\nr 99 99").openStream(), "simple");
  		Assert.assertEquals(0, skybox.getColorForPoint(0, 0, 0, 0, 0, 1, null));
  		int x = (99 * 64) + 32;
  		int y = (99 * 64) + 32;
  		Assert.assertEquals(0x0000FF, skybox.getColorForPoint(x, y, x, y, 0, 1, null));
  	}
test_case.class_method_signature: SkyboxTest.testLoadSimple()
test_case.full_signature: @Test public void testLoadSimple()
test_case.identifier: testLoadSimple
test_case.invocations: openStream wrap assertEquals getColorForPoint assertEquals getColorForPoint
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testLoadSimple()
focal_class.declarator: SQRT2 = Math.sqrt(2)
focal_class.modifier: private static final
focal_class.original_string: private static final double SQRT2 = Math.sqrt(2);
focal_class.type: double
focal_class.var_name: SQRT2
focal_class.declarator: BLEND_DISTRIBUTION = 3.075
focal_class.modifier: private static final
focal_class.original_string: private static final double BLEND_DISTRIBUTION = 3.075;
focal_class.type: double
focal_class.var_name: BLEND_DISTRIBUTION
focal_class.declarator: BLEND_RADIUS = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int BLEND_RADIUS = 5;
focal_class.type: int
focal_class.var_name: BLEND_RADIUS
focal_class.declarator: MAX_BLEND = (int) ((BLEND_RADIUS * 8) / BLEND_DISTRIBUTION)
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_BLEND = (int) ((BLEND_RADIUS * 8) / BLEND_DISTRIBUTION);
focal_class.type: int
focal_class.var_name: MAX_BLEND
focal_class.declarator: PLANE_ALL = 0b1111
focal_class.modifier: private static final
focal_class.original_string: private static final int PLANE_ALL = 0b1111;
focal_class.type: int
focal_class.var_name: PLANE_ALL
focal_class.declarator: PATTERN = Pattern.compile("^[ \\t]*(?<expr>" +
  		"//.*$|" + // //comment
  		"m[ \\t]*(?<mrx>[0-9]+)[ \\t]+(?<mry>[0-9]+)|" + // m <rx> <ry>
  		"r[ \\t]*(?<rx>[0-9]+)[ \\t]+(?<ry>[0-9]+)|" + // r <rx> <ry>
  		"R[ \\t]*(?<rx1>[0-9]+)[ \\t]+(?<ry1>[0-9]+)[ \\t]+(?<rx2>[0-9]+)[ \\t]+(?<ry2>[0-9]+)|" + // R <rx1> <ry1> <rx2> <ry2>
  		"c[ \\t]*(?<cx>[0-9-]+)[ \\t]+(?<cy>[0-9-]+)|" + // c <cx> <cy>
  		"C[ \\t]*(?<cx1>[0-9-]+)[ \\t]+(?<cy1>[0-9-]+)[ \\t]+(?<cx2>[0-9-]+)[ \\t]+(?<cy2>[0-9-]+)|" + // C <cx1> <cy1> <cx2> <cy2>
  		"#[ \\t]*(?<color>[0-9a-fA-F]{6}|[0-9a-fA-F]{3})|" + // #<RRGGBB> or #<RGB>
  		"p[ \\t]*(?<plane>all|0?[ \\t]*1?[ \\t]*2?[ \\t]*3?)|" + // p all or p<1><2><3><4>
  		"b[ \\t]*(?<blend>[0-9]+)|" + // b <blend>
  		"bounds[ \\t]+(?<bx1>[0-9]+)[ \\t]+(?<by1>[0-9]+)[ \\t]+(?<bx2>[0-9]+)[ \\t]+(?<by2>[0-9]+)" + // bounds <x0> <y0> <x1> <y1>
  		")[ \\t]*")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern PATTERN = Pattern.compile("^[ \\t]*(?<expr>" +
  		"//.*$|" + // //comment
  		"m[ \\t]*(?<mrx>[0-9]+)[ \\t]+(?<mry>[0-9]+)|" + // m <rx> <ry>
  		"r[ \\t]*(?<rx>[0-9]+)[ \\t]+(?<ry>[0-9]+)|" + // r <rx> <ry>
  		"R[ \\t]*(?<rx1>[0-9]+)[ \\t]+(?<ry1>[0-9]+)[ \\t]+(?<rx2>[0-9]+)[ \\t]+(?<ry2>[0-9]+)|" + // R <rx1> <ry1> <rx2> <ry2>
  		"c[ \\t]*(?<cx>[0-9-]+)[ \\t]+(?<cy>[0-9-]+)|" + // c <cx> <cy>
  		"C[ \\t]*(?<cx1>[0-9-]+)[ \\t]+(?<cy1>[0-9-]+)[ \\t]+(?<cx2>[0-9-]+)[ \\t]+(?<cy2>[0-9-]+)|" + // C <cx1> <cy1> <cx2> <cy2>
  		"#[ \\t]*(?<color>[0-9a-fA-F]{6}|[0-9a-fA-F]{3})|" + // #<RRGGBB> or #<RGB>
  		"p[ \\t]*(?<plane>all|0?[ \\t]*1?[ \\t]*2?[ \\t]*3?)|" + // p all or p<1><2><3><4>
  		"b[ \\t]*(?<blend>[0-9]+)|" + // b <blend>
  		"bounds[ \\t]+(?<bx1>[0-9]+)[ \\t]+(?<by1>[0-9]+)[ \\t]+(?<bx2>[0-9]+)[ \\t]+(?<by2>[0-9]+)" + // bounds <x0> <y0> <x1> <y1>
  		")[ \\t]*");
focal_class.type: Pattern
focal_class.var_name: PATTERN
focal_class.declarator: chunks
focal_class.modifier: private final
focal_class.original_string: private final int[] chunks;
focal_class.type: int[]
focal_class.var_name: chunks
focal_class.declarator: planeOverrides
focal_class.modifier: private final
focal_class.original_string: private final int[] planeOverrides;
focal_class.type: int[]
focal_class.var_name: planeOverrides
focal_class.declarator: x1
focal_class.modifier: private final
focal_class.original_string: private final int x1;
focal_class.type: int
focal_class.var_name: x1
focal_class.declarator: y1
focal_class.modifier: private final
focal_class.original_string: private final int y1;
focal_class.type: int
focal_class.var_name: y1
focal_class.declarator: x2
focal_class.modifier: private final
focal_class.original_string: private final int x2;
focal_class.type: int
focal_class.var_name: x2
focal_class.declarator: y2
focal_class.modifier: private final
focal_class.original_string: private final int y2;
focal_class.type: int
focal_class.var_name: y2
focal_class.declarator: stride
focal_class.modifier: private final
focal_class.original_string: private final int stride;
focal_class.type: int
focal_class.var_name: stride
focal_class.file: runelite-client/src/main/java/net/runelite/client/plugins/skybox/Skybox.java
focal_class.identifier: Skybox
focal_class.class_method_signature: Skybox.Skybox(InputStream is, String filename)
focal_class.full_signature: public  Skybox(InputStream is, String filename)
focal_class.identifier: Skybox
focal_class.modifiers: public
focal_class.parameters: (InputStream is, String filename)
focal_class.signature:  Skybox(InputStream is, String filename)
focal_class.class_method_signature: Skybox.Skybox(Reader reader, String filename)
focal_class.full_signature: public  Skybox(Reader reader, String filename)
focal_class.identifier: Skybox
focal_class.modifiers: public
focal_class.parameters: (Reader reader, String filename)
focal_class.signature:  Skybox(Reader reader, String filename)
focal_class.class_method_signature: Skybox.chunkData(int cx, int cy, int plane, ChunkMapper chunkMapper)
focal_class.full_signature: private int chunkData(int cx, int cy, int plane, ChunkMapper chunkMapper)
focal_class.identifier: chunkData
focal_class.modifiers: private
focal_class.parameters: (int cx, int cy, int plane, ChunkMapper chunkMapper)
focal_class.return: int
focal_class.signature: int chunkData(int cx, int cy, int plane, ChunkMapper chunkMapper)
focal_class.class_method_signature: Skybox.getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_class.full_signature: public int getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_class.identifier: getColorForPoint
focal_class.modifiers: public
focal_class.parameters: (double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_class.return: int
focal_class.signature: int getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_class.class_method_signature: Skybox.erf(double x)
focal_class.full_signature: private double erf(double x)
focal_class.identifier: erf
focal_class.modifiers: private
focal_class.parameters: (double x)
focal_class.return: double
focal_class.signature: double erf(double x)
focal_class.class_method_signature: Skybox.render(double resolution, int line, int plane, ChunkMapper chunkMapper)
focal_class.full_signature:  BufferedImage render(double resolution, int line, int plane, ChunkMapper chunkMapper)
focal_class.identifier: render
focal_class.parameters: (double resolution, int line, int plane, ChunkMapper chunkMapper)
focal_class.return: BufferedImage
focal_class.signature: BufferedImage render(double resolution, int line, int plane, ChunkMapper chunkMapper)
focal_method.body: public int getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
  	{
  		x /= 8.d;
  		y /= 8.d;
  
  		int cx = (int) x;
  		int cy = (int) y;
  
  		int centerChunkData = chunkData(px / 8, py / 8, plane, chunkMapper);
  		if (centerChunkData == -1)
  		{
  			// No data in the center chunk?
  			return 0;
  		}
  
  		double t = 0;
  		double ty = 0;
  		double tco = 0;
  		double tcg = 0;
  
  		int xmin = (int) (x - BLEND_RADIUS);
  		int xmax = (int) Math.ceil(x + BLEND_RADIUS);
  		int ymin = (int) (y - BLEND_RADIUS);
  		int ymax = (int) Math.ceil(y + BLEND_RADIUS);
  
  		for (int ucx = xmin; ucx < xmax; ucx++)
  		{
  			for (int ucy = ymin; ucy <= ymax; ucy++)
  			{
  				int val = chunkData(ucx, ucy, plane, chunkMapper);
  				if (val == -1)
  				{
  					continue;
  				}
  
  				// Get the blend value, add 1/8 tile to make sure we don't div/0, convert to chunks
  				double sigma = ((val >>> 24) + .125) / 8.d;
  
  				// Calculate how far we have to be away before we can discard this value without
  				// becoming visibly discontinuous
  				double minDist = 1 + (sigma * BLEND_DISTRIBUTION);
  
  				// Try to fast-fail
  				double dxl = ucx - x;
  				double dxh = dxl + 1.d;
  				if (dxl < -minDist || dxl > minDist)
  				{
  					continue;
  				}
  
  				double dyl = ucy - y;
  				double dyh = dyl + 1.d;
  				if (dyl < -minDist || dyh > minDist)
  				{
  					continue;
  				}
  
  				// Calculate integrate a gaussian distribution in each dimension for
  				// this chunk relative to the requested point
  				double erfdivc = sigma * SQRT2;
  				double m = (erf(dxl / erfdivc) - erf(dxh / erfdivc)) * (erf(dyl / erfdivc) - erf(dyh / erfdivc));
  
  				// Load our YCoCg24 values into floats
  				double vy = (val >>> 16 & 0xFF) / 255.d;
  				double vco = (byte) (val >>> 8) / 128.d;
  				double vcg = (byte) val / 128.d;
  
  				// And multiply by the weight
  				ty += vy * m;
  				tco += vco * m;
  				tcg += vcg * m;
  				t += m;
  			}
  		}
  
  		// Convert back to int range values, and bounds check while we are at it
  		byte ay = (byte) Math.min(Math.max(Math.round(ty / t * 255.d), 0), 255);
  		byte aco = (byte) Math.min(Math.max(Math.round(tco * 128.d / t), -128), 127);
  		byte acg = (byte) Math.min(Math.max(Math.round(tcg * 128.d / t), -128), 127);
  
  		// convert back to rgb from YCoCg24
  		int g = (ay - (acg >> 1)) & 0xFF;
  		int tmp = (g + acg) & 0xFF;
  		int r = (tmp - (aco >> 1)) & 0xFF;
  		int b = (r + aco) & 0xFF;
  
  		// increase brightness with HSB
  		float[] hsb = Color.RGBtoHSB(r, g, b, null);
  		hsb[2] = (float) Math.pow(hsb[2], brightness);
  
  		return 0xFFFFFF & Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
  	}
focal_method.class_method_signature: Skybox.getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_method.full_signature: public int getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_method.identifier: getColorForPoint
focal_method.invocations: chunkData ceil ceil chunkData erf erf erf erf min max round min max round min max round RGBtoHSB pow HSBtoRGB
focal_method.modifiers: public
focal_method.parameters: (double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)
focal_method.return: int
focal_method.signature: int getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper)