/// <summary> /// Merge this state with another one. /// </summary> /// <param name="state"> /// A <see cref="IGraphicsState"/> having the same <see cref="StateIdentifier"/> of this state. /// </param> /// <remarks> public override void Merge(IGraphicsState state) { if (state == null) { throw new ArgumentNullException("state"); } try { TransformStateBase otherState = (TransformStateBase)state; // Override projection matrix, if defined if (otherState.LocalProjection != null) { LocalProjection = otherState.LocalProjection; } // Affine local model LocalModel.Set(LocalModel.Multiply(otherState.LocalModel)); } catch (InvalidCastException) { throw new ArgumentException("not a TransformStateBase", "state"); } }
/// <summary> /// Merge this state with another one. /// </summary> /// <param name="state"> /// A <see cref="IGraphicsState"/> having the same <see cref="StateIdentifier"/> of this state. /// </param> /// <remarks> public override void Merge(IGraphicsState state) { if (state == null) { throw new ArgumentNullException("state"); } TransformStateBase otherState = state as TransformStateBase; if (otherState == null) { throw new ArgumentException("not a TransformStateBase", "state"); } // Override projection matrix, if defined if (otherState.LocalProjection != null) { LocalProjection = otherState.LocalProjection; } // Affine local model LocalModel.Multiply(otherState.LocalModel); }
/// <summary> /// Merge this state with another one. /// </summary> /// <param name="state"> /// A <see cref="IGraphicsState"/> having the same <see cref="StateIdentifier"/> of this state. /// </param> public override void Merge(IGraphicsState state) { if (state == null) { throw new ArgumentNullException("state"); } try { TransformStateBase otherState = (TransformStateBase)state; // Projection if (otherState.LocalProjection != null) { LocalProjection = otherState.LocalProjection; } if (otherState.HasLocalModel) { // LocalModel update LocalModel.Set(LocalModel.Multiply(otherState.LocalModel)); // LocalModelView update if (LocalModelView != null) { LocalModelView.Set(LocalModelView.Multiply(otherState.LocalModel)); } else if (otherState.LocalModelView != null) { LocalModelView = otherState.LocalModelView; } // LocalModelViewProjection update LocalModelViewProjection.Set(LocalModelViewProjection.Multiply(otherState.LocalModel)); } } catch (InvalidCastException) { throw new ArgumentException("not a TransformStateBase", "state"); } }