Exemplo n.º 1
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
            node.Add(LightmapName, Lightmap.ExportYAML(container));
            if (HasIndirectLightmap(container.ExportVersion))
            {
                node.Add(IndirectLightmapName, IndirectLightmap.ExportYAML(container));
            }
            if (HasLightInd(container.ExportVersion))
            {
                node.Add(LightIndName, LightInd.ExportYAML(container));
                node.Add(DirIndName, DirInd.ExportYAML(container));
            }
            if (HasDirLightmap(container.ExportVersion))
            {
                node.Add(DirLightmapName, DirLightmap.ExportYAML(container));
            }
            if (HasShadowMask(container.ExportVersion))
            {
                node.Add(ShadowMaskName, ShadowMask.ExportYAML(container));
            }
            return(node);
        }
Exemplo n.º 2
0
        public IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false)
        {
            yield return(Lightmap.FetchDependency(file, isLog, () => nameof(LightmapData), "m_Lightmap"));

            yield return(DirLightmap.FetchDependency(file, isLog, () => nameof(LightmapData), "m_DirLightmap"));

            yield return(ShadowMask.FetchDependency(file, isLog, () => nameof(LightmapData), "m_ShadowMask"));
        }
Exemplo n.º 3
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion));
            node.Add(LightmapName, Lightmap.ExportYAML(container));
            node.Add(DirLightmapName, DirLightmap.ExportYAML(container));
            node.Add(ShadowMaskName, ShadowMask.ExportYAML(container));
            return(node);
        }
Exemplo n.º 4
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add("m_Lightmap", Lightmap.ExportYAML(container));
            node.Add("m_DirLightmap", DirLightmap.ExportYAML(container));
            node.Add("m_ShadowMask", ShadowMask.ExportYAML(container));
            return(node);
        }
Exemplo n.º 5
0
 public void Read(AssetStream stream)
 {
     Lightmap.Read(stream);
     if (IsReadDirLightmap(stream.Version))
     {
         DirLightmap.Read(stream);
     }
     if (IsReadShadowMask(stream.Version))
     {
         ShadowMask.Read(stream);
     }
 }
Exemplo n.º 6
0
 public void Read(AssetReader reader)
 {
     Lightmap.Read(reader);
     if (IsReadDirLightmap(reader.Version))
     {
         DirLightmap.Read(reader);
     }
     if (IsReadShadowMask(reader.Version))
     {
         ShadowMask.Read(reader);
     }
 }
Exemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="borderWidth"></param>
        /// <param name="borderColor"></param>
        /// <param name="shadowMask"></param>
        /// <param name="targets"></param>
        public void AddShadow(int borderWidth, Color borderColor, ShadowMask shadowMask, params Control[] targets)
        {
            if (targets == null)
            {
                throw new ArgumentNullException("targets");
            }

            foreach (var target in targets)
            {
                borderEffects.Add(new ShadowEffect(target)
                {
                    BorderWidth = borderWidth, BorderColor = borderColor, ShadowMask = shadowMask
                });
            }
        }
Exemplo n.º 8
0
 public void Read(AssetReader reader)
 {
     Lightmap.Read(reader);
     if (HasIndirectLightmap(reader.Version))
     {
         IndirectLightmap.Read(reader);
     }
     if (HasLightInd(reader.Version))
     {
         LightInd.Read(reader);
         DirInd.Read(reader);
     }
     if (HasDirLightmap(reader.Version))
     {
         DirLightmap.Read(reader);
         ShadowMask.Read(reader);
     }
 }
Exemplo n.º 9
0
 public void Write(AssetWriter writer)
 {
     Lightmap.Write(writer);
     if (HasIndirectLightmap(writer.Version))
     {
         IndirectLightmap.Write(writer);
     }
     if (HasLightInd(writer.Version))
     {
         LightInd.Write(writer);
         DirInd.Write(writer);
     }
     if (HasDirLightmap(writer.Version))
     {
         DirLightmap.Write(writer);
         ShadowMask.Write(writer);
     }
 }
