示例#1
0
        public static void LoadData()
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyModels.LoadData");
            MySandboxGame.Log.WriteLine(string.Format("MyModels.LoadData - START"));

            MySandboxGame.Log.WriteLine("Pre-caching cube block models");
            foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
            {
                var cubeBlockDefinition = definition as MyCubeBlockDefinition;
                if (cubeBlockDefinition == null)
                {
                    continue;
                }

                if (cubeBlockDefinition.Model == null)
                {
                    continue;
                }

                MyModel model = MyModels.GetModelOnlyData(cubeBlockDefinition.Model);
                model.CheckLoadingErrors(definition.Context);

                foreach (var models in cubeBlockDefinition.BuildProgressModels)
                {
                    var buildProgressModel = MyModels.GetModelOnlyData(models.File);
                    buildProgressModel.CheckLoadingErrors(definition.Context);
                }
            }

            MySandboxGame.Log.WriteLine(string.Format("MyModels.LoadData - END"));
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }