예제 #1
0
 public void InvalidateMaterials()
 {
     foreach (var mesh in Descendants.OfType <Mesh3D>().SelectMany((m) => m.Submeshes))
     {
         mesh.Material.Invalidate();
     }
 }
예제 #2
0
파일: Model3D.cs 프로젝트: klenin/Citrus
 private void ResetLightning()
 {
     foreach (var mesh in Descendants.OfType <Mesh3D>())
     {
         mesh.ProcessLightning = lightningEnabled;
         mesh.RecieveShadow    = recieveShadow;
         mesh.CastShadow       = castShadow;
     }
 }
예제 #3
0
파일: Model3D.cs 프로젝트: x5f3759df/Citrus
        public void RebuildSkeleton()
        {
            var submeshes = Descendants
                            .OfType <Mesh3D>()
                            .SelectMany(m => m.Submeshes);

            foreach (var sm in submeshes)
            {
                sm.RebuildSkeleton(this);
            }
        }
예제 #4
0
        /// <summary>
        /// Tries to looks for the specified message type and returns it.
        /// </summary>
        /// <param name="result">The message of the specified type.</param>
        /// <typeparam name="T">The message type that needs to be searched.</typeparam>
        /// <returns><c>true</c>, if the message was found; otherwise <c>false</c>.</returns>
        /// <remarks>
        /// This method is necessary because there can be a hierarchy of messages. In this case the whole stack needs to be searched for the message.
        /// </remarks>
        /// <example>
        /// <code>
        /// protected override void ExecuteCore(Message messageData)
        /// {
        ///     //This will not execute if the message was decorated
        ///     if(messageData is SpecificMessage message)
        ///     {
        ///         //...
        ///     }
        ///
        ///     //This will work either way
        ///     if(messageData.TryGet(out SpecificMessage message))
        ///     {
        ///         //...
        ///     }
        /// }
        /// </code>
        /// </example>
        public bool TryGet <T>(out T result) where T : Message
        {
            result = this as T;
            if (result == null)
            {
                if (this != HeadMessage)
                {
                    HeadMessage.TryGet(out result);
                }
                else
                {
                    result = Descendants.OfType <T>().FirstOrDefault();
                }
            }

            return(result != null);
        }
예제 #5
0
 private void ManageFocusOnWindowActivation()
 {
     if (Window.Active)
     {
         if (Widget.Focused != null && Widget.Focused.SameOrDescendantOf(this))
         {
             lastFocused = Widget.Focused;
         }
     }
     if (windowActivated)
     {
         windowActivated = false;
         if (lastFocused == null || !lastFocused.GloballyVisible || !lastFocused.SameOrDescendantOf(this))
         {
             // Looking the first focus scope widget on the window and make it focused.
             lastFocused = Descendants.OfType <Widget>().FirstOrDefault(i => i.FocusScope != null && i.GloballyVisible);
         }
         Widget.SetFocus(lastFocused);
     }
 }