Пример #1
0
    bool AnimParse(BinaryReader br, string cid)
    {
        MegaShape ms = (MegaShape)target;

        switch (cid)
        {
        case "V":
            int v = br.ReadInt32();
            ma = new MegaKnotAnim();
            int s = ms.GetSpline(v, ref ma);                            //.s, ref ma.p, ref ma.t);

            if (ms.splines[s].animations == null)
            {
                ms.splines[s].animations = new List <MegaKnotAnim>();
            }

            ms.splines[s].animations.Add(ma);
            break;

        case "Anim":
            //ma.con = MegaBezVector3KeyControl.LoadBezVector3KeyControl(br);
            ma.con = MegaParseBezVector3Control.LoadBezVector3KeyControl(br);
            break;
        }
        return(true);
    }
Пример #2
0
    public int GetSpline(int p, ref MegaKnotAnim ma)            //int spl, ref int sp, ref int pt)
    {
        int index = 0;
        int pn    = p / 3;

        for (int i = 0; i < splines.Count; i++)
        {
            int nx = index + splines[i].knots.Count;

            if (pn < nx)
            {
                ma.s = i;
                ma.p = pn - index;
                ma.t = p % 3;
                return(i);
            }

            index = nx;
        }

        Debug.Log("Cant find point in spline");
        return(0);
    }
Пример #3
0
	bool AnimParse(BinaryReader br, string cid)
	{
		MegaShape ms = (MegaShape)target;

		switch ( cid )
		{
			case "V":
				int v = br.ReadInt32();
				ma = new MegaKnotAnim();
				int s = ms.GetSpline(v, ref ma);	//.s, ref ma.p, ref ma.t);

				if ( ms.splines[s].animations == null )
					ms.splines[s].animations = new List<MegaKnotAnim>();

				ms.splines[s].animations.Add(ma);
				break;

			case "Anim":
				ma.con = MegaParseBezVector3Control.LoadBezVector3KeyControl(br);
				break;
		}
		return true;
	}
Пример #4
0
	public int GetSpline(int p, ref MegaKnotAnim ma)	//int spl, ref int sp, ref int pt)
	{
		int index = 0;
		int pn = p / 3;
		for ( int i = 0; i < splines.Count; i++ )
		{
			int nx = index + splines[i].knots.Count;

			if ( pn < nx )
			{
				ma.s = i;
				ma.p = pn - index;
				ma.t = p % 3;
				return i;
			}

			index = nx;
		}

		Debug.Log("Cant find point in spline");
		return 0;
	}