/// <inheritdoc/> public override void Render(object dc, ShapeRenderer renderer, PageContainer container, double dx, double dy) { renderer.Fill(dc, dx, dy, container.Width, container.Height, container.Background); var db = container.Data == null ? default(ImmutableArray <Property>) : container.Data.Properties; var r = container.Data == null ? default(Record) : container.Data.Record; if (container.Template != null) { renderer.Draw(dc, container.Template, dx, dy, db, r); } renderer.Draw(dc, container, dx, dy, db, r); }
/// <inheritdoc/> public override void Render(object dc, ShapeRenderer renderer, XContainer container, double dx, double dy) { renderer.Fill(dc, dx, dy, container.Width, container.Height, container.Background); var db = container.Data == null ? default(ImmutableArray<XProperty>) : container.Data.Properties; var r = container.Data == null ? default(XRecord) : container.Data.Record; if (container.Template != null) { renderer.Draw(dc, container.Template, dx, dy, db, r); } renderer.Draw(dc, container, dx, dy, db, r); }
/// <inheritdoc/> public override void Draw(object dc, ShapeRenderer renderer, double dx, double dy, ImmutableArray <XProperty> db, XRecord r) { var record = this.Data.Record ?? r; if (State.Flags.HasFlag(ShapeStateFlags.Visible)) { renderer.Draw(dc, this, dx, dy, db, record); } if (renderer.State.SelectedShape != null) { if (this == renderer.State.SelectedShape) { _topLeft.Draw(dc, renderer, dx, dy, db, record); _bottomRight.Draw(dc, renderer, dx, dy, db, record); } else if (_topLeft == renderer.State.SelectedShape) { _topLeft.Draw(dc, renderer, dx, dy, db, record); } else if (_bottomRight == renderer.State.SelectedShape) { _bottomRight.Draw(dc, renderer, dx, dy, db, record); } } if (renderer.State.SelectedShapes != null) { if (renderer.State.SelectedShapes.Contains(this)) { _topLeft.Draw(dc, renderer, dx, dy, db, record); _bottomRight.Draw(dc, renderer, dx, dy, db, record); } } }
/// <inheritdoc/> public override void Render(object dc, ShapeRenderer renderer, PageContainer container, double dx, double dy) { var db = container.Data == null ? default(ImmutableArray <Property>) : container.Data.Properties; var r = container.Data == null ? default(Record) : container.Data.Record; renderer.Draw(dc, container, dx, dy, db, r); if (container.WorkingLayer != null) { renderer.Draw(dc, container.WorkingLayer, dx, dy, db, r); } if (container.HelperLayer != null) { renderer.Draw(dc, container.HelperLayer, dx, dy, db, r); } }
/// <inheritdoc/> public override void Draw(object dc, ShapeRenderer renderer, double dx, double dy, ImmutableArray <XProperty> db, XRecord r) { var record = this.Data.Record ?? r; if (State.Flags.HasFlag(ShapeStateFlags.Visible)) { renderer.Draw(dc, this, dx, dy, db, record); base.Draw(dc, renderer, dx, dy, db, record); } }
/// <summary> /// Draw container. /// </summary> /// <param name="dc">The drawing context.</param> /// <param name="renderer">The shape renderer.</param> /// <param name="container">The page to draw.</param> private void Draw(DrawingContext dc, ShapeRenderer renderer, XContainer container) { DrawBackground(dc, container.Background, container.Width, container.Height); var db = container.Data == null ? default(ImmutableArray <XProperty>) : container.Data.Properties; var r = container.Data == null ? default(XRecord) : container.Data.Record; renderer.Draw(dc, container, db, r); if (container.WorkingLayer != null) { renderer.Draw(dc, container.WorkingLayer, db, r); } if (container.HelperLayer != null) { renderer.Draw(dc, container.HelperLayer, db, r); } }
/// <inheritdoc/> public override void Draw(object dc, ShapeRenderer renderer, double dx, double dy, object db, object r) { var record = this.Data?.Record ?? r; if (State.Flags.HasFlag(ShapeStateFlags.Visible)) { var state = base.BeginTransform(dc, renderer); renderer.Draw(dc, this, dx, dy, db, record); base.EndTransform(dc, renderer, state); base.Draw(dc, renderer, dx, dy, db, record); } }
/// <inheritdoc/> public override void Draw(object dc, ShapeRenderer renderer, double dx, double dy, ImmutableArray <XProperty> db, XRecord r) { var record = this.Data.Record ?? r; if (State.Flags.HasFlag(ShapeStateFlags.Visible)) { renderer.Draw(dc, this, dx, dy, db, record); } if (renderer.State.SelectedShape != null) { if (this == renderer.State.SelectedShape) { var points = this.GetPoints(); foreach (var point in points) { point.Draw(dc, renderer, dx, dy, db, record); } } else { var points = this.GetPoints(); foreach (var point in points) { if (point == renderer.State.SelectedShape) { point.Draw(dc, renderer, dx, dy, db, record); } } } } if (renderer.State.SelectedShapes != null) { if (renderer.State.SelectedShapes.Contains(this)) { var points = this.GetPoints(); foreach (var point in points) { point.Draw(dc, renderer, dx, dy, db, record); } } } }
/// <summary> /// Display the name label(s) of the models in screen space. /// </summary> public void DrawModelNames(Scene debugScene, Camera debugCamera) { spriteBatch.Begin(); // If the cursor is over a model, we'll draw its name. Ray cursorRay = CalculateCursorRay(debugCamera.projection, debugCamera.view); Matrix instanceMatrix = Matrix.Identity; BoundingSphere bSphere; foreach (Meteor.Resources.Model staticModel in debugScene.sceneModels.Values) { // Check for cursor picking intersection if (RayIntersectsModel(cursorRay, staticModel, out instanceMatrix, out bSphere)) { String foundMeshName = "Model"; foreach (String meshName in staticModel.MeshInstanceGroups.Keys) { foundMeshName = meshName; break; } // Project from world space to screen space Vector3 screenSpace = graphicsDevice.Viewport.Project(Vector3.Zero, debugCamera.projection, debugCamera.view, instanceMatrix); // we want to draw the text a little bit above that, so we'll use the screen space position. Vector2 textPosition = new Vector2((int)screenSpace.X, (int)screenSpace.Y - 60); // Calculate string's center and draw using that as the origin. Vector2 stringCenter = font.MeasureString(foundMeshName) / 2; spriteBatch.Draw(nullTexture, new Vector2(textPosition.X - stringCenter.X - 8, textPosition.Y - (int)stringCenter.Y - 2), new Rectangle( (int)(textPosition.X - stringCenter.X - 8), (int)(textPosition.Y - (int)stringCenter.Y - 2), (int)(stringCenter.X * 2 + 16), font.LineSpacing + 4), new Color(0, 0, 0, 120)); // first draw the shadow... Vector2 shadowOffset = new Vector2(1, 1); spriteBatch.DrawString(font, foundMeshName, textPosition + shadowOffset, Color.Black, 0.0f, stringCenter, 1.0f, SpriteEffects.None, 0.0f); // ...and then the real text on top. spriteBatch.DrawString(font, foundMeshName, textPosition, Color.White, 0.0f, stringCenter, 1.0f, SpriteEffects.None, 0.0f); // Add debug shapes around the highlighted object ShapeRenderer.AddBoundingSphere(bSphere, Color.LawnGreen); ShapeRenderer.Draw(debugCamera.view, debugCamera.projection); // We can stop here if just one model is needed. //break; } } spriteBatch.End(); }