Exemple #1
0
        private void RemoveRenderable(Entity entity, MetaModel renderableEntity)
        {
            if (!IsVisible(renderableEntity, Renderer.Settings))
            {
                return;
            }

            renderableEntity.MetaModelChanged -= new EventHandler(SortedTestSceneRendererConnector_MetaModelChanged);

            metaModelIdToEntity.Remove(renderableEntity.InstanceID);
#if BETA_RELEASE
            if (!resources.ContainsKey(entity))
            {
                throw new Exception("resources[entity] fails");
            }

            if (!resources[entity].ContainsKey(renderableEntity.InstanceID))
            {
                throw new Exception("resources[entity][renderableEntity.InstanceID fails");
            }
            //seems to be this one failing
#endif
            var metaModel = resources[entity][renderableEntity.InstanceID].Second;
            var model     = resources[entity][renderableEntity.InstanceID].First;

            if (model.SkinnedMesh != null)
            {
#if BETA_RELEASE
                if (!EntityAnimations.ContainsKey(entity))
                {
                    throw new Exception("EntityAnimations[entity] fails");
                }
#endif
                Scene.View.Content.Release(EntityAnimations[entity]);
                EntityAnimations.Remove(entity);
            }

            Renderer.Remove(entity, metaModel, model, renderableEntity.InstanceID);
            Scene.View.Content.Release(model);
            resources[entity].Remove(renderableEntity.InstanceID);
        }