示例#1
0
文件: zwaves.cs 项目: yugecin/osusb1
            public Zwaves(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 200;

                rand   = new vec3[RESOLUTION, RESOLUTION];
                points = new vec3[SIZE, SIZE];
                dots   = new Odot[AMOUNT];

                Random r = new Random("Emily<3".GetHashCode());

                for (int a = 0; a < RESOLUTION; a++)
                {
                    for (int b = 0; b < RESOLUTION; b++)
                    {
                        rand[a, b] = v3(r.Next(11) - 5, r.Next(11) - 5, r.Next(11) - 5).norm();
                    }
                }
                for (int a = 0; a < SIZE; a++)
                {
                    for (int b = 0; b < SIZE; b++)
                    {
                        points[a, b] = calc(v3((float)a / SIZE, (float)b / SIZE, 1));
                        int s = Sprite.INTERPOLATE_MOVE;
                        s |= Sprite.EASE_FADE;
                        s |= Sprite.EASE_SCALE;
                        s |= Sprite.SESDSM;
                        dots[a * SIZE + b] = new Odot(Sprite.SPRITE_DOT_6_12, s);
                    }
                }
            }
示例#2
0
 public Zdebugdot2(int start, int stop)
 {
     this.start = start;
     this.stop  = stop;
     framedelta = 300;
     dot        = new Odot(Sprite.SPRITE_DOT_6_12, 0);
 }
示例#3
0
            public Zharrier(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 50;

                haha = create;

                dot       = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
                harrpoint = v3(0f);

                create();
            }
示例#4
0
            public Zharrierbreakdown(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 50;

                dot       = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
                harrpoint = v3(0f);

                points  = copy(harr.points);
                _points = new vec3[points.Length];
                dots    = new Odot[harr.points.Length];
                for (int i = 0; i < dots.Length; i++)
                {
                    dots[i] = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
                }
                lines = new Oline[harr.lines.Length];
                for (int i = 0; i < lines.Length; i++)
                {
                    lines[i] = new Oline(_points, harr.lines[i][0], harr.lines[i][1]);
                }
                int s = Orect.SETTING_SHADED;

                tris = new Otri2[harr.tris.Length];
                for (int i = 0; i < tris.Length; i++)
                {
                    tris[i] = new Otri2(new Tri(null,
                                                harr.cols[harr.tris[i][0]],
                                                _points,
                                                harr.tris[i][1],
                                                harr.tris[i][2],
                                                harr.tris[i][3]
                                                ), s);
                }
                move(points, Zcamera.mid);

                sizetext = 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);
                }
                sizetextloc = new vec4[sizetext.Length];
                for (int i = 0; i < sizetextloc.Length; i++)
                {
                    sizetextloc[i]    = v4(500f, 450f, 1f, 1f);
                    sizetextloc[i].x += (i % 80) * TEXTSPACING;
                    sizetextloc[i].y += (i / 80 - 6) * TEXTSPACING - 2;
                }

                inittext();
            }
示例#5
0
 private void init()
 {
     this.zbuf         = new float[hpixels, vpixels];
     this.owner        = new object[hpixels, vpixels];
     this.odot         = new Odot[hpixels, vpixels];
     this.hpixeloffset = this.x / pixelsize;
     this.vpixeloffset = this.y / pixelsize;
     for (int i = 0; i < hpixels; i++)
     {
         for (int j = 0; j < vpixels; j++)
         {
             odot[i, j] = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
         }
     }
 }
