Beispiel #1
0
            public Zshad(int start, int stop, int pixelsize, IColorOwner[] sides)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 50;

                this.sides   = sides;
                this.points  = new vec3[8];
                this._points = new vec3[this.points.Length];

                new Pcube(points, 0).set(v3(), 10f, 10f, 10f);
                c = new Cube(hwite, this._points, 0);
                Rect[] r = c.rects;
                lines = new LINE[] {
                    new LINE(r[Cube.F], r[Cube.U], 0, 1),
                    new LINE(r[Cube.F], r[Cube.L], 3, 0),
                    new LINE(r[Cube.F], r[Cube.R], 1, 2),
                    new LINE(r[Cube.F], r[Cube.D], 2, 3),
                    new LINE(r[Cube.L], r[Cube.U], 0, 5),
                    new LINE(r[Cube.L], r[Cube.B], 5, 4),
                    new LINE(r[Cube.L], r[Cube.D], 4, 3),
                    new LINE(r[Cube.B], r[Cube.D], 4, 7),
                    new LINE(r[Cube.R], r[Cube.U], 6, 1),
                    new LINE(r[Cube.R], r[Cube.B], 7, 6),
                    new LINE(r[Cube.R], r[Cube.D], 2, 7),
                    new LINE(r[Cube.B], r[Cube.U], 6, 5),
                };

                int pxs = pixelsize;

                this.pixelscreen = new Pixelscreen(/*widescreen mode*/ 854 / pxs, 480 / pxs, pxs);
            }
Beispiel #2
0
 public void draw(Pixelscreen screen)
 {
     if (this.shouldcull())
     {
         return;
     }
     screen.tri(this.tri1, this.tri1.project());
     screen.tri(this.tri2, this.tri2.project());
 }
Beispiel #3
0
 private void drawtri(Otri2 t, SCENE scene, Pixelscreen pixelscreen)
 {
     if (pixelscreen.hasOwner(t))
     {
         t.update(scene);
     }
     else
     {
         t.cullframe(scene);
     }
 }
Beispiel #4
0
 public void draw(Pixelscreen screen)
 {
     foreach (Rect r in rects)
     {
         if (r.shouldcull())
         {
             continue;
         }
         screen.tri(r.tri1, r.tri1.project());
         screen.tri(r.tri2, r.tri2.project());
     }
 }
Beispiel #5
0
            public void draw(SCENE scene, Pixelscreen screen)
            {
                if (r.shouldcull())
                {
                    for (int i = 0; i < this.dots.Length; i++)
                    {
                        this.dots[i].update(scene.time, null, null, 0f);
                    }
                    return;
                }
                for (int x = 0; x < dotcount; x++)
                {
                    for (int y = 0; y < dotcount; y++)
                    {
                        Odot  dot = this.dots[x * dotcount + y];
                        float INC = 1f / dotcount;
                        float dx  = x * (1f - INC) / (dotcount - 1) + INC / 2f;
                        float dy  = y * (1f - INC) / (dotcount - 1) + INC / 2f;
                        vec3  ab  = lerp(r.pts[r.a], r.pts[r.b], dx);
                        vec3  cd  = lerp(r.pts[r.c], r.pts[r.d], dx);
                        vec3  pt  = lerp(ab, cd, dy);
                        vec4  loc = project(pt);
                        if (!isOnScreen(loc.xy))
                        {
                            goto norender;
                        }
                        object o = screen.ownerAt(loc.xy);
                        if (!(o is Tri))
                        {
                            goto norender;
                        }
                        if (((Tri)o).owner != r)
                        {
                            goto norender;
                        }
                        dot.update(scene.time, col(r.color), loc);
                        dot.draw(scene.g);
                        continue;
norender:
                        dot.update(scene.time, null, null, size);
                        continue;
                    }
                }
            }
Beispiel #6
0
            public Zmc(int start, int stop, int pixelsize)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 50;

                this.sides = new IColorOwner[] {
                    GrassSide.instance,
                    GrassSide.instance,
                    GrassSide.instance,
                    GrassTop.instance,
                    GrassSide.instance,
                    GrassSide.instance,
                };
                this.points  = new vec3[8];
                this._points = new vec3[this.points.Length];

                new Pcube(points, 0).set(v3(), 8f, 8f, 8f);
                copy(_points, points);
                c = new Cube(hwite, this._points, 0);
                Rect[] r = c.rects;

                tpoints  = new vec3[4 * 8 * 8 * 6];
                _tpoints = new vec3[tpoints.Length];
                trects   = new Rect[8 * 8 * 6];
                shit(c.rects[Cube.U], 0, GrassTop.instance);
                shit(c.rects[Cube.L], 1 * 8 * 8, GrassSide.instance);
                shit(c.rects[Cube.R], 2 * 8 * 8, GrassSide.instance);
                shit(c.rects[Cube.F], 3 * 8 * 8, GrassSide.instance);
                shit(c.rects[Cube.B], 4 * 8 * 8, GrassSide.instance);
                shit(c.rects[Cube.D], 5 * 8 * 8, GrassSide.instance);
                torects = new Orect[trects.Length];
                for (int i = 0; i < torects.Length; i++)
                {
                    torects[i] = new Orect(trects[i], 0);
                }

                int pxs = pixelsize;

                this.pixelscreen = new Pixelscreen(/*widescreen mode*/ 854 / pxs, 480 / pxs, pxs);



                sizetext  = new Odot[8 /*charwidth*/ * 8 /*charheight*/ * 10];
                sizetext2 = new Odot[8 /*charwidth*/ * 8 /*charheight*/ * 10];
                for (int i = 0; i < sizetext.Length; i++)
                {
                    sizetext[i]  = new Odot(Sprite.SPRITE_SQUARE_2_2, 0);
                    sizetext2[i] = new Odot(Sprite.SPRITE_SQUARE_2_2, 0);
                }
                sizetextloc  = new vec4[sizetext.Length];
                sizetextloc2 = new vec4[sizetext.Length];
                for (int i = 0; i < sizetextloc.Length; i++)
                {
                    sizetextloc[i]     = v4(90f, 150f, 1f, 1f);
                    sizetextloc[i].x  += (i % 80) * TEXTSPACING;
                    sizetextloc[i].y  += (i / 80 - 6) * TEXTSPACING - 2;
                    sizetextloc2[i]    = v4(360f, 150f, 1f, 1f);
                    sizetextloc2[i].x += (i % 80) * TEXTSPACING;
                    sizetextloc2[i].y += (i / 80 - 6) * TEXTSPACING - 2;
                }

                inittext();
            }