/// <summary>
        /// Initializes a new instance of the <see cref="ManagedAsset"/> class
        /// for a <see cref="VehicleInfoSub"/> asset.
        /// </summary>
        /// <param name="asset">The <see cref="VehicleInfoSub"/> which uses the shader.</param>
        /// <exception cref="ArgumentNullException">Thrown if asset <c>m_mesh.name</c> is <c>null</c>.</exception>
        /// <exception cref="FormatException">Thrown if asset <c>m_mesh.name</c> format is invalid.</exception>
        internal ManagedAsset(VehicleInfoSub asset)
        {
            TypeOfAsset = AssetType.Vehicle;
            Vehicle     = asset;

            Info = new ShaderInfo(asset.m_mesh.name, nameof(VehicleInfoSub), asset.name);

            backup_InvFade    = asset.m_material.GetFloat("_InvFade");
            backup_meshColors = asset.m_mesh.colors;

            backup_lodRenderDistance = asset.m_lodRenderDistance;
            backup_maxRenderDistance = asset.m_maxRenderDistance;

            asset.m_material.SetFloat("_InvFade", Info.Fade);
            asset.m_mesh.colors = GetMeshColors(asset.m_mesh.vertexCount);

            CachedRenderDistance = GetRenderDistance(asset.m_generatedInfo.m_size);
            ApplyCachedRenderDistance();

            SetVisible(Info.IsAlwaysOn, FORCE_UPDATE);
        }
示例#2
0
 public static void Postfix(VehicleInfoSub __instance)
 {
     __instance.m_lodRenderDistance *= (TrueLodTogglerMod.ActiveConfig.VehicleLodDistance / 400f);
     __instance.m_maxRenderDistance *= (TrueLodTogglerMod.ActiveConfig.VehicleRenderDistance / 2000f);
 }