public int getWidth() { return _canvas.getCanvasRenderer().getCamera().getWidth(); }
iterator.next().draw(latch);
public void init() { // TODO: this can lead to problems with canvases and updaters added after init() has been called once... for (final Canvas canvas : _canvases) { canvas.init(); } for (final Updater updater : _updaters) { updater.init(); } }
public static Camera newOrthoCamera(final Canvas canvas) { final int width = canvas.getContentWidth(); final int height = canvas.getContentHeight(); final Camera camera = new Camera(width, height); camera.setFrustum(-1, 1, 0, width, height, 0); camera.setProjectionMode(ProjectionMode.Orthographic); final Vector3 loc = new Vector3(0.0f, 0.0f, 0.0f); final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); /** Move our camera to a correct place and orientation. */ camera.setFrame(loc, left, up, dir); canvas.addListener(new ICanvasListener() { @Override public void onResize(final int newWidth, final int newHeight) { camera.resize(newWidth, newHeight); camera.setFrustumRight(newWidth); camera.setFrustumTop(newHeight); } }); return camera; } }
@Override public void mouseEntered(final Canvas source, final MouseState current, final InteractManager manager) { if (source == null) { return; } final MouseManager mm = source.getMouseManager(); if (mm != null) { _lastEnteredCanvas = source; mm.setCursor(_cursor); } }
@Override public void mouseDeparted(Canvas source, final MouseState current, final InteractManager manager) { if (source == null) { if (_lastEnteredCanvas != null) { source = _lastEnteredCanvas; } else { return; } } final MouseManager mm = source.getMouseManager(); if (mm != null) { mm.setCursor(null); } _lastEnteredCanvas = null; }
public int getHeight() { return _canvas.getCanvasRenderer().getCamera().getHeight(); }
public void init() { // TODO: this can lead to problems with canvases and updaters added after init() has been called once... for (final Canvas canvas : _canvases) { canvas.init(); } for (final Updater updater : _updaters) { updater.init(); } }
iterator.next().draw(latch);
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { FirstPersonControl.this.move(source.getCanvasRenderer().getCamera(), inputStates.getCurrent() .getKeyboardState(), tpf); } };
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { FirstPersonControl.this.move(source.getCanvasRenderer().getCamera(), inputStates.getCurrent() .getKeyboardState(), tpf); } };
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final MouseState mouse = inputStates.getCurrent().getMouseState(); if (mouse.getDx() != 0 || mouse.getDy() != 0) { if (!firstPing) { FirstPersonControl.this.rotate(source.getCanvasRenderer().getCamera(), -mouse.getDx(), -mouse.getDy()); } else { firstPing = false; } } } };
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final MouseState mouse = inputStates.getCurrent().getMouseState(); if (mouse.getDx() != 0 || mouse.getDy() != 0) { if (!firstPing) { FirstPersonControl.this.rotate(source.getCanvasRenderer().getCamera(), -mouse.getDx(), -mouse.getDy()); } else { firstPing = false; } } } };
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final PinchGestureEvent event = inputStates.getCurrent().getGestureState() .first(PinchGestureEvent.class); if (event.isStartOfGesture()) { initialZoom = _sphereCoords.getX(); } if (event.getScale() != 0.0) { _sphereCoords.setX(MathUtils.clamp((1.0 / event.getScale()) * initialZoom, _minZoomDistance, _maxZoomDistance)); makeDirty(); } if (_updateCameraFromInput) { _camera = source.getCanvasRenderer().getCamera(); } } }));
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final MouseState mouse = inputStates.getCurrent().getMouseState(); if (mouse.getDx() != 0 || mouse.getDy() != 0) { if (!firstPing) { move(_xSpeed * mouse.getDx(), _ySpeed * mouse.getDy()); } else { firstPing = false; } } if (mouse.getDwheel() != 0) { zoom(_zoomSpeed * mouse.getDwheel()); } if (_updateCameraFromInput) { _camera = source.getCanvasRenderer().getCamera(); } } };
final Camera camera = source.getCanvasRenderer().getCamera();
@Override public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed, final InteractManager manager) { final Camera camera = source.getCanvasRenderer().getCamera(); final MouseState current = inputStates.getCurrent().getMouseState(); final MouseState previous = inputStates.getPrevious().getMouseState(); // first process mouse over state checkMouseOver(source, current, manager); // Now check drag status if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) { return; } // act on drag final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY()); final double scale = getNewScale(oldMouse, current, camera, manager); // Set new scale on spatial state manager.getSpatialState().getTransform().setScale(scale); // apply our filters, if any, now that we've made updates. applyFilters(manager); }
@Override public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed, final InteractManager manager) { final Camera camera = source.getCanvasRenderer().getCamera(); final MouseState current = inputStates.getCurrent().getMouseState(); final MouseState previous = inputStates.getPrevious().getMouseState(); // first process mouse over state checkMouseOver(source, current, manager); if (current.getButtonsReleasedSince(previous).contains(_dragButton)) { _rotateStore.setIdentity(); if (_interactMatrix != InteractMatrix.Local) { setRingRotations(Matrix3.IDENTITY); } } // Now check drag status if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) { return; } // act on drag if (_lastDragSpatial instanceof InteractRing) { _lastRing = (InteractRing) _lastDragSpatial; final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY()); final ReadOnlyQuaternion rot = getNewAxisRotation(_lastRing, oldMouse, current, camera, manager); final Transform transform = manager.getSpatialState().getTransform(); rot.toRotationMatrix(_calcMat3).multiply(transform.getMatrix(), _calcMat3); transform.setRotation(_calcMat3); // apply our filters, if any, now that we've made updates. applyFilters(manager); } }
getHud().getCanvas().getCanvasRenderer().getCamera().apply(renderer);
@Override public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed, final InteractManager manager) { final Camera camera = source.getCanvasRenderer().getCamera(); final MouseState current = inputStates.getCurrent().getMouseState(); final MouseState previous = inputStates.getPrevious().getMouseState(); // first process mouse over state checkMouseOver(source, current, manager); // Now check drag status if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) { return; } // act on drag final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY()); final Vector3 loc = getNewOffset(oldMouse, current, camera, manager); final Transform transform = manager.getSpatialState().getTransform(); transform.setTranslation(loc.addLocal(transform.getTranslation())); // apply our filters, if any, now that we've made updates. applyFilters(manager); }