public ReadOnlyVector3 getNormal() { return _floor.getNormal(); }
public ReadOnlyVector3 getNormal() { return waterPlane.getNormal(); }
public ReadOnlyVector3 getNormal() { return waterPlane.getNormal(); }
public ReadOnlyVector3 getNormal() { return _floor.getNormal(); }
clipPlane.set(waterPlane.getNormal().getX(), waterPlane.getNormal().getY(), waterPlane.getNormal().getZ(), heightTotal); renderReflection(clipPlane); clipPlane.set(-waterPlane.getNormal().getX(), -waterPlane.getNormal().getY(), -waterPlane.getNormal().getZ(), -waterPlane.getConstant()); renderRefraction(clipPlane);
clipPlane.set(waterPlane.getNormal().getX(), waterPlane.getNormal().getY(), waterPlane.getNormal() .getZ(), heightTotal); renderReflection(clipPlane); clipPlane.set(-waterPlane.getNormal().getX(), -waterPlane.getNormal().getY(), -waterPlane.getNormal() .getZ(), -waterPlane.getConstant()); renderRefraction(clipPlane);
@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); }
@Override public void apply(final double dt, final Particle particle, final int index) { // Is particle alive, AND "under" our floor? if (particle.getStatus() == Particle.Status.Alive && _floor.pseudoDistance(particle.getPosition()) <= 0) { final Vector3 tempVect1 = Vector3.fetchTempInstance(); final double scale = particle.getVelocity().length(); tempVect1.set(particle.getVelocity()).divideLocal(scale); // normalize // Is the particle moving further into the floor? if (_floor.getNormal().smallestAngleBetween(tempVect1) > MathUtils.HALF_PI) { // reflect our velocity vector across the floor plane _floor.reflectVector(tempVect1, tempVect1); // apply the "bounciness" factor tempVect1.multiplyLocal(scale * _bounciness); // write back to particle particle.setVelocity(tempVect1); } Vector3.releaseTempInstance(tempVect1); } }
@Override public void apply(final double dt, final Particle particle, final int index) { // Is particle alive, AND "under" our floor? if (particle.getStatus() == Particle.Status.Alive && _floor.pseudoDistance(particle.getPosition()) <= 0) { final Vector3 tempVect1 = Vector3.fetchTempInstance(); final double scale = particle.getVelocity().length(); tempVect1.set(particle.getVelocity()).divideLocal(scale); // normalize // Is the particle moving further into the floor? if (_floor.getNormal().smallestAngleBetween(tempVect1) > MathUtils.HALF_PI) { // reflect our velocity vector across the floor plane _floor.reflectVector(tempVect1, tempVect1); // apply the "bounciness" factor tempVect1.multiplyLocal(scale * _bounciness); // write back to particle particle.setVelocity(tempVect1); } Vector3.releaseTempInstance(tempVect1); } }
calcVect.set(waterPlane.getNormal()).multiplyLocal(planeDistance * 2.0f); camReflectPos.set(camLocation.subtractLocal(calcVect)); calcVect.set(waterPlane.getNormal()).multiplyLocal(planeDistance * 2.0f); camReflectDir.set(camLocation.subtractLocal(calcVect)).subtractLocal(camReflectPos).normalizeLocal(); calcVect.set(waterPlane.getNormal()).multiplyLocal(planeDistance * 2.0f); camReflectUp.set(camLocation.subtractLocal(calcVect)).subtractLocal(camReflectPos).normalizeLocal();
calcVect.set(waterPlane.getNormal()).multiplyLocal(planeDistance * 2.0f); camReflectPos.set(camLocation.subtractLocal(calcVect)); calcVect.set(waterPlane.getNormal()).multiplyLocal(planeDistance * 2.0f); camReflectDir.set(camLocation.subtractLocal(calcVect)).subtractLocal(camReflectPos).normalizeLocal(); calcVect.set(waterPlane.getNormal()).multiplyLocal(planeDistance * 2.0f); camReflectUp.set(camLocation.subtractLocal(calcVect)).subtractLocal(camReflectPos).normalizeLocal();