public double getWaterHeight() { return waterPlane.getConstant(); }
public double getConstant() { return _floor.getConstant(); }
public double getWaterHeight() { return waterPlane.getConstant(); }
public double getConstant() { return _floor.getConstant(); }
/** * @return returns a unique code for this plane object based on its values. If two planes are numerically equal, * they will return the same hash code value. */ @Override public int hashCode() { int result = 17; result += 31 * result + _normal.hashCode(); final long c = Double.doubleToLongBits(getConstant()); result += 31 * result + (int) (c ^ c >>> 32); return result; }
/** * Used with serialization. Not to be called manually. * * @param out * ObjectOutput * @throws IOException */ @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(_normal); out.writeDouble(getConstant()); }
/** * @return returns a unique code for this plane object based on its values. If two planes are numerically equal, * they will return the same hash code value. */ @Override public int hashCode() { int result = 17; result += 31 * result + _normal.hashCode(); final long c = Double.doubleToLongBits(getConstant()); result += 31 * result + (int) (c ^ c >>> 32); return result; }
/** * Used with serialization. Not to be called manually. * * @param out * ObjectOutput * @throws IOException */ @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(_normal); out.writeDouble(getConstant()); }
/** * @param o * the object to compare for equality * @return true if this plane and the provided plane have the same constant and normal values. */ @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ReadOnlyPlane)) { return false; } final ReadOnlyPlane comp = (ReadOnlyPlane) o; return getConstant() == comp.getConstant() && _normal.equals(comp.getNormal()); }
/** * @param o * the object to compare for equality * @return true if this plane and the provided plane have the same constant and normal values. */ @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ReadOnlyPlane)) { return false; } final ReadOnlyPlane comp = (ReadOnlyPlane) o; return getConstant() == comp.getConstant() && _normal.equals(comp.getNormal()); }
@Test public void testGetSet() { final Plane plane = new Plane(); assertEquals(Vector3.UNIT_Y, plane.getNormal()); assertTrue(plane.getConstant() == 0.0); plane.setNormal(Vector3.UNIT_X); plane.setConstant(1.0); assertEquals(Vector3.UNIT_X, plane.getNormal()); assertTrue(plane.getConstant() == 1.0); final Plane plane2 = new Plane(plane); assertEquals(Vector3.UNIT_X, plane2.getNormal()); assertTrue(plane.getConstant() == 1.0); final Plane plane3 = new Plane(Vector3.NEG_UNIT_Z, 2.5); assertEquals(Vector3.NEG_UNIT_Z, plane3.getNormal()); assertTrue(plane3.getConstant() == 2.5); final Plane plane4 = new Plane().setPlanePoints(new Vector3(1, 1, 1), new Vector3(2, 1, 1), new Vector3(2, 2, 1)); assertEquals(Vector3.UNIT_Z, plane4.getNormal()); assertTrue(plane4.getConstant() == 1.0); }
_worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() + _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() - _frustumRight); } else { _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() - _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() + _frustumRight); _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() + _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() - _frustumBottom); } else { _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() - _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() + _frustumBottom);
_worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() + _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() - _frustumRight); } else { _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() - _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() + _frustumRight); _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() + _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() - _frustumBottom); } else { _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() - _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() + _frustumBottom);
if (useProjectedShader) { setProperty("cameraPos", cam.getLocation()); setProperty("waterHeight", (float) waterPlane.getConstant()); setProperty("amplitude", (float) waterMaxAmplitude); setProperty("heightFalloffStart", (float) heightFalloffStart); final double heightTotal = clipBias + waterMaxAmplitude - waterPlane.getConstant(); final Vector4 clipPlane = Vector4.fetchTempInstance(); -waterPlane.getNormal().getZ(), -waterPlane.getConstant()); renderRefraction(clipPlane);
if (useProjectedShader) { waterShader.setUniform("cameraPos", cam.getLocation()); waterShader.setUniform("waterHeight", (float) waterPlane.getConstant()); waterShader.setUniform("amplitude", (float) waterMaxAmplitude); waterShader.setUniform("heightFalloffStart", (float) heightFalloffStart); final double heightTotal = clipBias + waterMaxAmplitude - waterPlane.getConstant(); final Vector4 clipPlane = Vector4.fetchTempInstance(); .getZ(), -waterPlane.getConstant()); renderRefraction(clipPlane);