/// <summary> /// Rendering logic for lines renderings. /// </summary> private void RenderPass( RenderPassBase renderPass, PassSubscribionProperties subscriptions, RenderState renderState, ref List <SceneObject> invalidObjects) { if (subscriptions.Subscriptions.Count > 0) { if (renderPass != null) { //Ensure loaded resources for transparency pass if (!renderPass.IsLoaded) { renderPass.LoadResource(); } //Render all subscriptions renderPass.Apply(renderState); } try { int subscriptionCount = subscriptions.Subscriptions.Count; for (int loopPass = 0; loopPass < subscriptionCount; loopPass++) { RenderPassSubscription actSubscription = subscriptions.Subscriptions[loopPass]; try { actSubscription.RenderMethod(renderState); } catch (Exception ex) { GraphicsCore.PublishInternalExceptionInfo( ex, InternalExceptionLocation.Rendering3DObject); // Mark this object as invalid if (invalidObjects == null) { invalidObjects = new List <SceneObject>(); } invalidObjects.Add(actSubscription.SceneObject); } } } finally { if (renderPass != null) { renderPass.Discard(renderState); } } } }
/// <summary> /// Initializes a new instance of the <see cref="ViewRelatedSceneLayerSubset" /> class. /// </summary> internal ViewRelatedSceneLayerSubset(SceneLayer sceneLayer, ViewInformation viewInformation, ResourceDictionary resources, int viewIndex) { m_scene = sceneLayer.Scene; m_sceneLayer = sceneLayer; m_viewInformation = viewInformation; m_device = ViewInformation.Device; m_resources = resources; ViewIndex = viewIndex; m_invalidObjects = new Dictionary <SceneObject, object>(); m_invalidObjectsToDeregister = new Queue <SceneObject>(); // Create temporary collections m_tmpChangedVisibilities = new List <Tuple <SceneObject, bool, bool> >(); // Create all specialized render pass lists m_objectsPassPlainRender = new PassSubscribionProperties(); m_objectsPassLineRender = new PassSubscribionProperties(); m_objectsPassTransparentRender = new PassSubscribionProperties(); m_objectsPassSpriteBatchRender = new PassSubscribionProperties(); m_objectsPass2DOverlay = new PassSubscribionProperties(); // Create dictionary for fast access to all render pass list m_objectsPerPassDict = new Dictionary <RenderPassInfo, PassSubscribionProperties>(); m_objectsPerPassDict[RenderPassInfo.PASS_PLAIN_RENDER] = m_objectsPassPlainRender; m_objectsPerPassDict[RenderPassInfo.PASS_LINE_RENDER] = m_objectsPassLineRender; m_objectsPerPassDict[RenderPassInfo.PASS_TRANSPARENT_RENDER] = m_objectsPassTransparentRender; m_objectsPerPassDict[RenderPassInfo.PASS_SPRITE_BATCH] = m_objectsPassSpriteBatchRender; m_objectsPerPassDict[RenderPassInfo.PASS_2D_OVERLAY] = m_objectsPass2DOverlay; m_objectsPerPass = new List <PassSubscribionProperties>(m_objectsPerPassDict.Values); m_anythingUnsubscribed = false; // Create and load all render pass relevant resources RefreshDeviceDependentResources(); }