示例#6
0
            public Ztestcube4(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 100;

                points = new vec3[] {
                    v3(-10f, -10f, 90f),
                    v3(-10f, -10f, 110f),
                    v3(-10f, 10f, 90f),
                    v3(-10f, 10f, 110f),
                    v3(10f, -10f, 90f),
                    v3(10f, -10f, 110f),
                    v3(10f, 10f, 90f),
                    v3(10f, 10f, 110f),
                };

                _points = new vec3[points.Length];

                cube = new Cube(
                    Color.Cyan,
                    Color.Lime,
                    Color.Red,
                    Color.Blue,
                    Color.Yellow,
                    Color.Orange,
                    _points,
                    PA,
                    PD,
                    PC,
                    PB,
                    PF,
                    PE,
                    PH,
                    PG
                    );

                rects = new Orect[6];
                for (int i = 0; i < rects.Length; i++)
                {
                    rects[i] = new Orect(cube.rects[i], 0);
                    cube.rects[i].setColor(Color.White);
                }

                light1 = new Odot(Sprite.SPRITE_DOT_6_12, 0);
                light2 = new Odot(Sprite.SPRITE_DOT_6_12, 0);
                light3 = new Odot(Sprite.SPRITE_DOT_6_12, 0);
            }
示例#7
0
 private void init()
 {
     this.zbuf         = new float[hpixels, vpixels];
     this.owner        = new object[hpixels, vpixels];
     this.odot         = new Odot[hpixels, vpixels];
     this.uv           = new vec2[hpixels, vpixels];
     this.hpixeloffset = this.x / pixelsize;
     this.vpixeloffset = this.y / pixelsize;
     for (int i = 0; i < hpixels; i++)
     {
         for (int j = 0; j < vpixels; j++)
         {
             odot[i, j] = new Odot(pixelsize == 2 ? ".png" : pixelsize + ".png", 0);
         }
     }
 }
示例#8
0
            private void inittext()
            {
                int pointcount = 0;

                for (int i = 0; i < text.Length; i++)
                {
                    pointcount += font.calcPointCount(text[i]);
                }
                statictext = new Odot[pointcount];
                textloc    = new vec2[pointcount];
                movtext    = new bool[pointcount];
                rottext    = new bool[pointcount];
                scaletext  = new bool[pointcount];
                ftext      = new bool[pointcount];

                int idx = 0;

                for (int q = 0; q < text.Length; q++)
                {
                    string t    = text[q];
                    int    xoff = 0;
                    for (int i = 0; i < t.Length; i++)
                    {
                        int c  = t[i] - 32;
                        int cw = font.charwidth[c];
                        for (int j = 0; j < font.charheight; j++)
                        {
                            for (int k = 0; k < cw; k++)
                            {
                                if (((font.chardata[c][j] >> k) & 1) == 1)
                                {
                                    int x = xoff + k;
                                    textloc[idx]    = v2(x, j) * TEXTSPACING + textlocstart[q] + textoffset;
                                    statictext[idx] = new Odot(Sprite.SPRITE_SQUARE_2_2, 0);
                                    movtext[idx]    = q == 1;
                                    rottext[idx]    = q == 2;
                                    scaletext[idx]  = q == 3;
                                    ftext[idx]      = q == 7;
                                    idx++;
                                }
                            }
                        }
                        xoff += cw + 1;
                    }
                }
            }
示例#9
0
            public Ztestfont(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 100;

                string text = "abc defABC DEG < ! > 2 @ # &";

                int width = font.textWidth(text);

                points = new vec3[font.calcPointCount(text)];

                const int SPACING = 2;

                vec3 topleft  = mid - v3(width / 2f * SPACING, 0f, -font.charheight / 2f * SPACING);
                int  pointidx = 0;

                for (int i = 0; i < text.Length; i++)
                {
                    int  c   = text[i] - 32;
                    vec3 pos = v3(topleft);
                    for (int j = 0; j < font.charheight; j++)
                    {
                        int cw = font.charwidth[c];
                        for (int k = 0; k < font.charwidth[c]; k++)
                        {
                            if (((font.chardata[c][j] >> k) & 1) == 1)
                            {
                                points[pointidx++] = pos + v3(k * SPACING, 0f, 0f);
                            }
                        }
                        pos.z -= SPACING;
                    }
                    topleft.x += (font.charwidth[c] + 1) * SPACING;
                }


                _points = new vec3[points.Length];
                dots    = new Odot[_points.Length];
                for (int i = 0; i < points.Length; i++)
                {
                    dots[i] = new Odot(Sprite.SPRITE_DOT_6_12, Sprite.INTERPOLATE_MOVE);
                }
            }
