Represents an RGBA color with 8-bit precision per channel.
Пример #1
0
 internal static bool TryParseHexColor(string Expression, out World.ColorRGBA Color)
 {
     if (Expression.StartsWith("#"))
     {
         string a = Expression.Substring(1).TrimStart();
         int    x; if (int.TryParse(a, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out x))
         {
             int r = (x >> 16) & 0xFF;
             int g = (x >> 8) & 0xFF;
             int b = x & 0xFF;
             if (r >= 0 & r <= 255 & g >= 0 & g <= 255 & b >= 0 & b <= 255)
             {
                 Color = new World.ColorRGBA((byte)r, (byte)g, (byte)b, 255);
                 return(true);
             }
             else
             {
                 Color = new World.ColorRGBA(0, 0, 255, 255);
                 return(false);
             }
         }
         else
         {
             Color = new World.ColorRGBA(0, 0, 255, 255);
             return(false);
         }
     }
     else
     {
         Color = new World.ColorRGBA(0, 0, 255, 255);
         return(false);
     }
 }
Пример #2
0
 internal Material(Material Prototype)
 {
     this.Color = Prototype.Color;
     this.EmissiveColor = Prototype.EmissiveColor;
     this.EmissiveColorUsed = Prototype.EmissiveColorUsed;
     this.TransparentColor = Prototype.TransparentColor;
     this.TransparentColorUsed = Prototype.TransparentColorUsed;
     this.DaytimeTexture = Prototype.DaytimeTexture;
     this.NighttimeTexture = Prototype.NighttimeTexture;
     this.BlendMode = Prototype.BlendMode;
     this.GlowAttenuationData = Prototype.GlowAttenuationData;
 }
Пример #3
0
 internal Material()
 {
     this.Color = new World.ColorRGBA(255, 255, 255, 255);
     this.EmissiveColor = new World.ColorRGB(0, 0, 0);
     this.EmissiveColorUsed = false;
     this.TransparentColor = new World.ColorRGB(0, 0, 0);
     this.TransparentColorUsed = false;
     this.DaytimeTexture = null;
     this.NighttimeTexture = null;
     this.BlendMode = World.MeshMaterialBlendMode.Normal;
     this.GlowAttenuationData = 0;
 }
Пример #4
0
 internal Material(Material Prototype)
 {
     this.Color                = Prototype.Color;
     this.EmissiveColor        = Prototype.EmissiveColor;
     this.EmissiveColorUsed    = Prototype.EmissiveColorUsed;
     this.TransparentColor     = Prototype.TransparentColor;
     this.TransparentColorUsed = Prototype.TransparentColorUsed;
     this.DaytimeTexture       = Prototype.DaytimeTexture;
     this.NighttimeTexture     = Prototype.NighttimeTexture;
     this.BlendMode            = Prototype.BlendMode;
     this.GlowAttenuationData  = Prototype.GlowAttenuationData;
 }
Пример #5
0
 internal Material()
 {
     this.Color                = new World.ColorRGBA(255, 255, 255, 255);
     this.EmissiveColor        = new World.ColorRGB(0, 0, 0);
     this.EmissiveColorUsed    = false;
     this.TransparentColor     = new World.ColorRGB(0, 0, 0);
     this.TransparentColorUsed = false;
     this.DaytimeTexture       = null;
     this.NighttimeTexture     = null;
     this.BlendMode            = World.MeshMaterialBlendMode.Normal;
     this.GlowAttenuationData  = 0;
 }
Пример #6
0
			internal Material() {
				this.Color = new World.ColorRGBA(255, 255, 255, 255);
				this.EmissiveColor = new World.ColorRGB(0, 0, 0);
				this.EmissiveColorUsed = false;
				this.TransparentColor = new World.ColorRGB(0, 0, 0);
				this.TransparentColorUsed = false;
				this.DaytimeTexture = null;
				this.NighttimeTexture = null;
				this.BlendMode = World.MeshMaterialBlendMode.Normal;
				this.GlowAttenuationData = 0;
				this.TextColor = System.Drawing.Color.Black;
				this.BackgroundColor = System.Drawing.Color.White;
				this.TextPadding = new Vector2(0, 0);
				this.Font = "Arial";
			}
Пример #7
0
		internal static bool TryParseHexColor(string Expression, out World.ColorRGBA Color) {
			if (Expression.StartsWith("#")) {
				string a = Expression.Substring(1).TrimStart();
				int x; if (int.TryParse(a, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out x)) {
					int r = (x >> 16) & 0xFF;
					int g = (x >> 8) & 0xFF;
					int b = x & 0xFF;
					if (r >= 0 & r <= 255 & g >= 0 & g <= 255 & b >= 0 & b <= 255) {
						Color = new World.ColorRGBA((byte)r, (byte)g, (byte)b, 255);
						return true;
					} else {
						Color = new World.ColorRGBA(0, 0, 255, 255);
						return false;
					}
				} else {
					Color = new World.ColorRGBA(0, 0, 255, 255);
					return false;
				}
			} else {
				Color = new World.ColorRGBA(0, 0, 255, 255);
				return false;
			}
		}