Пример #1
0
    private void AddVisibleTexture(Texture texture, Material ownerMat, GameObject ownerObj)
    {
        if (texture != null)
        {
            if (!_visibleTextures.ContainsKey(texture))
            {
                _visibleTextures.Add(texture, new HashSet <Material>());
            }
            _visibleTextures[texture].Add(ownerMat);

            if (!_visibleGameObjects.ContainsKey(texture))
            {
                _visibleGameObjects.Add(texture, new List <GameObject>());
            }
            _visibleGameObjects[texture].Add(ownerObj);

            // refresh the size
            if (!_textureSizeLut.ContainsKey(texture))
            {
                //_textureSizeLut[texture] = UsTextureUtil.CalculateTextureSizeBytes(texture);
                _textureSizeLut[texture] =
#if JX3M
                    KProfiler.GetRuntimeMemorySize(texture);
#else
                    (int)Profiler.GetRuntimeMemorySizeLong(texture);
#endif
            }

            // refresh the category
            if (!_textureCatLut.ContainsKey(texture))
            {
                _textureCatLut[texture] = TextureCategorizing.GetTextureCategory(ownerObj);
            }
        }
    }