Java Code Examples for com.jme3.math.FastMath#pow()
The following examples show how to use
com.jme3.math.FastMath#pow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LeaderFollowingBehavior.java From MonkeyBrains with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Calculates the factor in order to change the focus */ private float calculateFocusFactor(float distanceFromFocus) { float factor; if (distanceFromFocus > this.distanceToChangeFocus) { factor = 1; } else { factor = FastMath.pow((1 + distanceFromFocus / this.distanceToChangeFocus), 2); } return factor; }
Example 2
Source File: CubeField.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * 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); }
Example 3
Source File: PssmShadowUtil.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * 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; }
Example 4
Source File: BinaryExporter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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; }
Example 5
Source File: PssmShadowUtil.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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; }
Example 6
Source File: CubeField.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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); }
Example 7
Source File: BinaryExporter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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; }
Example 8
Source File: Environment.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static float eaxDbToAmp(float eaxDb){ float dB = eaxDb / 2000f; return FastMath.pow(10f, dB); }
Example 9
Source File: Environment.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
private static final float eaxDbToAmp(float eaxDb){ float dB = eaxDb / 2000f; return FastMath.pow(10f, dB); }