protected virtual Matrix ApplyViewRotationOnDeviceMatrix([NotNull] Matrix deviceMatrix, float magnificationFactor, ViewRotation viewRotation = ViewRotation.Normal) { if (deviceMatrix == null) { throw new ArgumentNullException(nameof(deviceMatrix)); } var viewMatrix = deviceMatrix.Clone(); if (viewRotation == ViewRotation.Normal) { // TODO test this orientation! viewMatrix.Scale(magnificationFactor, magnificationFactor, MatrixOrder.Prepend); } else if (viewRotation == ViewRotation.RotateBy90Degrees) { // TODO test this orientation! viewMatrix.Scale(magnificationFactor, magnificationFactor, MatrixOrder.Prepend); viewMatrix.Rotate(90f, MatrixOrder.Prepend); viewMatrix.Translate(this.OutputWidth, 0, MatrixOrder.Append); } else if (viewRotation == ViewRotation.RotateBy180Degrees) { // TODO test this orientation! viewMatrix.Scale(magnificationFactor, magnificationFactor, MatrixOrder.Prepend); viewMatrix.Rotate(180f, MatrixOrder.Prepend); viewMatrix.Translate(-this.OutputWidth, -this.OutputHeight, MatrixOrder.Append); } else if (viewRotation == ViewRotation.RotateBy270Degrees) { // TODO test this orientation! viewMatrix.Scale(magnificationFactor, magnificationFactor, MatrixOrder.Prepend); viewMatrix.Rotate(270f, MatrixOrder.Prepend); viewMatrix.Translate(0, this.OutputHeight, MatrixOrder.Append); } return(viewMatrix); }
public virtual Matrix CreateViewMatrix(float magnificationFactor, ViewRotation viewRotation = ViewRotation.Normal) { var deviceMatrix = this.CreateDeviceMatrix(); var viewMatrix = this.ApplyViewRotationOnDeviceMatrix(deviceMatrix, magnificationFactor, viewRotation); return(viewMatrix); }
public virtual Matrix CreateViewMatrix([NotNull] ZplTransformer zplTransformer, float sourceDpi, float destinationDpi, ViewRotation viewRotation = ViewRotation.Normal) { if (zplTransformer == null) { throw new ArgumentNullException(nameof(zplTransformer)); } var magnificationFactor = destinationDpi / sourceDpi; var viewMatrix = zplTransformer.CreateViewMatrix(magnificationFactor, viewRotation); return(viewMatrix); }
BlueprintModifyCamera != null?BlueprintModifyCamera(DeltaTime, ViewLocation, ViewRotation, FOV, NewViewLocation, NewViewRotation, NewFOV) : (NewViewLocation, NewViewRotation, NewFOV);