コード例 #1
0
        private void DrawOctagon(ILED3DCanvas canvas, float x, float y, float r, RGB color)
        {
            float d = r * (float)Math.Tan(Math.PI / 8f);

            var pts = new List <PointF>();
            var dx  = (float)Math.Max(0, width * 0.5);

            pts.Add(new PointF(r + x + dx, d + y));   // 右上
            pts.Add(new PointF(r + x + dx, -d + y));  // 右下

            pts.Add(new PointF(d + x + dx, -r + y));  // 下右
            pts.Add(new PointF(-d + x - dx, -r + y)); // 下左
            pts.Add(new PointF(-r + x - dx, -d + y)); // 左下
            pts.Add(new PointF(-r + x - dx, d + y));  // 左上
            pts.Add(new PointF(-d + x - dx, r + y));  // 上左
            pts.Add(new PointF(d + x + dx, r + y));   // 上右
            pts.Add(new PointF(r + x + dx, d + y));   // 1番目と同じ


            for (int i = 0; i < pts.Count - 1; i++)
            {
                var   pt1  = pts[i];
                var   pt2  = pts[i + 1];
                Dot[] dots = drawUtility.Line(pt1, pt2, color, 2f);
                foreach (var dot in dots)
                {
                    canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
                }
            }
        }
コード例 #2
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var dots = drawUtility.Circle(this.x, this.y, this.w, this.h, this.Color);

            foreach (var dot in dots)
            {
                canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
            }
        }
コード例 #3
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var dots = drawUtility.Rectangle(rect, this.Color);

            foreach (var dot in dots)
            {
                canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
            }
        }
コード例 #4
0
ファイル: LED3DSheet.cs プロジェクト: tatsuo98se/3d_led_cube
 public override void Draw(ILED3DCanvas canvas)
 {
     for (int x = 0; x < LED.WIDTH; x++)
     {
         for (int z = 0; z < LED.DEPTH; z++)
         {
             canvas.SetLed(x, LED.HEIGHT - 1, z, this.Color - (Math.Sin(GetElapsedAt().TotalMilliseconds / 400) * 150));
         }
     }
 }
コード例 #5
0
 private void SetFlashEffect(ILED3DCanvas canvas)
 {
     for (int x = 0; x < LED.WIDTH; x++)
     {
         for (int y = 0; y < LED.HEIGHT; y++)
         {
             canvas.SetLed(x, y, 0, new RGB(0xff, 0xff, 0xff));
         }
     }
     return;
 }
コード例 #6
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var yangle = (GetElapsedAt().TotalMilliseconds / 15) * (Math.PI / 180);

            var newDots = Get6thAngel(yangle, new Dot(8, 4, 7));

            foreach (var dot in newDots)
            {
                canvas.SetLed(dot.X, dot.Y, dot.Z, dot.RGB);
            }
        }
コード例 #7
0
        private void FarEffect(ILED3DCanvas canvas)
        {
            RGB color = this.GetAtFieldColor(1);

            int count = 1;

            foreach (var r in this.rs)
            {
                DrawOctagon(canvas, (float)this.x, (float)this.y, r, new RGB(color.R, color.G, color.B, (int)(0xff - this.z * 300f - count * 20f)));
                count++;
            }
        }
コード例 #8
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var isNeedUpdate = false;

            if (this.GetElapsedAt().Subtract(this.lastUpdateAt).Milliseconds > 100)
            {
                this.lastUpdateAt = this.GetElapsedAt();
                isNeedUpdate      = true;
            }

            canvas.SetLed(this.x, this.y, this.z, this.Color);
            this.Color -= 10;
        }
コード例 #9
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var count = 0;

            foreach (var layer in this.dots)
            {
                foreach (var dot in layer)
                {
                    var hsv = Util.RGB2HSV(dot.RGB);
                    hsv.S = hsv.V = 360;
                    hsv.H = 360 * count / LED.DEPTH;
                    canvas.SetLed(dot.X, dot.Y, count, Util.HSV2RGB(hsv.H, hsv.S, hsv.V, dot.RGB.A));
                }
                count++;
            }
        }
コード例 #10
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var isNeedUpdate = false;

            if (this.GetElapsedAt().Subtract(this.lastUpdateAt).Milliseconds > 100)
            {
                this.lastUpdateAt = this.GetElapsedAt();
                isNeedUpdate      = true;
            }

            if (this.rs.Min() - 4 >= FIRST_R && this.produced < this.size)
            {
                this.rs.Add(FIRST_R);
                produced++;
            }

            var newRs = new List <float>();


            foreach (var r in this.rs)
            {
                if (r * 20 >= 0xff)
                {
                    continue;
                }
                else
                {
                    var dots = drawUtility.CircleCenterAt(x, y, r * 2, r * 2, new RGB(this.Color.R, this.Color.G, this.Color.B, (int)(this.Color.A - r * 20)));

                    foreach (var dot in dots)
                    {
                        canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
                    }
                }


                if (isNeedUpdate)
                {
                    newRs.Add(r + 1);
                }
                else
                {
                    newRs.Add(r);
                }
            }
            this.rs = newRs;
        }
コード例 #11
0
        private void NearEffect(ILED3DCanvas canvas)
        {
            RGB color = this.GetAtFieldColor();

            if (color == null)
            {
                this.SetFlashEffect(canvas);
            }
            else
            {
                int count = 1;
                foreach (var r in this.rs)
                {
                    DrawOctagon(canvas, (float)this.x, (float)this.y, r + GetVibe(), new RGB(color.R, color.G, color.B, (int)(0xff - count * 20)));
                }
            }
        }
