예제 #1
0
파일: zltext.cs 프로젝트: yugecin/osusb2
 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);
     Zcamera.adjust(_points);
     for (int i = rects2.Length - 1; i >= 0; i--)
     {
         if (!rects2[i].left.shouldcull())
         {
             orects2[i].update(scene);
         }
         else
         {
             orects2[i].update(scene, -1f, -1f, -1f);
         }
     }
     for (int i = 0; i < rects.Length; i++)
     {
         if (rects[i].left.shouldcull())
         {
             orects[i].update(scene);
         }
         else
         {
             orects[i].update(scene, -1f, -1f, -1f);
         }
     }
     ICommand.round_move_decimals.Pop();
     ICommand.round_scale_decimals.Pop();
     ICommand.round_rot_decimals.Pop();
 }
예제 #2
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);
                Zcamera.adjust(_points);

                foreach (MultiRect r in rects)
                {
                    r.update(scene);
                }

                ICommand.round_move_decimals.Pop();
                ICommand.round_scale_decimals.Pop();
                ICommand.round_rot_decimals.Pop();
            }
예제 #3
0
파일: zshad.cs 프로젝트: yugecin/osusb2
            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
            }
예제 #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);
                        }
                    }
                }
            }
예제 #5
0
파일: zctext.cs 프로젝트: yugecin/osusb2
 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(_tripos, tripos);
     turn(_tripos, v3(), rotation);
     move(_tripos, position);
     move(_tripos, Zcamera.mid);
     Zcamera.adjust(_tripos);
     vec3[] vecs = new vec3[1];
     for (int i = 0; i < bg.Length; i++)
     {
         if (tri.shouldcull() || bgcol.w < 0f || bgsize < 0f || !showbg)
         {
             bg[i].update(scene.time, v4(1f), null);
         }
         else
         {
             float f = i / (float)bg.Length;
             vec3  v = v3();
             if (bgstyle == 0)
             {
                 f *= PI * 2f;
                 float r = 2f - 2f * sin(f) + sin(f) * sqrt(abs(cos(f))) / (sin(f) + 1.4f);
                 r   *= bgsize;
                 v.x  = cos(f) * r * 10f * SIZE;
                 v.z  = sin(f) * r * 10f * SIZE;
                 v.z += bgsize * 4.5f;
             }
             else if (bgstyle == 1)
             {
                 int   part = (int)(f / 0.1f);
                 float tt   = progress(part * 0.1f, (part + 1) * 0.1f, f);
                 vec2  p    = lerp(starbgpoints[part], starbgpoints[(part + 1) % 10], tt);
                 v = lerp(v3(), v3(p.x, 0f, p.y) * 9f, bgsize);
             }
             v.x     = v.x - v.x % SIZE;
             v.z     = v.z - v.z % SIZE;
             vecs[0] = v;
             turn(vecs, v3(), rotation);
             move(vecs, position);
             move(vecs, Zcamera.mid);
             Zcamera.adjust(vecs);
             bg[i].update(scene.time, bgcol, project(vecs[0]));
             bg[i].draw(scene.g);
         }
     }
     for (int i = 0; i < dots.Length; i++)
     {
         if (tri.shouldcull())
         {
             dots[i].update(scene.time, v4(1f), null);
         }
         else
         {
             vecs[0] = v3(pos[i]);
             turn(vecs, v3(), rotation);
             move(vecs, position);
             move(vecs, Zcamera.mid);
             Zcamera.adjust(vecs);
             dots[i].update(scene.time, v4(1f), project(vecs[0]));
             dots[i].draw(scene.g);
         }
     }
     ICommand.round_move_decimals.Pop();
     ICommand.round_scale_decimals.Pop();
     ICommand.round_rot_decimals.Pop();
 }
