Example #1
0
        /// <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");
            }

            RenderBufferState otherState = state as RenderBufferState;

            if (otherState == null)
            {
                throw new ArgumentException("not a RenderBufferState", "state");
            }

            // The actual binding name
            mDrawBinding = otherState.mDrawBinding;

            // The framebuffer object
            mDrawFramebuffer = otherState.mDrawFramebuffer;
            if (mDrawFramebuffer != null)
            {
                mDrawFramebuffer.IncRef();
            }

            // The draw buffers
            if (otherState.mDrawBuffers != null)
            {
                mDrawBuffers = new int[otherState.mDrawBuffers.Length];
                Array.Copy(otherState.mDrawBuffers, mDrawBuffers, mDrawBuffers.Length);
            }
            else
            {
                mDrawBuffers = null;
            }
        }
Example #2
0
        /// <summary>
        /// Performs a deep copy of this <see cref="IGraphicsState"/>.
        /// </summary>
        /// <returns>
        /// It returns the equivalent of this <see cref="IGraphicsState"/>, but all objects referenced
        /// are not referred by both instances.
        /// </returns>
        public override IGraphicsState Copy()
        {
            RenderBufferState copy = base.Copy() as RenderBufferState;

            copy.mDrawBuffers = new int[mDrawBuffers.Length];
            Array.Copy(mDrawBuffers, copy.mDrawBuffers, mDrawBuffers.Length);

            return(copy);
        }
Example #3
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">
        /// A <see cref="GraphicsState"/> to compare to this GraphicsState.
        /// </param>
        /// <returns>
        /// It returns true if the current object is equal to <paramref name="other"/>.
        /// </returns>
        /// <remarks>
        /// <para>
        /// This method test only whether <paramref name="other"/> type equals to this type.
        /// </para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// This exception is thrown if the parameter <paramref name="other"/> is null.
        /// </exception>
        public override bool Equals(IGraphicsState other)
        {
            if (base.Equals(other) == false)
            {
                return(false);
            }
            Debug.Assert(other is RenderBufferState);

            RenderBufferState otherState = (RenderBufferState)other;

            if (mDrawBinding != otherState.mDrawBinding)
            {
                return(false);
            }

            return(true);
        }