Exemplo n.º 1
0
 public void DestroyTex()
 {
     if (dataTex != null)
     {
         group.FreeTexture(dataTex);
         dataTex = null;
     }
     if (symbolInstanceTex != null)
     {
         group.FreeTexture(symbolInstanceTex);
         symbolInstanceTex = null;
     }
     if (symbolOverrideInfoTex != null)
     {
         group.FreeTexture(symbolOverrideInfoTex);
         symbolOverrideInfoTex = null;
     }
 }
Exemplo n.º 2
0
    public int UpdateDirty(int frame)
    {
        if (!needsWrite)
        {
            return(0);
        }
        if (dataTex == null || dataTex.floats.Length == 0)
        {
            Init();
        }
        writtenLastFrame = 0;
        bool flag  = false;
        bool flag2 = false;

        if (dirtySet.Count > 0)
        {
            foreach (int item in dirtySet)
            {
                KAnimConverter.IAnimConverter animConverter = controllers[item];
                if (animConverter != null && animConverter as Object != (Object)null)
                {
                    WriteBatchedAnimInstanceData(item, animConverter);
                    bool flag3 = WriteSymbolInstanceData(item, animConverter);
                    flag = (flag || flag3);
                    if (animConverter.ApplySymbolOverrides())
                    {
                        if (symbolOverrideInfoTex == null)
                        {
                            int bestTextureSize = KAnimBatchGroup.GetBestTextureSize((float)(group.data.maxSymbolFrameInstancesPerbuild * group.maxGroupSize * 12));
                            symbolOverrideInfoTex = group.CreateTexture("SymbolOverrideInfoTex", bestTextureSize, ShaderProperty_symbolOverrideInfoTex, ShaderProperty_SYMBOL_OVERRIDE_INFO_TEXTURE_SIZE);
                            symbolOverrideInfoTex.SetTextureAndSize(matProperties);
                            matProperties.SetFloat(ShaderProperty_SUPPORTS_SYMBOL_OVERRIDING, 1f);
                        }
                        bool flag4 = WriteSymbolOverrideInfoTex(item, animConverter);
                        flag2 = (flag2 || flag4);
                    }
                    writtenLastFrame++;
                }
            }
            if (writtenLastFrame != 0)
            {
                ClearDirty();
            }
            else
            {
                Debug.LogError("dirtySet not written");
            }
        }
        dataTex.LoadRawTextureData();
        dataTex.Apply();
        if (flag)
        {
            symbolInstanceTex.LoadRawTextureData();
            symbolInstanceTex.Apply();
        }
        if (flag2)
        {
            symbolOverrideInfoTex.LoadRawTextureData();
            symbolOverrideInfoTex.Apply();
        }
        return(writtenLastFrame);
    }