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); }
public bool TryGetInstancingBatchData(int skinId, out InstancingBatchData data) { return(m_instancingBatchDataDic.TryGetValue(skinId, out data)); }
public void AddInstancingBatchData(int skinId, InstancingBatchData data) { m_instancingBatchDataDic.Add(skinId, data); }