Beispiel #1
0
 public override void draw(SCENE scene)
 {
     turn(_points, points, mid, 800f * scene.progress, 1200f * scene.progress);
     screen.clear();
     cube.draw(screen);
     screen.draw(scene);
 }
Beispiel #2
0
 public override void draw(SCENE scene)
 {
     screen.clear();
     for (int i = 0; i < NBARS; i++)
     {
         pcubes[i].setheight(MAXHEIGHT * fft.frame.values[i]);
     }
     turn(_points, points, v3(0f, 50f, 70f), scene.progress * 580f, 0f);
     foreach (Rect r in rects)
     {
         if (!r.shouldcull())
         {
             r.draw(screen);
         }
     }
     screen.draw(scene);
 }
Beispiel #3
0
            public override void draw(SCENE scene)
            {
                copy(_points, points);
                move(_points, v3(0f, 0f, -5.5f));
                if (scene.time < 104085)
                {
                    // first shad
                    //turn(_points, v3(), quat(sin(scene.progress * 5f), 0f, sin(scene.progress) * .5f));
                }
                else
                {
                    // second shad
                    //turn(_points, v3(), quat(sin(scene.progress * 5f), 0f, sin(scene.progress) * .5f));
                    float p = progressx(110791, 117250, scene.time);
                    float a = p * PI * 2;
                    float b = p * PI * 2;
                    turn(_points, v3(), quat(a, b, 0f));
                    p = progressx(122500, 124000, scene.time);
                    move(_points, v3(p * 100.0f, 0f, 0f));
                }
                move(_points, Zcamera.mid);
                Zcamera.adjust(_points);

                pixelscreen.clear();

                /*if (scene.time < scene.starttime + 100) {
                 *      // disgusting hack beacuse the osushader would have ghost pixels on the first frames.
                 *      for (int i = 0; i < this.pixelscreen.owner.GetLength(0); i++) {
                 *              for (int j = 0; j < this.pixelscreen.owner.GetLength(1); j++) {
                 *                      this.pixelscreen.owner[i, j] = this;
                 *              }
                 *      }
                 * } else*/{
                    for (int i = 0; i < this.c.rects.Length; i++)
                    {
                        Rect r = this.c.rects[i];
                        if (r.shouldcull())
                        {
                            continue;
                        }
                        // abc, cbd
                        vec4 a = project(this._points[r.a]);
                        vec4 b = project(this._points[r.b]);
                        vec4 c = project(this._points[r.c]);
                        vec4 d = project(this._points[r.d]);
                        if (a.z < 1 || b.z < 1 || c.z < 1 || d.z < 1)
                        {
                            continue;
                        }
                        this.pixelscreen.tri_(sides[i], new vec6[] {
                            v6(a, v2(0f)),
                            v6(b, v2(1f, 0f)),
                            v6(c, v2(0f, 1f))
                        });
                        this.pixelscreen.tri_(sides[i], new vec6[] {
                            v6(c, v2(0f, 1f)),
                            v6(b, v2(1f, 0f)),
                            v6(d, v2(1f))
                        });
                    }
                }
                this.pixelscreen.draw(scene);

#if LINES
                ICommand.round_move_decimals.Push(5);
                foreach (LINE l in lines)
                {
                    if (l.r1.shouldcull() && l.r2.shouldcull())
                    {
                        l.line.update(scene.time, null);
                        continue;
                    }
                    l.pts[0] = _points[l.a];
                    l.pts[1] = _points[l.b];
                    l.line.update(scene.time, v4(1f));
                    l.line.draw(scene.g);
                }
                ICommand.round_move_decimals.Pop();
#endif
            }
