Ejemplo n.º 1
0
    public void UpdateModels()
    {
        updateModelsCalled = true;

        var meshCount = Meshes != null ? Meshes.Count : 0;

        for (var i = 0; i < meshCount; i++)
        {
            var mesh  = Meshes[i];
            var model = GetOrAddModel(i);

            model.SetMesh(mesh);
            model.SetMaterial(Material);
        }

        // Remove any excess
        if (Models != null)
        {
            for (var i = Models.Count - 1; i >= meshCount; i--)
            {
                SgtSingularityModel.Pool(Models[i]);

                Models.RemoveAt(i);
            }
        }
    }
    private void UpdateModels()
    {
        models.RemoveAll(m => m == null);

        if (Meshes.Count != models.Count)
        {
            SgtHelper.ResizeArrayTo(ref models, Meshes.Count, i => SgtSingularityModel.Create(this), m => SgtSingularityModel.Pool(m));
        }

        for (var i = Meshes.Count - 1; i >= 0; i--)
        {
            models[i].ManualUpdate(Meshes[i], material);
        }
    }