public void Add(EffectVariantKey key, EffectVariant item) { mVariants.Add(key, item); }
public bool TryGetValue(EffectVariantKey key, out EffectVariant result) { return(mVariants.TryGetValue(key, out result)); }
private static void AppendToGroup(Dictionary <GltfInstancedGroupKey, GltfInstanceDrawGroup> instanceDrawGroups, GltfNodeInfo node, int meshIndex, GltfMeshPrimitive primitive, EffectVariantKey key, EffectVariant found) { var groupKey = new GltfInstancedGroupKey { MeshIndex = meshIndex, CameraSlotIndex = 0, TextureSlotIndex = 0, MaterialSlotIndex = primitive.Material.StorageIndex, VariantKey = key, }; if (!instanceDrawGroups.TryGetValue(groupKey, out GltfInstanceDrawGroup drawGroup)) { drawGroup = new GltfInstanceDrawGroup { GroupKey = groupKey, Variant = found, Members = new List <GltfInstancedDraw>(), }; instanceDrawGroups.Add(groupKey, drawGroup); } var instancedDraw = new GltfInstancedDraw { Key = key, GroupKey = groupKey, Instance = new PerInstance { Translation = node.Transform.ExtractTranslation(), Scale = node.Transform.ExtractScale(), Rotation = node.Transform.ExtractRotation(true), // TODO MaterialIndex = primitive.Material.Offset, }, }; drawGroup.Members.Add(instancedDraw); }