internal static int GetPerMaterialDataIndex(ref MyPerMaterialData data) { var key = data.CalculateKey(); if (!HashIndex.ContainsKey(key)) { HashIndex[key] = HashIndex.Count; Data.Add(data); } return HashIndex[key]; }
internal static void PreFrame() { TransferHashIndex.Clear(); // bump default material as 0 MyPerMaterialData defaultMat = new MyPerMaterialData(); GetDrawMaterialIndex(GetPerMaterialDataIndex(ref defaultMat)); // bump foliage material as 1 (important) MyPerMaterialData foliageMat = new MyPerMaterialData(); foliageMat.Type = MyMaterialTypeEnum.FOLIAGE; GetDrawMaterialIndex(GetPerMaterialDataIndex(ref foliageMat)); }
internal static void FillPerMaterialData(ref MyPerMaterialData perMaterialData, string technique) { perMaterialData.Type = 0; switch(technique) { case "FOLIAGE": perMaterialData.Type = MyMaterialTypeEnum.FOLIAGE; break; } }