/** * Set the normal of the waterplane(Used for reflecting the camera for rendering reflection) * * @param normal * Waterplane normal */ public void setNormal(final Vector3 normal) { waterPlane.setNormal(normal); }
/** * Set the normal of the waterplane(Used for reflecting the camera for rendering reflection) * * @param normal * Waterplane normal */ public void setNormal(final Vector3 normal) { waterPlane.setNormal(normal); }
public void setNormal(final Vector3 normal) { _floor.setNormal(normal.normalize(null)); }
public void setNormal(final Vector3 normal) { _floor.setNormal(normal.normalize(null)); }
/** * Used with serialization. Not to be called manually. * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setNormal((Vector3) in.readObject()); setConstant(in.readDouble()); }
/** * Used with serialization. Not to be called manually. * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setNormal((Vector3) in.readObject()); setConstant(in.readDouble()); }
/** * Sets the value of this plane to the constant and normal values of the provided source plane. * * @param source * @return this plane for chaining * @throws NullPointerException * if source is null. */ public Plane set(final ReadOnlyPlane source) { setConstant(source.getConstant()); setNormal(source.getNormal()); return this; }
/** * Sets the value of this plane to the constant and normal values of the provided source plane. * * @param source * @return this plane for chaining * @throws NullPointerException * if source is null. */ public Plane set(final ReadOnlyPlane source) { setConstant(source.getConstant()); setNormal(source.getNormal()); return this; }
planeNormal.addLocal(_direction.getX() * _coeffLeft[1], _direction.getY() * _coeffLeft[1], _direction.getZ() * _coeffLeft[1]); _worldPlane[LEFT_PLANE].setNormal(planeNormal); _worldPlane[LEFT_PLANE].setConstant(_location.dot(planeNormal)); planeNormal.addLocal(_direction.getX() * _coeffRight[1], _direction.getY() * _coeffRight[1], _direction.getZ() * _coeffRight[1]); _worldPlane[RIGHT_PLANE].setNormal(planeNormal); _worldPlane[RIGHT_PLANE].setConstant(_location.dot(planeNormal)); planeNormal.addLocal(_direction.getX() * _coeffBottom[1], _direction.getY() * _coeffBottom[1], _direction.getZ() * _coeffBottom[1]); _worldPlane[BOTTOM_PLANE].setNormal(planeNormal); _worldPlane[BOTTOM_PLANE].setConstant(_location.dot(planeNormal)); planeNormal.addLocal(_direction.getX() * _coeffTop[1], _direction.getY() * _coeffTop[1], _direction.getZ() * _coeffTop[1]); _worldPlane[TOP_PLANE].setNormal(planeNormal); _worldPlane[TOP_PLANE].setConstant(_location.dot(planeNormal)); _worldPlane[FAR_PLANE].setNormal(planeNormal); _worldPlane[FAR_PLANE].setConstant(-(dirDotLocation + _frustumFar)); _worldPlane[NEAR_PLANE].setNormal(_direction); _worldPlane[NEAR_PLANE].setConstant(dirDotLocation + _frustumNear);
planeNormal.addLocal(_direction.getX() * _coeffLeft[1], _direction.getY() * _coeffLeft[1], _direction.getZ() * _coeffLeft[1]); _worldPlane[LEFT_PLANE].setNormal(planeNormal); _worldPlane[LEFT_PLANE].setConstant(_location.dot(planeNormal)); planeNormal.addLocal(_direction.getX() * _coeffRight[1], _direction.getY() * _coeffRight[1], _direction.getZ() * _coeffRight[1]); _worldPlane[RIGHT_PLANE].setNormal(planeNormal); _worldPlane[RIGHT_PLANE].setConstant(_location.dot(planeNormal)); planeNormal.addLocal(_direction.getX() * _coeffBottom[1], _direction.getY() * _coeffBottom[1], _direction.getZ() * _coeffBottom[1]); _worldPlane[BOTTOM_PLANE].setNormal(planeNormal); _worldPlane[BOTTOM_PLANE].setConstant(_location.dot(planeNormal)); planeNormal.addLocal(_direction.getX() * _coeffTop[1], _direction.getY() * _coeffTop[1], _direction.getZ() * _coeffTop[1]); _worldPlane[TOP_PLANE].setNormal(planeNormal); _worldPlane[TOP_PLANE].setConstant(_location.dot(planeNormal)); _worldPlane[FAR_PLANE].setNormal(planeNormal); _worldPlane[FAR_PLANE].setConstant(-(dirDotLocation + _frustumFar)); _worldPlane[NEAR_PLANE].setNormal(_direction); _worldPlane[NEAR_PLANE].setConstant(dirDotLocation + _frustumNear);
@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); }