Exemplo n.º 1
0
    public bool ParseAnimMesh(BinaryReader br, string id)
    {
        switch (id)
        {
        case "Size":
            Vector3 sz = MegaParse.ReadP3(br);
            Vector3 min1, max1;

            Vector3 ex1 = Extents(mods.verts, out min1, out max1);

            int largest = 0;
            if (sz.x > sz.y)
            {
                if (sz.x > sz.z)
                {
                    largest = 0;
                }
                else
                {
                    largest = 2;
                }
            }
            else
            {
                if (sz.y > sz.z)
                {
                    largest = 1;
                }
                else
                {
                    largest = 2;
                }
            }

            scl = ex1[largest] / sz[largest];
            break;

        case "V":
            Vector3 p = MegaParse.ReadP3(br) * scl;
            // Find all matching verts
            currentVert           = new MegaAnimatedVert();
            currentVert.startVert = p;
            currentVert.indices   = FindVerts(p);
            if (currentVert.indices == null)
            {
                Debug.Log("Error! No match found");
            }

            Verts.Add(currentVert);
            break;

        case "Anim":
            //currentVert.con = MegaBezVector3KeyControl.LoadBezVector3KeyControl(br);
            currentVert.con = MegaParseBezVector3Control.LoadBezVector3KeyControl(br);

            currentVert.con.Scale(scl);
            break;

        default: return(false);
        }

        return(true);
    }
	public bool ParseAnimMesh(BinaryReader br, string id)
	{
		switch ( id )
		{
			case "Size":
				Vector3 sz = MegaParse.ReadP3(br);
				Vector3 min1,max1;

				Vector3 ex1 = Extents(mods.verts, out min1, out max1);

				int largest = 0;
				if ( sz.x > sz.y )
				{
					if ( sz.x > sz.z )
						largest = 0;
					else
						largest = 2;
				}
				else
				{
					if ( sz.y > sz.z )
						largest = 1;
					else
						largest = 2;
				}

				scl = ex1[largest] / sz[largest];
				break;

			case "V":
				Vector3 p = MegaParse.ReadP3(br) * scl;
				// Find all matching verts
				currentVert = new MegaAnimatedVert();
				currentVert.startVert = p;
				currentVert.indices = FindVerts(p);
				if ( currentVert.indices == null )
					Debug.Log("Error! No match found");

				Verts.Add(currentVert);
				break;

			case "Anim":
				//currentVert.con = MegaBezVector3KeyControl.LoadBezVector3KeyControl(br);
				currentVert.con = MegaParseBezVector3Control.LoadBezVector3KeyControl(br);

				currentVert.con.Scale(scl);
				break;

			default: return false;
		}

		return true;
	}