Beispiel #4
0
            public override void draw(SCENE scene)
            {
                copy(_points, points);
                move(_points, v3(0f, 0f, -7.5f));
                turn(_points, v3(), quat(0f, 0f, -.8f + 6.4f * scene.progress));
                move(_points, v3(0f, -8f, 0f));
                move(_points, Zcamera.mid);
                Zcamera.adjust(_points);
                copy(_tpoints, tpoints);
                move(_tpoints, v3(0f, 0f, -7.5f));
                turn(_tpoints, v3(), quat(0f, 0f, .8f - 6.4f * scene.progress));
                move(_tpoints, v3(0f, 8f, 0f));
                move(_tpoints, Zcamera.mid);
                Zcamera.adjust(_tpoints);

                pixelscreen.clear();
                for (int i = 0; i < this.c.rects.Length; i++)
                {
                    Rect r = this.c.rects[i];
                    if (r.shouldcull())
                    {
                        continue;
                    }
                    // abc, cbd
                    vec4 a = project(this._points[r.a]);
                    vec4 b = project(this._points[r.b]);
                    vec4 c = project(this._points[r.c]);
                    vec4 d = project(this._points[r.d]);
                    if (a.z < 1 || b.z < 1 || c.z < 1 || d.z < 1)
                    {
                        continue;
                    }
                    this.pixelscreen.tri_(sides[i], new vec6[] {
                        v6(a, v2(0f)),
                        v6(b, v2(1f, 0f)),
                        v6(c, v2(0f, 1f))
                    });
                    this.pixelscreen.tri_(sides[i], new vec6[] {
                        v6(c, v2(0f, 1f)),
                        v6(b, v2(1f, 0f)),
                        v6(d, v2(1f))
                    });
                }
                this.pixelscreen.draw(scene);

                foreach (Orect o in torects)
                {
                    o.update(scene);
                }



                for (int i = 0; i < statictext.Length; i++)
                {
                    statictext[i].update(scene.time, v4(1f), v4(textloc[i], 1f, 1f));
                    statictext[i].draw(scene.g);
                }


                {
                    int size = 0;
                    for (int i = 0; i < pixelscreen.hpixels; i++)
                    {
                        for (int j = 0; j < pixelscreen.vpixels; j++)
                        {
                            size += pixelscreen.odot[i, j].calcStoryboardCommandSize();
                        }
                    }
                    if (!rendering)
                    {
                        size = 2030333;
                    }
                    string sizestr       = string.Format("{0,8:###0.000}KB", (size / 1000f));
                    bool[] sizetextshown = new bool[sizetext.Length];
                    int    xoff          = 0;
                    for (int i = 0; i < sizestr.Length; i++)
                    {
                        int c  = sizestr[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 idx = 80 * j + xoff + k;
                                    sizetextshown[idx] = true;
                                    sizetext[idx].update(scene.time, v4(1f), sizetextloc[idx]);
                                    sizetext[idx].draw(scene.g);
                                }
                            }
                        }
                        xoff += cw + 1;
                    }
                    for (int i = 0; i < sizetextshown.Length; i++)
                    {
                        if (!sizetextshown[i])
                        {
                            sizetext[i].update(scene.time, null, null);
                        }
                    }
                }
                {
                    int size = 0;
                    foreach (Orect r in torects)
                    {
                        size += r.tris[0].calcStoryboardCommandSize();
                        size += r.tris[1].calcStoryboardCommandSize();
                        size += r.tris[2].calcStoryboardCommandSize();
                        size += r.tris[3].calcStoryboardCommandSize();
                    }
                    if (!rendering)
                    {
                        size = 3222000;
                    }
                    string sizestr       = string.Format("{0,8:###0.000}KB", (size / 1000f));
                    bool[] sizetextshown = new bool[sizetext.Length];
                    int    xoff          = 0;
                    for (int i = 0; i < sizestr.Length; i++)
                    {
                        int c  = sizestr[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 idx = 80 * j + xoff + k;
                                    sizetextshown[idx] = true;
                                    sizetext2[idx].update(scene.time, v4(1f), sizetextloc2[idx]);
                                    sizetext2[idx].draw(scene.g);
                                }
                            }
                        }
                        xoff += cw + 1;
                    }
                    for (int i = 0; i < sizetextshown.Length; i++)
                    {
                        if (!sizetextshown[i])
                        {
                            sizetext2[i].update(scene.time, null, null);
                        }
                    }
                }
            }
