public DungeonLayer(Point _enterCoords) { Ambient = new FColor(0, 0, 0.01f, 0.01f); EnterCoords = _enterCoords; FogColor = FColor.FromArgb(255, 100, 100, 100); FogLightness = FogColor.Lightness(); }
public SplatterDropper(WorldLayer _layer, LiveMapCell _from, int _strength, FColor _color, LiveMapCell _to): base(EALNouns.NONE, _layer, 0) { m_strenght = _strength; m_color = _color; var d = _to.PathMapCoords - _from.PathMapCoords; World.TheWorld.CreatureManager.AddCreature(this, _from.WorldCoords, _from.LiveCoords, _layer); m_path = _from.LiveCoords.GetLineToPoints(_from.LiveCoords + d * 10).ToList(); }
protected Thing(EALNouns _name, Material _material) : base(_name, _material) { m_lerpColor = _material == null ? FColor.Empty : _material.LerpColor; }
public void Add(FColor value) { R += value.R; G += value.G; B += value.B; A += value.A; }
public void SetVisibleCelss(LiveMap _liveMap, Point _dPoint, FColor _startFrom) { unchecked { var cvisibles = new FColor[m_inOrder.Length]; var visibles = new float[m_inOrder.Length]; cvisibles[0] = _startFrom; visibles[0] = 1; for (var index = 0; index < m_inOrder.Length; index++) { var visibilityCoeff = visibles[index]; if (visibilityCoeff < VISIBILITY_THRESHOLD) continue; var losCell = m_inOrder[index]; var myPnt = LiveMap.WrapCellCoords(losCell.Point + _dPoint); var liveCell = _liveMap.Cells[myPnt.X, myPnt.Y]; var transColor = index == 0 ? FColor.White : liveCell.TransparentColor; visibilityCoeff = transColor.A*visibilityCoeff; var childsColor = cvisibles[index].Multiply(transColor); if (visibilityCoeff < VISIBILITY_THRESHOLD) continue; foreach (var pair in losCell.CellIndexes) { visibles[pair.Key] += pair.Value*visibilityCoeff; cvisibles[pair.Key] = cvisibles[pair.Key].ScreenColorsOnly(childsColor); } } for (var index = 0; index < m_inOrder.Length; index++) { var visibilityCoeff = visibles[index]; var color = cvisibles[index]; if (visibilityCoeff < VISIBILITY_THRESHOLD) continue; var losCell = m_inOrder[index]; var myPnt = LiveMap.WrapCellCoords(losCell.Point + _dPoint); var liveCell = _liveMap.Cells[myPnt.X, myPnt.Y]; liveCell.Visibility = new FColor(Math.Min(1f, visibilityCoeff), color); } } }
public async Task ToggleColorRoleAsync([Summary("kolor z listy(none - lista)")] FColor color = FColor.None, [Summary("waluta(SC/TC)")] SCurrency currency = SCurrency.Tc) { var user = Context.User as SocketGuildUser; if (user == null) { return; } if (color == FColor.None) { using (var img = _profile.GetColorList(currency)) { await Context.Channel.SendFileAsync(img, "list.png"); return; } } using (var db = new Database.UserContext(Config)) { var botuser = await db.GetUserOrCreateAsync(user.Id); var points = currency == SCurrency.Tc ? botuser.TcCnt : botuser.ScCnt; if (points < color.Price(currency)) { await ReplyAsync("", embed : $"{user.Mention} nie posiadasz wystarczającej liczby {currency.ToString().ToUpper()}!".ToEmbedMessage(EMType.Error).Build()); return; } var colort = botuser.TimeStatuses.FirstOrDefault(x => x.Type == Database.Models.StatusType.Color && x.Guild == Context.Guild.Id); if (colort == null) { colort = new Database.Models.TimeStatus { Type = Database.Models.StatusType.Color, Guild = Context.Guild.Id, EndsAt = DateTime.Now, }; botuser.TimeStatuses.Add(colort); } if (color == FColor.CleanColor) { colort.EndsAt = DateTime.Now; await _profile.RomoveUserColorAsync(user); } else { using (var cdb = new Database.GuildConfigContext(Config)) { if (_profile.HasSameColor(user, color) && colort.IsActive()) { colort.EndsAt = colort.EndsAt.AddMonths(1); } else { await _profile.RomoveUserColorAsync(user); colort.EndsAt = DateTime.Now.AddMonths(1); } var gConfig = await cdb.GetCachedGuildFullConfigAsync(Context.Guild.Id); if (!await _profile.SetUserColorAsync(user, gConfig.AdminRole, color)) { await ReplyAsync("", embed : $"Coś poszło nie tak!".ToEmbedMessage(EMType.Error).Build()); return; } if (currency == SCurrency.Tc) { botuser.TcCnt -= color.Price(currency); } else { botuser.ScCnt -= color.Price(currency); } } } await db.SaveChangesAsync(); QueryCacheManager.ExpireTag(new string[] { $"user-{botuser.Id}", "users" }); await ReplyAsync("", embed : $"{user.Mention} wykupił kolor!".ToEmbedMessage(EMType.Success).Build()); } }
public abstract void Draw(Point _point, FColor _color, EDirections _direction, bool _isCorpse);
protected ATile(int _x, int _y, FColor _color) { Color = _color; Point = new Point(_x, _y); SrcPoint = new Point(_x, _y); }
public void setColor(FColor color) { this.color = color; }
public void UpdateVisibility(float _fogLightness, FColor _ambient) { foreach (var point in LiveCoords.GetAllBlockPoints()) { m_liveMap.Cells[point.X, point.Y].UpdateVisibility(_fogLightness, _ambient); } }
// constructor you should use public Figure(FColor color) { this.color = color; }
public Bishop(FColor color) : base(color) { }
public Rook(FColor color) : base(color) { }
public Queen(FColor color) : base(color) { }
public King(FColor color) : base(color) { }
public TreeMazeDungeonLayer(Point _enterCoords, Random _rnd) : base(_enterCoords) { var enterBlock = BaseMapBlock.GetBlockId(_enterCoords); var size = _rnd.Next(5) + _rnd.Next(5) + 5; var center = new Point(size, size)/2; var map = new EMapBlockTypes[size,size]; var list = LayerHelper.GetRandomPoints(center, _rnd, map, size, EMapBlockTypes.GROUND, EMapBlockTypes.NONE); var blockIds = list.Distinct().Select(_point => _point - center + enterBlock).ToArray(); foreach (var blockId in blockIds) { BaseMapBlock block; if (!m_mazeBlocks.TryGetValue(blockId, out block)) { block = new BaseMapBlock(blockId); } if (BaseMapBlock.GetBlockId(EnterCoords) == blockId) { GenerateInternal(block, new[] {BaseMapBlock.GetInBlockCoords(EnterCoords)}); } else { GenerateInternal(block); } m_mazeBlocks[block.BlockId] = block; } var connectionPoints = new List<ConnectionPoint>(); foreach (var block in blockIds.Select(_blockId => m_mazeBlocks[_blockId])) { var rnd = new Random(block.RandomSeed); foreach (var room in block.Rooms) { connectionPoints.AddRange(AddConnectionPoints(block, room, rnd)); } } LinkRooms(connectionPoints); foreach (var mapBlock in m_mazeBlocks.Values) { foreach (var room in mapBlock.Rooms.Where(_room => _room.IsConnected)) { var border = room.RoomRectangle.BorderPoints.ToArray(); foreach (var point in border) { if (_rnd.NextDouble() > 0.7) { var dir = EDirections.NONE; if (point.X > 0 && TerrainAttribute.GetAttribute(mapBlock.Map[point.X - 1, point.Y]).IsNotPassable) { dir = EDirections.RIGHT; } else if (point.X < Constants.MAP_BLOCK_SIZE - 1 && TerrainAttribute.GetAttribute(mapBlock.Map[point.X + 1, point.Y]).IsNotPassable) { dir = EDirections.LEFT; } else if (point.Y > 0 && TerrainAttribute.GetAttribute(mapBlock.Map[point.X, point.Y - 1]).IsNotPassable) { dir = EDirections.DOWN; } else if (point.Y < Constants.MAP_BLOCK_SIZE - 1 && TerrainAttribute.GetAttribute(mapBlock.Map[point.X, point.Y + 1]).IsNotPassable) { dir = EDirections.UP; } if (dir == EDirections.NONE) continue; var fColor = new FColor(3f, (float) _rnd.NextDouble(), (float) _rnd.NextDouble(), (float) _rnd.NextDouble()); mapBlock.AddEssence(new OnWallTorch(new LightSource(_rnd.Next(4) + 3, fColor), dir, EssenceHelper.GetFirstFoundedMaterial<WoodMaterial>()), point); break; } } } } }
public Pawn(FColor color) : base(color) { pawnObject = GameObject.Instantiate(Resources.Load <GameObject>("pawn")); this.setMeshColor(); }
public void SetLerpColor(FColor _fColor) { m_lerpColor = _fColor; }
public Knight(FColor color) : base(color) { }
public Splatter(FColor _color, int _tileIndex) { m_color = _color; m_tileIndex = _tileIndex; m_direction = World.Rnd.GetRandomDirection(); }
public static System.Windows.Media.Color GetColor(this FColor _fc) { return(System.Windows.Media.Color.FromArgb((byte)(_fc.A * 255), (byte)(_fc.R * 255), (byte)(_fc.G * 255), (byte)(_fc.B * 255))); }
public abstract void Draw(Point _point, FColor _color);
public static System.Drawing.Color GetDColor(this FColor _fc) { return(System.Drawing.Color.FromArgb((byte)(_fc.A * 255), (byte)(_fc.R * 255), (byte)(_fc.G * 255), (byte)(_fc.B * 255))); }
public static XColor GetXColor(this FColor _fc) { return(new XColor { A = _fc.A, R = _fc.R, G = _fc.G, B = _fc.B }); }
public void Paint(FColor _lerpColor) { m_lerpColor = _lerpColor; }
public void LightCells(LiveMap _liveMap, Point _dPoint, FColor _fColor) { unchecked { var cvisibles = new FColor[m_inOrder.Length]; var power = new float[m_inOrder.Length]; var childVisibility = new float[m_inOrder.Length]; power[0] = _fColor.A; childVisibility[0] = 1; cvisibles[0] = new FColor(1f, _fColor); for (var index = 1; index < m_inOrder.Length; index++) { cvisibles[index] = FColor.Empty; } for (var index = 0; index < m_inOrder.Length; index++) { var losCell = m_inOrder[index]; var powerCoeff = power[index]; if (powerCoeff < LIGHT_THRESHOLD) continue; var myPnt = LiveMap.WrapCellCoords(losCell.Point + _dPoint); var liveCell = _liveMap.Cells[myPnt.X, myPnt.Y]; var color = cvisibles[index].NormalColorOnly; var transColor = index == 0 ? FColor.White : liveCell.TransparentColor; if (childVisibility[index] > 0) { liveCell.Lighted = liveCell.Lighted.Screen(color.Multiply(powerCoeff)); powerCoeff *= transColor.A; if (powerCoeff < LIGHT_THRESHOLD) continue; } else { powerCoeff *= transColor.A; if (powerCoeff < LIGHT_THRESHOLD) continue; liveCell.Lighted = liveCell.Lighted.Screen(color.Multiply(powerCoeff)); } var childsColor = color.Multiply(transColor); foreach (var pair in losCell.CellIndexes) { var i = pair.Key; power[i] += pair.Value*powerCoeff; cvisibles[i].AddColorOnly(childsColor); childVisibility[i] = pair.Value*liveCell.Visibility.A; } } } }
protected Thing(EALNouns _name, Material _material) : base(_name, _material) { m_lerpColor = _material == null ? FColor.Empty : _material.LerpColor; }
public void Paint(FColor _lerpColor) { m_lerpColor = _lerpColor; }
public async Task <bool> SetUserColorAsync(SocketGuildUser user, ulong adminRole, FColor color) { if (user == null) { return(false); } var colorNumeric = (uint)color; var aRole = user.Guild.GetRole(adminRole); if (aRole == null) { return(false); } var cRole = user.Guild.Roles.FirstOrDefault(x => x.Name == colorNumeric.ToString()); if (cRole == null) { var dColor = new Color(colorNumeric); var createdRole = await user.Guild.CreateRoleAsync(colorNumeric.ToString(), GuildPermissions.None, dColor); await createdRole.ModifyAsync(x => x.Position = aRole.Position + 1); await user.AddRoleAsync(createdRole); return(true); } if (!user.Roles.Contains(cRole)) { await user.AddRoleAsync(cRole); } return(true); }
public FColor(FColor color) { R = color.R; G = color.G; B = color.B; A = color.A; }
/// <summary> /// Creates a Printer with the specified text color. /// </summary> /// <param name="textColor"></param> public Printer(FColor textColor) : this() { TextColor = textColor; }
public void Sub(FColor value) { R -= value.R; G -= value.G; B -= value.B; A -= value.A; }
public King(string name, FColor color) : base(name, color) { Name = name; Color = color; }
public void InitDB() { #region Init User data if (DB.GetCollectionDBModel <User>().FindAll().Any() == false) { User user = new User(); user.ID = 1; user.Email = "*****@*****.**"; user.Password = "******"; user.FirstName = "Tam"; user.LastName = "Nguyen"; DB.GetCollectionDBModel <User>().Insert(user); User user1 = new User(); user1.ID = 2; user1.Email = "*****@*****.**"; user1.Password = "******"; user1.FirstName = "user"; user1.LastName = "user"; DB.GetCollectionDBModel <User>().Insert(user1); } #endregion #region Init Color data if (DB.GetCollectionDBModel <FColor>().FindAll().Any() == false) { FColor color = new FColor(); color.ID = 1; color.Code = "0xFFFFFF"; color.Name = "White"; DB.GetCollectionDBModel <FColor>().Insert(color); FColor color1 = new FColor(); color1.ID = 2; color1.Code = "0xFFFFFF"; color1.Name = "Black"; DB.GetCollectionDBModel <FColor>().Insert(color1); } #endregion #region Init Size data if (DB.GetCollectionDBModel <FSize>().FindAll().Any() == false) { FSize size = new FSize(); size.ID = 1; size.Name = "S"; size.OrderIndex = 1; DB.GetCollectionDBModel <FSize>().Insert(size); FSize size1 = new FSize(); size1.ID = 2; size1.Name = "M"; size1.OrderIndex = 2; DB.GetCollectionDBModel <FSize>().Insert(size1); FSize size2 = new FSize(); size2.ID = 3; size2.Name = "L"; size2.OrderIndex = 3; DB.GetCollectionDBModel <FSize>().Insert(size2); FSize size3 = new FSize(); size3.ID = 4; size3.Name = "XL"; size3.OrderIndex = 4; DB.GetCollectionDBModel <FSize>().Insert(size3); } #endregion #region Init Category data if (DB.GetCollectionDBModel <Category>().FindAll().Any() == false) { Category cate = new Category(); cate.ID = 1; cate.Code = "S01"; cate.Name = "Shirt"; DB.GetCollectionDBModel <Category>().Insert(cate); Category cate1 = new Category(); cate1.ID = 2; cate1.Code = "S02"; cate1.Name = "T-Shirt"; DB.GetCollectionDBModel <Category>().Insert(cate1); Category cate2 = new Category(); cate2.ID = 3; cate2.Code = "J01"; cate2.Name = "Jacket"; DB.GetCollectionDBModel <Category>().Insert(cate2); Category cate3 = new Category(); cate3.ID = 4; cate3.Code = "J02"; cate3.Name = "Jeans"; DB.GetCollectionDBModel <Category>().Insert(cate3); Category cate4 = new Category(); cate4.ID = 5; cate4.Code = "P01"; cate4.Name = "Pants"; DB.GetCollectionDBModel <Category>().Insert(cate4); } #endregion #region Init Product data if (DB.GetCollectionDBModel <Product>().FindAll().Any() == false) { #region Shirt Product product = new Product(); product.ID = 1; product.CategoryID = 1; product.Code = "SA01"; product.Name = "Shirt A01"; product.Price = 450000; product.Description = "".RandomString(100); product.IsActive = true; product.SizeID = 1; product.ColorID = 1; product.Gender = 1; product.imageSrc = "https://outdoor-and-country-res.cloudinary.com/image/upload/e_trim:2/bo_8px_solid_white/c_pad,b_white,w_1000,h_1200,f_auto,q_auto/v1540205233/product/186710.jpg"; DB.GetCollectionDBModel <Product>().Insert(product); Product product1 = new Product(); product1.ID = 2; product1.CategoryID = 1; product1.Code = "SA02"; product1.Name = "Shirt A02"; product1.Price = 300000; product1.Description = "".RandomString(100); product1.IsActive = true; product1.SizeID = 2; product1.ColorID = 1; product1.Gender = 1; product1.imageSrc = "https://a3655836d5c58a086ac2-4e8d43a89f100386d472e9f1a1dc59ca.ssl.cf3.rackcdn.com/images/original/dbf68972-c4aa-447b-9726-c11fd209cc7d.jpg"; DB.GetCollectionDBModel <Product>().Insert(product1); Product product2 = new Product(); product2.ID = 3; product2.CategoryID = 1; product2.Code = "SA03"; product2.Name = "Shirt A03"; product2.Price = 350000; product2.Description = "".RandomString(100); product2.IsActive = true; product2.SizeID = 3; product2.ColorID = 1; product2.Gender = 1; product2.imageSrc = "https://cdn.shopify.com/s/files/1/1832/4455/products/1153_S17_IconShirt_MendocinoBlue_FR.jpg?v=1572027022"; DB.GetCollectionDBModel <Product>().Insert(product2); #endregion #region T-shirt Product product3 = new Product(); product3.ID = 4; product3.CategoryID = 2; product3.Code = "TSA01"; product3.Name = "T-Shirt A01"; product3.Price = 250000; product3.Description = "".RandomString(100); product3.IsActive = true; product3.SizeID = 4; product3.ColorID = 1; product3.Gender = 1; product3.imageSrc = "https://cdn11.bigcommerce.com/s-rxzabllq/images/stencil/1280x1280/products/910/18045/Kids-Plain-Poly-Fit-Quick_Dry-Tshirt-red__13799.1567089094.jpg?c=2"; DB.GetCollectionDBModel <Product>().Insert(product3); Product product4 = new Product(); product4.ID = 5; product4.CategoryID = 2; product4.Code = "TSA02"; product4.Name = "T-Shirt A02"; product4.Price = 150000; product4.Description = "".RandomString(100); product4.IsActive = true; product4.SizeID = 1; product4.ColorID = 1; product4.Gender = 1; product4.imageSrc = "https://d2h2vnfmmg5sct.cloudfront.net/catalog/product/large_image/02_414443.jpg"; DB.GetCollectionDBModel <Product>().Insert(product4); Product product5 = new Product(); product5.ID = 6; product5.CategoryID = 2; product5.Code = "TSA03"; product5.Name = "T-Shirt A03"; product5.Price = 100000; product5.Description = "".RandomString(100); product5.IsActive = true; product5.SizeID = 2; product5.ColorID = 1; product5.Gender = 1; product5.imageSrc = "https://images-na.ssl-images-amazon.com/images/I/61mSyjeYXWL._AC_UX679_.jpg"; DB.GetCollectionDBModel <Product>().Insert(product5); #endregion #region Jacket Product product6 = new Product(); product6.ID = 7; product6.CategoryID = 3; product6.Code = "JA01"; product6.Name = "Jacket A01"; product6.Price = 500000; product6.Description = "".RandomString(100); product6.IsActive = true; product6.SizeID = 3; product6.ColorID = 1; product6.Gender = 1; product6.imageSrc = "https://product.hstatic.net/1000306633/product/5bc67f9a-f1db-4405-9583-9ebc476078b5_4335d664706d4ec0a53e337da90c06a3_master.jpg"; DB.GetCollectionDBModel <Product>().Insert(product6); Product product7 = new Product(); product7.ID = 8; product7.CategoryID = 3; product7.Code = "JA02"; product7.Name = "Jacket A02"; product7.Price = 600000; product7.Description = "".RandomString(100); product7.IsActive = true; product7.SizeID = 4; product7.ColorID = 1; product7.Gender = 1; product7.imageSrc = "https://cdni.llbean.net/is/image/wim/507067_0_46?hei=1095&wid=950&resMode=sharp2&defaultImage=llbstage/A0211793_2"; DB.GetCollectionDBModel <Product>().Insert(product7); Product product8 = new Product(); product8.ID = 9; product8.CategoryID = 3; product8.Code = "JA03"; product8.Name = "Jacket A03"; product8.Price = 700000; product8.Description = "".RandomString(100); product8.IsActive = true; product8.SizeID = 2; product8.ColorID = 1; product8.Gender = 1; product8.imageSrc = "https://cf.shopee.ph/file/70f66a937abf9230417e1700379ca3ee"; DB.GetCollectionDBModel <Product>().Insert(product8); #endregion #region Jeans Product product9 = new Product(); product9.ID = 10; product9.CategoryID = 4; product9.Code = "JEA01"; product9.Name = "Jean A01"; product9.Price = 400000; product9.Description = "".RandomString(100); product9.IsActive = true; product9.SizeID = 3; product9.ColorID = 1; product9.Gender = 1; product9.imageSrc = "https://i1.wp.com/ae01.alicdn.com/kf/HTB1U7edb9WD3KVjSZSgq6ACxVXaN/2019-New-autumn-Men-s-cotton-Jeans-men-Business-Casual-Stretch-Jean-Classic-Trousers-Denim-Blue.jpg?fit=800%2C800&ssl=1"; DB.GetCollectionDBModel <Product>().Insert(product9); Product product10 = new Product(); product10.ID = 11; product10.CategoryID = 4; product10.Code = "JEA02"; product10.Name = "Jean A02"; product10.Price = 3500000; product10.Description = "".RandomString(100); product10.IsActive = true; product10.SizeID = 4; product10.ColorID = 1; product10.Gender = 1; product10.imageSrc = "https://cdn.mudjeans.eu/wp-content/uploads/2018/04/Man-Ethical-Jeans-Regular-Dunn-Stone-Blue-halffront-1.jpg"; DB.GetCollectionDBModel <Product>().Insert(product10); Product product11 = new Product(); product11.ID = 12; product11.CategoryID = 4; product11.Code = "JEA03"; product11.Name = "Jean A03"; product11.Price = 600000; product11.Description = "".RandomString(100); product11.IsActive = true; product11.SizeID = 1; product11.ColorID = 1; product11.Gender = 1; product11.imageSrc = "https://www1.assets-gap.com/webcontent/0015/058/596/cn15058596.jpg"; DB.GetCollectionDBModel <Product>().Insert(product11); #endregion #region Pant Product product12 = new Product(); product12.ID = 13; product12.CategoryID = 5; product12.Code = "PA01"; product12.Name = "Pant A01"; product12.Price = 450000; product12.Description = "".RandomString(100); product12.IsActive = true; product12.SizeID = 2; product12.ColorID = 1; product12.Gender = 1; product12.imageSrc = "https://cdn.shopify.com/s/files/1/0071/5633/4681/products/Men_Original-Mountain-Pant_Relaxed-Fit_Terra_272_grande.jpg?v=1568320083"; DB.GetCollectionDBModel <Product>().Insert(product12); Product product13 = new Product(); product13.ID = 14; product13.CategoryID = 5; product13.Code = "PA02"; product13.Name = "Pant A02"; product13.Price = 3700000; product13.Description = "".RandomString(100); product13.IsActive = true; product13.SizeID = 3; product13.ColorID = 1; product13.Gender = 1; product13.imageSrc = "https://cdn.shopify.com/s/files/1/0023/9901/0881/products/M-Coburn-Pant-Storm-Cloud_5f952c4f-d899-484f-b891-acf4f37f6269_1400x1400.jpg?v=1582657066"; DB.GetCollectionDBModel <Product>().Insert(product13); Product product14 = new Product(); product14.ID = 15; product14.CategoryID = 5; product14.Code = "PA03"; product14.Name = "Pant A03"; product14.Price = 800000; product14.Description = "".RandomString(100); product14.IsActive = true; product14.SizeID = 4; product14.ColorID = 1; product14.Gender = 1; product14.imageSrc = "https://images.puma.net/images/596699/32/fnd/AUS/w/1000/h/1000/bg/255,255,255"; DB.GetCollectionDBModel <Product>().Insert(product14); #endregion } #endregion }
public LightSource(int _radius, FColor _color) { m_radius = _radius; m_color = _color; }
/// <summary> /// Creates a Printer with the specified text and back colors. /// </summary> /// <param name="textColor"></param> /// <param name="backColor"></param> /// <returns></returns> public Printer(FColor textColor, FColor backColor) : this(textColor) { BackColor = backColor; }
protected override void OnRenderFrame(FrameEventArgs _e) { base.OnRenderFrame(_e); GL.ClearColor(0f, 0f, 0f, 0f); GL.Clear(ClearBufferMask.ColorBufferBit); using (new FboWrapper.DrawHelper(m_fboWrapper)) { #region #1 //dfbo.BeginDrawIn(0); GL.ClearColor(0f, 0f, 0f, 0f); GL.Clear(ClearBufferMask.ColorBufferBit); GL.Disable(EnableCap.Texture2D); GL.Begin(BeginMode.Polygon); { const int center = Map.SIZE * SZ / 2; GL.Color3(1f, 1f, 0.7f); GL.Vertex2(center, center); GL.Color3(0f, 0f, 0f); const float step = (float)Math.PI / 10f; for (float f = 0; f < Math.PI * 2 + step; f += step) { var x = Math.Sin(f) * LIGHTRADIUS + center; var y = Math.Cos(f) * LIGHTRADIUS + center; GL.Vertex2(x, y); } GL.Color3(1f, 1f, 0.7f); GL.Vertex2(center, center); } GL.End(); #endregion m_fboWrapper.BlitTo(m_fboWrapperBlit, 0); } using (new FboWrapper.DrawHelper(m_fboWrapper)) { DrawShadows(new PointF(Mouse.X * SZ / VSZ, Mouse.Y * SZ / VSZ)); m_fboWrapper.BlitTo(m_fboWrapperBlit, 1); } const float sz = Map.SIZE * VSZ; //Map.SIZE; //512f / SZ; const float to = ((float)Map.SIZE * SZ) / FboWrapper.SIZE; if (true) { using (new FboWrapper.DrawHelper(m_fboWrapper)) { GL.Color4(1f, 1f, 1f, 1f); GL.Enable(EnableCap.Texture2D); m_fboWrapperBlit.BindTexture(1); GL.Begin(BeginMode.Quads); { GL.TexCoord2(0f, 0f); GL.Vertex2(0f, 0f); GL.TexCoord2(to, 0f); GL.Vertex2(sz, 0f); GL.TexCoord2(to, to); GL.Vertex2(sz, sz); GL.TexCoord2(0f, to); GL.Vertex2(0f, sz); } GL.End(); GL.BindTexture(TextureTarget.ProxyTexture2D, 0); GL.Disable(EnableCap.Texture2D); var arr = new FColor[Map.SIZE, Map.SIZE]; GL.ReadPixels(0, 0, Map.SIZE, Map.SIZE, PixelFormat.Rgba, PixelType.Float, arr); var bmp = new Bitmap(Map.SIZE, Map.SIZE, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); for (int i = 0; i < Map.SIZE; i++) { for (int j = 0; j < Map.SIZE; j++) { bmp.SetPixel(j, i, Color.FromArgb((int)(arr[i, j].A * 255), (int)(arr[i, j].R * 255), (int)(arr[i, j].G * 255), (int)(arr[i, j].B * 255))); } } bmp.Save("d:\\eee.png", ImageFormat.Png); } } GL.UseProgram(m_shaderProgramHandle); BindTexture(m_t2, TextureUnit.Texture1, "Shadow0"); BindTexture(m_t1, TextureUnit.Texture0, "Spot"); GL.Color3(1f, 1f, 1f); GL.Begin(BeginMode.Quads); { GL.TexCoord2(0f, 0f); GL.Vertex2(0f, 0f); GL.TexCoord2(to, 0f); GL.Vertex2(sz, 0f); GL.TexCoord2(to, to); GL.Vertex2(sz, sz); GL.TexCoord2(0f, to); GL.Vertex2(0f, sz); } GL.End(); GL.BindTexture(TextureTarget.Texture2D, 0); GL.Disable(EnableCap.Texture2D); GL.UseProgram(0); GL.Flush(); //var arr = new FColor[Map.SIZE, Map.SIZE]; //GL.ReadPixels(0, 0, Map.SIZE, Map.SIZE, PixelFormat.Rgba, PixelType.Float, arr); //var bmp = new Bitmap(Map.SIZE, Map.SIZE, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); //for (int i = 0; i < Map.SIZE; i++) //{ // for (int j = 0; j < Map.SIZE; j++) // { // bmp.SetPixel(j, i, Color.FromArgb((int)(arr[i, j].A * 255), (int)(arr[i, j].R * 255), (int)(arr[i, j].G * 255), (int)(arr[i, j].B * 255))); // } //} //bmp.Save("d:\\aaa.png",ImageFormat.Png); SwapBuffers(); Title = string.Format("fps:{0} per frame", Math.Round(1 / _e.Time)); }
protected AbstractTorch(EALNouns _name, Material _material, int _radius, FColor _color) : base(_name, _material) { m_radius = _radius; m_color = _color; }
internal static FColor WithDefault(this FColor fColor, FColor defaultColor) { return(fColor == FColor.Default ? defaultColor : fColor); }
public LightSource(int _radius, FColor _color) { m_radius = _radius; m_color = _color; }
public Splatter(FColor _color, int _tileIndex) { m_color = _color; m_tileIndex = _tileIndex; m_direction = World.Rnd.GetRandomDirection(); }