public override void ConstructRenderable(PrimitiveBatch BBoxBatcher) { // NB: Base class is not called here as it may result in PrimitiveBatch.AddObject conflict RenderBoundingBox navigationBox = new RenderBoundingBox(); navigationBox.SetColour(System.Drawing.Color.Blue); navigationBox.Init(new BoundingBox(new Vector3(-0.5f), new Vector3(0.5f))); navigationBox.SetTransform(Matrix4x4.CreateTranslation(Unk2)); BBoxBatcher.AddObject(RefID, navigationBox); }
public override void ConstructRenderable(PrimitiveBatch BBoxBatcher) { base.ConstructRenderable(BBoxBatcher); RenderBoundingBox navigationBox = new RenderBoundingBox(); navigationBox.SetColour(System.Drawing.Color.White); navigationBox.Init(new BoundingBox(new Vector3(-0.5f), new Vector3(0.5f))); navigationBox.SetTransform(Matrix4x4.CreateTranslation(Position)); BBoxBatcher.AddObject(RefID, navigationBox); }
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(); }
public override void ConstructRenderable(PrimitiveBatch BBoxBatcher) { base.ConstructRenderable(BBoxBatcher); RenderBoundingBox navigationBox = new RenderBoundingBox(); navigationBox.SetColour(System.Drawing.Color.Yellow); BoundingBox BBox = new BoundingBox(Minimum, Maximum); //Matrix4x4 RotationMatrix = MatrixExtensions.ConvertFromDirection(Direction); //RotationMatrix.TranslationVector = Position; navigationBox.Init(BBox); navigationBox.SetTransform(Matrix4x4.CreateTranslation(Position)); BBoxBatcher.AddObject(RefID, navigationBox); }
private void ClearRenderStack() { foreach (KeyValuePair <int, IRenderer> asset in InitObjectStack) { asset.Value.InitBuffers(D3D.Device, D3D.DeviceContext); if (asset.Value is RenderBoundingBox) { BBoxBatch.AddObject(asset.Key, asset.Value); } else if (asset.Value is RenderLine) { LineBatch.AddObject(asset.Key, asset.Value); } else { Assets.Add(asset.Key, asset.Value); } } InitObjectStack.Clear(); }
public void Init(OBJData data) { DoRender = true; this.data = data; string VertexBatchID = string.Format("NavObjData_{0}", RefManager.GetNewRefID()); PathVertexBatch = new PrimitiveBatch(PrimitiveType.Box, VertexBatchID); foreach (OBJData.VertexStruct Vertex in data.vertices) { RenderBoundingBox navigationBox = new RenderBoundingBox(); navigationBox.Init(new BoundingBox(new Vector3(-0.1f), new Vector3(0.1f))); navigationBox.SetColour(System.Drawing.Color.Green); navigationBox.SetTransform(Matrix4x4.CreateTranslation(Vertex.Position)); int PathHandle = RefManager.GetNewRefID(); PathVertexBatch.AddObject(PathHandle, navigationBox); BoundingBoxes.Add(navigationBox); } OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(PathVertexBatch); OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(PointConnectionsBatch); }
private void Update() { // TODO: Ideally, we should be using the same primitive batcher. // Problem is, calling ClearObjects on the batcher shuts down the lines too. // Once the RenderLine and RenderBBox has been decoupled, then this should be easier. OwnGraphics.OurPrimitiveManager.RemovePrimitiveBatch(LineBatch); if (DoRender) { if (Lines.Count > 0) { string LineBatchID = string.Format("NavCellLineBatch_{0}", RefManager.GetNewRefID()); LineBatch = new PrimitiveBatch(PrimitiveType.Line, LineBatchID); foreach (RenderLine line in Lines) { int PathHandle = RefManager.GetNewRefID(); LineBatch.AddObject(PathHandle, line); } OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(LineBatch); } } }