public override void PreInitialise() { base.PreInitialise(); NavCell = new RenderNavCell(OwnGraphicsClass); NavCell.Init(OurCellInfo); assets.Add(RefManager.GetNewRefID(), NavCell); }
public SpatialCell(SpatialCell_InitParams InitParams) { OwnGraphicsClass = InitParams.OwnGraphics; boundingBox = InitParams.CellExtents; assets = new Dictionary <int, IRenderer>(); RefID = RefManager.GetNewRefID(); }
// TODO: Make OwnGraphics in the base class public RenderNavCell(GraphicsClass InGraphicsOwner) { OwnGraphics = InGraphicsOwner; Lines = new List <RenderLine>(); string LineBatchID = string.Format("NavCellLineBatch_{0}", RefManager.GetNewRefID()); LineBatch = new PrimitiveBatch(PrimitiveType.Line, LineBatchID); }
public FrameEntry(FrameEntry entry) { refID = RefManager.GetNewRefID(); refs = new Dictionary <FrameEntryRefTypes, int>(); for (int i = 0; i < entry.refs.Count; i++) { refs.Add(entry.refs.ElementAt(i).Key, entry.refs.ElementAt(i).Value); } }
public void RequestUpdate() { OwnGraphics.OurPrimitiveManager.RemovePrimitiveBatch(AIWorldBatch); string BoxID = string.Format("AIWorld_{0}", RefManager.GetNewRefID()); AIWorldBatch = new PrimitiveBatch(PrimitiveType.Box, BoxID); InitWorldInfo.PopulatePrimitiveBatch(AIWorldBatch); OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(AIWorldBatch); }
public void Init(AIWorld WorldInfo) { InitWorldInfo = WorldInfo; string BoxID = string.Format("AIWorld_{0}", RefManager.GetNewRefID()); AIWorldBatch = new PrimitiveBatch(PrimitiveType.Box, BoxID); WorldInfo.PopulatePrimitiveBatch(AIWorldBatch); OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(AIWorldBatch); }
public RenderNav(GraphicsClass InGraphicsClass) { OwnGraphics = InGraphicsClass; SelectedIndex = -1; BoundingBoxes = new List <RenderBoundingBox>(); ConnectionsList = new List <RenderLine>(); string ConnectionList = string.Format("NavConnectionList_{0}", RefManager.GetNewRefID()); PointConnectionsBatch = new PrimitiveBatch(PrimitiveType.Line, ConnectionList); }
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 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); } } }
public GraphicsClass() { InitObjectStack = new Dictionary <int, IRenderer>(); Profile = new Profiler(); Assets = new Dictionary <int, IRenderer>(); selectionBox = new RenderBoundingBox(); translokatorGrid = new SpatialGrid(); navigationGrids = new SpatialGrid[0]; OurPrimitiveManager = new PrimitiveManager(); OnSelectedObjectUpdated += OnSelectedObjectHasUpdated; // Create bespoke batches for any lines or boxes passed in via the construct stack string LineBatchID = string.Format("Graphics_LineBatcher_{0}", RefManager.GetNewRefID()); LineBatch = new PrimitiveBatch(PrimitiveType.Line, LineBatchID); string BBoxBatchID = string.Format("Graphics_BBoxBatcher_{0}", RefManager.GetNewRefID()); BBoxBatch = new PrimitiveBatch(PrimitiveType.Box, BBoxBatchID); OurPrimitiveManager.AddPrimitiveBatch(LineBatch); OurPrimitiveManager.AddPrimitiveBatch(BBoxBatch); }
public IType(AIWorld InWorld) { RefID = RefManager.GetNewRefID(); OwnWorld = InWorld; bIsVisible = true; }
public FrameEntry() { refID = RefManager.GetNewRefID(); }