Пример #1
0
            /// <summary>
            /// Converts a string of color values to its <see cref="VRageMath.Color"/> equivalent.
            /// </summary>
            public static VRageMath.Color ParseColor(string colorData, bool ignoreAlpha = false)
            {
                Match             match    = colorParser.Match(colorData);
                CaptureCollection captures = match.Groups[2].Captures;

                VRageMath.Color value = new VRageMath.Color();

                if (captures.Count > 2)
                {
                    value.R = byte.Parse(captures[0].Value);
                    value.G = byte.Parse(captures[1].Value);
                    value.B = byte.Parse(captures[2].Value);

                    if (captures.Count > 3 || ignoreAlpha)
                    {
                        value.A = byte.Parse(captures[3].Value);
                    }
                    else
                    {
                        value.A = 255;
                    }

                    return(value);
                }
                else
                {
                    throw new Exception("Color string must contain at least 3 values.");
                }
            }
Пример #2
0
        public void DrawGameLogo(float transitionAlpha)
        {
            Color colorForeground = new Color(1, 1, 1, transitionAlpha);

            MyGuiManager.DrawSpriteBatch(GameLogoTexture, new Vector2(0.5f, 0.15f),
                                         new Vector2(702 / 1600f, 237 / 1200f), colorForeground,
                                         MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
        }
Пример #3
0
 internal void Add6FacedConvex(Vector3 [] vertices, Color color)
 {
     AddQuad(vertices[0], vertices[1], vertices[2], vertices[3], color);
     AddQuad(vertices[4], vertices[5], vertices[6], vertices[7], color);
     AddQuad(vertices[0], vertices[1], vertices[5], vertices[4], color);
     AddQuad(vertices[0], vertices[3], vertices[7], vertices[4], color);
     AddQuad(vertices[3], vertices[2], vertices[6], vertices[7], color);
     AddQuad(vertices[2], vertices[1], vertices[5], vertices[6], color);
 }
Пример #4
0
        public static Vector3 ColorToHSVDX11(this VRageMath.Color rgb)
        {
            System.Drawing.Color color = System.Drawing.Color.FromArgb(rgb.R, rgb.G, rgb.B);
            int   num  = Math.Max(color.R, Math.Max(color.G, color.B));
            int   num2 = Math.Min(color.R, Math.Min(color.G, color.B));
            float x    = color.GetHue() / 360f;
            float y    = (num == 0) ? -1f : (1f - ((2f * num2) / ((float)num)));

            return(new Vector3(x, y, -1f + ((2f * num) / 255f)));
        }
Пример #5
0
 public static string GetColorString(VRageMath.Color color, bool includeAlpha = true)
 {
     if (includeAlpha)
     {
         return($"{color.R},{color.G},{color.B},{color.A}");
     }
     else
     {
         return($"{color.R},{color.G},{color.B}");
     }
 }
Пример #6
0
        internal void Clear(VRageMath.Color clearColor)
        {
            RC.ClearDsv(DepthStencil,
                        DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, MyRender11.DepthClearValue, 0);

            var v3 = clearColor.ToVector3();

            RC.ClearRtv(m_gbuffer0, new Color4(v3.X, v3.Y, v3.Z, 1));
            RC.ClearRtv(m_gbuffer1, Color4.Black);
            RC.ClearRtv(m_gbuffer2, Color4.Black);
            RC.ClearRtv(m_lbuffer, Color4.Black);
        }
Пример #7
0
        internal void AddSphereRing(BoundingSphere sphere, Color color, Matrix onb)
        {
            float increment = 1.0f / 32;

            for (float i = 0; i < 1; i += increment)
            {
                float a0 = 2 * (float)Math.PI * i;
                float a1 = 2 * (float)Math.PI * (i + increment);

                Add(
                    Vector3.Transform(new Vector3(Math.Cos(a0), 0, Math.Sin(a0)) * sphere.Radius, onb) + sphere.Center,
                    Vector3.Transform(new Vector3(Math.Cos(a1), 0, Math.Sin(a1)) * sphere.Radius, onb) + sphere.Center,
                    color);
            }
        }
Пример #8
0
        internal void AddQuad(Vector3 v0, Vector3 v1, Vector3 v2, Vector3 v3, Color color)
        {
            var bcolor = new Byte4(color.R, color.G, color.B, color.A);

            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));

            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));

            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));

            Add(new MyVertexFormatPositionColor(v3, bcolor));
            Add(new MyVertexFormatPositionColor(v0, bcolor));
        }
        internal static void AddSingleSprite(string textureStr, Color color, Vector2 origin, Rectangle? sourceRect, RectangleF destinationRect)
        {
            Vector2 clipOffset;
            Vector2 clipScale;

            CalculateSpriteClipspace(destinationRect,
                MyRender.ViewportResolution,
                out clipOffset, out clipScale);

            var texture = MyTextureManager.GetTexture(textureStr);

            AddSingleSprite(texture, new MyVertexFormatSpritePositionTextureColor(
                new HalfVector4(clipOffset.X, clipOffset.Y, clipScale.X, clipScale.Y),
                new HalfVector4(0, 0, 1, 1),
                new Byte4(color.R, color.G, color.B, color.A)));
        }
