@Test(expected = RuntimeException.class) public void testPoolReleaseNullError() { Vector2.releaseTempInstance(null); }
/** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. * * @param check * the vector to check against - null will return false. * @param buf * the buffer to compare data with * @param index * the position (in terms of vectors, not floats) of the vector in the buffer to check against * @return */ public static boolean equals(final ReadOnlyVector2 check, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector2.releaseTempInstance(temp); return equals; }
/** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. * * @param check * the vector to check against - null will return false. * @param buf * the buffer to compare data with * @param index * the position (in terms of vectors, not floats) of the vector in the buffer to check against * @return */ public static boolean equals(final ReadOnlyVector2 check, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector2.releaseTempInstance(temp); return equals; }
/** * Normalize a Vector2 in-buffer. * * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to normalize */ public static void normalizeVector2(final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.normalizeLocal(); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Normalize a Vector2 in-buffer. * * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to normalize */ public static void normalizeVector2(final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.normalizeLocal(); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Multiply and store a Vector2 in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to multiply */ public static void multInBuffer(final ReadOnlyVector2 toMult, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.multiplyLocal(toMult); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Add to a Vector2 in-buffer. * * @param toAdd * the vector to add from * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to add to */ public static void addInBuffer(final ReadOnlyVector2 toAdd, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.addLocal(toAdd); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Multiply and store a Vector2 in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to multiply */ public static void multInBuffer(final ReadOnlyVector2 toMult, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.multiplyLocal(toMult); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
/** * Add to a Vector2 in-buffer. * * @param toAdd * the vector to add from * @param buf * the buffer to find the Vector2 within * @param index * the position (in terms of vectors, not floats) of the vector to add to */ public static void addInBuffer(final ReadOnlyVector2 toAdd, final FloatBuffer buf, final int index) { final Vector2 temp = Vector2.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.addLocal(toAdd); setInBuffer(temp, buf, index); Vector2.releaseTempInstance(temp); }
result.setOrigin(origin); result.setDirection(direction); Vector2.releaseTempInstance(pos); Vector3.releaseTempInstance(origin); Vector3.releaseTempInstance(direction);
result.setOrigin(origin); result.setDirection(direction); Vector2.releaseTempInstance(pos); Vector3.releaseTempInstance(origin); Vector3.releaseTempInstance(direction);
Vector3.releaseTempInstance(def); Vector2.releaseTempInstance(x0x1); Vector2.releaseTempInstance(y0y1);
Vector3.releaseTempInstance(def); Vector2.releaseTempInstance(x0x1); Vector2.releaseTempInstance(y0y1);
Vector2.releaseTempInstance(temp); updateWorldRenderStates(true); _particleMesh.getSceneHints().setCastsShadows(false);
Vector2.releaseTempInstance(temp); updateWorldRenderStates(true); _particleMesh.getSceneHints().setCastsShadows(false);
@Test public void testValid() { final Vector2 vec1 = new Vector2(0, 0); final Vector2 vec2 = new Vector2(Double.POSITIVE_INFINITY, 0); final Vector2 vec3 = new Vector2(0, Double.NEGATIVE_INFINITY); final Vector2 vec4 = new Vector2(Double.NaN, 0); final Vector2 vec5 = new Vector2(0, Double.NaN); assertTrue(Vector2.isValid(vec1)); assertFalse(Vector2.isValid(vec2)); assertFalse(Vector2.isValid(vec3)); assertFalse(Vector2.isValid(vec4)); assertFalse(Vector2.isValid(vec5)); vec5.zero(); assertTrue(Vector2.isValid(vec5)); assertFalse(Vector2.isValid(null)); // couple of equals validity tests assertEquals(vec1, vec1); assertFalse(vec1.equals(null)); assertFalse(vec1.equals(new Vector3())); // throw in a couple pool accesses for coverage final Vector2 vec6 = Vector2.fetchTempInstance(); vec6.set(vec1); assertEquals(vec1, vec6); assertNotSame(vec1, vec6); Vector2.releaseTempInstance(vec6); // cover more of equals vec1.set(0, 1); assertFalse(vec1.equals(new Vector2(0, 2))); }