private static float eaxDbToAmp(float eaxDb){ float dB = eaxDb / 2000f; return FastMath.pow(10f, dB); }
/** * Updates the frustum splits stores in <code>splits</code> using PSSM. */ public static void updateFrustumSplits(float[] splits, float near, float far, float lambda) { for (int i = 0; i < splits.length; i++) { float IDM = i / (float) splits.length; float log = near * FastMath.pow((far / near), IDM); float uniform = near + (far - near) * IDM; splits[i] = log * lambda + uniform * (1.0f - lambda); } // This is used to improve the correctness of the calculations. Our main near- and farplane // of the camera always stay the same, no matter what happens. splits[0] = near; splits[splits.length - 1] = far; }
@Override public float apply(float value) { return FastMath.pow(2f, -10f * value) * FastMath.sin((value - 0.3f / 4f) * (2f * FastMath.PI) / 0.3f) + 1f; } };
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; }
/** * Inits the mip maps of a cube map witht he given number of mip maps * @param nbMipMaps the number of mip maps to initialize */ public void initMipMaps(int nbMipMaps) { int maxMipMap = (int) (Math.log(image.getWidth()) / Math.log(2) + 1); if (nbMipMaps > maxMipMap) { throw new IllegalArgumentException("Max mip map number for a " + image.getWidth() + "x" + image.getHeight() + " cube map is " + maxMipMap); } sizes = new int[nbMipMaps]; int totalSize = 0; for (int i = 0; i < nbMipMaps; i++) { int size = (int) pow(2, maxMipMap - 1 - i); sizes[i] = size * size * image.getFormat().getBitsPerPixel() / 8; totalSize += sizes[i]; } image.setMipMapSizes(sizes); image.getData().clear(); for (int i = 0; i < 6; i++) { image.addData(BufferUtils.createByteBuffer(totalSize)); } mipMapRaster = new MipMapImageRaster(image, 0); } }
/** * Forcefully takes over Camera adding functionality and placing it behind the character * @param tpf Tickes Per Frame */ private void camTakeOver(float tpf) { cam.setLocation(player.getLocalTranslation().add(-8, 2, 0)); cam.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y); Quaternion rot = new Quaternion(); rot.fromAngleNormalAxis(camAngle, Vector3f.UNIT_Z); cam.setRotation(cam.getRotation().mult(rot)); camAngle *= FastMath.pow(.99f, fpsRate * tpf); }
private static final float eaxDbToAmp(float eaxDb){ float dB = eaxDb / 2000f; return FastMath.pow(10f, dB); }
private static float eaxDbToAmp(float eaxDb){ float dB = eaxDb / 2000f; return FastMath.pow(10f, dB); }
/** * Updates the frustum splits stores in <code>splits</code> using PSSM. */ public static void updateFrustumSplits(float[] splits, float near, float far, float lambda) { for (int i = 0; i < splits.length; i++) { float IDM = i / (float) splits.length; float log = near * FastMath.pow((far / near), IDM); float uniform = near + (far - near) * IDM; splits[i] = log * lambda + uniform * (1.0f - lambda); } // This is used to improve the correctness of the calculations. Our main near- and farplane // of the camera always stay the same, no matter what happens. splits[0] = near; splits[splits.length - 1] = far; }
/** * Updates the frustum splits stores in <code>splits</code> using PSSM. */ public static void updateFrustumSplits(float[] splits, float near, float far, float lambda) { for (int i = 0; i < splits.length; i++) { float IDM = i / (float) splits.length; float log = near * FastMath.pow((far / near), IDM); float uniform = near + (far - near) * IDM; splits[i] = log * lambda + uniform * (1.0f - lambda); } // This is used to improve the correctness of the calculations. Our main near- and farplane // of the camera always stay the same, no matter what happens. splits[0] = near; splits[splits.length - 1] = far; }
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; }
/** * Inits the mip maps of a cube map witht he given number of mip maps * @param nbMipMaps the number of mip maps to initialize */ public void initMipMaps(int nbMipMaps) { int maxMipMap = (int) (Math.log(image.getWidth()) / Math.log(2) + 1); if (nbMipMaps > maxMipMap) { throw new IllegalArgumentException("Max mip map number for a " + image.getWidth() + "x" + image.getHeight() + " cube map is " + maxMipMap); } sizes = new int[nbMipMaps]; int totalSize = 0; for (int i = 0; i < nbMipMaps; i++) { int size = (int) pow(2, maxMipMap - 1 - i); sizes[i] = size * size * image.getFormat().getBitsPerPixel() / 8; totalSize += sizes[i]; } image.setMipMapSizes(sizes); image.getData().clear(); for (int i = 0; i < 6; i++) { image.addData(BufferUtils.createByteBuffer(totalSize)); } mipMapRaster = new MipMapImageRaster(image, 0); } }
/** * Forcefully takes over Camera adding functionality and placing it behind the character * @param tpf Tickes Per Frame */ private void camTakeOver(float tpf) { cam.setLocation(player.getLocalTranslation().add(-8, 2, 0)); cam.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y); Quaternion rot = new Quaternion(); rot.fromAngleNormalAxis(camAngle, Vector3f.UNIT_Z); cam.setRotation(cam.getRotation().mult(rot)); camAngle *= FastMath.pow(.99f, fpsRate * tpf); }