public static RenderAIWorld BuildAIWorld(GraphicsClass InGraphics, AIWorld InWorldInfo) { RenderAIWorld OurAIWorld = new RenderAIWorld(InGraphics); OurAIWorld.Init(InWorldInfo); return(OurAIWorld); }
public SpatialGrid(GraphicsClass InGraphics, KynogonRuntimeMesh mesh) { OwnGraphicsClass = InGraphics; bIsReady = true; var min = new Vector3(mesh.BoundMin, float.MinValue); var max = new Vector3(mesh.BoundMax, float.MaxValue); gridBounds = new BoundingBox(min, max); width = mesh.CellSizeY; height = mesh.CellSizeX; origin = new Vector3(gridBounds.Minimum.X, gridBounds.Minimum.Y, 0.0f); cellSize = new Vector2(gridBounds.GetWidth() / width, gridBounds.GetHeight() / height); cells = new SpatialCell[width * height]; Vector3 TempMin = gridBounds.Minimum; Vector3 TempMax = gridBounds.Maximum; var index = 0; for (int i = 0; i < width; i++) { for (int x = 0; x < height; x++) { KynogonRuntimeMesh.Cell cell = mesh.Cells[index]; foreach (var set in cell.Sets) { if (gridBounds.Minimum.Z < set.X) { TempMin.Z = set.X; } if (gridBounds.Maximum.Z > set.Y) { TempMax.Z = set.Y; } } // Construct cell extents Vector3 Minimum = new Vector3(origin.X + cellSize.X * x, origin.Y + cellSize.Y * i, 0.0f); Vector3 Maximum = new Vector3(origin.X + cellSize.X * (x + 1), origin.Y + cellSize.Y * (i + 1), 0.0f); BoundingBox CellExtents = new BoundingBox(Minimum, Maximum); // Construct Init params SpatialCell_ObjDataParams InitParams = new SpatialCell_ObjDataParams(); InitParams.OwnGraphics = OwnGraphicsClass; InitParams.CellExtents = CellExtents; InitParams.CellInfo = cell; // Construct ObjData cell SpatialCell_ObjData ObjDataCell = new SpatialCell_ObjData(InitParams); ObjDataCell.PreInitialise(); cells[index] = ObjDataCell; index++; } } }
public SpatialCell(SpatialCell_InitParams InitParams) { OwnGraphicsClass = InitParams.OwnGraphics; boundingBox = InitParams.CellExtents; assets = new Dictionary <int, IRenderer>(); RefID = RefManager.GetNewRefID(); }
public MainClass() { try { graphics = new GraphicsClass(); } catch(DirectXException) { return; } if( graphics.CreateGraphicsSample() ) graphics.Run(); }
public MainClass() { try { graphics = new GraphicsClass(); } catch (DirectXException) { return; } if (graphics.CreateGraphicsSample()) { graphics.Run(); } }
public SpatialGrid(GraphicsClass InGraphics, TranslokatorLoader translokator) { OwnGraphicsClass = InGraphics; bIsReady = true; gridBounds = translokator.Bounds; width = translokator.Grids[0].Width; height = translokator.Grids[0].Height; cellSize = new Vector2(gridBounds.GetWidth() / width, gridBounds.GetHeight() / height); cells = new SpatialCell[width * height]; origin = gridBounds.Minimum; var index = 0; /*for (int i = 0; i < width; i++) * { * for (int x = 0; x < height; x++) * { * var extents = new BoundingBox(); * extents.Minimum = new Vector3(origin.X + cellSize.X * x, origin.Y + cellSize.Y * i, 10.0f); * extents.Maximum = new Vector3(origin.X + cellSize.X * (x + 1), origin.Y + cellSize.Y * (i + 1), 10.0f); * cells[index++] = new SpatialCell(InGraphics, extents); * } * } * * for (int i = 0; i != translokator.ObjectGroups.Length; i++) * { * ObjectGroup objectGroup = translokator.ObjectGroups[i]; * * for (int x = 0; x != objectGroup.NumObjects; x++) * { * ResourceTypes.Translokator.Object obj = objectGroup.Objects[x]; * * for (int y = 0; y != obj.NumInstances; y++) * { * Instance instance = obj.Instances[y]; * var cell = GetCell(instance.Position); * RenderBoundingBox box = new RenderBoundingBox(); * box.SetTransform(Matrix4x4.CreateTranslation(instance.Position)); * box.Init(new BoundingBox(-Vector3.One, Vector3.One)); * cells[cell].AddAsset(box, RefManager.GetNewRefID()); * } * } * }*/ }
public PlayClass(GraphicsClass parent) { this.parent = parent; this.peerObject = peerObject; this.message = new MessageDelegate(parent.MessageArrived); peerObject = new Peer(); // First set up our event handlers (We only need events for the ones we care about) peerObject.PlayerCreated += new PlayerCreatedEventHandler(this.PlayerCreated); peerObject.PlayerDestroyed += new PlayerDestroyedEventHandler(this.PlayerDestroyed); peerObject.HostMigrated += new HostMigratedEventHandler(this.HostMigrated); peerObject.Receive += new ReceiveEventHandler(this.DataReceived); peerObject.SessionTerminated += new SessionTerminatedEventHandler(this.SessionTerminated); Connect = new ConnectWizard(peerObject, AppGuid, "Direct3DTest"); if (!Connect.StartWizard()) { MessageBox.Show("DirectPlay initialization was incomplete. Application will terminate."); throw new DirectXException(); } }
public void ConstructRenderable(GraphicsClass InGraphicsClass) { RenderObject = new RenderableAdapter(); RenderObject.InitAdaptor(RenderableFactory.BuildAIWorld(InGraphicsClass, this), this); }