public SynchroFrame SynchroFrame() { try { GameSession session; _sessionManager.SessionTable.TryGetValue(Id, out session); if (session == null) { return(null); } AGameObject[] gameObjects = GameObjectConverter.ArrayedObjects(session.GetSynchroFrame()); var synchroFrame = new SynchroFrame(gameObjects, session.GetTime()); Trace.WriteLine(synchroFrame); return(synchroFrame); } catch (Exception exc) { Trace.WriteLine("ERROR: Syncroframe broken", exc.ToString()); } return(null); }
public void RewriteItemsBuffer() { GL.BindVertexArray(itemsArrayObject); itemsVertexArray = GameObjectConverter.GetPointsVertexs(map); GL.BindBuffer(BufferTarget.ArrayBuffer, itemsBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, itemsVertexArray.Length * sizeof(float), itemsVertexArray, BufferUsageHint.DynamicDraw); itemsColorArray = GameObjectConverter.GetPointsColors(map); GL.BindBuffer(BufferTarget.ArrayBuffer, itemsColorBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, itemsColorArray.Length * sizeof(float), itemsColorArray, BufferUsageHint.DynamicDraw); }
public void BufferItemsColors() { itemsColorArray = GameObjectConverter.GetPointsColors(map); itemsColorBufferObject = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, itemsColorBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * itemsColorArray.Length, itemsColorArray, BufferUsageHint.DynamicDraw); GL.BindVertexArray(itemsArrayObject); GL.EnableVertexAttribArray(1); GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, 0, 0); }
public void BufferMap() { mapVertexArray = GameObjectConverter.GetMapVertexs(map); mapBufferObject = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, mapBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, mapVertexArray.Length * sizeof(float), mapVertexArray, BufferUsageHint.StaticDraw); mapArrayObject = GL.GenVertexArray(); GL.BindVertexArray(mapArrayObject); GL.EnableVertexAttribArray(0); GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0); }
public void RewriteMapBuffers() { GL.BindVertexArray(mapArrayObject); mapVertexArray = GameObjectConverter.GetMapVertexs(map); GL.BindBuffer(BufferTarget.ArrayBuffer, mapBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, mapVertexArray.Length * sizeof(float), mapVertexArray, BufferUsageHint.StaticDraw); mapColorArray = GameObjectConverter.GetMapColors(map); GL.BindBuffer(BufferTarget.ArrayBuffer, mapColorBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, mapColorArray.Length * sizeof(float), mapColorArray, BufferUsageHint.StaticDraw); }
public void BufferSecondePlayer() { player2 = map.SpawnPlayer(); secondPlayerVertexArray = GameObjectConverter.GetPlayerVertexs(player2); secondPlayerBufferObject = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, secondPlayerBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, secondPlayerVertexArray.Length * sizeof(float), secondPlayerVertexArray, BufferUsageHint.DynamicDraw); secondPlayerArrayObject = GL.GenVertexArray(); GL.BindVertexArray(secondPlayerArrayObject); GL.EnableVertexAttribArray(0); GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0); }
public void BufferPlayersColors() { List <float> colorsList = new List <float>(); colorsList.AddRange(GameObjectConverter.GetPlayerColors(player1)); colorsList.AddRange(GameObjectConverter.GetPlayerColors(player2)); playersColorArray = colorsList.ToArray(); playersColorBufferObject = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, playersColorBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * playersColorArray.Length, playersColorArray, BufferUsageHint.StaticDraw); GL.BindVertexArray(firstPlayerArrayObject); GL.EnableVertexAttribArray(1); GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, 0, 0); GL.BindVertexArray(secondPlayerArrayObject); GL.EnableVertexAttribArray(1); GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, 0, 128); }
public NewObjectEvent(AGameObject obj, long timeStamp) : base(obj.Id, timeStamp) { NewGameObject = GameObjectConverter.OneObject(obj); Type = EventType.NewObjectEvent; }
public override Object Convert(IExportContainer container) { return(GameObjectConverter.Convert(container, this)); }