Пример #10
0
        internal void AddQuad(Vector3 v0, Vector3 v1, Vector3 v2, Vector3 v3, Color color)
        {
            var bcolor = new Byte4(color.R, color.G, color.B, color.A);

            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));

            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));

            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));

            Add(new MyVertexFormatPositionColor(v3, bcolor));
            Add(new MyVertexFormatPositionColor(v0, bcolor));
        }
Пример #11
0
        internal static void AddSingleSprite(string textureStr, Color color, Vector2 origin, Rectangle?sourceRect, RectangleF destinationRect)
        {
            Vector2 clipOffset;
            Vector2 clipScale;

            CalculateSpriteClipspace(destinationRect,
                                     MyRender.ViewportResolution,
                                     out clipOffset, out clipScale);

            var texture = MyTextureManager.GetTexture(textureStr);

            AddSingleSprite(texture, new MyVertexFormatSpritePositionTextureColor(
                                new HalfVector4(clipOffset.X, clipOffset.Y, clipScale.X, clipScale.Y),
                                new HalfVector4(0, 0, 1, 1),
                                new Byte4(color.R, color.G, color.B, color.A)));
        }
Пример #12
0
        internal static void AddSingleSprite(ISrvBindable view, Vector2 textureSize, Color color, Vector2 origin, Vector2 tangent, Rectangle?sourceRect, RectangleF destinationRect)
        {
            if (StackTop.m_internalBatch.ScissorRectangle.HasValue)
            {
                RectangleF intersection;
                var        scissor = StackTop.m_internalBatch.ScissorRectangle.Value;
                RectangleF.Intersect(ref scissor, ref destinationRect, out intersection);
                if (intersection.Size.X * intersection.Size.Y == 0)
                {
                    return;
                }
            }

            Vector2 clipOffset;

            Vector2 targetResolution = StackTop.m_resolution ?? MyRender11.ResolutionF;

            clipOffset   = destinationRect.Position / targetResolution * 2 - 1;
            clipOffset.Y = -clipOffset.Y;

            Vector2 texOffset = Vector2.Zero;
            Vector2 texScale  = Vector2.One;

            Vector2 originOffset;

            if (sourceRect != null)
            {
                Vector2 leftTop = new Vector2(sourceRect.Value.Left, sourceRect.Value.Top);
                Vector2 size    = new Vector2(sourceRect.Value.Width, sourceRect.Value.Height);
                texOffset = leftTop / textureSize;
                texScale  = size / textureSize;

                originOffset    = origin / new Vector2(sourceRect.Value.Width, sourceRect.Value.Height) - 0.5f;
                originOffset.Y *= -1;
            }
            else
            {
                originOffset    = origin / textureSize - 0.5f;
                originOffset.Y *= -1;
            }

            AddSingleSprite(view, new MyVertexFormatSpritePositionTextureRotationColor(
                                new HalfVector4(clipOffset.X, clipOffset.Y, destinationRect.Width, destinationRect.Height),
                                new HalfVector4(texOffset.X, texOffset.Y, texScale.X, texScale.Y),
                                new HalfVector4(originOffset.X, originOffset.Y, tangent.X, tangent.Y),
                                new Byte4(color.R, color.G, color.B, color.A)));
        }