示例#10
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;
                    }
                }
            }
示例#11
0
            public void create()
            {
                points  = copy(harr.points);
                _points = new vec3[points.Length];
                dots    = new Odot[harr.points.Length];
                for (int i = 0; i < dots.Length; i++)
                {
                    dots[i] = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
                }
                lines = new Oline[harr.lines.Length];
                for (int i = 0; i < lines.Length; i++)
                {
                    lines[i] = new Oline(_points, harr.lines[i][0], harr.lines[i][1]);
                }
                int s = Orect.SETTING_SHADED;

                tris = new Otri2[harr.tris.Length];
                for (int i = 0; i < tris.Length; i++)
                {
                    tris[i] = new Otri2(new Tri(null,
                                                harr.cols[harr.tris[i][0]],
                                                _points,
                                                harr.tris[i][1],
                                                harr.tris[i][2],
                                                harr.tris[i][3]
                                                ), s);
                }
                move(points, v3(15f, 0f, 0f));
                spectrumdots  = new Odot[SPECTRUM_HEIGHT][];
                spectrumdots2 = new Odot[SPECTRUM_HEIGHT][];
                for (int i = 0; i < SPECTRUM_HEIGHT; i++)
                {
                    spectrumdots[i]  = new Odot[SPECTRUM_WIDTH];
                    spectrumdots2[i] = new Odot[SPECTRUM_WIDTH];
                    for (int j = 0; j < SPECTRUM_WIDTH; j++)
                    {
                        spectrumdots[i][j]  = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
                        spectrumdots2[i][j] = new Odot(Sprite.SPRITE_SQUARE_6_6, 0);
                    }
                }
            }
示例#12
0
            public Zstart(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 100;

                points = new vec3[SIZE * SIZE];
                dots   = new Odot[SIZE * SIZE];

                for (int i = 0; i < SIZE; i++)
                {
                    for (int j = 0; j < SIZE; j++)
                    {
                        int  idx   = i * SIZE + j;
                        int  x     = i - SIZE / 2;
                        int  y     = j - SIZE / 2;
                        vec3 point = mid + v3(x, y, 0f) * SPACING;
                        points[idx] = point;
                        int s = Sprite.INTERPOLATE_MOVE;
                        dots[idx] = new Odot(Sprite.SPRITE_DOT_6_12, s);
                    }
                }
            }
示例#13
0
            public Zstarfield(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 250;

                points  = new vec3[AMOUNT];
                _points = new vec3[AMOUNT];
                odots   = new Odot[AMOUNT];

                Random r      = new Random("zstarfield".GetHashCode());
                vec3   offset = mid - v3(SIZEXZ / 2, 0f, SIZEXZ / 2);

                for (int i = 0; i < AMOUNT; i++)
                {
                    points[i] = v3(
                        (float)r.NextDouble() * SIZEXZ,
                        (float)r.NextDouble() * SIZEY,
                        (float)r.NextDouble() * SIZEXZ
                        ) + offset;
                    odots[i] = new Odot(Sprite.SPRITE_DOT_6_12, Sprite.EASE_ALL | Sprite.SESDSM);
                }
            }
示例#14
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();
            }
