1 16 17 package com.buchuki.ensmer.input.command.navigation; 18 19 import com.buchuki.ensmer.input.Accelerator; 20 import com.buchuki.ensmer.input.command.Command; 21 import com.buchuki.ensmer.input.event.Measurable; 22 import javax.vecmath.Matrix4f; 23 24 30 public abstract class TransformCommand implements Command { 31 32 40 public TransformCommand(Transformable3D transformable, Accelerator accel, float accelmod) { 41 this.transformable = transformable; 42 this.accelerator = accel; 43 this.accelmod = accelmod; 44 } 45 46 52 public float getAcceleratedMagnitude(Measurable event) { 53 return event.getMagnitude() * accelerator.getAcceleration() * accelmod; 54 } 55 56 61 protected void updatePosition(Matrix4f matrix) { 62 transformable.moveTransform(matrix); 63 } 64 65 68 private Accelerator accelerator; 69 70 74 private float accelmod; 75 76 79 private Transformable3D transformable; 80 81 } 82 | Popular Tags |