Пример #13
0
            /// <summary>
            /// Tries to convert a string of color values to its <see cref="VRageMath.Color"/> equivalent.
            /// </summary>
            public static bool TryParseColor(string colorData, out VRageMath.Color value, bool ignoreAlpha = false)
            {
                bool successful;

                try
                {
                    value      = ParseColor(colorData, ignoreAlpha);
                    successful = true;
                }
                catch
                {
                    value      = VRageMath.Color.White;
                    successful = false;
                }

                return(successful);
            }
Пример #14
0
        internal void AddBoundingBox(BoundingBox bb, Color color)
        {
            var v0 = bb.Center - bb.HalfExtents;
            var v1 = v0 + new Vector3(bb.HalfExtents.X * 2, 0, 0);
            var v2 = v0 + new Vector3(bb.HalfExtents.X * 2, bb.HalfExtents.Y * 2, 0);
            var v3 = v0 + new Vector3(0, bb.HalfExtents.Y * 2, 0);

            var v4 = v0 + new Vector3(0, 0, bb.HalfExtents.Z * 2);
            var v5 = v4 + new Vector3(bb.HalfExtents.X * 2, 0, 0);
            var v6 = v4 + new Vector3(bb.HalfExtents.X * 2, bb.HalfExtents.Y * 2, 0);
            var v7 = v4 + new Vector3(0, bb.HalfExtents.Y * 2, 0);

            var bcolor = new Byte4(color.R, color.G, color.B, color.A);

            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));
            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));

            Add(new MyVertexFormatPositionColor(v4, bcolor));
            Add(new MyVertexFormatPositionColor(v5, bcolor));
            Add(new MyVertexFormatPositionColor(v5, bcolor));
            Add(new MyVertexFormatPositionColor(v6, bcolor));
            Add(new MyVertexFormatPositionColor(v6, bcolor));
            Add(new MyVertexFormatPositionColor(v7, bcolor));
            Add(new MyVertexFormatPositionColor(v4, bcolor));
            Add(new MyVertexFormatPositionColor(v7, bcolor));

            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v4, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v5, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v6, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));
            Add(new MyVertexFormatPositionColor(v7, bcolor));
        }
        internal void AddBoundingBox(BoundingBox bb, Color color)
        {
            var v0 = bb.Center - bb.HalfExtents;
            var v1 = v0 + new Vector3(bb.HalfExtents.X * 2, 0, 0);
            var v2 = v0 + new Vector3(bb.HalfExtents.X * 2, bb.HalfExtents.Y * 2, 0);
            var v3 = v0 + new Vector3(0, bb.HalfExtents.Y * 2, 0);

            var v4 = v0 + new Vector3(0, 0, bb.HalfExtents.Z * 2);
            var v5 = v4 + new Vector3(bb.HalfExtents.X * 2, 0, 0);
            var v6 = v4 + new Vector3(bb.HalfExtents.X * 2, bb.HalfExtents.Y * 2, 0);
            var v7 = v4 + new Vector3(0, bb.HalfExtents.Y * 2, 0);

            var bcolor = new Byte4(color.R, color.G, color.B, color.A);

            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));
            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));

            Add(new MyVertexFormatPositionColor(v4, bcolor));
            Add(new MyVertexFormatPositionColor(v5, bcolor));
            Add(new MyVertexFormatPositionColor(v5, bcolor));
            Add(new MyVertexFormatPositionColor(v6, bcolor));
            Add(new MyVertexFormatPositionColor(v6, bcolor));
            Add(new MyVertexFormatPositionColor(v7, bcolor));
            Add(new MyVertexFormatPositionColor(v4, bcolor));
            Add(new MyVertexFormatPositionColor(v7, bcolor));

            Add(new MyVertexFormatPositionColor(v0, bcolor));
            Add(new MyVertexFormatPositionColor(v4, bcolor));
            Add(new MyVertexFormatPositionColor(v1, bcolor));
            Add(new MyVertexFormatPositionColor(v5, bcolor));
            Add(new MyVertexFormatPositionColor(v2, bcolor));
            Add(new MyVertexFormatPositionColor(v6, bcolor));
            Add(new MyVertexFormatPositionColor(v3, bcolor));
            Add(new MyVertexFormatPositionColor(v7, bcolor));
        }