Beispiel #5
0
            public override void draw(SCENE scene)
            {
                ICommand.round_move_decimals.Push(5);
                turn(this._points, this.points, mid, scene.reltime / 5f + mouse.x, scene.reltime / 10f + mouse.y);

                copy(_points, points);
                for (int i = 0; i < points.Length; i++)
                {
                    float expand = 0f;
                    if (scene.time < 86000)
                    {
                        float time = scene.time - 89 - 150;
                        time -= BEATLEN;
                        float interval = BEATLEN * 2;
                        expand = progressx(interval - framedelta * 2, interval, time % interval);
                    }
                    int pulsetime = sync(Zgreet.PULSETIME) - framedelta;
                    if (scene.time > pulsetime)
                    {
                        float v = 1.8f;
                        expand += v - progressx(pulsetime, pulsetime + framedelta * 2, scene.time) * v;
                    }
                    _points[i] = ((_points[i] - mid) * (1f + expand * .2f)) + mid;
                }

                float ambient = .3f;

                if (scene.time > firstpulsetime)
                {
                    float v = progressx(firstpulsetime, firstpulsetime + 1500, scene.time);
                    v        = eq_in_sine(v);
                    ambient += (1f - ambient) * (1f - v);
                    int   reltime      = scene.time - firstpulsetime;
                    float turnprogress = progressx(firstpulsetime, turnstop, scene.time);
                    int   fstart       = sync(Zgreet.FADE_START) - framedelta * 2;
                    if (scene.time > fstart)
                    {
                        reltime      = scene.time - fstart;
                        turnprogress = eq_in_quad(reltime / 5000f);
                    }
                    vec4 q;
                    q = quat(0f, 0f, -eq_in_out_sine(turnprogress) * TWOPI * 3);
                    turn(_points, mid, q);
                    q = quat(0f, -eq_in_out_quad(turnprogress) * TWOPI * 2, 0f);
                    turn(_points, mid, q);
                    q = quat(eq_in_out_quad(turnprogress) * TWOPI, 0f, 0f);
                    turn(_points, mid, q);

                    if (!rendering)
                    {
                        turn(_points, mid, quat(0f, 0f, rad(mouse.x)));
                        turn(_points, mid, quat(0f, rad(-mouse.y), 0f));
                    }

                    if (scene.time < transitionone || scene.time > transitiontri)
                    {
                        foreach (Orect o in orects)
                        {
                            o.update(scene, ambient, .9f - ambient, 1.4f);
                        }
                    }
                    else if (scene.time > transitiontwo)
                    {
                        foreach (Oline o in olines)
                        {
                            o.update(scene.time, v4(1f));
                            o.draw(scene.g);
                        }
                        foreach (Orect o in orects)
                        {
                            o.update(scene, -1f, -1f, -1f);
                        }
                    }
                    else               /*if (scene.time > transitionone) */
                    {
                        screen.clear();
                        foreach (Orect o in orects)
                        {
                            Rect r = o.rect;
                            if (!r.shouldcull())
                            {
                                float rv  = (r.surfacenorm().norm() ^ r.rayvec().norm());
                                vec3  col = (v3(ambient) + (1f - ambient) * rv) * basecolor;
                                r.setColor(col.col());
                                r.draw(screen);
                            }
                            o.update(scene, -1f, -1f, -1f);
                        }
                        screen.draw(scene);
                        foreach (Orect o in orects)
                        {
                            o.rect.setColor(basecolor.col());
                        }
                    }
                }
                else
                {
                    float dt = progressx(start, firstpulsetime, scene.time);
                    for (int i = 0; i < indatac; i++)
                    {
                        INDATA j = indata[i];
                        copy(j._pts, j.pts);
                        vec3 dir = (j.rect.mid() - mid) * 2f;
                        dir   *= 1f - eq_in_sine(dt);
                        dir.z *= .4f;
                        move(indata[i]._pts, dir);
                        vec3 md = j.rect.mid();
                        vec3 r  = j.rots * (1f - dt);
                        turn(j._pts, md, quat(0f, 0f, r.z));
                        turn(j._pts, md, quat(0f, r.y, 0f));
                        turn(j._pts, md, quat(r.x, 0f, 0f));
                        indata[i].orect.update(scene, ambient, .9f - ambient, 1.4f);
                    }
                }
end:
                ICommand.round_move_decimals.Pop();
            }
Beispiel #6
0
            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();
            }
