示例#1
0
            public Ztor(int start, int stop)
            {
                this.start        = start;
                this.stop         = stop;
                framedelta        = 125;
                phantomframedelta = 25;

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

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

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

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

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

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

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

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

                vec3[] rpts =
                {
                    // I have no clue really
                    mid + v3(-100, -70,  80),
                    mid + v3(100,  -70,  80),
                    mid + v3(-100, -70, -80),
                    mid + v3(100,  -70, -80),
                };
                textplane = new Rect(null, Color.Red, rpts, 0, 1, 2, 3);
            }