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

            var model = Scene.View.Content.Acquire <Model9>(renderableEntity);

            renderableEntity.MetaModelChanged += new EventHandler(SortedTestSceneRendererConnector_MetaModelChanged);

            metaModelIdToEntity.Add(renderableEntity.InstanceID, entity);

            resources[entity].Add(renderableEntity.InstanceID,
                                  new Common.Tuple <Model9, MetaResource <Model9, Model10> >(
                                      model, (MetaResource <Model9, Model10>)renderableEntity.Clone()));

            Graphics.Renderer.Renderer.EntityAnimation ea = null;
            if (model.SkinnedMesh != null)
            {
                ea = Scene.View.Content.Acquire <Graphics.Renderer.Renderer.EntityAnimation>(entity.MetaEntityAnimation);
                ea.Update(model, 0.01f, ((MetaModel)renderableEntity).GetWorldMatrix(Scene.Camera, entity));
                EntityAnimations.Add(entity, ea);
                ((MetaModel)renderableEntity).StoredFrameMatrices = ea.StoredFrameMatrices;
            }

            Renderer.Add(entity, renderableEntity, model, renderableEntity.InstanceID);
        }