public Mesh BuildMesh(Transform[] boneArray, int textureIndex)
        {
            Mesh mesh = new Mesh();

            Vector3[] vertices = null;
            int[]     indices  = null;

            VertexMapper.GetVertices(ref vertices, data.GetBodyPoses(), data.GetBodySizes());
            VertexMapper.GetIndices(ref indices);

            mesh.vertices  = vertices;
            mesh.triangles = indices;

            Vector3[] uvs = null;
            UVMapper.GetUV(ref uvs, data.GetUVPoses(), data.GetUVSizes(), textureIndex);
            mesh.SetUVs(0, new List <Vector3>(uvs));

            Matrix4x4[]  bindPoses = null;
            BoneWeight[] weight    = null;

            SkinMapper.GetBoneWieghts(ref weight);
            Rigger.GetBindPoses(ref bindPoses, transform, boneArray);

            mesh.boneWeights = weight;
            mesh.bindposes   = bindPoses;

            return(mesh);
        }
Example #2
0
        public static Mesh BuildMesh(CharacterData data)
        {
            Mesh mesh = new Mesh();

            Vector3[] vertices = null;
            int[]     indices  = null;

            VertexMapper.GetVertices(ref vertices, data.GetBodyPoses(), data.GetBodySizes());
            VertexMapper.GetIndices(ref indices);

            mesh.vertices  = vertices;
            mesh.triangles = indices;

            Vector3[] uvs = null;
            UVMapper.GetUV(ref uvs, data.GetUVPoses(), data.GetUVSizes());
            mesh.SetUVs(0, new List <Vector3>(uvs));

            return(mesh);
        }