示例#1
0
        public static float sol_test_side(float dt,
                                          float[] T,
                                          s_ball up,
                                          s_file fp,
                                          s_lump lp,
                                          s_side sp,
                                          float[] o,
                                          float[] w)
        {
            float t = v_side(T, o, w, sp.m_n, sp.m_d, up.m_p, up.m_v, up.m_r);
            int   i;

            if (t < dt)
            {
                for (i = 0; i < lp.m_sc; i++)
                {
                    s_side sq = fp.m_sv[fp.m_iv[lp.m_s0 + i]];

                    if (sp != sq &&
                        Vec3.v_dot(T, sq.m_n) -
                        Vec3.v_dot(o, sq.m_n) -
                        Vec3.v_dot(w, sq.m_n) * t > sq.m_d)
                    {
                        return((float)LARGE);
                    }
                }
            }
            return(t);
        }
示例#2
0
        void sol_draw_lump(s_lump lp, int mi)
        {
            int i;

            for (i = 0; i < lp.m_gc; i++)
            {
                sol_draw_geom(m_gv[m_iv[lp.m_g0 + i]], mi);
            }
        }
示例#3
0
        void sol_shad_lump(s_file fp, s_lump lp, int mi)
        {
            int i;

            for (i = 0; i < lp.m_gc; i++)
            {
                sol_shad_geom(fp, fp.m_gv[fp.m_iv[lp.m_g0 + i]], mi);
            }
        }
示例#4
0
        public static float sol_test_node(float dt,
                                          float[] T,
                                          s_ball up,
                                          s_file fp,
                                          s_node np,
                                          float[] o,
                                          float[] w)
        {
            float u, t = dt;

            float[] U = new float[3];
            int     i;

            /* Test all lumps */

            for (i = 0; i < np.m_lc; i++)
            {
                s_lump lp = fp.m_lv[np.m_l0 + i];

                if ((u = sol_test_lump(t, U, up, fp, lp, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }

            /* Test in front of this node */

            if (np.m_ni >= 0 &&
                sol_test_fore(t, up, fp.m_sv[np.m_si], o, w) != 0)
            {
                s_node nq = fp.m_nv[np.m_ni];

                if ((u = sol_test_node(t, U, up, fp, nq, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }

            /* Test behind this node */

            if (np.m_nj >= 0 &&
                sol_test_back(t, up, fp.m_sv[np.m_si], o, w) != 0)
            {
                s_node nq = fp.m_nv[np.m_nj];

                if ((u = sol_test_node(t, U, up, fp, nq, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }

            return(t);
        }
示例#5
0
 public static void sol_load_lump(IntPtr fin, s_lump lp)
 {
     Binary.get_index(fin, ref lp.m_fl);
     Binary.get_index(fin, ref lp.m_v0);
     Binary.get_index(fin, ref lp.m_vc);
     Binary.get_index(fin, ref lp.m_e0);
     Binary.get_index(fin, ref lp.m_ec);
     Binary.get_index(fin, ref lp.m_g0);
     Binary.get_index(fin, ref lp.m_gc);
     Binary.get_index(fin, ref lp.m_s0);
     Binary.get_index(fin, ref lp.m_sc);
 }
示例#6
0
        public static float sol_test_lump(float dt,
                                          float[] T,
                                          s_ball up,
                                          s_file fp,
                                          s_lump lp,
                                          float[] o,
                                          float[] w)
        {
            float[] U = new float[3] {
                0.0f, 0.0f, 0.0f
            };

            float u, t = dt;
            int   i;

            /* Short circuit a non-solid lump. */

            if ((lp.m_fl & Solid.L_DETAIL) != 0)
            {
                return(t);
            }

            /* Test all verts */

            if (up.m_r > 0.0f)
            {
                for (i = 0; i < lp.m_vc; i++)
                {
                    s_vert vp = fp.m_vv[fp.m_iv[lp.m_v0 + i]];

                    if ((u = sol_test_vert(t, U, up, vp, o, w)) < t)
                    {
                        Vec3.v_cpy(T, U);
                        t = u;
                    }
                }
            }

            /* Test all edges */

            if (up.m_r > 0.0f)
            {
                for (i = 0; i < lp.m_ec; i++)
                {
                    s_edge ep = fp.m_ev[fp.m_iv[lp.m_e0 + i]];

                    if ((u = sol_test_edge(t, U, up, fp, ep, o, w)) < t)
                    {
                        Vec3.v_cpy(T, U);
                        t = u;
                    }
                }
            }

            /* Test all sides */

            for (i = 0; i < lp.m_sc; i++)
            {
                s_side sp = fp.m_sv[fp.m_iv[lp.m_s0 + i]];

                if ((u = sol_test_side(t, U, up, fp, lp, sp, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }
            return(t);
        }