예제 #1
0
    /// <summary>
    /// LODSetting发生变化时调用
    /// fzy:LOD功能关闭
    /// </summary>
    /// <param name="player"></param>
    public void LODSettingChanged(GPUSkinningPlayer player)
    {
        //fzy add:
        player.SetLODMesh(null);
        return;

        if (player.LODEnabled)
        {
            int numPlayers = players.Count;
            for (int i = 0; i < numPlayers; ++i)
            {
                if (players[i].Player == player)
                {
                    int distanceIndex = cullingGroup.GetDistance(i);
                    SetLODMeshByDistanceIndex(distanceIndex, players[i].Player);
                    break;
                }
            }
        }
        else
        {
            player.SetLODMesh(null);
        }
    }
    private void SetLODMeshByDistanceIndex(int index, GPUSkinningPlayer player)
    {
        Mesh lodMesh = null;

        if (index == 0)
        {
            lodMesh = this.mesh;
        }
        else
        {
            Mesh[] lodMeshes = anim.lodMeshes;
            lodMesh = lodMeshes == null || lodMeshes.Length == 0 ? this.mesh : lodMeshes[Mathf.Min(index - 1, lodMeshes.Length - 1)];
            if (lodMesh == null)
            {
                lodMesh = this.mesh;
            }
        }
        player.SetLODMesh(lodMesh);
    }