示例#1
0
 public override void draw(SCENE scene)
 {
     if (scene.progress > .2f && scene.progress < .5f)
     {
         dot.update(scene.time, null, null, 5f);
     }
     else
     {
         vec4 color = v4(1f);
         color.x *= scene.progress;
         vec4 pos = v4(100f, 100f, 1f, 10f);
         pos.x += scene.progress * 100f;
         dot.update(scene.time, color, pos, 5f);
     }
     dot.draw(scene.g);
 }
示例#2
0
            public override void draw(SCENE scene)
            {
                turn(_points, points, mid, 800f * scene.progress, 1200f * scene.progress);

                float ang       = scene.progress * 20f;
                vec3  light1pos = mid + v3(30f * sin(ang), 20f * cos(ang), 20f);
                vec3  light1col = v3(1f, 0f, 0f);

                light1.update(scene.time, v4(light1col, 1f), project(light1pos), 12f);
                light1.draw(scene.g);

                vec3 light2pos = mid + v3(30f * sin(ang * 1.7f), 0f, 20f * cos(ang * 1.7f));

                light2pos = turn(light2pos, mid, quat(rad(45f), rad(0f), 0f));
                vec3 light2col = v3(0f, 0f, 1f);

                light2.update(scene.time, v4(light2col, 1f), project(light2pos), 12f);
                light2.draw(scene.g);

                vec3 light3pos = mid + v3(30f * sin(ang * 0.5f), 0f, 20f * cos(ang * 0.5f));

                light3pos = turn(light3pos, mid, quat(0f, rad(-45f), 0f));
                vec3 light3col = v3(0f, .4f, 0f);

                light3.update(scene.time, v4(light3col, 1f), project(light3pos), 12f);
                light3.draw(scene.g);

                for (int i = 0; i < 6; i++)
                {
                    Rect  r = cube.rects[i];
                    Orect o = rects[i];

                    vec3 rectmid = v3(0f);
                    rectmid += r.pts[r.a];
                    rectmid += r.pts[r.b];
                    rectmid += r.pts[r.c];
                    rectmid += r.pts[r.d];
                    rectmid /= 4f;


                    float aval = 0.3f;
                    float bval = 0.7f;

                    vec3 result = col(r.color).xyz *aval;
                    result += light1col * bval / pow(distance(light1pos, rectmid) / 15, 2);
                    result += light2col * bval / pow(distance(light2pos, rectmid) / 15, 2);
                    result += light3col * bval / pow(distance(light3pos, rectmid) / 15, 2);

                    result.x = min(1f, result.x);
                    result.y = min(1f, result.y);
                    result.z = min(1f, result.z);

                    Color original = r.color;
                    r.setColor(v4(result, 1f).col());
                    o.update(scene);
                    r.setColor(original);
                }
            }
示例#3
0
            public override void draw(SCENE scene)
            {
                float r     = (scene.time / framedelta) % 2 == 1 ? 1f : 0f;
                vec4  color = v4(v3(r, 0f, 1f), 1f);
                vec4  pos   = v4(100f, 100f, 1f, 10f);

                dot.update(scene.time, color, pos, 6f);
                dot.draw(scene.g);
            }
示例#4
0
            public void draw(SCENE scene, Pixelscreen screen)
            {
                if (r.shouldcull())
                {
                    for (int i = 0; i < this.dots.Length; i++)
                    {
                        this.dots[i].update(scene.time, null, null, 0f);
                    }
                    return;
                }
                for (int x = 0; x < dotcount; x++)
                {
                    for (int y = 0; y < dotcount; y++)
                    {
                        Odot  dot = this.dots[x * dotcount + y];
                        float INC = 1f / dotcount;
                        float dx  = x * (1f - INC) / (dotcount - 1) + INC / 2f;
                        float dy  = y * (1f - INC) / (dotcount - 1) + INC / 2f;
                        vec3  ab  = lerp(r.pts[r.a], r.pts[r.b], dx);
                        vec3  cd  = lerp(r.pts[r.c], r.pts[r.d], dx);
                        vec3  pt  = lerp(ab, cd, dy);
                        vec4  loc = project(pt);
                        if (!isOnScreen(loc.xy))
                        {
                            goto norender;
                        }
                        object o = screen.ownerAt(loc.xy);
                        if (!(o is Tri))
                        {
                            goto norender;
                        }
                        if (((Tri)o).owner != r)
                        {
                            goto norender;
                        }
                        dot.update(scene.time, col(r.color), loc);
                        dot.draw(scene.g);
                        continue;
norender:
                        dot.update(scene.time, null, null, size);
                        continue;
                    }
                }
            }
示例#5
0
文件: zwaves.cs 项目: yugecin/osusb1
            public override void draw(SCENE scene)
            {
                ICommand.round_scale_decimals.Push(1);

                vec3[] points = new vec3[AMOUNT];

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

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

                float angle = 10f;

                float rot = scene.reltime / 80f;

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

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

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

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

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

                Odot d = new Odot(Sprite.SPRITE_DOT_6_12, 0);
                d.update(scene.time, v4(1f, 0f, 1f, 1f), project(Zsc.mid), 3f);
                d.draw(scene.g);
                ICommand.round_scale_decimals.Pop();
            }
示例#6
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();
            }
示例#7
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);
            }