示例#1
0
 private static Brush BrushFromColor(CubeHack.Data.Color c)
 {
     return(new SolidBrush(System.Drawing.Color.FromArgb(
                               IntFromFloatColor(c.R),
                               IntFromFloatColor(c.G),
                               IntFromFloatColor(c.B))));
 }
示例#2
0
        private static void DrawCrossHair(Canvas canvas)
        {
            var color = new Color(1, 1, 1);
            var x = canvas.Width * 0.5f;
            var y = canvas.Height * 0.5f;

            var l = 4;
            var w = 0.7f;

            canvas.DrawRectangle(color, x - w, y - l, x + w, y + l);
            canvas.DrawRectangle(color, x - l, y - w, x + l, y + w);
        }
示例#3
0
        public static void DrawTexture(BitmapData bitmapData, Texture texture, int offsetX, int offsetY)
        {
            if (texture == null)
            {
                return;
            }

            var color = new CubeHack.Data.Color(texture.Color);

            double tf = 1.0 / TextureSize;

            for (int x = 0; x < TextureSize; ++x)
            {
                double xf = x * tf;
                for (int y = 0; y < TextureSize; ++y)
                {
                    double yf = y * tf;

                    float r = color.R;
                    float g = color.G;
                    float b = color.B;

                    float o = 10 * (_noiseCube.Get(xf, yf, 0.075) - _noiseCube.Get(xf, yf, 0.10));
                    if (texture.Index == 2)
                    {
                        o  = o > 0.070f ? 0.070f : 0;
                        r += o;
                        g += o;
                        b += o;
                    }
                    else
                    {
                        o  = Math.Abs(o) < 0.05 ? 0.80f : 1;
                        r *= o;
                        g *= o;
                        b *= o;
                    }

                    SetPixel(bitmapData, offsetX, offsetY, x, y, r, g, b);
                }
            }
        }
示例#4
0
        public static void DrawTexture(BitmapData bitmapData, Texture texture, int offsetX, int offsetY)
        {
            if (texture == null) return;

            var color = new CubeHack.Data.Color(texture.Color);

            double tf = 1.0 / TextureSize;
            for (int x = 0; x < TextureSize; ++x)
            {
                double xf = x * tf;
                for (int y = 0; y < TextureSize; ++y)
                {
                    double yf = y * tf;

                    float r = color.R;
                    float g = color.G;
                    float b = color.B;

                    float o = 10 * (_noiseCube.Get(xf, yf, 0.075) - _noiseCube.Get(xf, yf, 0.10));
                    if (texture.Index == 2)
                    {
                        o = o > 0.070f ? 0.070f : 0;
                        r += o;
                        g += o;
                        b += o;
                    }
                    else
                    {
                        o = Math.Abs(o) < 0.05 ? 0.80f : 1;
                        r *= o;
                        g *= o;
                        b *= o;
                    }

                    SetPixel(bitmapData, offsetX, offsetY, x, y, r, g, b);
                }
            }
        }