コード例 #12
0
ファイル: LED3DBall.cs プロジェクト: tatsuo98se/3d_led_cube
        public override void Draw(ILED3DCanvas canvas)
        {
            var src = drawUtility.CircleCenterAt(0, 0, this.w, this.h, this.Color);

            var dots   = new List <Dot>();
            var offset = Util.GetOffsetMatrix(new Dot(x, y, z));

            for (double i = 0; i < 2 * Math.PI; i = i + (2 * Math.PI / (w * 3)))
            {
                dots.AddRange(Util.appryMatrix(src, Util.GetYAxisRotateMatrix(i, new Dot(x, y, z))));
            }

            foreach (var dot in dots)
            {
                canvas.SetLed(dot.X, dot.Y, dot.Z, dot.RGB);
            }
        }
コード例 #13
0
        public void Run(ILED3DCanvas canvas, LED3DCanvasFilter filter)
        {
            var rand = new Random();

            while (true)
            {
                if (canvas.GetObjectCount() < 1)
                {
                    var x = rand.Next() % LED.WIDTH;
                    var y = rand.Next() % LED.HEIGHT;
                    canvas.AddObject(new LED3DAtField(x, y, 0, 4, 0)
                                     , filter
                                     );
                }
                canvas.Show();
                LED.Wait(20);
            }
        }
コード例 #14
0
        public void Run(ILED3DCanvas canvas, LED3DCanvasFilter filter)
        {
            var rand = new Random();

            while (true)
            {
                if (canvas.GetObjectCount() < 2)
                {
                    var x = rand.Next() % LED.WIDTH;
                    var y = rand.Next() % LED.HEIGHT;
                    canvas.AddObject(new LED3DRipple(x, y, new RGB(0xff, 0x00, 0xff), LED.Direction.Front, 6)
                                     , filter
                                     );
                }
                canvas.Show();
                LED.Wait(20);
            }
        }
コード例 #15
0
        public override void Draw(ILED3DCanvas canvas)
        {
            bool isNeedUpdate = false;
            var  updateSpan   = this.GetElapsedAt().Subtract(this.lastUpdateAt).TotalMilliseconds;

            if (updateSpan < 100)
            {
                isNeedUpdate = true;
            }

            if (this.longTimeNoSee == true && this.z < NEAR_BORDER)
            {
                this.SetFlashEffect(canvas);
                this.longTimeNoSee = false;
            }

            if (isNeedUpdate)
            {
                if (this.z < NEAR_BORDER)
                {
                    this.NearEffect(canvas);
                }
                else
                {
                    this.FarEffect(canvas);
                }
            }
            else
            {
                foreach (var r in this.rs)
                {
                    var dcline = this.GetElapsedAt().Subtract(this.lastUpdateAt).TotalMilliseconds;
                    DrawOctagon(canvas, (float)this.x, (float)this.y, r + this.GetVibe(), new RGB(0xff, 0x65, 0x00, (int)(0xff - dcline * 0.8)));
                }
            }
        }
コード例 #16
0
 public LED3DHsvColorFilter(ILED3DCanvas canvas)
     : base(canvas)
 {
 }
コード例 #17
0
 public void AddObject(LED3DObject obj, ILED3DCanvas filter)
 {
     this.objects.Add(new LED3DObjectSet(obj, filter));
 }
コード例 #18
0
 public LED3DWaveCanvasFilter2(ILED3DCanvas canvas)
     : base(canvas)
 {
     bornAt     = DateTime.Now;
     lastUpdate = DateTime.Now;
 }
コード例 #19
0
 public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter)
 {
     canvas.AddObject(new LED3DRectangle(new Rectangle(-5, -5, 10, 10), new RGB(0xff, 0xff, 0xff)), filter);
 }
コード例 #20
0
ファイル: LED3DDot.cs プロジェクト: tatsuo98se/3d_led_cube
 public override void Draw(ILED3DCanvas canvas)
 {
     canvas.SetLed(this.x, this.y, this.z, this.Color);
 }
コード例 #21
0
 public LED3DWaveCanvasFilter(ILED3DCanvas canvas)
     : base(canvas)
 {
     bornAt = DateTime.Now;
 }
コード例 #22
0
 virtual public void AddObject(LED3DObject obj, ILED3DCanvas filter)
 {
     this.canvas.AddObject(obj, filter);
 }
コード例 #23
0
 abstract public void Draw(ILED3DCanvas canvas);
コード例 #24
0
 public LED3DSurfaceCanvasFilter(ILED3DCanvas canvas)
     : base(canvas)
 {
 }
コード例 #25
0
 public LED3DCanvasFilter(ILED3DCanvas canvas)
 {
     this.canvas = canvas;
 }
コード例 #26
0
 public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter)
 {
     canvas.AddObject(new LED3D5thAngel(), filter);
 }
コード例 #27
0
 public LED3DObjectSet(LED3DObject obj, ILED3DCanvas filter)
 {
     this.obj    = obj;
     this.filter = filter;
 }
コード例 #28
0
 public void Run(ILED3DCanvas canvas, LED3DCanvasFilter filter)
 {
 }
コード例 #29
0
 public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter)
 {
 }
コード例 #30
0
ファイル: BallOnCube.cs プロジェクト: tatsuo98se/3d_led_cube
 public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter)
 {
     canvas.AddObject(new LED3DBall(4, 4, 4, 8, 8, new RGB(0xff, 0xff, 0xff)), filter);
 }