示例#15
0
文件: zheart.cs 项目: yugecin/osusb1
            public Zheart(int start, int stop)
            {
                this.start     = start;
                framedelta     = BEATLEN / 4;     // should be (540 / 4 =) 135
                this.start    -= framedelta;
                this.stop      = sync(stop);
                firstpulsetime = sync(72900);
                turnstop       = sync(86500);
                transitionone  = sync(77900);
                transitiontwo  = sync(80000);
                transitiontri  = sync(82100);

                Rect[] rects;
                loadobj("obj1", out points, out rects);
                dots    = new Odot[points.Length];
                orects  = new Orect[rects.Length];
                olines  = new Oline[rects.Length * 3];
                indata  = new INDATA[rects.Length];
                _points = new vec3[points.Length];
                for (int i = 0; i < points.Length; i++)
                {
                    _points[i] = points[i] = points[i] * 20f + mid;
                }
                for (int i = 0; i < points.Length; i++)
                {
                    dots[i] = new Odot(Sprite.SPRITE_DOT_6_12, 0);
                }
                Color  bc   = v4(basecolor, 1f).col();
                Random rand = new Random("zhearts".GetHashCode());

                for (int i = 0; i < rects.Length; i++)
                {
                    Rect r = rects[i];
                    r.setColor(bc);
                    orects[i]         = new Orect(r, Orect.SETTING_SHADED);
                    r.pts             = _points;
                    r.tri1.points     = _points;
                    r.tri2.points     = _points;
                    olines[i * 3 + 0] = new Oline(r.pts, r.a, r.b);
                    olines[i * 3 + 1] = new Oline(r.pts, r.a, r.d);
                    olines[i * 3 + 2] = new Oline(r.pts, r.c, r.d);
                    //if (!r.tri1.shouldcull() || !r.tri2.shouldcull()) {
                    vec3[] inpts =
                    {
                        v3(points[r.a]),
                        v3(points[r.b]),
                        v3(points[r.c]),
                        v3(points[r.d])
                    };
                    INDATA id;
                    id.pts   = inpts;
                    id._pts  = new vec3[4];
                    id.rect  = new Rect(null, bc, id._pts, 0, 1, 2, 3);
                    id.orect = new Orect(id.rect, Orect.SETTING_SHADED | Orect.SETTING_NO_BCULL);
                    //var fc = new FadeCommand(start, start + 300, 0f, 1f);
                    //id.orect.addCommandOverride(fc);
                    float m = (project(r.mid()).xy - v2(50f)).length();
                    id.flyinstart     = start + (int)m;
                    id.rots           = v3(rand.Next(10), rand.Next(10), rand.Next(10));
                    indata[indatac++] = id;
                    //}
                }
            }
示例#16
0
            public override void draw(SCENE scene)
            {
                vec3[] opt = textplane.pts;
                textplane.setpts(copy(opt));

                copy(_points, points);
                vec4 q;

                q = quat(0f, 0f, -scene.reltime / 1000f);
                turn(_points, mid, q);
                q = quat(0f, -scene.reltime / 1400f, 0f);
                turn(_points, mid, q);
                q = quat(scene.reltime / 2000f, 0f, 0f);
                turn(_points, mid, q);

                /*
                 * if (scene.g != null) {
                 *      foreach (vec3 v in this._points) {
                 *              vec4 r = p.Project(v);
                 *              scene.g.FillRectangle(new SolidBrush(Color.Green), r.x - 1, r.y - 1, 2, 2);
                 *      }
                 * }
                 */
                if (!isPhantomFrame)
                {
                    screen1.clear();
                }
                screen2.clear();
                foreach (Rect r in rects)
                {
                    if (!r.shouldcull())
                    {
#if SCREEN
                        vec4 col = v4(basecolor, 1f);
                        col *= .2f + .8f * (r.surfacenorm().norm() ^ r.rayvec().norm());
                        r.setColor(col.col());
#endif
                        if (!isPhantomFrame)
                        {
                            r.draw(screen1);
                        }
                        r.draw(screen2);
                    }
                }
                textplane.draw(screen2);
                if (!isPhantomFrame)
                {
#if SCREEN
                    screen.draw(scene1);
#else
                    for (int i = 0; i < rects.Length; i++)
                    {
                        Odot od = dots[i];
                        Rect r  = rects[i];
                        if (r.shouldcull())
                        {
                            goto cull;
                        }
                        vec4 a   = project(r.pts[r.a]);
                        vec4 d   = project(r.pts[r.d]);
                        vec3 loc = lerp(a.xyz, d.xyz, .5f);
                        if (!isOnScreen(loc.xy))
                        {
                            goto cull;
                        }
                        object o = screen1.ownerAt(loc.xy);
                        if (!(o is Tri))
                        {
                            goto cull;
                        }
                        if (((Tri)o).owner != r)
                        {
                            goto cull;
                        }
                        vec4  b    = project(r.pts[r.b]);
                        float dist = min(distance(a.xy, d.xy), distance(a.xy, b.xy));
                        float size = dist / 3f;
                        vec3  col  = v3(basecolor);
                        col *= .1f + .9f * (r.surfacenorm().norm() ^ r.rayvec().norm());
                        od.update(scene.time, v4(col, 1f), v4(loc, 1f), size);
                        od.draw(scene.g);
                        continue;
cull:
                        od.update(scene.time, null, null, 0f);
                    }
#endif
                }
                for (int i = 0; i < txtdots.Length; i++)
                {
                    vec2 px = txtpoints[i] + v2(-2000 * scene.progress, 0f);
                    if (isOnScreen(px))
                    {
                        var owner = screen2.ownerAt(px);
                        if (owner is Tri && (owner as Tri).color == textplane.color)
                        {
                            txtdots[i].update(scene.time, v4(1f), v4(px, 1f, 1f));
                            txtdots[i].draw(scene.g);
                            continue;
                        }
                    }
                    txtdots[i].update(scene.time, null, null);
                }
                textplane.setpts(opt);
            }
