示例#1
0
        internal static void AddDecal(uint ID, uint ParentID, ref MyDecalTopoData topoData, MyDecalFlags flags, string sourceTarget, string material, int matIndex)
        {
            if (m_decals.Count >= m_decalsQueueSize && m_decals.Count != 0)
            {
                MarkForRemove(m_decals.First);
            }

            MyScreenDecal decal = new MyScreenDecal();

            decal.FadeTimestamp = uint.MaxValue;
            decal.ID            = ID;
            decal.ParentID      = ParentID;
            decal.TopoData      = topoData;
            decal.Flags         = flags;
            decal.SourceTarget  = sourceTarget;
            decal.Material      = material;
            decal.MaterialId    = X.TEXT_(material);
            decal.MaterialIndex = matIndex;

            if (!flags.HasFlag(MyDecalFlags.World))
            {
                var parent = MyIDTracker <MyActor> .FindByID(ParentID);

                if (parent == null)
                {
                    return;
                }

                decal.TopoData.WorldPosition = Vector3D.Transform(topoData.MatrixCurrent.Translation, ref parent.WorldMatrix);
            }

            DecalNode node = m_decals.AddLast(decal);

            m_nodeMap[ID] = node;

            List <DecalNode> handles;
            bool             found = m_entityDecals.TryGetValue(ParentID, out handles);

            if (!found)
            {
                handles = new List <DecalNode>();
                m_entityDecals.Add(ParentID, handles);
            }

            handles.Add(node);
        }