Пример #16
0
        internal void AddCone(Vector3 translation, Vector3 directionVec, Vector3 baseVec, int tessalation, Color color)
        {
            var axis = directionVec;
            axis.Normalize();

            var apex = translation + directionVec;

            var steps = tessalation;
            var stepsRcp = (float)(Math.PI * 2 / steps);
            for (int i = 0; i < 32; i++)
            {
                float a0 = i * stepsRcp;
                float a1 = (i + 1) * stepsRcp;

                var A = translation + Vector3.Transform(baseVec, Matrix.CreateFromAxisAngle(axis, a0));
                var B = translation + Vector3.Transform(baseVec, Matrix.CreateFromAxisAngle(axis, a1));

                Add(A, B, color);
                Add(A, apex, color);
            }
        }
Пример #17
0
        internal void Clear(VRageMath.Color clearColor)
        {
            MyRender11.DeviceContext.ClearDepthStencilView(DepthStencil.m_DSV,
                                                           DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, MyRender11.DepthClearValue, 0);

            foreach (var res in m_resources)
            {
                var rt = res as IRenderTargetBindable;
                if (rt != null)
                {
                    var v3 = clearColor.ToVector3();
                    MyRender11.DeviceContext.ClearRenderTargetView(rt.RTV,
                                                                   new Color4(v3.X, v3.Y, v3.Z, 1
                                                                              ));
                }

                var uav = res as IUnorderedAccessBindable;
                if (uav != null)
                {
                    MyRender11.DeviceContext.ClearUnorderedAccessView(uav.UAV, Int4.Zero);
                }
            }
        }
Пример #18
0
 public static VRageMath.Color Shade(this VRageMath.Color c, float r) =>
 new VRageMath.Color((int)(c.R * r), (int)(c.G * r), (int)(c.B * r), c.A);
Пример #19
0
 void IMyEntity.SetEmissivePartsForSubparts(string emissiveName, VRageMath.Color emissivePartColor, float emissivity)
 {
     SetEmissivePartsForSubparts(emissiveName, emissivePartColor, emissivity);
 }
Пример #20
0
 public static float HueDistance(this VRageMath.Color color, VRageMath.Color otherColor) =>
 color.HueDistance(otherColor.ColorToHSV().X);
Пример #21
0
 public static VRageMath.Color Alpha(this VRageMath.Color c, float a) =>
 new VRageMath.Color(c, a);
