1 16 package com.buchuki.ensmer.input; 17 18 import com.buchuki.ensmer.EnsmerManager; 19 import com.buchuki.ensmer.SelectionManager; 20 import javax.vecmath.*; 21 import com.buchuki.ensmer.input.command.*; 22 import com.buchuki.ensmer.input.command.navigation.*; 23 import com.buchuki.ensmer.input.event.*; 24 import java.awt.event.KeyEvent ; 25 26 27 33 public class Manipulator implements InputProcessor, Transformable3D { 34 35 40 public Manipulator(Accelerator accelerator) { 41 CommandMap map = InputManager.getCommandMap(); 42 43 Command moveForwardBack = 44 new OrientedMoveCommand(this, accelerator, -0.01f, MoveCommand.Axis.Z); 45 Command moveLeftRight = 46 new OrientedMoveCommand(this, accelerator, -0.01f, MoveCommand.Axis.X); 47 Command moveUpDown = 48 new OrientedMoveCommand(this, accelerator, -0.01f, MoveCommand.Axis.Y); 49 50 map.addCommand(this, moveForwardBack, new VerticalMouseMoveEvent(-1)); 51 map.addCommand(this, moveForwardBack, new VerticalMouseMoveEvent(1)); 52 map.addCommand(this, moveLeftRight, new HorizontalMouseMoveEvent(-1)); 53 map.addCommand(this, moveLeftRight, new HorizontalMouseMoveEvent(1)); 54 map.addCommand(this, moveUpDown, new MouseWheelEvent()); 55 } 56 57 63 public void processInput(EnsmerInputEvent event) { 64 CommandMap map = InputManager.getCommandMap(); 65 map.interpretEvent(this, event); 66 } 67 68 73 public void moveTransform(Matrix4f matrix) { 74 SelectionManager sel = EnsmerManager.instance().getSelectionManager(); 75 sel.setSelectedObjectPositions(matrix, true); 76 } 77 } 78 79 | Popular Tags |