예제 #6
0
            public override void draw(SCENE scene)
            {
                vec3[] sp = new vec3[] { v3(0f, 0f, 50f) };
                move(sp, Zcamera.mid);
                Zcamera.adjust(sp);
                sunpos = sp[0];

                //Zharrier.position = v3(0f);
                lockedharrpos = null;

                dp = v3(0f);
                vec3  dir = v3(0f);
                float rz  = 0f;

                int t = scene.time;

                if (t < 5041)
                {
                    // intro
                    dp  = v3(lerp(-1000f, 1000f, progress(2000, 5041, t)), 0f, 0f);
                    dir = v3(10f, 0f, 0f);
                }
                else if (t < 9950)
                {
                    // first circling
                    float f = progress(5041, 9950, t) + .7f;
                    if (t > 6625)
                    {
                        f += .2f;
                    }
                    if (t > 8250)
                    {
                        f += .2f;
                    }
                    dp  = v3(500f * cos(f * 4f), 500f * sin(f * 4f), -200f);
                    dir = dp - v3(0f, 0f, 0f);
                }
                else if (t < 11708)
                {
                    // i present
                    float f = progress(9950, 11708, t);
                    dp  = v3(-lerp(-520f, 520f, f), -200f, -40f);
                    dir = dp - v3(-lerp(-400f, 400f, f), -450f, -20f);
                }
                else if (t < 14958)
                {
                    // more showoff
                    float f = progress(11708, 14666, t) - .1f;
                    if (t > 13200)
                    {
                        f += .2f;
                    }
                    dp  = v3(lerp(500f, -500f, f), 0f, -600f);
                    dir = dp - v3(lerp(500f, -500f, f), 0f, 0f);
                }
                else if (t < 18291)
                {
                    // osu sb numero dos
                    int   nums = 11;
                    float size = 0.07f;
                    float f    = progress(14958, 18291, t) * (1f - nums * size);
                    int   tt   = t + 75;
                    if (tt > 15375)
                    {
                        f += size;
                    }
                    for (int i = 0; i < 6; i++)
                    {
                        if (t > 15791 + i * 132)
                        {
                            f += size;
                        }
                    }
                    if (tt > 16583)
                    {
                        f += size;
                    }
                    if (tt > 16980)
                    {
                        f += size;
                    }
                    if (tt > 17375)
                    {
                        f += size;
                    }
                    if (tt > 17833)
                    {
                        f += size;
                    }
                    dp  = v3(-lerp(-700f, 650f, f), 100f, -25f);
                    dir = v3(0f, 1f, 0f);
                }
                else if (t < 31400)
                {
                    // harr
                    float f   = progressx(18291, 24583, t);
                    float fat = f * 0.99f;
                    float fto = clamp(f + 0.1f, 0f, 1f);

                    /*
                     * vec3 ha = v3(-600f, 0f, 0f);
                     * vec3 hp1 = v3(1200f, 200f, 150f);
                     * vec3 hp2 = v3(1000f, -800f, 350f);
                     * vec3 hb = v3(-300f, -300f, 200f);
                     *
                     * vec3 at = cubic(ha, hb, hp1, hp2, fat);
                     * vec3 atn = cubic(ha, hb, hp1, hp2, clamp(fat + 0.001f, 0f, 1f));
                     * vec3 to = cubic(ha, hb, hp1, hp2, fto);
                     *
                     * Zharrier.position = at;
                     * Zharrier.yaw = atan2(atn.y - at.y, atn.x - at.x);
                     * Zharrier.pitch = -atan2(to.z - at.z, (to.xy - at.xy).length());
                     * Zharrier.roll = -(atan2(atn.x - at.x, atn.y - at.y) - atan2(to.x - at.x, to.y - at.y));*/

                    dp  = v3() - getCamPos(t);
                    dir = dp + getHarrPos(t);
                }
                else if (t < 56333)
                {
                    // greets
                    vec3 _00_pos = v3(-1097.832f, -1175.126f, 271.0345f);
                    vec3 _00_lok = v3(-1077.637f, -1267.603f, 285.5392f);
                    vec3 _01_lok = v3(0f, 0f, 100f);

                    vec3 _05_pos = v3(759.1069f, -193.1827f, 289.7183f);
                    vec3 _05_lok = lerp(v3(), _05_pos, 0.9f);
                    _05_lok.z = _05_pos.z;
                    vec3 _05_lokb = v3(_05_lok);
                    _05_lok = _05_pos - (_05_pos - _05_lok) * 5f;

                    vec3 _10_pos = _05_pos + v3(-30f, 40f, 0f);

                    vec3 her_dir  = v3(0f, -1f, 0f);
                    vec3 her_pos  = v3(398f, -115.85317f, 35f);
                    vec3 her_lok  = her_pos + her_dir * 50f;
                    vec3 her_int  = lerp(_10_pos, her_pos, 0.2f) + v3(0, 400f, 0f);
                    vec3 her_int2 = lerp(_10_pos, her_pos, 0.8f) + v3(0, 400f, 0f);
                    vec3 her_pos2 = v3(398f, -115.85317f, 58f);
                    vec3 her_lok2 = her_pos2 + her_dir * 50f;

                    vec3 qua_lok = v3(300f, 80f, 230f);
                    vec3 qua_pos = v3(-748.7392f, -328.6331f, 80f);
                    qua_lok = lerp(qua_lok, qua_pos, 0.4f);
                    vec3 qua_int  = lerp(her_pos2, qua_pos, 0.2f) + v3(0, -200f, 0);
                    vec3 qua_int2 = lerp(her_pos2, qua_pos, 0.8f) + v3(0, -200f, 0);
                    vec3 qua_pos2 = v3(-748.7392f, -270.6331f, 80f);

                    vec3 luk_pos    = v3(632.1013f, 358.0017f, 48.1202f);
                    vec3 luk_lok    = v3(-263.8631f, 1.909196f, 270f);
                    vec3 luk_pos2   = luk_pos + v3(0f, -40f, 0f);
                    vec3 luk_int    = lerp(qua_pos2, luk_pos, 0.5f) + v3(0f, 500f, 200f);
                    vec3 luk_lokint = lerp(qua_lok, luk_lok, 0.5f) + v3(0f, 0f, -400f);

                    if (t < 33125)
                    {
                        // transition from harr
                        float f = progress(31400, 33125, t);
                        dp  = v3() - _00_pos;
                        dir = dp + lerp(_00_lok, _01_lok, f);
                    }
                    else if (t < 35708)
                    {
                        // transition to em
                        float f  = greetprogress(33125, 35708, 34041, 34791, t, .11f);
                        vec3  to = lerp(_00_pos, _05_pos, f);
                        //to = quadratic(_00_pos, _05_pos, v3(800f, -700f, 0f), f);
                        //to.z = lerp(_00_pos.z, _05_pos.z, f);
                        dp  = v3() - to;
                        dir = dp + lerp(_01_lok, _05_lok, f);
                    }
                    else if (t < 39750)
                    {
                        // around em
                        float f = progress(36458, 39750, t);
                        dp  = v3() - lerp(_05_pos, _10_pos, f);
                        dir = dp + _05_lokb;
                    }
                    else if (t < 42333)
                    {
                        // transition to herakles
                        float f = greetprogress(39750, 42333, 40666, 41416, t, .11f);
                        dp  = v3() - lerp(_10_pos, her_pos, f);
                        dp  = v3() - cubic(_10_pos, her_pos, her_int, her_int2, f);
                        dir = dp + lerp(_05_lokb, her_lok, f);
                        rz  = lerp(0f, 1f, eq_in_quart(f));
                    }
                    else if (t < 46375)
                    {
                        // around herakles
                        float f = progress(42333, 46375, t);
                        dp  = v3() - lerp(her_pos, her_pos2, f);
                        dir = dp + lerp(her_lok, her_lok2, f);
                        rz  = 1f;
                    }
                    else if (t < 48850)
                    {
                        // transition to quack
                        float f = greetprogress(46375, 48850, 47333, 48000, t, .11f);
                        dp  = v3() - cubic(her_pos2, qua_pos, qua_int, qua_int2, f);
                        dir = dp + lerp(her_lok2, qua_lok, eq_in_cubic(f));
                        rz  = lerp(1f, 0f, f);
                    }
                    else if (t < 51333)
                    {
                        // around quack
                        float f = progress(48850, 51333, t);
                        dp  = v3() - lerp(qua_pos, qua_pos2, f);
                        dir = dp + qua_lok;
                        rz  = lerp(0f, -0.2f, f);
                    }
                    else if (t < 53900)
                    {
                        // transition to luki
                        float f = greetprogress(51333, 53900, 52291, 53000, t, .11f);
                        dp  = v3() - quadratic(qua_pos2, luk_pos, luk_int, f);
                        dir = dp + quadratic(qua_lok, luk_lok, luk_lokint, f);
                        rz  = lerp(-0.2f, 0f, f);
                    }
                    else
                    {
                        // around luki
                        float f = progress(53900, 56333, t);
                        dp  = v3() - lerp(luk_pos, luk_pos2, f);
                        dir = dp + luk_lok;
                    }

                    if (t < 40000)
                    {
                        Zctext.position = _05_lokb;
                        Zctext.rotation = quat(0f, 0f, 1.5f);
                        float f = progress(36458, 39125, t);
                        Zctext.showbg  = f >= 0f;
                        Zctext.bgsize  = eq_out_circ(clamp(f * 2.2f, 0f, 1f));
                        Zctext.bgcol   = v4(1f, .42f, .8f, 1f - eq_in_expo(f));
                        Zctext.bgstyle = 0;
                    }
                    else if (t < 47000)
                    {
                        Zctext.position = v3(400f, -205f, 40f);
                        Zctext.rotation = quat(-PI2, 0f, PI);
                        float f = progress(43040, 44750, t);
                        Zctext.showbg  = f >= 0f;
                        Zctext.bgsize  = eq_out_circ(clamp(f * 2.2f, 0f, 1f));
                        Zctext.bgcol   = v4(.4f, .7f, 1f, 1f - eq_in_expo(f));
                        Zctext.bgstyle = 1;
                    }
                    else if (t < 52000)
                    {
                        Zctext.position = lerp(qua_lok, lerp(qua_pos, qua_pos2, 0.8f), 0.9f);
                        Zctext.rotation = quat(0f, 0f, -1.5f);
                        float f = progress(49583, 50916, t);
                        Zctext.showbg  = f >= 0f;
                        Zctext.bgsize  = eq_out_circ(clamp(f * 2.2f, 0f, 1f));
                        Zctext.bgcol   = v4(.4f, .7f, 1f, 1f - eq_in_expo(f));
                        Zctext.bgstyle = 1;
                    }
                    else if (t < 56541)
                    {
                        Zctext.position = lerp(luk_lok, lerp(luk_pos, luk_pos2, 0.6f), 0.95f);
                        Zctext.rotation = quat(0f, 0f, 1.9f);
                        float f = progress(54400, 55800, t);
                        Zctext.showbg  = f >= 0f;
                        Zctext.bgsize  = eq_out_circ(clamp(f * 2.2f, 0f, 1f));
                        Zctext.bgcol   = v4(.4f, .7f, 1f, 1f - eq_in_expo(f));
                        Zctext.bgstyle = 1;
                    }
                }
                else if (t < 58000)
                {
                    // transition to shad (first appearance) (but not actually, mc is in between)
                    float tt  = t / 200f;
                    int   seg = (58000 - 56333) / 6;
                    switch ((t - 56333) / seg)
                    {
                    case 0:
                        dp = v3(17f, 17f, -15f);
                        break;

                    case 1:
                        dp = v3(-20f, -18f, 19f);
                        break;

                    case 2:
                        dp = v3(20f, -18f, 0f);
                        break;

                    case 3:
                        dp = v3(20f, -20f, -20f);
                        break;

                    case 4:
                        dp = v3(-16f, 5f, 15f);
                        break;

                    default:
                        dp = v3(20f, -20f, -20f);
                        rz = 3.3f;
                        break;
                    }
                    dir = dp - v3(0f);
                }
                else if (t < 64250)
                {
                    // mc
                    dp  = v3(-25f, 0f, -10f);
                    dir = dp - v3(0f);
                }
                else if (t < 67600)
                {
                    // shad (first.5 appearance)
                    float p = progressx(64250, 67458, t) * 3.5f;
                    p += 3.2f * step(t, 64350);
                    //float tt = t;
                    //tt += 2000.0f * step(64350, t) - 200f;
                    //tt /= 200.0f;
                    float a, b;
                    //a = tt / -4f;
                    //b = tt / 6f;
                    a = p + -.75f;
                    b = p + 6.5f;
                    float xymod = (1f + .1f * abs(sin(b)));
                    float dist  = 25f + progressx(67600 - 500, 67600, t) * 200.0f;
                    dp  = v3(dist * cos(a) * xymod, dist * sin(a) * xymod, 14f * cos(b));
                    dir = dp - v3(0f);
                }
                else if (t < 104085)
                {
                    // harrier breakdown
                    dp  = v3(-38f, 40f, -20f);
                    dir = dp - v3(0f, 20f, -5f);
                }
                else
                {
                    // shad (second appearance)
                    dp  = v3(20f, 0f, 0f);
                    dir = dp - v3(0f);
                }

                vec2 vd = viewdir(dir);

                lquatx = quat(0f, 0f, vd.x);
                lquaty = quat(0f, vd.y, 0f);
                lquatz = quat(rz, 0f, 0f);
            }
예제 #7
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();
            }
예제 #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);

                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();
            }