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 Rotator implements InputProcessor, Transformable3D { 34 35 40 public Rotator(Accelerator accelerator) { 41 CommandMap map = InputManager.getCommandMap(); 42 43 Command rotateForwardBack = 44 new RotateCommand(this, accelerator, 0.01f, RotateCommand.Axis.X); 45 Command rotateLeftRight = 46 new RotateCommand(this, accelerator, 0.01f, RotateCommand.Axis.Y); 47 Command rotateUpDown = 48 new RotateCommand(this, accelerator, 0.1f, RotateCommand.Axis.Z); 49 50 map.addCommand(this, rotateForwardBack, new VerticalMouseMoveEvent(-1)); 51 map.addCommand(this, rotateForwardBack, new VerticalMouseMoveEvent(1)); 52 map.addCommand(this, rotateLeftRight, new HorizontalMouseMoveEvent(-1)); 53 map.addCommand(this, rotateLeftRight, new HorizontalMouseMoveEvent(1)); 54 map.addCommand(this, rotateUpDown, 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, false); 76 } 77 } 78 79 | Popular Tags |