示例#1
0
        public void AddInstancingBatchData(int skinId, GpuSkinData data, Material material, Texture tex)
        {
            Mesh[] skinMeshes = new Mesh[data.SkinMeshes.Length];
            for (int i = 0; i < data.SkinMeshes.Length; i++)
            {
                Mesh mesh = new Mesh();
                mesh.name      = "GpuSkin_" + data.SkinMeshes[i].Name;
                mesh.vertices  = data.SkinMeshes[i].Vertices;
                mesh.triangles = data.SkinMeshes[i].Triangles;
                mesh.SetIndices(data.SkinMeshes[i].Indices, MeshTopology.Triangles, 0);
                mesh.normals = data.SkinMeshes[i].Normals;
                mesh.uv      = data.SkinMeshes[i].Uv;
                List <Vector4> uvs2 = new List <Vector4>();
                uvs2.AddRange(data.SkinMeshes[i].BoneIndex);
                mesh.SetUVs(1, uvs2);
                List <Vector4> uvs3 = new List <Vector4>();
                uvs3.AddRange(data.SkinMeshes[i].Weights);
                mesh.SetUVs(2, uvs3);
                skinMeshes[i] = mesh;
            }
            InstancingBatchData instancingData = new InstancingBatchData(skinMeshes, new MaterialPropertyBlock(), material);

            instancingData.SetMaterialProperty(tex, data.BlockWidth, data.BlockHeight, data.AnimationTextureWidth, data.AnimationTextureHeight);
            m_instancingBatchDataDic.Add(skinId, instancingData);
        }
示例#2
0
 public bool TryGetInstancingBatchData(int skinId, out InstancingBatchData data)
 {
     return(m_instancingBatchDataDic.TryGetValue(skinId, out data));
 }
示例#3
0
 public void AddInstancingBatchData(int skinId, InstancingBatchData data)
 {
     m_instancingBatchDataDic.Add(skinId, data);
 }