/// <summary> /// renders the RenderableComponent flushing the Batcher and resetting current material if necessary /// </summary> /// <param name="renderable">Renderable.</param> /// <param name="cam">Cam.</param> protected void renderAfterStateCheck(RenderableComponent renderable, Camera cam) { // check for Material changes if (renderable.material != null && renderable.material != _currentMaterial) { _currentMaterial = renderable.material; if (_currentMaterial.effect != null) { _currentMaterial.onPreRender(cam); } flushBatch(cam); } else if (renderable.material == null && _currentMaterial != material) { _currentMaterial = material; flushBatch(cam); } renderable.render(Graphics.instance, cam); }
/// <summary> /// renders the RenderableComponent flushing the SpriteBatch and resetting RenderState if necessary /// </summary> /// <param name="renderable">Renderable.</param> /// <param name="cam">Cam.</param> protected void renderAfterStateCheck(RenderableComponent renderable, Camera cam) { // check for RenderState changes if (renderable.renderState != null && renderable.renderState != _currentRenderState) { _currentRenderState = renderable.renderState; if (_currentRenderState.effect != null) { _currentRenderState.onPreRender(cam); } flushSpriteBatch(cam); } else if (renderable.renderState == null && _currentRenderState != renderState) { _currentRenderState = renderState; flushSpriteBatch(cam); } renderable.render(Graphics.instance, cam); }