public static void UpdateDecals(List <MyDecalPositionUpdate> decals)
        {
            for (int it = 0; it < decals.Count; it++)
            {
                MyDecalPositionUpdate position = decals[it];

                DecalNode node;
                bool      found = m_nodeMap.TryGetValue(position.ID, out node);
                if (!found)
                {
                    continue;
                }

                MyScreenDecal decal = node.Value;
                decal.Data.Position = position.Position;
                decal.Data.Normal   = position.Normal;
                node.Value.OBBox    = ComputeOBB(ref decal.Data, decal.Flags);
            }
        }
Beispiel #2
0
        public static void UpdateDecals(IReadOnlyList <MyDecalPositionUpdate> decals)
        {
            uint    currentObjectId    = MyRenderProxy.RENDER_ID_UNASSIGNED;
            MatrixD currentWorldMatrix = new MatrixD();

            for (int it = 0; it < decals.Count; it++)
            {
                MyDecalPositionUpdate position = decals[it];

                DecalNode node;
                bool      found = m_nodeMap.TryGetValue(position.ID, out node);
                if (!found)
                {
                    continue;
                }
                MyScreenDecal decal = node.Value;
                if (decal.Flags.HasFlag(MyDecalFlags.World))
                {
                    decal.TopoData.WorldPosition = position.Position;
                }
                else
                {
                    if (currentObjectId != decal.ParentID)
                    {
                        var parent = MyIDTracker <MyActor> .FindByID(decal.ParentID);

                        currentWorldMatrix = parent.WorldMatrix;
                        currentObjectId    = decal.ParentID;
                    }

                    decal.TopoData.WorldPosition = Vector3D.Transform(position.Transform.Translation, ref currentWorldMatrix);
                }

                node.Value.TopoData.MatrixCurrent = position.Transform;
            }
        }