Beispiel #7
0
            public override void draw(SCENE scene)
            {
                ICommand.round_move_decimals.Push(5);
                copy(_points, points);

                vec4  qm1        = quat(0f, 0f, mouse.x / 100f);
                vec4  qm2        = quat(0f, mouse.y / 100f, 0f);
                float idlerotmod = .7f;
                vec4  q1         = quat(0f, 0f, -scene.reltime / 4000f * idlerotmod);
                vec4  q2         = quat(0f, -scene.reltime / 5600f * idlerotmod, 0f);
                vec4  q3         = quat(scene.reltime / 8000f * idlerotmod, 0f, 0f);

                turn(_points, mid, qm1);
                turn(_points, mid, qm2);
                turn(_points, mid, q1);
                turn(_points, mid, q2);
                turn(_points, mid, q3);

                const int mmm = 4;
                float     rx  = movs[mmm].rx;
                float     ry  = movs[mmm].ry;
                float     rz  = movs[mmm].rz;

                movs[mmm].rx += udata[0] / 100f;
                movs[mmm].ry += udata[1] / 100f;
                movs[mmm].rz += udata[2] / 100f;

                vec4[] movqs = new vec4[movs.Length * 3];
                int    movi  = 0;

                foreach (MOV m in movs)
                {
                    if (scene.reltime < m.start)
                    {
                        break;
                    }
                    float pg = progressx(m.start, m.stop, scene.reltime);
                    if (pg != 1f)
                    {
                        pg = eq_in_out_sine(pg);
                    }
                    vec4 q;
                    q = quat(0f, 0f, lerp(0, m.rx, pg));
                    turn(_points, mid, q);
                    movqs[movi++] = q;
                    q             = quat(0f, lerp(0, m.ry, pg), 0f);
                    turn(_points, mid, q);
                    movqs[movi++] = q;
                    q             = quat(lerp(0, m.rz, pg), 0f, 0f);
                    turn(_points, mid, q);
                    movqs[movi++] = q;
                }
                movs[mmm].rx = rx;
                movs[mmm].ry = ry;
                movs[mmm].rz = rz;

                screen.clear();
                cube.draw(screen);

                float linex = progressx(0, loadtime, scene.reltime);
                bool  cull  = linex == 1f;

                foreach (LINE l in lines)
                {
                    if (cull && l.r1.shouldcull() && l.r2.shouldcull())
                    {
                        l.line.update(scene.time, null);
                        continue;
                    }
                    l.pts[0] = _points[l.a];
                    l.pts[1] = _points[l.b];
                    if (linex != 1f)
                    {
                        l.pts[1] = lerp(l.pts[0], l.pts[1], linex);
                    }
                    l.line.update(scene.time, v4(1f));
                    l.line.draw(scene.g);
                }

                foreach (TEXT t in texts)
                {
                    copy(t._points, t.points);
                    turn(t._points, mid, qm1);
                    turn(t._points, mid, qm2);
                    turn(t._points, mid, q1);
                    turn(t._points, mid, q2);
                    turn(t._points, mid, q3);
                    foreach (vec4 q in movqs)
                    {
                        if (q == null)
                        {
                            break;
                        }
                        turn(t._points, mid, q);
                    }
                    for (int i = 0; i < t.odots.Length; i++)
                    {
                        vec4 p     = project(t._points[i]);
                        var  owner = screen.ownerAt(p.xy);
                        if (owner is Tri && (owner as Tri).color == t.col)
                        {
                            t.odots[i].update(scene.time, v4(1f), p);
                            t.odots[i].draw(scene.g);
                            continue;
                        }
                        t.odots[i].update(scene.time, null, null);
                    }
                }
                ICommand.round_move_decimals.Pop();
            }
