Exemplo n.º 1
0
        protected override void UpdateResourceCore(DUCE.Channel channel)
        {
            Debug.Assert(_duceResource.IsOnChannel(channel));
            DependencyObject dobj = ((DependencyObject)_dependencyObject.Target);

            // The dependency object was GCed, nothing to do here
            if (dobj == null)
            {
                return;
            }

            Quaternion tempValue = (Quaternion)dobj.GetValue(_dependencyProperty);

            DUCE.MILCMD_QUATERNIONRESOURCE data;
            data.Type   = MILCMD.MilCmdQuaternionResource;
            data.Handle = _duceResource.GetHandle(channel);
            data.Value  = CompositionResourceManager.QuaternionToMilQuaternionF(tempValue);

            unsafe
            {
                channel.SendCommand(
                    (byte *)&data,
                    sizeof(DUCE.MILCMD_QUATERNIONRESOURCE));
            }
        }
Exemplo n.º 2
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Obtain handles for animated properties
                DUCE.ResourceHandle hQuaternionAnimations = GetAnimationResourceHandle(QuaternionProperty, channel);

                // Pack & send command packet
                DUCE.MILCMD_QUATERNIONROTATION3D data;
                unsafe
                {
                    data.Type   = MILCMD.MilCmdQuaternionRotation3D;
                    data.Handle = _duceResource.GetHandle(channel);
                    if (hQuaternionAnimations.IsNull)
                    {
                        data.quaternion = CompositionResourceManager.QuaternionToMilQuaternionF(Quaternion);
                    }
                    data.hQuaternionAnimations = hQuaternionAnimations;

                    // Send packed command structure
                    channel.SendCommand(
                        (byte *)&data,
                        sizeof(DUCE.MILCMD_QUATERNIONROTATION3D));
                }
            }
        }