@Override JCameraFPSStyleLinearIntegratorType newIntegrator( final JCameraFPSStyleType c, final JCameraFPSStyleInputType i) { return JCameraFPSStyleLinearIntegrator.newIntegrator(c, i); } }
/** * Construct a new integrator. * * @param in_camera The camera to be integrated. * @param in_input The input to be sampled. * * @return A new integrator */ public static JCameraFPSStyleLinearIntegratorType newIntegrator( final JCameraFPSStyleType in_camera, final JCameraFPSStyleInputType in_input) { return new JCameraFPSStyleLinearIntegrator(in_camera, in_input); }
@Override public void integrate( final double t) { this.speed_forward = this.integrateForward(t); this.speed_right = this.integrateRight(t); this.speed_up = this.integrateUp(t); }
private float integrateUp( final float time) { float s = this.speed_up; final boolean forward = this.input.isMovingUp(); if (forward) { s += this.acceleration * time; } final boolean backward = this.input.isMovingDown(); if (backward) { s -= this.acceleration * time; } s = Clamp.clamp(s, -this.maximum_speed, this.maximum_speed); this.camera.cameraMoveUp(s * time); return this.applyDrag(s, time); }
private double integrateRight( final double time) { double s = this.speed_right; final boolean forward = this.input.isMovingRight(); if (forward) { s += this.acceleration * time; } final boolean backward = this.input.isMovingLeft(); if (backward) { s -= this.acceleration * time; } s = Clamp.clamp(s, -this.maximum_speed, this.maximum_speed); this.camera.cameraMoveRight(s * time); return this.applyDrag(s, time); }
@Override public void integrate( final float t) { this.speed_forward = this.integrateForward(t); this.speed_right = this.integrateRight(t); this.speed_up = this.integrateUp(t); }
/** * Return a new integrator for the given camera and input using the default * integrator implementations. * * @param in_camera The camera * @param in_input The input * * @return A new integrator */ public static JCameraFPSStyleIntegratorType newIntegrator( final JCameraFPSStyleType in_camera, final JCameraFPSStyleInputType in_input) { final JCameraFPSStyleAngularIntegratorType ai = JCameraFPSStyleAngularIntegrator.newIntegrator(in_camera, in_input); final JCameraFPSStyleLinearIntegratorType li = JCameraFPSStyleLinearIntegrator.newIntegrator(in_camera, in_input); return JCameraFPSStyleIntegrator.newIntegratorWith(ai, li); }
private float integrateForward( final float time) { float s = this.speed_forward; final boolean forward = this.input.isMovingForward(); if (forward) { s += this.acceleration * time; } final boolean backward = this.input.isMovingBackward(); if (backward) { s -= this.acceleration * time; } s = Clamp.clamp(s, -this.maximum_speed, this.maximum_speed); this.camera.cameraMoveForward(s * time); return this.applyDrag(s, time); }
/** * Construct a new integrator. * * @param in_camera The camera to be integrated. * @param in_input The input to be sampled. * * @return A new integrator */ public static JCameraFPSStyleLinearIntegratorType newIntegrator( final JCameraFPSStyleType in_camera, final JCameraFPSStyleInputType in_input) { return new JCameraFPSStyleLinearIntegrator(in_camera, in_input); }
/** * Return a new integrator for the given camera and input using the default * integrator implementations. * * @param in_camera The camera * @param in_input The input * * @return A new integrator */ public static JCameraFPSStyleIntegratorType newIntegrator( final JCameraFPSStyleType in_camera, final JCameraFPSStyleInputType in_input) { final JCameraFPSStyleAngularIntegratorType ai = JCameraFPSStyleAngularIntegrator.newIntegrator(in_camera, in_input); final JCameraFPSStyleLinearIntegratorType li = JCameraFPSStyleLinearIntegrator.newIntegrator(in_camera, in_input); return JCameraFPSStyleIntegrator.newIntegratorWith(ai, li); }
private float integrateRight( final float time) { float s = this.speed_right; final boolean forward = this.input.isMovingRight(); if (forward) { s += this.acceleration * time; } final boolean backward = this.input.isMovingLeft(); if (backward) { s -= this.acceleration * time; } s = Clamp.clamp(s, -this.maximum_speed, this.maximum_speed); this.camera.cameraMoveRight(s * time); return this.applyDrag(s, time); }
@Test(expected = IllegalArgumentException.class) public void testCameraIncorrect() { final JCameraFPSStyleType c0 = JCameraFPSStyle.newCamera(); final JCameraFPSStyleType c1 = JCameraFPSStyle.newCamera(); final JCameraFPSStyleInputType i = JCameraFPSStyleInput.newInput(); final JCameraFPSStyleAngularIntegratorType ai = JCameraFPSStyleAngularIntegrator.newIntegrator(c0, i); final JCameraFPSStyleLinearIntegratorType li = JCameraFPSStyleLinearIntegrator.newIntegrator(c1, i); JCameraFPSStyleIntegrator.newIntegratorWith(ai, li); }
private double integrateForward( final double time) { double s = this.speed_forward; final boolean forward = this.input.isMovingForward(); if (forward) { s += this.acceleration * time; } final boolean backward = this.input.isMovingBackward(); if (backward) { s -= this.acceleration * time; } s = Clamp.clamp(s, -this.maximum_speed, this.maximum_speed); this.camera.cameraMoveForward(s * time); return this.applyDrag(s, time); }
@Test(expected = IllegalArgumentException.class) public void testInputIncorrect() { final JCameraFPSStyleType c = JCameraFPSStyle.newCamera(); final JCameraFPSStyleInputType i0 = JCameraFPSStyleInput.newInput(); final JCameraFPSStyleInputType i1 = JCameraFPSStyleInput.newInput(); final JCameraFPSStyleAngularIntegratorType ai = JCameraFPSStyleAngularIntegrator.newIntegrator(c, i0); final JCameraFPSStyleLinearIntegratorType li = JCameraFPSStyleLinearIntegrator.newIntegrator(c, i1); JCameraFPSStyleIntegrator.newIntegratorWith(ai, li); } }
private double integrateUp( final double time) { double s = this.speed_up; final boolean forward = this.input.isMovingUp(); if (forward) { s += this.acceleration * time; } final boolean backward = this.input.isMovingDown(); if (backward) { s -= this.acceleration * time; } s = Clamp.clamp(s, -this.maximum_speed, this.maximum_speed); this.camera.cameraMoveUp(s * time); return this.applyDrag(s, time); }