public override void Init(DeviceInterface devIf, SceneManager sManager) { base.Init(devIf, sManager); vBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), 6, gDevice, Usage.None, CustomVertex.PositionColored.Format, Pool.Managed); CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])vBuffer.Lock(0, LockFlags.None); verts[0].Color = verts[1].Color = Color.Red.ToArgb(); verts[1].Position = new Vector3(1, 0, 0); verts[2].Color = verts[3].Color = Color.Green.ToArgb(); verts[3].Position = new Vector3(0, 1, 0); verts[4].Color = verts[5].Color = Color.Blue.ToArgb(); verts[5].Position = new Vector3(0, 0, 1); vBuffer.Unlock(); // build selection lines selectionVBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), 6, gDevice, Usage.None, CustomVertex.PositionColored.Format, Pool.Managed); verts = (CustomVertex.PositionColored[])selectionVBuffer.Lock(0, LockFlags.None); verts[0].Color = verts[1].Color = Color.Yellow.ToArgb(); verts[1].Position = new Vector3(1, 0, 0); verts[2].Color = verts[3].Color = Color.Yellow.ToArgb(); verts[3].Position = new Vector3(0, 1, 0); verts[4].Color = verts[5].Color = Color.Yellow.ToArgb(); verts[5].Position = new Vector3(0, 0, 1); selectionVBuffer.Unlock(); labels = new ScreenSpaceText[3]; labels[0] = new ScreenSpaceText("x", Color.Red, "Verdana", FontWeight.Normal, 10, new Vector3(1.1f, 0, 0), this); labels[0].Init(devIf, sManager); sManager.AddEntity(labels[0]); labels[1] = new ScreenSpaceText("y", Color.Green, "Verdana", FontWeight.Normal, 10, new Vector3(0, 1.1f, 0), this); labels[1].Init(devIf, sManager); sManager.AddEntity(labels[1]); labels[2] = new ScreenSpaceText("z", Color.Blue, "Verdana", FontWeight.Normal, 10, new Vector3(0, 0, 1.1f), this); labels[2].Init(devIf, sManager); sManager.AddEntity(labels[2]); }
public override void Init(DeviceInterface devIf, SceneManager sManager) { // init line line = new Line(devIf.Device); line.Antialias = true; line.Width = 2; linePoints = new Vector2[2]; // init text distanceText = new ScreenSpaceText(".m", Color.Yellow, "Tahoma", FontWeight.Normal, 10, new Vector3()); sManager.AddEntity(distanceText); }
public override void Init(DeviceInterface devIf, SceneManager sManager) { base.Init(devIf, sManager); // do a lookup to get y position float height = heightLookup.ValueLookup(0.25f, 0.25f) / maxDataValue; // load text text = new ScreenSpaceText(Math.Round((decimal)height * 10, 1) + "m", Color.Yellow, "Tahoma", FontWeight.Bold, 11, new Vector3(0, 2.2f, 0), this); text.Init(devIf, sManager); sManager.AddEntity(text); AddDependant(text); Move(new Vector3(1.25f, height, 1.25f)); }