示例#17
0
文件: zwaves.cs 项目: yugecin/osusb1
            public override void draw(SCENE scene)
            {
                ICommand.round_scale_decimals.Push(1);

                vec3[] points = new vec3[AMOUNT];

                vec3 posoffset = v3(0f, 0f, 0f);
                vec3 mid       = v3(Zsc.mid);

                posoffset.xy -= v2(DIMENSION / 2.3f);
                posoffset.x  += 40;
                posoffset.y  -= 10;
                posoffset.xy -= (-30 + udata[0]) / 100f * DIMENSION / 2f;
                posoffset.xy += DIMENSION / 9.5f * scene.progress;
                posoffset.z  += 30f;

                float angle = 10f;

                float rot = scene.reltime / 80f;

                rot = 45;        // + sin(rad(rot)) * 10f;
                //rot = 225;

                for (int a = 0; a < SIZE; a++)
                {
                    for (int b = 0; b < SIZE; b++)
                    {
                        int  i     = a * SIZE + b;
                        vec3 point = v3(this.points[a, b]);
                        point.z   = heightat((float)a / SIZE, (float)b / SIZE, scene.reltime);
                        point.z  += mid.z;
                        point.z  -= 2f;
                        point    -= posoffset;
                        point     = turn(point, mid, quat(0f, 0, rad(rot)));
                        point     = turn(point, mid, quat(0f, rad(angle), 0));
                        points[i] = point;
                    }
                }
                Zsc.adjust(points);

                screen.clear();
                for (int a = 0; a < SIZE; a++)
                {
                    for (int b = 0; b < SIZE; b++)
                    {
                        int         i        = a * SIZE + b;
                        vec4        pos      = project(points[i]);
                        vec4        col      = v4(1f);
                        const float VIEWDIST = 200f;
                        const float FADEDIST = 100f;
                        float       fadedist = (points[i] - Zsc.mid).length();
                        col.w  = 1f - clampx(fadedist, FADEDIST, VIEWDIST) / FADEDIST;
                        col.w *= clamp(scene.reltime, 0f, 1500f) / 1500f;
                        col.w *= 1f - clampx(scene.time, stop - 1000, stop) / 1000f;
                        float size = col.w * 6f;

                        dots[i].update(scene.time, col, pos, size);
                        dots[i].draw(scene.g);

#if FILL
                        if (a == SIZE - 1 || b == SIZE - 1)
                        {
                            continue;
                        }
                        int  aa = a * SIZE + b;
                        int  bb = (a + 1) * SIZE + b;
                        int  cc = a * SIZE + b + 1;
                        int  dd = (a + 1) * SIZE + b + 1;
                        Rect r  = new Rect(this, col.col(), points, bb, aa, dd, cc);
                        if (r.shouldcull())
                        {
                            continue;
                        }
                        col      = v4(.5f, .68f, .98f, 1f);
                        col.xyz *= .5f + .5f * (r.surfacenorm().norm() ^ r.rayvec().norm());
                        r.setColor(col.col());
                        r.draw(screen);
#endif
                    }
                }
                screen.draw(scene);

                Odot d = new Odot(Sprite.SPRITE_DOT_6_12, 0);
                d.update(scene.time, v4(1f, 0f, 1f, 1f), project(Zsc.mid), 3f);
                d.draw(scene.g);
                ICommand.round_scale_decimals.Pop();
            }
