public boolean applyFrameTransform(GL10 gl, GraphName frame) { Preconditions.checkNotNull(frame); if (this.frame != null) { FrameTransform frameTransform = frameTransformTree.transform(frame, this.frame); if (frameTransform != null) { OpenGlTransform.apply(gl, frameTransform.getTransform()); return true; } } return false; }
/** * Changes the camera frame to the specified frame. * * <p>If possible, the camera will avoid jumping on the next frame. * * @param frame the new camera frame */ public void setFrame(GraphName frame) { Preconditions.checkNotNull(frame); synchronized (mutex) { if (this.frame != null && this.frame != frame) { FrameTransform frameTransform = frameTransformTree.transform(frame, this.frame); if (frameTransform != null) { // Best effort to prevent the camera from jumping. If we don't have // the transform yet, we can't help matters. transform = transform.multiply(frameTransform.getTransform()); } } this.frame = frame; } }