Esempio n. 1
0
 public void Init(OBJData data, int i)
 {
     DoRender      = true;
     this.data     = data;
     lines         = new List <RenderLine>();
     navigationBox = new RenderBoundingBox();
     navigationBox.Init(new BoundingBox(new Vector3(-0.1f), new Vector3(0.1f)));
     navigationBox.SetColour(System.Drawing.Color.Green);
     navigationBox.SetTransform(Matrix.Translation(data.vertices[i].Position));
     vertex = data.vertices[i];
 }
Esempio n. 2
0
        private RenderLine CreateConnectionLine(OBJData.VertexStruct FromPoint, OBJData.VertexStruct ToPoint, System.Drawing.Color Colour)
        {
            RenderLine navigationLine = new RenderLine();

            navigationLine.SetUnselectedColour(Colour);
            navigationLine.SetSelectedColour(System.Drawing.Color.Red);
            navigationLine.Init(new Vector3[2] {
                FromPoint.Position, ToPoint.Position
            });

            return(navigationLine);
        }
Esempio n. 3
0
        public void SelectNode(int Index)
        {
            // TODO: Big problem here - The graphics class isn't aware of the selecting logic here.
            // So we'll one day need to support the graphics class aware of this and deselect this whenever another
            // object has been selected.
            if (SelectedIndex != -1)
            {
                BoundingBoxes[SelectedIndex].Unselect();
            }

            // Move the selection to the new Vertex
            BoundingBoxes[Index].Select();
            SelectedIndex = Index;

            // Render debug work
            OBJData.VertexStruct PathPoint = data.vertices[Index];
            RenderLine           FromA     = CreateConnectionLine(PathPoint, data.vertices[PathPoint.Unk3], System.Drawing.Color.Yellow);
            RenderLine           FromB     = CreateConnectionLine(PathPoint, data.vertices[PathPoint.Unk4], System.Drawing.Color.Brown);
            RenderLine           FromC     = CreateConnectionLine(PathPoint, data.vertices[PathPoint.Unk5], System.Drawing.Color.Red);

            PointConnectionsBatch.ClearObjects();
            PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), FromA);
            PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), FromB);
            PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), FromC);

            foreach (var IncomingPoint in PathPoint.IncomingConnections)
            {
                RenderLine Connection = CreateConnectionLine(PathPoint, IncomingPoint, System.Drawing.Color.Green);
                PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), Connection);
            }

            foreach (var OutgoingPoint in PathPoint.OutgoingConnections)
            {
                RenderLine Connection = CreateConnectionLine(PathPoint, OutgoingPoint, System.Drawing.Color.Blue);
                PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), Connection);
            }

            PointConnectionsBatch.SetIsDirty();
        }