示例#18
0
文件: ztunnel.cs 项目: yugecin/osusb1
            public Ztunnel(int start, int stop)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 300;
                FRAMEDELTA = framedelta;

                lighttimes.Add(21000);
                lighttimes.Add(29750);
                lighttimes.Add(38350);
                lighttimes.Add(47050);

                const int ssettings =
                    Sprite.INTERPOLATE_MOVE | Sprite.EASE_FADE | Sprite.EASE_SCALE;

                points        = new vec3[CIRCLEAMOUNT * LENGTH];
                _points       = new vec3[points.Length];
                dots0         = new Odot[points.Length];
                dots          = new Odot[points.Length];
                pointfadetime = new int[points.Length];
                Random r = new Random("sunpy:3".GetHashCode());

                int[] fadeoffset = new int[CIRCLEAMOUNT];
                float y          = -FADEEND;

                for (int i = 0; i < LENGTH; i++)
                {
                    y += SPACING;
                    if (i % SEGLENGTH == 0)
                    {
                        y += (SEGSPACINGMOD - 1) * SPACING;
                        for (int j = 0; j < CIRCLEAMOUNT; j++)
                        {
                            fadeoffset[j] = -1;
                        }
                    }
                    float ang     = 0f;
                    int   k       = 0;
                    int   segment = 0;
                    for (int j = 0; j < CIRCLEAMOUNT; j++)
                    {
                        if (++k < SEGWIDTH)
                        {
                            ang += ANGINC;
                        }
                        else
                        {
                            k    = 0;
                            ang += ANGINC * (SEGWIDTH + 1);
                            segment++;
                            if (fadeoffset[segment] == -1)
                            {
                                int v = r.Next(FADEWINDOW - framedelta);
                                fadeoffset[segment] = sync(v);
                            }
                        }
                        int  idx = i * CIRCLEAMOUNT + j;
                        vec3 p   = v3(Zsc.mid);
                        p.x        += cos(ang) * Zsc.TUNNEL_RAD;
                        p.y        += y;
                        p.z        += sin(ang) * Zsc.TUNNEL_RAD;
                        points[idx] = p;
                        dots0[idx]  = new Odot(Sprite.SPRITE_DOT_6_12, ssettings);
                        dots[idx]   = new Odot(Sprite.SPRITE_DOT_6_12, ssettings | Sprite.SESDSM);
                        int ft = stop - FADEWINDOW + fadeoffset[segment];
                        pointfadetime[idx] = ft;
                        FadeCommand fc;
                        fc = new FadeCommand(ft, ft + FADETIME, 1f, 0f);
                        dots[idx].addCommandOverride(fc);
                        foreach (int lighttime in lighttimes)
                        {
                            int          lightstart = lightStartTime(p, lighttime, lighttime);
                            int          lightend   = lightstart + LIGHTFALLOFFTIME;
                            ColorCommand cc;
                            cc        = new ColorCommand(lightstart, lightend, v3(1f), color);
                            cc.easing = eq2num(eq_in_quad);
                            dots[idx].addCommandOverride(cc);
                        }
                    }
                }
                framedelta = 900;
            }
