/** * The maximum lod supported by this terrain patch. * If the patch size is 32 then the returned value would be log2(32)-2 = 3 * You can then use that value, 3, to see how many times you can divide 32 by 2 * before the terrain gets too un-detailed (can't stitch it any further). * @return the maximum LOD */ public int getMaxLod() { if (maxLod < 0) maxLod = Math.max(1, (int) (FastMath.log(size-1)/FastMath.log(2)) -1); // -1 forces our minimum of 4 triangles wide return maxLod; }
protected byte[] generateTag() { int width = ((int) FastMath.log(aliasCount, 256) + 1); int count = aliasCount; aliasCount++; byte[] bytes = new byte[width]; for (int x = width - 1; x >= 0; x--) { int pow = (int) FastMath.pow(256, x); int factor = count / pow; bytes[width - x - 1] = (byte) factor; count %= pow; } return bytes; }
int aliasSize = ((int) FastMath.log(classNum, 256) + 1); // make all
aliasWidth = ((int)FastMath.log(numClasses, 256) + 1);
/** * The maximum lod supported by this terrain patch. * If the patch size is 32 then the returned value would be log2(32)-2 = 3 * You can then use that value, 3, to see how many times you can divide 32 by 2 * before the terrain gets too un-detailed (can't stitch it any further). * @return the maximum LOD */ public int getMaxLod() { if (maxLod < 0) maxLod = Math.max(1, (int) (FastMath.log(size-1)/FastMath.log(2)) -1); // -1 forces our minimum of 4 triangles wide return maxLod; }
protected byte[] generateTag() { int width = ((int) FastMath.log(aliasCount, 256) + 1); int count = aliasCount; aliasCount++; byte[] bytes = new byte[width]; for (int x = width - 1; x >= 0; x--) { int pow = (int) FastMath.pow(256, x); int factor = count / pow; bytes[width - x - 1] = (byte) factor; count %= pow; } return bytes; }
protected byte[] generateTag() { int width = ((int) FastMath.log(aliasCount, 256) + 1); int count = aliasCount; aliasCount++; byte[] bytes = new byte[width]; for (int x = width - 1; x >= 0; x--) { int pow = (int) FastMath.pow(256, x); int factor = count / pow; bytes[width - x - 1] = (byte) factor; count %= pow; } return bytes; }
int aliasSize = ((int) FastMath.log(classNum, 256) + 1); // make all
int aliasSize = ((int) FastMath.log(classNum, 256) + 1); // make all
aliasWidth = ((int)FastMath.log(numClasses, 256) + 1);
aliasWidth = ((int)FastMath.log(numClasses, 256) + 1);