@Override public String toString() { return "com.ardor3d.renderer.Camera: loc - " + Arrays.toString(getLocation().toArray(null)) + " dir - " + Arrays.toString(getDirection().toArray(null)) + " up - " + Arrays.toString(getUp().toArray(null)) + " left - " + Arrays.toString(getLeft().toArray(null)); }
@Override public String toString() { return "com.ardor3d.renderer.Camera: loc - " + Arrays.toString(getLocation().toArray(null)) + " dir - " + Arrays.toString(getDirection().toArray(null)) + " up - " + Arrays.toString(getUp().toArray(null)) + " left - " + Arrays.toString(getLeft().toArray(null)); }
/** * Sets the axes and location of the camera using those of a given source camera * * @param source * a source camera. */ public void setFrame(final Camera source) { _left.set(source.getLeft()); _up.set(source.getUp()); _direction.set(source.getDirection()); _location.set(source.getLocation()); onFrameChange(); }
/** * Sets the axes and location of the camera using those of a given source camera * * @param source * a source camera. */ public void setFrame(final Camera source) { _left.set(source.getLeft()); _up.set(source.getUp()); _direction.set(source.getDirection()); _location.set(source.getLocation()); onFrameChange(); }
private void applyDx(final double dx, final Camera camera) { _workerMatrix.fromAngleNormalAxis(_mouseRotateSpeed * dx, _upAxis); _workerMatrix.applyPost(camera.getLeft(), _workerStoreA); camera.setLeft(_workerStoreA); _workerMatrix.applyPost(camera.getDirection(), _workerStoreA); camera.setDirection(_workerStoreA); _workerMatrix.applyPost(camera.getUp(), _workerStoreA); camera.setUp(_workerStoreA); }
/** * Forces rotation and translation of this node to be sync'd with the attached camera. (Assumes the node is in world * space.) */ public void updateFromCamera() { final ReadOnlyVector3 camLeft = _camera.getLeft(); final ReadOnlyVector3 camUp = _camera.getUp(); final ReadOnlyVector3 camDir = _camera.getDirection(); final ReadOnlyVector3 camLoc = _camera.getLocation(); final Matrix3 rotation = Matrix3.fetchTempInstance(); rotation.fromAxes(camLeft, camUp, camDir); setRotation(rotation); setTranslation(camLoc); Matrix3.releaseTempInstance(rotation); }
private void applyDx(final double dx, final Camera camera) { _workerMatrix.fromAngleNormalAxis(_mouseRotateSpeed * dx, _upAxis); _workerMatrix.applyPost(camera.getLeft(), _workerStoreA); camera.setLeft(_workerStoreA); _workerMatrix.applyPost(camera.getDirection(), _workerStoreA); camera.setDirection(_workerStoreA); _workerMatrix.applyPost(camera.getUp(), _workerStoreA); camera.setUp(_workerStoreA); }
/** * Forces rotation and translation of this node to be sync'd with the attached camera. (Assumes the node is in world * space.) */ public void updateFromCamera() { final ReadOnlyVector3 camLeft = _camera.getLeft(); final ReadOnlyVector3 camUp = _camera.getUp(); final ReadOnlyVector3 camDir = _camera.getDirection(); final ReadOnlyVector3 camLoc = _camera.getLocation(); final Matrix3 rotation = Matrix3.fetchTempInstance(); rotation.fromAxes(camLeft, camUp, camDir); setRotation(rotation); setTranslation(camLoc); Matrix3.releaseTempInstance(rotation); }
/** * Rotate the billboard so it points directly opposite the direction the camera's facing */ private void rotateScreenAligned() { final Camera camera = Camera.getCurrentCamera(); _look.set(camera.getDirection()).negateLocal(); _left.set(camera.getLeft()).negateLocal(); _orient.fromAxes(_left, camera.getUp(), _look); if(_localRot != null) _orient.multiplyLocal(_localRot); _worldTransform.setRotation(_orient); }
/** * Rotate the billboard so it points directly opposite the direction the camera's facing * * @param camera * Camera */ private void rotateScreenAligned() { final Camera camera = Camera.getCurrentCamera(); // coopt diff for our in direction: _look.set(camera.getDirection()).negateLocal(); // coopt loc for our left direction: _left.set(camera.getLeft()).negateLocal(); _orient.fromAxes(_left, camera.getUp(), _look); _worldTransform.setRotation(_orient); }
private void applyDY(final double dy, final Camera camera) { // apply dy angle change to direction vector _workerMatrix.fromAngleNormalAxis(_mouseRotateSpeed * dy, camera.getLeft()); _workerMatrix.applyPost(camera.getDirection(), _workerStoreA); camera.setDirection(_workerStoreA); // do we want to constrain our vertical angle? if (isClampVerticalAngle()) { // check if we went out of bounds and back up final double angleV = MathUtils.HALF_PI - _workerStoreA.smallestAngleBetween(_upAxis); if (angleV > getMaxVerticalAngle() || angleV < getMinVerticalAngle()) { // clamp the angle to our range final double newAngle = MathUtils.clamp(angleV, getMinVerticalAngle(), getMaxVerticalAngle()); // take the difference in angles and back up the direction vector _workerMatrix.fromAngleNormalAxis(-(newAngle - angleV), camera.getLeft()); _workerMatrix.applyPost(camera.getDirection(), _workerStoreA); camera.setDirection(_workerStoreA); // figure out new up vector by crossing direction and left. camera.getDirection().cross(camera.getLeft(), _workerStoreA); camera.setUp(_workerStoreA); return; } } // just apply to up vector _workerMatrix.applyPost(camera.getUp(), _workerStoreA); camera.setUp(_workerStoreA); }
private void applyDY(final double dy, final Camera camera) { // apply dy angle change to direction vector _workerMatrix.fromAngleNormalAxis(_mouseRotateSpeed * dy, camera.getLeft()); _workerMatrix.applyPost(camera.getDirection(), _workerStoreA); camera.setDirection(_workerStoreA); // do we want to constrain our vertical angle? if (isClampVerticalAngle()) { // check if we went out of bounds and back up final double angleV = MathUtils.HALF_PI - _workerStoreA.smallestAngleBetween(_upAxis); if (angleV > getMaxVerticalAngle() || angleV < getMinVerticalAngle()) { // clamp the angle to our range final double newAngle = MathUtils.clamp(angleV, getMinVerticalAngle(), getMaxVerticalAngle()); // take the difference in angles and back up the direction vector _workerMatrix.fromAngleNormalAxis(-(newAngle - angleV), camera.getLeft()); _workerMatrix.applyPost(camera.getDirection(), _workerStoreA); camera.setDirection(_workerStoreA); // figure out new up vector by crossing direction and left. camera.getDirection().cross(camera.getLeft(), _workerStoreA); camera.setUp(_workerStoreA); return; } } // just apply to up vector _workerMatrix.applyPost(camera.getUp(), _workerStoreA); camera.setUp(_workerStoreA); }
/** * * @param cam */ public void correctTransform(final Camera cam) { updateWorldTransform(false); if (_autoRotate) { // Billboard rotation _look.set(cam.getDirection()); _left.set(cam.getLeft()).negateLocal(); _rot.fromAxes(_left, _look, cam.getUp()); if (_rot.isOrthonormal()) { _worldTransform.setRotation(_rot); } else { logger.warning("BMText: non-orthonormal rotation matrix :" + getName()); } } _worldTransform.setScale(_localTransform.getScale()); }
/** * * @param cam */ public void correctTransform(final Camera cam) { updateWorldTransform(false); if (_autoRotate) { // Billboard rotation _look.set(cam.getDirection()); _left.set(cam.getLeft()).negateLocal(); _rot.fromAxes(_left, _look, cam.getUp()); _worldTransform.setRotation(_rot); } _worldTransform.setScale(_localTransform.getScale()); }
protected double getNewScale(final Vector2 oldMouse, final MouseState current, final Camera camera, final InteractManager manager) { // calculate a plane running through the Arrow and facing the camera. _calcVec3A.set(_handle.getWorldTranslation()); _calcVec3B.set(_calcVec3A).addLocal(camera.getLeft()); _calcVec3C.set(_calcVec3A).addLocal(_arrowDirection); final Plane pickPlane = new Plane().setPlanePoints(_calcVec3A, _calcVec3B, _calcVec3C); // find out where we were hitting the plane before getPickRay(oldMouse, camera); _calcRay.intersectsPlane(pickPlane, _calcVec3A); final double oldHeight = _calcVec3A.getY(); // find out where we are hitting the plane now getPickRay(new Vector2(current.getX(), current.getY()), camera); _calcRay.intersectsPlane(pickPlane, _calcVec3A); final double newHeight = _calcVec3A.getY(); // Use distance between points against arrow length to determine how big we need to grow our bounding radius final double delta = newHeight - oldHeight; final double oldRadius = manager.getSpatialTarget().getWorldBound().getRadius(); return manager.getSpatialTarget().getScale().getY() * (1.0 + delta / oldRadius); } }
@Override public void draw(final Renderer r) { if (_timer != null && _redrawRate > 0) { _elapsed += _timer.getTimePerFrame(); } if (_tRenderer == null) { init(r); } if (_cam == null) { _cam = Camera.getCurrentCamera(); _tRenderer.getCamera().setFrustum(_cam.getFrustumNear(), _cam.getFrustumFar(), _cam.getFrustumLeft(), _cam.getFrustumRight(), _cam.getFrustumTop(), _cam.getFrustumBottom()); _tRenderer.getCamera().setFrame(_cam.getLocation(), _cam.getLeft(), _cam.getUp(), _cam.getDirection()); } if (_doUpdate && (!_haveDrawn || shouldDoUpdate(_cam)) && _targetScene.getWorldBound() != null) { final BoundingVolume b = _targetScene.getWorldBound(); _center.set(b.getCenter()); updateCameraLookat(); calculateImposter(); updateCameraLookat(); updateCameraFrustum(); renderImposter(); _haveDrawn = true; } _imposterQuad.draw(r); }
@Override public void draw(final Renderer r) { if (_timer != null && _redrawRate > 0) { _elapsed += _timer.getTimePerFrame(); } if (_tRenderer == null) { init(r); } if (_cam == null) { _cam = Camera.getCurrentCamera(); _tRenderer.getCamera().setFrustum(_cam.getFrustumNear(), _cam.getFrustumFar(), _cam.getFrustumLeft(), _cam.getFrustumRight(), _cam.getFrustumTop(), _cam.getFrustumBottom()); _tRenderer.getCamera().setFrame(_cam.getLocation(), _cam.getLeft(), _cam.getUp(), _cam.getDirection()); } if (_doUpdate && (!_haveDrawn || shouldDoUpdate(_cam)) && _targetScene.getWorldBound() != null) { final BoundingVolume b = _targetScene.getWorldBound(); _center.set(b.getCenter()); updateCameraLookat(); calculateImposter(); updateCameraLookat(); updateCameraFrustum(); renderImposter(); _haveDrawn = true; } _imposterQuad.draw(r); }
_left.set(source.getLeft()); _up.set(source.getUp()); _direction.set(source.getDirection());
_left.set(source.getLeft()); _up.set(source.getUp()); _direction.set(source.getDirection());
_calcVec3B.set(_calcVec3A).addLocal(camera.getLeft());