示例#19
0
文件: zctext.cs 项目: yugecin/osusb2
            public Zctext(int start, int stop, string[] text)
            {
                this.start = start;
                this.stop  = stop;
                framedelta = 50;

                starbgpoints = new vec2[10];
                float angleIncRads = PI * 36f / 180f;
                float ang          = PI2;
                float maxrad       = 1f;
                float minrad       = .35f;

                for (int i = 0; i < 10; i++)
                {
                    float rad = i % 2 == 1 ? minrad : maxrad;
                    starbgpoints[i] = v2(cos(ang) * rad, sin(ang) * rad);
                    ang            += angleIncRads;
                }

                int numdots = 0;

                foreach (string line in text)
                {
                    numdots += line.Replace(" ", "").Length;
                }
                dots = new Odot[numdots];
                pos  = new vec3[numdots];

                bg = new Odot[BG_DETAIL];
                for (int i = 0; i < BG_DETAIL; i++)
                {
                    bg[i] = new Odot(Sprite.SPRITE_SQUARE_2_2, Sprite.EASE_FADE);
                }

                tripos  = new vec3[] { v3(0f), v3(10f, 0f, 0f), v3(10f, 0f, -10f) };
                _tripos = new vec3[tripos.Length];
                tri     = new Tri(this, Color.Wheat, _tripos, 0, 1, 2);

                float maxx = 0f;
                float minz = 0f;
                int   idx  = 0;

                for (int i = 0; i < text.Length; i++)
                {
                    for (int j = 0; j < text[i].Length; j++)
                    {
                        if (text[i][j] == 'x')
                        {
                            dots[idx] = new Odot(Sprite.SPRITE_SQUARE_2_2, 0);
                            pos[idx]  = v3(j, 0f, -i) * SIZE;
                            maxx      = max(maxx, pos[idx].x);
                            minz      = min(minz, pos[idx].z);
                            idx++;
                        }
                    }
                }
                for (int i = 0; i < pos.Length; i++)
                {
                    pos[i].x -= maxx / 2;
                    pos[i].z -= minz / 2;
                }

                /*
                 * switch (rotation) {
                 * case 1:
                 *      turn(pos, v3(0f), quat(0f, 0f, 1f));
                 *      break;
                 * case 2:
                 *      break;
                 * case 3:
                 *      break;
                 * case 4:
                 *      break;
                 * }*/
                //move(pos, mid);
            }
