Пример #1
0
        private void RemoveDecal(Vector3I position, ConcurrentQueue <MyDecalPartIdentity> decals, MyCube cube)
        {
            MyDecalPartIdentity identity;

            decals.TryDequeue(out identity);
            MyDecals.RemoveDecal(identity.DecalId);
            if (identity.CubePartIndex != -1)
            {
                MyCubePart part = cube.Parts[identity.CubePartIndex];
                this.GetOrAddCell((Vector3)position, true).RemoveCubePartDecal(part, identity.DecalId);
            }
        }
Пример #2
0
        /// <param name="position">Position of the decal in the binding pose</param>
        protected void AddBoneDecal(uint decalId, int boneIndex)
        {
            List <uint> decals;
            bool        found = m_boneDecals.TryGetValue(boneIndex, out decals);

            if (!found)
            {
                decals = new List <uint>(MAX_BONE_DECALS_COUNT);
                m_boneDecals.Add(boneIndex, decals);
            }

            if (decals.Count == decals.Capacity)
            {
                MyDecals.RemoveDecal(decals[0]);
                decals.RemoveAt(0);
            }

            decals.Add(decalId);
        }
Пример #3
0
        public void AddDecal(Vector3I cube, uint decalId)
        {
            List <uint> decals;
            bool        found = m_cubeDecals.TryGetValue(cube, out decals);

            if (!found)
            {
                decals             = new List <uint>();
                m_cubeDecals[cube] = decals;
            }

            if (decals.Count > MAX_DECALS_PER_CUBE)
            {
                MyDecals.RemoveDecal(decals[0]);
                decals.RemoveAt(0);
            }

            decals.Add(decalId);
        }
Пример #4
0
        /// <param name="position">Position of the decal in the binding pose</param>
        protected void AddBoneDecal(uint decalId, Vector3 hitPosition, Vector3 hitNormal, int boneIndex)
        {
            List <MyDecalHitInfo> decals;
            bool found = m_boneDecals.TryGetValue(boneIndex, out decals);

            if (!found)
            {
                decals = new List <MyDecalHitInfo>(MAX_BONE_DECALS_COUNT);
                m_boneDecals.Add(boneIndex, decals);
            }

            if (decals.Count == decals.Capacity)
            {
                MyDecals.RemoveDecal(decals[0].ID);
                decals.RemoveAt(0);
            }

            decals.Add(new MyDecalHitInfo()
            {
                ID = decalId, Position = hitPosition, Normal = hitNormal
            });
        }
Пример #5
0
        private void RemoveDecal(Vector3I position, List <MyDecalPartIdentity> decals, int index, ref MyCube cube)
        {
            MyDecalPartIdentity decal = decals[index];

            MyDecals.RemoveDecal(decal.DecalId);

            if (cube == null)
            {
                bool found = m_gridRender.CubeGrid.TryGetCube(position, out cube);
                if (!found)
                {
                    return;
                }
            }

            if (decal.CubePartIndex != -1)
            {
                var part = cube.Parts[decal.CubePartIndex];
                var cell = GetCell(position);
                cell.RemoveCubePartDecal(part, decal.DecalId);
            }
        }