Пример #1
0
        public static void ball_draw_solid(float[] ball_M,
                                           float[] ball_bill_M, float t)
        {
            if (has_solid != 0)
            {
                int mask = (solid_flags & F_DEPTHMASK);
                int test = (solid_flags & F_DEPTHTEST);

                if (solid_alpha < 1.0f)
                {
                    GL.Enable(EnableCap.AlphaTest);
                    GL.AlphaFunc(AlphaFunction.Gequal, solid_alpha);
                }

                Video.MODELVIEW_PushMatrix();
                {
                    /* Apply the ball rotation. */

                    Video.MODELVIEW_MultMatrix(ball_M);

                    /* Draw the solid billboard geometry. */

                    if (solid.m_rc != 0)
                    {
                        if (test == 0)
                        {
                            GL.Disable(EnableCap.DepthTest);
                        }
                        if (mask == 0)
                        {
                            GL.DepthMask(false);
                        }
                        GL.Disable(EnableCap.Lighting);
                        {
                            solid.sol_bill(ball_bill_M, t);
                        }
                        GL.Enable(EnableCap.Lighting);
                        if (mask == 0)
                        {
                            GL.DepthMask(true);
                        }
                        if (test == 0)
                        {
                            GL.Enable(EnableCap.DepthTest);
                        }
                    }

                    /* Draw the solid opaque and transparent geometry. */

                    solid.sol_draw(mask, test);
                }
                Video.MODELVIEW_PopMatrix();

                if (solid_alpha < 1.0f)
                {
                    GL.Disable(EnableCap.AlphaTest);
                }
            }
        }
Пример #2
0
        public void item_draw(s_item hp, float r)
        {
            float[] c  = new float[3];
            s_file  fp = null;

            switch (hp.m_t)
            {
            case Solid.ITEM_COIN: fp = item_coin_file; break;

            case Solid.ITEM_GROW: fp = item_grow_file; break;

            case Solid.ITEM_SHRINK: fp = item_shrink_file; break;
            }

            item_color(hp, c);

            Video.Color(c);
            fp.sol_draw(0, 1);
        }
Пример #3
0
        public static void game_draw_fore(int pose, float[] M, int d, float t)
        {
            float[] ball_p = file.m_uv[0].m_p;
            float   ball_r = file.m_uv[0].m_r;

            Video.MODELVIEW_PushMatrix();
            {
                //  Rotate the environment about the position of the ball.

                game_draw_tilt(d);

                //  Compute clipping planes for reflection and ball facing.

                game_clip_refl(d);
                game_clip_ball(d, ball_p);

                if (d < 0)
                {
                    GL.Enable(EnableCap.ClipPlane0);
                }

                switch (pose)
                {
                case 1:
                    file.sol_draw(0, 1);
                    break;

                case 0:
                    //  Draw the coins.

                    game_draw_items(file, t);

                    //  Draw the floor.

                    file.sol_draw(0, 1);

                    //  Fall through.
                    goto case 2;

                case 2:

                    //  Draw the ball shadow.

                    if (d > 0 &&
                        Config.config_get_d(Config.CONFIG_SHADOW) != 0)
                    {
                        file.DrawBallShadow(0);
                    }

                    //  Draw the ball.

                    game_draw_balls(file, M, t);

                    break;
                }

                //  Draw the particles and light columns.

                GL.Enable(EnableCap.ColorMaterial);
                GL.Disable(EnableCap.Lighting);
                GL.DepthMask(false);
                {
                    Video.Color(1.0f, 1.0f, 1.0f);

                    file.sol_bill(M, t);
                    Part.part_draw_coin(M, t);

                    GL.Disable(EnableCap.Texture2D);
                    {
                        file.game_draw_goals(M, t);
                        game_draw_jumps(file, M, t);
                        file.game_draw_swchs();
                    }
                    GL.Enable(EnableCap.Texture2D);

                    Video.Color(1.0f, 1.0f, 1.0f);
                }
                GL.DepthMask(true);
                GL.Enable(EnableCap.Lighting);
                GL.Disable(EnableCap.ColorMaterial);

                if (d < 0)
                {
                    GL.Disable(EnableCap.ClipPlane0);
                }
            }
            Video.MODELVIEW_PopMatrix();
        }