示例#20
0
            public Ztor(int start, int stop)
            {
                this.start        = start;
                this.stop         = stop;
                framedelta        = 125;
                phantomframedelta = 25;

                string text = "Lacking creativity to make a better storyboard"
                              + "... hope you enjoyed this!";

                txtpoints = new vec2[font.calcPointCount(text)];
                txtdots   = new Odot[txtpoints.Length];
                const float FONTSPACING = 2f;
                int         pointidx    = 0;
                vec2        fonttopleft = v2(UPPERBOUND, 260 - font.charheight / 2f * FONTSPACING);

                for (int i = 0; i < text.Length; i++)
                {
                    int  c   = text[i] - 32;
                    vec2 pos = v2(fonttopleft);
                    for (int j = 0; j < font.charheight; j++)
                    {
                        int cw = font.charwidth[c];
                        for (int k = 0; k < font.charwidth[c]; k++)
                        {
                            if (((font.chardata[c][j] >> k) & 1) == 1)
                            {
                                int idx = pointidx++;
                                txtpoints[idx] = pos + v2(k * FONTSPACING, 0f);
                                txtdots[idx]   = new Odot(
                                    Sprite.SPRITE_SQUARE_2_2,
                                    Sprite.INTERPOLATE_MOVE | Sprite.COMPRESS_MOVE
                                    );
                            }
                        }
                        pos.y += FONTSPACING;
                    }
                    fonttopleft.x += (font.charwidth[c] + 1) * FONTSPACING;
                }

                this.rects   = new Rect[DIVH * DIVV];
                this.points  = new vec3[DIVH * DIVV];
                dots         = new Odot[rects.Length];
                this._points = new vec3[DIVH * DIVV];
                const float INTH = 360f / DIVH;
                const float INTV = 360f / DIVV;

                for (int a = 0; a < DIVH; a++)
                {
                    vec3  p1   = v3(mid);
                    float anga = rad(INTH * a);
                    for (int b = 0; b < DIVV; b++)
                    {
                        var s = Sprite.EASE_ALL | Sprite.SESDSM | Sprite.SESDSC;
                        var d = new Odot(Sprite.SPRITE_DOT_6_12, s);
                        var c = new FadeCommand(stop - 500, stop, 1f, 0f);
                        d.addCommandOverride(c);
                        dots[a * DIVV + b] = d;
                        float angb = rad(INTV * b);
                        float dist = RH - RV * cos(angb);
                        vec3  p    = mid + v3(dist * cos(anga), dist * sin(anga), RV * sin(angb));
                        this.points[a * DIVV + b] = p;

                        int a_ = (a + 1) % DIVH;
                        int b_ = (b + 1) % DIVV;

                        int _1 = a * DIVV + b;
                        int _2 = a_ * DIVV + b;
                        int _3 = a * DIVV + b_;
                        int _4 = a_ * DIVV + b_;

                        Rect r = new Rect(this, Color.Green, this._points, _1, _2, _3, _4);
                        this.rects[a * DIVV + b] = r;
                    }
                }

                vec3[] rpts =
                {
                    // I have no clue really
                    mid + v3(-100, -70,  80),
                    mid + v3(100,  -70,  80),
                    mid + v3(-100, -70, -80),
                    mid + v3(100,  -70, -80),
                };
                textplane = new Rect(null, Color.Red, rpts, 0, 1, 2, 3);
            }
示例#21
0
            private TEXT gentext(Color col, float rx, float ry, float rz, params string[] lines)
            {
                int pointc = 0;

                foreach (string line in lines)
                {
                    pointc += font.calcPointCount(line);
                }
                vec3[] points = new vec3[pointc];

                vec4 qx = quat(0f, 0f, rx);
                vec4 qy = quat(0f, ry, 0f);
                vec4 qz = quat(rz, 0f, 0f);

                const float SPACING = .2f;

                float startz   = (lines.Length * font.charheight + (lines.Length - 1)) * SPACING / 2f;
                int   pointidx = 0;

                for (int z = 0; z < lines.Length; z++)
                {
                    string line    = lines[z];
                    int    width   = font.textWidth(line);
                    vec3   topleft = mid - v3(width / 2f * SPACING, 0f, -startz);
                    topleft.z -= z * (font.charheight + 1) * SPACING;
                    for (int i = 0; i < line.Length; i++)
                    {
                        int  c   = line[i] - 32;
                        vec3 pos = v3(topleft);
                        for (int j = 0; j < font.charheight; j++)
                        {
                            int cw = font.charwidth[c];
                            for (int k = 0; k < font.charwidth[c]; k++)
                            {
                                if (((font.chardata[c][j] >> k) & 1) == 1)
                                {
                                    vec3 p = pos + v3(k * SPACING, 0f, 0f);
                                    p = turn(p, mid, qx);
                                    p = turn(p, mid, qy);
                                    p = turn(p, mid, qz);
                                    points[pointidx++] = p;
                                }
                            }
                            pos.z -= SPACING;
                        }
                        topleft.x += (font.charwidth[c] + 1) * SPACING;
                    }
                }


                vec3[] _points = new vec3[points.Length];
                Odot[] dots    = new Odot[_points.Length];
                for (int i = 0; i < points.Length; i++)
                {
                    dots[i] = new Odot(Sprite.SPRITE_SQUARE_2_2, 0);
                }

                TEXT text;

                text.points  = points;
                text._points = _points;
                text.odots   = dots;
                text.col     = col;
                return(text);
            }