internal WirePainter(RenderState renderState, LineRenderResources renderResources) { m_isValid = true; m_renderResources = renderResources; m_renderState = renderState; m_worldViewPojCreator = new Lazy <Matrix4x4>(() => Matrix4x4.Transpose(renderState.ViewProj)); }
/// <summary> /// Main render method for the wire object. /// </summary> /// <param name="renderState">Current render state.</param> private void RenderLines(RenderState renderState) { LineRenderResources resourceData = m_localResources[renderState.DeviceIndex]; if (m_paintAction != null) { WirePainter wirePainter = new WirePainter(renderState, resourceData); try { m_paintAction(wirePainter); } finally { wirePainter.SetInvalid(); } } }
/// <summary> /// Unloads the resource. /// </summary> /// <param name="device">The target device.</param> /// <param name="resources">Parent ResourceDictionary.</param> protected override void UnloadResourceInternal(EngineDevice device, ResourceDictionary resources) { m_defaultResources = null; m_lineRenderResources = null; }
/// <summary> /// Loads the resource. /// </summary> /// <param name="device">The target device.</param> /// <param name="resources">Parent ResourceDictionary.</param> protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources) { m_defaultResources = resources.GetResourceAndEnsureLoaded <DefaultResources>(DefaultResources.RESOURCE_KEY); m_lineRenderResources = resources.GetResourceAndEnsureLoaded <LineRenderResources>(LineRenderResources.RESOURCE_KEY); }