/** * Checks to see if the given Vector3 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 ReadOnlyVector4 check, final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector4.releaseTempInstance(temp); return equals; }
/** * Checks to see if the given Vector3 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 ReadOnlyVector4 check, final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); final boolean equals = temp.equals(check); Vector4.releaseTempInstance(temp); return equals; }
/** * Multiply and store a Vector3 in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector3 within * @param index * the position (in terms of vectors, not floats) of the vector to multiply */ public static void multInBuffer(final ReadOnlyVector4 toMult, final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.multiplyLocal(toMult); setInBuffer(temp, buf, index); Vector4.releaseTempInstance(temp); }
/** * Multiply and store a Vector3 in-buffer. * * @param toMult * the vector to multiply against * @param buf * the buffer to find the Vector3 within * @param index * the position (in terms of vectors, not floats) of the vector to multiply */ public static void multInBuffer(final ReadOnlyVector4 toMult, final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.multiplyLocal(toMult); setInBuffer(temp, buf, index); Vector4.releaseTempInstance(temp); }
/** * Normalize a Vector4 in-buffer. * * @param buf * the buffer to find the Vector4 within * @param index * the position (in terms of vectors, not floats) of the vector to normalize */ public static void normalizeVector4(final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.normalizeLocal(); setInBuffer(temp, buf, index); Vector4.releaseTempInstance(temp); }
/** * Normalize a Vector4 in-buffer. * * @param buf * the buffer to find the Vector4 within * @param index * the position (in terms of vectors, not floats) of the vector to normalize */ public static void normalizeVector4(final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.normalizeLocal(); setInBuffer(temp, buf, index); Vector4.releaseTempInstance(temp); }
/** * Add to a Vector4 in-buffer. * * @param toAdd * the vector to add from * @param buf * the buffer to find the Vector4 within * @param index * the position (in terms of vectors, not floats) of the vector to add to */ public static void addInBuffer(final ReadOnlyVector4 toAdd, final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.addLocal(toAdd); setInBuffer(temp, buf, index); Vector4.releaseTempInstance(temp); }
/** * Add to a Vector4 in-buffer. * * @param toAdd * the vector to add from * @param buf * the buffer to find the Vector4 within * @param index * the position (in terms of vectors, not floats) of the vector to add to */ public static void addInBuffer(final ReadOnlyVector4 toAdd, final FloatBuffer buf, final int index) { final Vector4 temp = Vector4.fetchTempInstance(); populateFromBuffer(temp, buf, index); temp.addLocal(toAdd); setInBuffer(temp, buf, index); Vector4.releaseTempInstance(temp); }
public Vector3 getNormalizedDeviceCoordinates(final ReadOnlyVector3 worldPosition, Vector3 store) { if (store == null) { store = new Vector3(); } checkModelViewProjection(); final Vector4 position = Vector4.fetchTempInstance(); position.set(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), 1); _modelViewProjection.applyPre(position, position); position.multiplyLocal(1.0 / position.getW()); store.setX(position.getX()); store.setY(position.getY()); store.setZ(position.getZ()); Vector4.releaseTempInstance(position); return store; }
public Vector3 getNormalizedDeviceCoordinates(final ReadOnlyVector3 worldPosition, Vector3 store) { if (store == null) { store = new Vector3(); } checkModelViewProjection(); final Vector4 position = Vector4.fetchTempInstance(); position.set(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), 1); _modelViewProjection.applyPre(position, position); position.multiplyLocal(1.0 / position.getW()); store.setX(position.getX()); store.setY(position.getY()); store.setZ(position.getZ()); Vector4.releaseTempInstance(position); return store; }
final Vector4 position = Vector4.fetchTempInstance(); for (final Vector3 frustumCorner : frustumCorners) { position.set(frustumCorner.getX(), frustumCorner.getY(), frustumCorner.getZ(), 1);
final Vector4 position = Vector4.fetchTempInstance(); position.set((screenPosition.getX() / getWidth() - _viewPortLeft) / (_viewPortRight - _viewPortLeft) * 2 - 1, (screenPosition.getY() / getHeight() - _viewPortBottom) / (_viewPortTop - _viewPortBottom) * 2 - 1,
final Vector4 position = Vector4.fetchTempInstance(); position.set((screenPosition.getX() / getWidth() - _viewPortLeft) / (_viewPortRight - _viewPortLeft) * 2 - 1, (screenPosition.getY() / getHeight() - _viewPortBottom) / (_viewPortTop - _viewPortBottom) * 2 - 1,
double optimalCameraNear = Double.MAX_VALUE; double optimalCameraFar = -Double.MAX_VALUE; final Vector4 position = Vector4.fetchTempInstance(); for (int i = 0; i < _corners.length; i++) { position.set(_corners[i].getX(), _corners[i].getY(), _corners[i].getZ(), 1);
double optimalCameraNear = Double.MAX_VALUE; double optimalCameraFar = -Double.MAX_VALUE; final Vector4 position = Vector4.fetchTempInstance(); for (int i = 0; i < _corners.length; i++) { position.set(_corners[i].getX(), _corners[i].getY(), _corners[i].getZ(), 1);
double optimalCameraNear = Double.MAX_VALUE; double optimalCameraFar = -Double.MAX_VALUE; final Vector4 position = Vector4.fetchTempInstance(); for (int i = 0; i < _corners.length; i++) { position.set(_corners[i].getX(), _corners[i].getY(), _corners[i].getZ(), 1);
double optimalCameraNear = Double.MAX_VALUE; double optimalCameraFar = -Double.MAX_VALUE; final Vector4 position = Vector4.fetchTempInstance(); for (int i = 0; i < _corners.length; i++) { position.set(_corners[i].getX(), _corners[i].getY(), _corners[i].getZ(), 1);
final Vector4 clipPlane = Vector4.fetchTempInstance();
final Vector4 clipPlane = Vector4.fetchTempInstance();
final Vector4 vec6 = Vector4.fetchTempInstance(); vec6.set(vec1); assertEquals(vec1, vec6);