Ejemplo n.º 1
0
    public static MegaBezVector3KeyControl LoadBezVector3KeyControl(BinaryReader br)
    {
        MegaBezVector3KeyControl con = new MegaBezVector3KeyControl();

        MegaUtils.Parse(br, con.Parse);
        return con;
    }
    static public MegaBezVector3KeyControl LoadBezVector3KeyControl(BinaryReader br)
    {
        con = new MegaBezVector3KeyControl();

        MegaParse.Parse(br, Parse);
        return(con);
    }
    static public MegaBezVector3KeyControl LoadBezVector3KeyControl(BinaryReader br)
    {
        MegaBezVector3KeyControl con = new MegaBezVector3KeyControl();

        MegaUtils.Parse(br, con.Parse);
        return(con);
    }
Ejemplo n.º 4
0
    void AdditiveWeighted(MegaModifiers mc, int startvert, int endvert)
    {
        //int wc = (int)weightChannel;

        //Vector3[]	vts = mc.GetSourceVerts();

        for (int i = startvert; i < endvert; i++)
        {
            MegaBezVector3KeyControl bc = (MegaBezVector3KeyControl)Verts[i].con;

            Vector3 basep = mc.verts[Verts[i].indices[0]];
            Vector3 off   = bc.GetVector3(t) - basep;

            //float w = mc.cols[Verts[i].indices[0]][wc] * weight;
            float w = mc.selection[Verts[i].indices[0]] * weight;               //[wc];

            //off.x *= w;
            //off.y *= w;
            //off.z *= w;

            Vector3 p1 = verts[Verts[i].indices[0]];

            off = p1 + ((off - p1) * w);

            for (int v = 0; v < Verts[i].indices.Length; v++)
            {
                int idx = Verts[i].indices[v];

                sverts[idx] = off;
                //mc.sverts[idx].x = basep.x + off.x;
                //mc.sverts[idx].y = basep.y + off.y;
                //mc.sverts[idx].z = basep.z + off.z;
            }
        }
    }
Ejemplo n.º 5
0
    void Additive(MegaModifiers mc, int startvert, int endvert)
    {
        //Vector3[]	vts = mc.GetSourceVerts();

        for (int i = startvert; i < endvert; i++)
        {
            MegaBezVector3KeyControl bc = (MegaBezVector3KeyControl)Verts[i].con;

            Vector3 basep = mc.verts[Verts[i].indices[0]];
            Vector3 off   = bc.GetVector3(t) - basep;

            //off.x *= weight;
            //off.y *= weight;
            //off.z *= weight;
            off = verts[Verts[i].indices[0]] + (off * weight);

            for (int v = 0; v < Verts[i].indices.Length; v++)
            {
                int idx = Verts[i].indices[v];

                sverts[idx] = off;
                //mc.sverts[idx].x = basep.x + off.x;
                //mc.sverts[idx].y = basep.y + off.y;
                //mc.sverts[idx].z = basep.z + off.z;
            }
        }
    }
Ejemplo n.º 6
0
    public void ModifyCompressedMT(MegaModifiers mc, int tindex, int cores)
    {
        //Vector3[]	verts = mc.GetSourceVerts();
        //Vector3[]	sverts = mc.GetDestVerts();

        int step      = NoAnim.Length / cores;
        int startvert = (tindex * step);
        int endvert   = startvert + step;

        if (tindex == cores - 1)
        {
            endvert = NoAnim.Length;
        }

        if (NoAnim != null)
        {
            for (int i = startvert; i < endvert; i++)
            {
                int index = NoAnim[i];
                sverts[index] = verts[index];
            }
        }

        //Debug.Log("tindex " + tindex + " cores " + cores + " Verts " + Verts.Length);
        step      = Verts.Length / cores;
        startvert = (tindex * step);
        endvert   = startvert + step;

        if (tindex == cores - 1)
        {
            endvert = Verts.Length;
        }

        switch (blendMode)
        {
        case MegaBlendAnimMode.Additive:        Additive(mc, startvert, endvert); break;

        case MegaBlendAnimMode.Replace:         Replace(mc, startvert, endvert); break;
        }
#if false
        for (int i = startvert; i < endvert; i++)
        {
            MegaBezVector3KeyControl bc = (MegaBezVector3KeyControl)Verts[i].con;

            Vector3 off = bc.GetVector3(t);

            for (int v = 0; v < Verts[i].indices.Length; v++)
            {
                sverts[Verts[i].indices[v]] = off;
            }
        }
#endif
    }
    void Replace(MegaModifiers mc, int startvert, int endvert)
    {
        for (int i = startvert; i < endvert; i++)
        {
            MegaBezVector3KeyControl bc = (MegaBezVector3KeyControl)Verts[i].con;

            Vector3 off = bc.GetVector3(t);

            // ******* We must have duplicate verts in the indices array, so check that, if so same will apply to pc mod
            for (int v = 0; v < Verts[i].indices.Length; v++)
            {
                sverts[Verts[i].indices[v]] = off;
            }
        }
    }
    void Additive(MegaModifiers mc, int startvert, int endvert)
    {
        for (int i = startvert; i < endvert; i++)
        {
            MegaBezVector3KeyControl bc = (MegaBezVector3KeyControl)Verts[i].con;

            Vector3 basep = mc.verts[Verts[i].indices[0]];
            Vector3 off   = bc.GetVector3(t) - basep;

            off = verts[Verts[i].indices[0]] + (off * weight);

            for (int v = 0; v < Verts[i].indices.Length; v++)
            {
                int idx = Verts[i].indices[v];

                sverts[idx] = off;
            }
        }
    }
    void ReplaceWeighted(MegaModifiers mc, int startvert, int endvert)
    {
        for (int i = startvert; i < endvert; i++)
        {
            MegaBezVector3KeyControl bc = (MegaBezVector3KeyControl)Verts[i].con;

            Vector3 off = bc.GetVector3(t);

            float w = mc.selection[Verts[i].indices[0]] * weight;               //[wc];

            Vector3 p1 = verts[Verts[i].indices[0]];

            off = p1 + ((off - p1) * w);

            for (int v = 0; v < Verts[i].indices.Length; v++)
            {
                sverts[Verts[i].indices[v]] = off;
            }
        }
    }
Ejemplo n.º 10
0
	static public MegaBezVector3KeyControl LoadBezVector3KeyControl(BinaryReader br)
	{
		con = new MegaBezVector3KeyControl();

		MegaParse.Parse(br, Parse);
		return con;
	}