protected override void DoRender( Moment now, GraphicsDevice graphicsDevice, ISpriteBatch spriteBatch, TextureContent content, HolofunkView view, Transform parentTransform, int depth) { // no texture = no-op if (m_texture == null) { return; } int left = -(int)((float)m_texture.Width * m_origin.X); int top = -(int)((float)m_texture.Height * m_origin.Y); Rectangle rect = new Rectangle(left, top, m_texture.Width, m_texture.Height); Transform combinedTransform = parentTransform.CombineWith(LocalTransform); Rectangle transformedRect = rect * combinedTransform; Spam.Graphics.WriteLine(new string(' ', depth * 4) + Label + ": parentTransform " + parentTransform + ", localTransform " + LocalTransform + ", combinedTransform " + combinedTransform + "; start rect " + rect.FormatToString() + "; transformedRect " + transformedRect.FormatToString()); Texture2D texture = m_texture; SpriteEffects effects = SpriteEffects.None; if (view == HolofunkView.Secondary) { if ((SecondaryViewOption & SecondaryViewOption.TextureMirrored) != 0) { effects = SpriteEffects.FlipHorizontally; } if ((SecondaryViewOption & SecondaryViewOption.PositionMirrored) != 0) { // need to flip transformedRect around center of viewport int newLeft = (int)spriteBatch.Viewport.X - transformedRect.Right; transformedRect = new Rectangle(newLeft, transformedRect.Y, transformedRect.Width, transformedRect.Height); } if ((SecondaryViewOption & SecondaryViewOption.SecondTexture) != 0) { HoloDebug.Assert(m_secondaryTexture != null); texture = m_secondaryTexture; } } Color color = m_color; if (view == HolofunkView.Secondary && m_secondaryColor.HasValue) { color = m_secondaryColor.Value; } // Use NonPremultiplied, as our sprite textures are not premultiplied spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); spriteBatch.Draw( texture, transformedRect, null, color, 0, m_origin, effects, 0); spriteBatch.End(); }