Exemple #1
0
        private static void RemoveTexture(Resources.TexId texId)
        {
            if (texId == Resources.TexId.NULL)
            {
                return;
            }

            var arrayIndex = m_textureArrayIndices[texId];

            arrayIndex.Counter--;
            if (arrayIndex.Counter == 0)
            {
                m_textureArrayIndices.Remove(texId);

                foreach (var item in m_textureArrayIndices)
                {
                    if (item.Value.Index > arrayIndex.Index)
                    {
                        m_textureArrayIndices[item.Key].Index--;
                    }
                }

                m_textureArrayDirty = true;
            }
        }
Exemple #2
0
        private static void UpdateTextureArray()
        {
            if (m_textureArrayDirty)
            {
                if (m_textureArray != null)
                {
                    m_textureArray.Dispose();
                }

                Resources.TexId[] textIds = new Resources.TexId[m_textureArrayIndices.Count];
                foreach (var item in m_textureArrayIndices)
                {
                    textIds[item.Value.Index] = item.Key;
                }
                m_textureArray = new Resources.MyTextureArray(textIds, "gpuParticles");

                m_textureArrayDirty = false;
            }
        }
Exemple #3
0
        private static void AddTexture(Resources.TexId texId)
        {
            if (texId == Resources.TexId.NULL)
            {
                return;
            }

            if (m_textureArrayIndices.ContainsKey(texId))
            {
                m_textureArrayIndices[texId].Counter++;
            }
            else
            {
                m_textureArrayIndices.Add(texId,
                                          new MyTextureArrayIndex()
                {
                    Index = (uint)m_textureArrayIndices.Count, Counter = 1
                });
                m_textureArrayDirty = true;
            }
        }