Beispiel #8
0
            public override void draw(SCENE scene)
            {
                ICommand.round_move_decimals.Push(DECIMALS_PRECISE);
                ICommand.round_scale_decimals.Push(DECIMALS_PRECISE);
                ICommand.round_rot_decimals.Push(DECIMALS_PRECISE);

                if (!rendering)
                {
                    dot.update(scene.time, v4(1f, 0, 0, 1f), project(sunpos));
                    dot.draw(scene.g);
                }

                copy(_points, points);
                if (lockedharrpos == null)
                {
                    turn(_points, v3(0f), quat(pitch2.valueAt(scene.time) * -2f, 0f, 0f));
                    turn(_points, v3(0f), quat(0f, roll.valueAt(scene.time) * 5f, 0f));
                    turn(_points, v3(0f), quat(pitch.valueAt(scene.time) * -5f, 0f, 0f));
                    turn(_points, v3(0f), quat(0f, 0f, yaw.valueAt(scene.time) * 5f));
                }
                move(_points, getHarrPos(scene.time));

                /*
                 * move(_points, position);
                 * turn(_points, position, quat(pitch2, 0f, 0f));
                 * turn(_points, position, quat(0f, roll, 0f));
                 * turn(_points, position, quat(pitch, 0f, 0f));
                 * turn(_points, position, quat(0f, 0f, yaw));
                 */
                move(_points, Zcamera.mid);
                Zcamera.adjust(_points);

                pixelscreen.clear();
                foreach (Otri2 t in tris)
                {
                    pixelscreen.tri(
                        t,
                        new vec4[] {
                        project(t.tri.points[t.tri.a]),
                        project(t.tri.points[t.tri.b]),
                        project(t.tri.points[t.tri.c])
                    });
                }
                //pixelscreen.draw(scene);

                foreach (Otri2 t in tris)
                {
                    if (pixelscreen.hasOwner(t))
                    {
                        t.update(scene);
                    }
                    else
                    {
                        t.cullframe(scene);
                    }
                }

                foreach (Oline l in lines)
                {
                    l.update(scene.time, v4(1f));
                    if (udata[5] > 0)
                    {
                        l.draw(scene.g);
                    }
                }

                /*
                 * for (int i = 0; i < dots.Length; i++) {
                 *      dots[i].update(scene.time, v4(1f, 1f, 0f, 1f), project(_points[i]));
                 *      dots[i].draw(scene.g);
                 * }
                 */

                System.Drawing.Font font = new System.Drawing.Font("Tahoma", 12.0f);
                if (!rendering)
                {
                    for (int i = 0; i < harr.points.Length; i++)
                    {
                        //vec3 p = harr.points[i];
                        //vec3[] _p = new vec3[] { p };
                        //move(_p, Zcamera.mid);
                        //Zcamera.adjust(_p);
                        vec4 px = project(_points[i]);
                        if (udata[6] > 0 && px.w > 0)
                        {
                            scene.g.DrawString(i.ToString(), font, new SolidBrush(Color.White), px.x + 1, px.y + 1);
                            scene.g.DrawString(i.ToString(), font, new SolidBrush(Color.Blue), px.x, px.y);
                        }
                    }
                }

                if (28000 < scene.time && scene.time < 31458)
                {
                    float[] fftval = fft.SmoothValue(scene.time).values;
                    for (int i = 0; i < SPECTRUM_HEIGHT; i++)
                    {
                        float yval = (i + 1) / (float)(SPECTRUM_HEIGHT + 1);
                        float y    = i / (float)(SPECTRUM_HEIGHT - 1) * 0.8f + 0.1f;
                        float r    = clamp(yval * 2f, 0f, 1f);
                        float g    = 1f - clamp((yval - .5f) * 2f, 0f, 1f);
                        vec4  col  = v4(r, g, 0f, 1f);
                        for (int j = 0; j < SPECTRUM_WIDTH; j++)
                        {
                            float x       = j / (float)(SPECTRUM_WIDTH - 1) * 0.9f + 0.05f;
                            float fftvalx = eq_out_circ(fftval[j]);                    //clamp(0f, 1f, fftval[j] * 10f);
                            if (!tris[22].tri.shouldcull() && yval <= fftvalx)
                            {
                                vec3 a = lerp(_points[80], _points[81], y);
                                vec3 b = lerp(_points[79], _points[78], y);
                                vec4 p = project(lerp(a, b, x));
                                spectrumdots[i][j].update(scene.time, col, p);
                                spectrumdots[i][j].draw(scene.g);
                            }
                            else
                            {
                                spectrumdots[i][j].update(scene.time, col, null);
                            }
                            if (!tris[14].tri.shouldcull() && yval <= fftvalx)
                            {
                                vec3 a = lerp(_points[77], _points[76], y);
                                vec3 b = lerp(_points[75], _points[74], y);
                                vec4 p = project(lerp(a, b, x));
                                spectrumdots2[i][j].update(scene.time, col, p);
                                spectrumdots2[i][j].draw(scene.g);
                            }
                            else
                            {
                                spectrumdots2[i][j].update(scene.time, col, null);
                            }
                        }
                    }
                }

                if (!rendering)
                {
                    vec3[] v2 = new vec3[] { harrpoint };
                    turn(v2, v3(0f), quat(pitch2.valueAt(scene.time) * -2f, 0f, 0f));
                    turn(v2, v3(0f), quat(0f, roll.valueAt(scene.time) * 5f, 0f));
                    turn(v2, v3(0f), quat(pitch.valueAt(scene.time) * -5f, 0f, 0f));
                    turn(v2, v3(0f), quat(0f, 0f, yaw.valueAt(scene.time) * 5f));
                    move(v2, getHarrPos(scene.time));
                    move(v2, Zcamera.mid);
                    Zcamera.adjust(v2);
                    dot.update(scene.time, v4(1f, 0, 0, 1f), project(v2[0]));
                    dot.draw(scene.g);
                }

                ICommand.round_move_decimals.Pop();
                ICommand.round_scale_decimals.Pop();
                ICommand.round_rot_decimals.Pop();
            }