Exemplo n.º 10
0
 protected override void OnUpdate()
 {
     // go through all known render types, and assign groups to them
     // assign groups to all renderers
     Entities
     .WithNone <RenderToPasses>()
     .WithAll <MeshRenderer, TextRenderer>()
     .ForEach((Entity e) => {
         CameraMask cameraMask;
         if (EntityManager.HasComponent <CameraMask>(e))
         {
             cameraMask = EntityManager.GetComponentData <CameraMask>(e);
         }
         else
         {
             cameraMask = new CameraMask {
                 mask = ulong.MaxValue
             }
         };
         if (EntityManager.HasComponent <CameraMask>(e))
         {
             cameraMask = EntityManager.GetComponentData <CameraMask>(e);
         }
         ShadowMask shadowMask = new ShadowMask {
             mask = ulong.MaxValue
         };
         if (EntityManager.HasComponent <ShadowMask>(e))
         {
             shadowMask = EntityManager.GetComponentData <ShadowMask>(e);
         }
         m_AssignRenderGroups.AddItemToRenderGroup(e,
                                                   new BuildGroup
         {
             passTypes  = RenderPassType.Transparent,
             cameraMask = cameraMask, shadowMask = shadowMask
         });
     });
 }
Exemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mask"></param>
 /// <returns></returns>
 public static bool IsTop(this ShadowMask mask)
 {
     return((mask == ShadowMask.TopLeft) || (mask == ShadowMask.TopCenter) || (mask == ShadowMask.TopRight));
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mask"></param>
 /// <returns></returns>
 public static bool IsLeft(this ShadowMask mask)
 {
     return((mask == ShadowMask.TopLeft) || (mask == ShadowMask.MiddleLeft) || (mask == ShadowMask.BottomLeft));
 }
Exemplo n.º 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mask"></param>
 /// <returns></returns>
 public static bool IsRight(this ShadowMask mask)
 {
     return((mask == ShadowMask.TopRight) || (mask == ShadowMask.MiddleRight) || (mask == ShadowMask.BottomRight));
 }
 public static void DrawShadow(this Graphics g, string text, Font font, Color color, float x, float y, ShadowMask mask)
 {
     using (var brush = new SolidBrush(color))
     {
         if ((mask & ShadowMask.TopLeft) != 0)
         {
             g.DrawString(text, font, brush, x - 1, y - 1);
         }
         if ((mask & ShadowMask.TopCenter) != 0)
         {
             g.DrawString(text, font, brush, x, y - 1);
         }
         if ((mask & ShadowMask.TopRight) != 0)
         {
             g.DrawString(text, font, brush, x + 1, y - 1);
         }
         if ((mask & ShadowMask.MiddleLeft) != 0)
         {
             g.DrawString(text, font, brush, x - 1, y);
         }
         if ((mask & ShadowMask.MiddleRight) != 0)
         {
             g.DrawString(text, font, brush, x + 1, y);
         }
         if ((mask & ShadowMask.BottomLeft) != 0)
         {
             g.DrawString(text, font, brush, x - 1, y + 1);
         }
         if ((mask & ShadowMask.BottomCenter) != 0)
         {
             g.DrawString(text, font, brush, x, y + 1);
         }
         if ((mask & ShadowMask.BottomRight) != 0)
         {
             g.DrawString(text, font, brush, x + 1, y + 1);
         }
     }
 }
        public static void DrawShadow(this Graphics g, string text, Font font, Color color, RectangleF rect, ContentAlignmentEx textAlign, ShadowMask mask)
        {
            var rc = textAlign.CalcTextRect(g.MeasureString(text, font), rect);

            DrawShadow(g, text, font, color, rc.X, rc.Y, mask);
        }
Exemplo n.º 16
0
 public static void DrawShadow(this Graphics g, string text, Font font, Color color, RectangleF rect, ContentAlignmentEx textAlign, ShadowMask mask)
 {
     var rc = textAlign.CalcTextRect(g.MeasureString(text, font), rect);
     DrawShadow(g, text, font, color, rc.X, rc.Y, mask);
 }
Exemplo n.º 17
0
 public static void DrawShadow(this Graphics g, string text, Font font, Color color, float x, float y, ShadowMask mask)
 {
     using (var brush = new SolidBrush(color))
     {
         if ((mask & ShadowMask.TopLeft) != 0)
         {
             g.DrawString(text, font, brush, x - 1, y - 1);
         }
         if ((mask & ShadowMask.TopCenter) != 0)
         {
             g.DrawString(text, font, brush, x, y - 1);
         }
         if ((mask & ShadowMask.TopRight) != 0)
         {
             g.DrawString(text, font, brush, x + 1, y - 1);
         }
         if ((mask & ShadowMask.MiddleLeft) != 0)
         {
             g.DrawString(text, font, brush, x - 1, y);
         }
         if ((mask & ShadowMask.MiddleRight) != 0)
         {
             g.DrawString(text, font, brush, x + 1, y);
         }
         if ((mask & ShadowMask.BottomLeft) != 0)
         {
             g.DrawString(text, font, brush, x - 1, y + 1);
         }
         if ((mask & ShadowMask.BottomCenter) != 0)
         {
             g.DrawString(text, font, brush, x, y + 1);
         }
         if ((mask & ShadowMask.BottomRight) != 0)
         {
             g.DrawString(text, font, brush, x + 1, y + 1);
         }
     }
 }
Exemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mask"></param>
 /// <returns></returns>
 public static bool IsBottom(this ShadowMask mask)
 {
     return((mask == ShadowMask.BottomLeft) || (mask == ShadowMask.BottomCenter) || (mask == ShadowMask.BottomRight));
 }
Exemplo n.º 19
0
        protected static void DrawText(Graphics g, Rectangle rect, string text, ContentAlignmentEx alignment, bool multiline, Font font, Color color, Color shadow, ShadowMask mask)
        {
            if (multiline == false)
            {
                var rc = alignment.CalcTextRect(g.MeasureString(text, font), rect);

                if (mask != ShadowMask.None)
                {
                    g.DrawShadow(text, font, shadow, rc.X, rc.Y, mask);
                }

                using (var brush = new SolidBrush(color))
                {
                    g.DrawString(text, font, brush, rc.X, rc.Y);
                }
            }
            else
            {
                var texts = g.GetMultilineText(text, font, rect.Width);
                var textSize = g.CalcMultilineTextSize(texts, font);

                var rc = alignment.CalcTextRect(textSize, rect);
                using (var brush = new SolidBrush(color))
                {
                    var top = rc.Top;
                    foreach (var line in texts)
                    {
                        var size = g.MeasureString(String.IsNullOrEmpty(line) ? " " : line, font);
                        var rcLine = alignment.CalcTextRect(size, rc.Left, top, rc.Width, size.Height);

                        if (mask != ShadowMask.None)
                        {
                            g.DrawShadow(text, font, shadow, rcLine.X, rcLine.Y, mask);
                        }

                        g.DrawString(line, font, brush, rcLine.X, rcLine.Y);

                        top += rcLine.Height;
                    }
                }
            }
        }
Exemplo n.º 20
0
        protected static void DrawText(Graphics g, Rectangle rect, string text, ContentAlignmentEx alignment, bool multiline, Font font, Color color, Color shadow, ShadowMask mask)
        {
            if (multiline == false)
            {
                var rc = alignment.CalcTextRect(g.MeasureString(text, font), rect);

                if (mask != ShadowMask.None)
                {
                    g.DrawShadow(text, font, shadow, rc.X, rc.Y, mask);
                }

                using (var brush = new SolidBrush(color))
                {
                    g.DrawString(text, font, brush, rc.X, rc.Y);
                }
            }
            else
            {
                var texts    = g.GetMultilineText(text, font, rect.Width);
                var textSize = g.CalcMultilineTextSize(texts, font);

                var rc = alignment.CalcTextRect(textSize, rect);
                using (var brush = new SolidBrush(color))
                {
                    var top = rc.Top;
                    foreach (var line in texts)
                    {
                        var size   = g.MeasureString(String.IsNullOrEmpty(line) ? " " : line, font);
                        var rcLine = alignment.CalcTextRect(size, rc.Left, top, rc.Width, size.Height);

                        if (mask != ShadowMask.None)
                        {
                            g.DrawShadow(text, font, shadow, rcLine.X, rcLine.Y, mask);
                        }

                        g.DrawString(line, font, brush, rcLine.X, rcLine.Y);

                        top += rcLine.Height;
                    }
                }
            }
        }