Пример #22
0
        internal static void AddSingleSprite(ShaderResourceView view, Vector2 textureSize, Color color, Vector2 origin, Vector2 tangent, Rectangle? sourceRect, RectangleF destinationRect)
        {
            if (StackTop().m_internalBatch.ScissorRectangle.HasValue)
            {
                RectangleF intersection;
                var scissor = StackTop().m_internalBatch.ScissorRectangle.Value;
                RectangleF.Intersect(ref scissor, ref destinationRect, out intersection);
                if (intersection.Size.X * intersection.Size.Y == 0)
                {
                    return;
                }
            }

            Vector2 clipOffset;

            Vector2 targetResolution = StackTop().m_resolution ?? MyRender11.ResolutionF;
            clipOffset = destinationRect.Position / targetResolution * 2 - 1;
            clipOffset.Y = -clipOffset.Y;

            Vector2 texOffset = Vector2.Zero;
            Vector2 texScale = Vector2.One;

            Vector2 originOffset;
            if (sourceRect != null)
            {
                Vector2 leftTop = new Vector2(sourceRect.Value.Left, sourceRect.Value.Top);
                Vector2 size = new Vector2(sourceRect.Value.Width, sourceRect.Value.Height);
                texOffset = leftTop / textureSize;
                texScale = size / textureSize;

                originOffset = origin / new Vector2(sourceRect.Value.Width, sourceRect.Value.Height) - 0.5f;
                originOffset.Y *= -1;
            }
            else
            {
                originOffset = origin / textureSize - 0.5f;
                originOffset.Y *= -1;
            }

            AddSingleSprite(view, new MyVertexFormatSpritePositionTextureRotationColor(
                new HalfVector4(clipOffset.X, clipOffset.Y, destinationRect.Width, destinationRect.Height),
                new HalfVector4(texOffset.X, texOffset.Y, texScale.X, texScale.Y),
                new HalfVector4(originOffset.X, originOffset.Y, tangent.X, tangent.Y),
                new Byte4(color.R, color.G, color.B, color.A)));
        }
Пример #23
0
 /// <summary>
 /// Add AABB box to be drawn
 /// </summary>
 /// <param name="aabb">AABB box in world coords</param>
 /// <param name="col">Color</param>
 static public void AddAABB(VRageMath.BoundingBoxD aabb, VRageMath.Color col)
 {
     AABBsToDraw.Add(new Tuple <VRageMath.BoundingBoxD, VRageMath.Color>(aabb, col));
 }
Пример #24
0
 internal void Add6FacedConvex(Vector3 [] vertices, Color color)
 {
     AddQuad(vertices[0], vertices[1], vertices[2], vertices[3], color);
     AddQuad(vertices[4], vertices[5], vertices[6], vertices[7], color);
     AddQuad(vertices[0], vertices[1], vertices[5], vertices[4], color);
     AddQuad(vertices[0], vertices[3], vertices[7], vertices[4], color);
     AddQuad(vertices[3], vertices[2], vertices[6], vertices[7], color);
     AddQuad(vertices[2], vertices[1], vertices[5], vertices[6], color);
 }
Пример #25
0
        internal void AddSphereRing(BoundingSphere sphere, Color color, Matrix onb)
        {
            float increment = 1.0f / 32;
            for (float i=0; i < 1; i += increment)
            {
                float a0 = 2* (float)Math.PI * i;
                float a1 = 2* (float)Math.PI * (i + increment);

                Add(
                    Vector3.Transform(new Vector3(Math.Cos(a0), 0, Math.Sin(a0)) * sphere.Radius, onb) + sphere.Center,
                    Vector3.Transform(new Vector3(Math.Cos(a1), 0, Math.Sin(a1)) * sphere.Radius, onb) + sphere.Center, 
                    color);
            }
        }