Beispiel #9
0
            public override void draw(SCENE scene)
            {
                screen.clear();
                copy(_points, points);

                if (scene.reltime < pretime)
                {
                    for (int i = 0; i < cubes.Length; i++)
                    {
                        Rect[] r   = { cubes[i].rects[Cube.F], cubes[i].rects[Cube.B] };
                        vec3   mid = (r[0].mid() + r[1].mid()) / 2f;
                        vec3   dir = (mid - Zsc.mid).norm();
                        float  x   = 1f - clamp(progress(cubeintime[i], cubeintime[i] + intime, scene.reltime), 0f, 1f);
                        dir *= x * INOFFSET;
                        r[0].move(dir);
                        r[1].move(dir);
                    }
                }

                int currentmove = max(0, scene.reltime - pretime) / movetime;

                if (currentmove < this.moves.Count && scene.reltime > pretime)
                {
                    float moveprogress = scene.reltime - pretime - currentmove * movetime;
                    moveprogress /= movetime;
                    Mov mov = this.moves[currentmove];
                    Rot rot = this.rots[mov.axis];
                    foreach (Cube c in rot.cubes)
                    {
                        turn(c, Zsc.mid, quat(rot.angles * moveprogress * 30f * mov.dir * mov.mp));
                    }
                }

                Cube[] originalCubePositions = new Cube[cubes.Length];
                Array.Copy(cubes, originalCubePositions, cubes.Length);
                int[,] originalCubePoints = new int[cubes.Length, 4 * 6];
                int[,] cp = new int[cubes.Length, 8];
                R rots = new R();

                for (int i = 0; i < cubes.Length; i++)
                {
                    for (int j = 0; j < cubes[i].rects.Length; j++)
                    {
                        originalCubePoints[i, j * 4 + 0] = cubes[i].rects[j].a;
                        originalCubePoints[i, j * 4 + 1] = cubes[i].rects[j].b;
                        originalCubePoints[i, j * 4 + 2] = cubes[i].rects[j].c;
                        originalCubePoints[i, j * 4 + 3] = cubes[i].rects[j].d;
                    }
                    for (int j = 0; j < 8; j++)
                    {
                        cp[i, j] = pt(i, j);
                    }
                    rots.Add(cubes[i], new List <int[]>());
                }

                Cube[] nc = new Cube[cubes.Length];
                for (int i = 0; i < currentmove && i < moves.Count; i++)
                {
                    int axis   = moves[i].axis;
                    int amount = (moves[i].mp + (1 - (moves[i].mp - 1)) * (((moves[i].dir >> 1) & 1) * 2 + dirfix[axis])) % 4;
                    while (amount-- > 0)
                    {
                        Array.Copy(cubes, nc, cubes.Length);
                        for (int j = 0; j < 9; j++)
                        {
                            rc(nc, cp, rots, movmat[rmref[axis], j], emovmat[axis], rotmat[rmref[axis]]);
                        }
                        Array.Copy(nc, cubes, cubes.Length);
                    }
                }

                for (int i = 0; i < cubes.Length; i++)
                {
                    rc3(i, rots[cubes[i]]);
                }

                if (scene.time > 43250)
                {
                    int  rt = scene.time - 43250;
                    vec4 q  = quat(0f, 0f, -rt / 1000f);
                    turn(_points, Zsc.mid, q);
                }
                if (scene.time > 45450)
                {
                    int  rt = scene.time - 45450;
                    vec4 q  = quat(0f, -rt / 1400f, 0f);
                    turn(_points, Zsc.mid, q);
                }
                if (scene.time > 47650)
                {
                    int  rt = scene.time - 47650;
                    vec4 q  = quat(rt / 2000f, 0f, 0f);
                    turn(_points, Zsc.mid, q);
                }

                Zsc.adjust(_points);

                foreach (Cube c in this.cubes)
                {
                    c.draw(screen);
                }
#if ASDOTS
                foreach (Odottedrect o in this.dottedrects)
                {
                    o.draw(scene, screen);
                }
#else
                screen.draw(scene);
#endif
#if ASRECTS
                foreach (Orect o in orects)
                {
                    o.update(scene);
                }
#endif

                Array.Copy(originalCubePositions, cubes, cubes.Length);

                for (int i = 0; i < cubes.Length; i++)
                {
                    for (int j = 0; j < cubes[i].rects.Length; j++)
                    {
                        int a = originalCubePoints[i, j * 4 + 0];
                        int b = originalCubePoints[i, j * 4 + 1];
                        int c = originalCubePoints[i, j * 4 + 2];
                        int d = originalCubePoints[i, j * 4 + 3];
                        cubes[i].rects[j].updatepts(a, b, c, d);
                    }
                }
            }
