public GameObject DrawPolyline(string key, Vector3[] margin, Vector4 green) { var line = VisualPolylineObject.Create(Context, ElementTag.New($"{key}_polyline"), margin, green, true); return(line); }
static void _Create(IContextState context, IEnumerable <IFileGeometry3D> meshes, FileInfo texture, string name, LoadedVisualObject visual) { List <ElementTag> t = new List <ElementTag>(); var details = new LoadedObjectDetails(); var baseTag = ElementTag.New(); var index = 0; AxisAlignedBox fullBox = AxisAlignedBox.Zero; foreach (var geo in meshes) { var tag = Create(context, baseTag.WithPrefix(geo.Name ?? index.ToString()), new GeometryStructures <IFileGeometry3D>(geo), texture, out var box); t.Add(tag); fullBox = fullBox.Merge(box.Bounds); details.VertexCount += geo.Positions.Count; details.TriangleCount += (geo.Indices.Count / 3); index++; } visual.tags.AddRange(t); visual.Details = details; var size = fullBox.Size(); visual.worldX = VisualPolylineObject.Create(context, baseTag.WithPrefix("WorldX"), new[] { Vector3.Zero + Vector3.UnitX * size.X * -2f, Vector3.Zero + Vector3.UnitX * size.X * 2f }, V4Colors.Red, false); visual.worldX.IsVisible = false; visual.worldY = VisualPolylineObject.Create(context, baseTag.WithPrefix("WorldY"), new[] { Vector3.Zero + Vector3.UnitY * size.Y * -2f, Vector3.Zero + Vector3.UnitY * size.Y * 2f }, V4Colors.Green, false); visual.worldY.IsVisible = false; visual.worldZ = VisualPolylineObject.Create(context, baseTag.WithPrefix("WorldZ"), new[] { Vector3.Zero + Vector3.UnitZ * size.Z * -2f, Vector3.Zero + Vector3.UnitZ * size.Z * 2f }, V4Colors.Blue, false); visual.worldZ.IsVisible = false; }
public void Draw(IContextState context, List <VisualPolylineObject> drawed) { if (IsLeaf()) { drawed.Add(VisualPolylineObject.CreateBox(context, ElementTag.New(), Bounds, V4Colors.Yellow)); } else { var nodes = Nodes.ToArray(); for (int i = 0; i < nodes.Length; i++) { nodes[i].Draw(context, drawed); } } foreach (var i in items.ToList()) { drawed.Add(VisualPolylineObject.CreateBox(context, ElementTag.New("DEBUG_BOX_"), i.Bound, V4Colors.Blue)); } }
public GameObject DrawArrow(string key, ArrowDetails arrowData) { var llength = 10; var tt = new ArrowData { axis = arrowData.Axis, orthogonal = arrowData.Orthogonal, center = arrowData.Center + arrowData.Axis * (llength - 2), lenght = 2.1f, radius = .8f, color = arrowData.Color }; var points = new[] { arrowData.Center, arrowData.Center + arrowData.Axis * llength, }; var arrow = ArrowGameObject.Create(Context, ElementTag.New($"{key}_arrowhead"), tt); var line = VisualPolylineObject.Create(Context, ElementTag.New($"{key}_arrowline"), points, arrowData.Color, true); return(new MultiVisualObject(new[] { arrow.Tag, line.Tag }, key)); }