Пример #26
0
 internal static void AddSingleSprite(ISrvBindable tex, Color color, Vector2 origin, Vector2 tangent, Rectangle? sourceRect, RectangleF destinationRect)
 {
     AddSingleSprite(tex, tex.Size, color, origin, tangent, sourceRect, destinationRect);
 }
        internal static void AddSingleSprite(MyTexture2D texture, Vector2 position, Rectangle? sourceRectangle, float scale, Color color)
        {
            Vector2 clipOffset;
            Vector2 clipScale;

            RectangleF destination;
            if (sourceRectangle != null)
            {
                destination = new RectangleF(position.X, position.Y, scale * sourceRectangle.Value.Width,
                    scale * sourceRectangle.Value.Height);
            }
            else
            {
                destination = new RectangleF(position.X, position.Y, scale, scale);
            }

            CalculateSpriteClipspace(destination,
                MyRender.ViewportResolution,
                out clipOffset, out clipScale);

            Vector2 texOffset = Vector2.Zero;
            Vector2 texScale = Vector2.One;

            if (sourceRectangle != null)
            {
                Vector2 textureSize = texture != null ? texture.Size : Vector2.Zero;

                Vector2 leftTop = new Vector2(sourceRectangle.Value.Left, sourceRectangle.Value.Top);
                Vector2 size = new Vector2(sourceRectangle.Value.Width, sourceRectangle.Value.Height);
                texOffset = leftTop / textureSize;
                texScale = size / textureSize;
            }

            AddSingleSprite(texture, new MyVertexFormatSpritePositionTextureColor(
                new HalfVector4(clipOffset.X, clipOffset.Y, clipScale.X, clipScale.Y),
                new HalfVector4(texOffset.X, texOffset.Y, texScale.X, texScale.Y),
                new Byte4(color.R, color.G, color.B, color.A)));
        }
Пример #28
0
 static public void AddLine(VRageMath.Vector3 from, VRageMath.Vector3 to, VRageMath.Color color)
 {
     LinesToDraw.Add(new Tuple <VRageMath.Vector3, VRageMath.Vector3, VRageMath.Color>(from, to, color));
 }
Пример #29
0
        internal void AddCone(Vector3 translation, Vector3 directionVec, Vector3 baseVec, int tessalation, Color color)
        {
            var axis = directionVec;

            axis.Normalize();

            var apex = translation + directionVec;

            var steps    = tessalation;
            var stepsRcp = (float)(Math.PI * 2 / steps);

            for (int i = 0; i < 32; i++)
            {
                float a0 = i * stepsRcp;
                float a1 = (i + 1) * stepsRcp;

                var A = translation + Vector3.Transform(baseVec, Matrix.CreateFromAxisAngle(axis, a0));
                var B = translation + Vector3.Transform(baseVec, Matrix.CreateFromAxisAngle(axis, a1));

                Add(A, B, color);
                Add(A, apex, color);
            }
        }
Пример #30
0
        internal static void AddSingleSprite(MyTexture2D texture, Vector2 position, Rectangle?sourceRectangle, float scale, Color color)
        {
            Vector2 clipOffset;
            Vector2 clipScale;

            RectangleF destination;

            if (sourceRectangle != null)
            {
                destination = new RectangleF(position.X, position.Y, scale * sourceRectangle.Value.Width,
                                             scale * sourceRectangle.Value.Height);
            }
            else
            {
                destination = new RectangleF(position.X, position.Y, scale, scale);
            }

            CalculateSpriteClipspace(destination,
                                     MyRender.ViewportResolution,
                                     out clipOffset, out clipScale);

            Vector2 texOffset = Vector2.Zero;
            Vector2 texScale  = Vector2.One;

            if (sourceRectangle != null)
            {
                Vector2 textureSize = texture != null ? texture.Size : Vector2.Zero;

                Vector2 leftTop = new Vector2(sourceRectangle.Value.Left, sourceRectangle.Value.Top);
                Vector2 size    = new Vector2(sourceRectangle.Value.Width, sourceRectangle.Value.Height);
                texOffset = leftTop / textureSize;
                texScale  = size / textureSize;
            }

            AddSingleSprite(texture, new MyVertexFormatSpritePositionTextureColor(
                                new HalfVector4(clipOffset.X, clipOffset.Y, clipScale.X, clipScale.Y),
                                new HalfVector4(texOffset.X, texOffset.Y, texScale.X, texScale.Y),
                                new Byte4(color.R, color.G, color.B, color.A)));
        }