Beispiel #10
0
            public override void draw(SCENE scene)
            {
                ICommand.round_move_decimals.Push(DECIMALS_PRECISE);
                ICommand.round_scale_decimals.Push(DECIMALS_PRECISE);
                ICommand.round_rot_decimals.Push(DECIMALS_PRECISE);

                copy(_points, points);

                int t = scene.time;

                float prg = progressx(71208, 97666, scene.time);

                turn(_points, Zcamera.mid, quat(0f, 0f, cos(prg * 40f) * .18f));
                turn(_points, Zcamera.mid, quat(0f, -cos(prg * 30f) * .18f, 0f));
                if (t >= 97666)
                {
                    move(_points, v3(progressx(97666, scene.endtime, scene.time) * 20f, 0f, 0f));
                    float x = t - 97666;
                    turn(_points, Zcamera.mid, quat(0f, 0f, x * .00014f));
                    turn(_points, Zcamera.mid, quat(0f, x * -.0014f, 0f));
                    turn(_points, Zcamera.mid, quat(x * .0005f, 0f, 0f));
                }
                Zcamera.adjust(_points);

                pixelscreen.clear();
                foreach (Otri2 tri in tris)
                {
                    pixelscreen.tri(
                        tri,
                        new vec4[] {
                        project(tri.tri.points[tri.tri.a]),
                        project(tri.tri.points[tri.tri.b]),
                        project(tri.tri.points[tri.tri.c])
                    });
                }
                //pixelscreen.draw(scene);

                bool showmov = false, showrot = false, showscale = false;

                // shakes
                if (76166 <= t && t < 77208 ||
                    82791 <= t && t < 83875 ||
                    89375 <= t && t < 90458)
                {
                    move(_points, v3(.5f * cos(scene.time * 368f)));
                }

                // dots n lines
                //if (t < 96080) {
                for (int i = 0; i < lines.Length; i++)
                {
                    int mod = 0;
                    if (t > 67916)
                    {
                        mod++;
                    }
                    if (t > 68333)
                    {
                        mod++;
                    }
                    if (t > 68750)
                    {
                        mod++;                                // 1
                    }
                    if (t > 68750 + (69416 - 68750) / 5 * 1)
                    {
                        mod++;                                                          // 2
                    }
                    if (t > 68750 + (69416 - 68750) / 5 * 2)
                    {
                        mod++;                                                          // 3
                    }
                    if (t > 68750 + (69416 - 68750) / 5 * 3)
                    {
                        mod++;                                                          // 4
                    }
                    if (t > 68750 + (69416 - 68750) / 5 * 4)
                    {
                        mod++;                                                          // 5
                    }
                    if (t > 69416)
                    {
                        mod++;                                // 6
                    }
                    if ((i % 8) < mod)
                    {
                        lines[i].update(scene.time, v4(1f));
                        lines[i].draw(scene.g);
                    }
                }

                for (int i = 0; i < dots.Length; i++)
                {
                    int mod = 0;
                    if (t > 69666)
                    {
                        mod++;
                    }
                    if (t > 70041)
                    {
                        mod++;
                    }
                    if (t > 70458)
                    {
                        mod++;                                // 1
                    }
                    if (t > 70458 + (71208 - 70458) / 5 * 1)
                    {
                        mod++;                                                          // 2
                    }
                    if (t > 70458 + (71208 - 70458) / 5 * 2)
                    {
                        mod++;                                                          // 3
                    }
                    if (t > 70458 + (71208 - 70458) / 5 * 3)
                    {
                        mod++;                                                          // 4
                    }
                    if (t > 70458 + (71208 - 70458) / 5 * 4)
                    {
                        mod++;                                                          // 5
                    }
                    if (t > 71208)
                    {
                        mod++;                                // 6
                    }
                    if ((i % 8) < mod)
                    {
                        dots[i].update(scene.time, v4(1f, 1f, 0f, 1f), project(_points[i]));
                        dots[i].draw(scene.g);
                    }
                }
                //}

                if (t < 71208)
                {
                    goto skipnonlinenondots;
                }

                // tris
                float faster = 1.2f;

                if (t < 96080)
                {
                    Otri2.custom_position = v2(200f, 100f);
                    Otri2.position_factor = progressxy(71208, 72958, scene.time, faster);
                    Otri2.rotation_factor = progressxy(72958, 74583, scene.time, faster);
                    Otri2.scale_factor    = progressxy(74583, 76166, scene.time, faster);
                    showmov   |= t < 76166 && t >= 71208;
                    showrot   |= t < 76166 && t >= 72958;
                    showscale |= t < 76166 && t >= 74583;
                    if (t < 74583)
                    {
                        tris[129].settings &= ~Otri2.SETTING_SHADED;
                    }
                    drawtri(tris[129], scene, pixelscreen);
                    tris[129].settings   |= Otri2.SETTING_SHADED;
                    Otri2.custom_position = v2(325f, 100f);
                    Otri2.position_factor = progressxy(77875, 79500, scene.time, faster);
                    Otri2.rotation_factor = progressxy(79500, 81125, scene.time, faster);
                    Otri2.scale_factor    = progressxy(81125, 82791, scene.time, faster);
                    showmov   |= t < 82791 && t >= 77875;
                    showrot   |= t < 82791 && t >= 79500;
                    showscale |= t < 82791 && t >= 81125;
                    if (t < 82791)
                    {
                        tris[108].settings &= ~Otri2.SETTING_SHADED;
                    }
                    drawtri(tris[108], scene, pixelscreen);
                    tris[108].settings   |= Otri2.SETTING_SHADED;
                    Otri2.custom_position = v2(450f, 100f);
                    Otri2.position_factor = progressxy(84458, 86125, scene.time, faster);
                    Otri2.rotation_factor = progressxy(86125, 87791, scene.time, faster);
                    Otri2.scale_factor    = progressxy(87791, 89375, scene.time, faster);
                    showmov   |= t < 89375 && t >= 84458;
                    showrot   |= t < 89375 && t >= 86125;
                    showscale |= t < 89375 && t >= 87791;
                    if (t < 89375)
                    {
                        tris[135].settings &= ~Otri2.SETTING_SHADED;
                    }
                    drawtri(tris[135], scene, pixelscreen);
                    tris[135].settings   |= Otri2.SETTING_SHADED;
                    Otri2.custom_position = v2(575f, 100f);
                    Otri2.position_factor = progressxy(91040, 92792, scene.time, faster);
                    Otri2.rotation_factor = progressxy(92792, 94333, scene.time, faster);
                    Otri2.scale_factor    = progressxy(94333, 96080, scene.time, faster);
                    showmov   |= t < 96080 && t >= 91040;
                    showrot   |= t < 96080 && t >= 92792;
                    showscale |= t < 96080 && t >= 94333;
                    if (t < 96080)
                    {
                        tris[103].settings &= ~Otri2.SETTING_SHADED;
                    }
                    drawtri(tris[103], scene, pixelscreen);
                    tris[103].settings   |= Otri2.SETTING_SHADED;
                    Otri2.position_factor = Otri2.rotation_factor = Otri2.scale_factor = 1f;
                }
                else if (t < 97666)
                {
                    int mod = (int)(progressxy(96080, 97666, t, 3f) * 4f);
                    for (int i = 0; i < tris.Length; i++)
                    {
                        if ((i % 5) <= mod || i == 129 || i == 108 || i == 135 || i == 103)
                        {
                            drawtri(tris[i], scene, pixelscreen);
                        }
                    }
                }
                else
                {
                    foreach (Otri2 tri in tris)
                    {
                        drawtri(tri, scene, pixelscreen);
                    }
                }

                // limit to 40ms flickers, we don't want to give high fps peoples epilepsy (and it looks bad)
                if (scene.time - lastshakeytime > 40)
                {
                    EW_STATE_FLICKER_TEXT_SHOWN = !EW_STATE_FLICKER_TEXT_SHOWN;
                    lastshakeytime = scene.time;
                }
                bool flicker_text_state = EW_STATE_FLICKER_TEXT_SHOWN || t < 100208 || 101041 < t;

                for (int i = 0; i < statictext.Length; i++)
                {
                    bool show =
                        (!movtext[i] || showmov) &&
                        (!rottext[i] || showrot) &&
                        (!scaletext[i] || showscale) &&
                        (!ftext[i] || flicker_text_state);

                    if (show)
                    {
                        statictext[i].update(scene.time, v4(1f), v4(textloc[i], 1f, 1f));
                        statictext[i].draw(scene.g);
                    }
                    else
                    {
                        statictext[i].update(scene.time, null, null);
                    }
                }

                int size = 0;

                foreach (Otri2 tri in tris)
                {
                    size += tri.calcStoryboardCommandSize();
                }
                if (!rendering)
                {
                    size = 2030333;
                }
                string sizestr = string.Format("{0,8:###0.000}", (size / 1000f));

                bool[] sizetextshown = new bool[sizetext.Length];
                if (flicker_text_state)
                {
                    int xoff = 0;
                    for (int i = 0; i < sizestr.Length; i++)
                    {
                        int c  = sizestr[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 idx = 80 * j + xoff + k;
                                    sizetextshown[idx] = true;
                                    sizetext[idx].update(scene.time, v4(1f), sizetextloc[idx]);
                                    sizetext[idx].draw(scene.g);
                                }
                            }
                        }
                        xoff += cw + 1;
                    }
                }
                for (int i = 0; i < sizetextshown.Length; i++)
                {
                    if (!sizetextshown[i])
                    {
                        sizetext[i].update(scene.time, null, null);
                    }
                }
skipnonlinenondots:

                ICommand.round_move_decimals.Pop();
                ICommand.round_scale_decimals.Pop();
                ICommand.round_rot_decimals.Pop();
            }
Beispiel #11
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);
            }