Пример #31
0
 internal void Add(Vector3 from, Vector3 to, Color colorFrom, Color? colorTo = null)
 {
     List.Add(new MyVertexFormatPositionColor(from, new Byte4(colorFrom.PackedValue)));
     List.Add(new MyVertexFormatPositionColor(to, colorTo.HasValue ? new Byte4(colorTo.Value.PackedValue) : new Byte4(colorFrom.PackedValue)));
 }
Пример #32
0
 public static VRageMath.Color Tint(this VRageMath.Color c, float r) =>
 new VRageMath.Color((int)(c.R + ((0xff - c.R) * r)), (int)(c.G + ((0xff - c.G) * r)), (int)(c.B + ((0xff - c.B) * r)), c.A);
Пример #33
0
 internal static void AddSingleSprite(ISrvBindable tex, Color color, Vector2 origin, Vector2 tangent, Rectangle?sourceRect, RectangleF destinationRect)
 {
     AddSingleSprite(tex, tex.Size, color, origin, tangent, sourceRect, destinationRect);
 }
Пример #34
0
 internal void AddFrustum(BoundingFrustum bf, Color color)
 {
     Add6FacedConvex(bf.GetCorners(), color);
 }
Пример #35
0
 internal static void AddSingleSprite(TexId texId, Color color, Vector2 origin, Vector2 tangent, Rectangle? sourceRect, RectangleF destinationRect)
 {
     AddSingleSprite(MyTextures.Views[texId.Index], MyTextures.GetSize(texId), color, origin, tangent, sourceRect, destinationRect);
 }
Пример #36
0
        public static float HueDistance(this VRageMath.Color color, float hue)
        {
            float num2 = Math.Abs((float)(color.ColorToHSV().X - hue));

            return(Math.Min(num2, 1f - num2));
        }
Пример #37
0
 internal void Add(Vector3 from, Vector3 to, Color colorFrom, Color?colorTo = null)
 {
     List.Add(new MyVertexFormatPositionColor(from, new Byte4(colorFrom.PackedValue)));
     List.Add(new MyVertexFormatPositionColor(to, colorTo.HasValue ? new Byte4(colorTo.Value.PackedValue) : new Byte4(colorFrom.PackedValue)));
 }
Пример #38
0
 /// <summary>
 /// Add matrix to be drawn as axes with OBB
 /// </summary>
 /// <param name="mat">World matrix</param>
 /// <param name="col">Color</param>
 static public void AddMatrix(VRageMath.Matrix mat, VRageMath.Color col)
 {
     MatricesToDraw.Add(new Tuple <VRageMath.Matrix, VRageMath.Color>(mat, col));
 }
Пример #39
0
 public void DrawGameLogo(float transitionAlpha)
 {
     Color colorForeground = new Color(1, 1, 1, transitionAlpha);
     MyGuiManager.DrawSpriteBatch(GameLogoTexture, new Vector2(0.5f, 0.15f),
                                  new Vector2(702 / 1600f, 237 / 1200f), colorForeground,
                                  MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
 }
Пример #40
0
 internal void AddFrustum(BoundingFrustum bf, Color color)
 {
     Add6FacedConvex(bf.GetCorners(), color);
 }
Пример #41
0
 internal static void AddSingleSprite(TexId texId, Color color, Vector2 origin, Vector2 tangent, Rectangle?sourceRect, RectangleF destinationRect)
 {
     AddSingleSprite(MyTextures.Views[texId.Index], MyTextures.GetSize(texId), color, origin, tangent, sourceRect, destinationRect);
 }
Пример #42
0
 static public void AddCapsule(VRageMath.CapsuleD capsule, VRageMath.Color col)
 {
     CapsulesToDraw.Add(new Tuple <VRageMath.CapsuleD, VRageMath.Color>(capsule, col));
 }