public static void ConvertLigth() { BitmapImage img = FileOperations.OpenLigthImage(); if (img != null) { if (img.PixelWidth > 800 || img.PixelHeight > 800) { MessageBox.Show("Максимальный размер 800 x 800", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning); return; } LightImage li = new LightImage(); li.BeginInit(); li.Source = img; li.Stretch = Stretch.Fill; li.Width = img.PixelWidth; li.Height = img.PixelHeight; li.EndInit(); string file = FileOperations.ShowSaveDialog("Экспорт PNG", ".png", "Light Map", FileOperations.FilterPng); if (string.IsNullOrEmpty(file)) { return; } RenderToLMap(li, file); } }
public IImage LightAvaToImage(LightImage li, int width, int height) { li = li.CropToSize(width, height); IImage avaImage = SocketManager.resourcesProvider.MakeIImage(li); return(avaImage); }
/// <summary> /// Default constructor /// </summary> public Primitive() { Flexible = new FlexibleData(); Light = new LightData(); LightMap = new LightImage(); Sculpt = new SculptData(); PrimData = new ConstructionData(); PhysicsProps = new PhysicsProperties(); }
public static void SetAva(Server.TokenAndId tai, LightImage image, BrainDuelsLib.delegates.Action callback) { LightImage largeImage = image.CropToSize(SocketManager.Images.avatarSize.width, SocketManager.Images.avatarSize.height); LightImage miniImage = image.CropToSize(SocketManager.Images.miniAvatarSize.width, SocketManager.Images.miniAvatarSize.height); string content1 = ImageSerizlizer.Serialize(largeImage); string content2 = ImageSerizlizer.Serialize(miniImage); PictureRequest.SetPicture(tai, content1, callback, true); PictureRequest.SetPicture(tai, content2, callback, false); }
public int SetExtraParamsFromBytes(byte[] data, int pos) { int i = pos; int totalLength = 1; if (data.Length == 0 || pos >= data.Length) { return(0); } byte extraParamCount = data[i++]; for (int k = 0; k < extraParamCount; k++) { ExtraParamType type = (ExtraParamType)Utils.BytesToUInt16(data, i); i += 2; uint paramLength = Utils.BytesToUInt(data, i); i += 4; if (type == ExtraParamType.Flexible) { Flexible = new FlexibleData(data, i); } else if (type == ExtraParamType.Light) { Light = new LightData(data, i); } else if (type == ExtraParamType.LightImage) { LightMap = new LightImage(data, i); } else if (type == ExtraParamType.Sculpt || type == ExtraParamType.Mesh) { Sculpt = new SculptData(data, i); } i += (int)paramLength; totalLength += (int)paramLength + 6; } return(totalLength); }
public static void GetPicture(Server.TokenAndId tai, int serverIndex, int pictureId, BrainDuelsLib.delegates.Action <LightImage> imageCallback) { KeyValuePair <int, int> address = new KeyValuePair <int, int>(serverIndex, pictureId); if (picturesCache.ContainsKey(address)) { imageCallback(picturesCache[address]); return; } BrainDuelsLib.delegates.Action <string> resultCallback = delegate(string s){ LightImage li = ImageSerizlizer.Deserialize(s); picturesCache[address] = li; imageCallback(li); }; PictureRequest.GetPicture(tai, serverIndex, pictureId, resultCallback); return; }
public Primitive(Primitive prim) { CollisionPlane = prim.CollisionPlane; Flexible = prim.Flexible; Light = prim.Light; LightMap = prim.LightMap; Sculpt = prim.Sculpt; PrimData = prim.PrimData; // FIXME: Get a real copy constructor for TextureEntry instead of serializing to bytes and back if (prim.Textures != null) { byte[] textureBytes = prim.Textures.GetBytes(); Textures = new TextureEntry(textureBytes, 0, textureBytes.Length); } else { Textures = null; } TextureAnim = prim.TextureAnim; //ParticleSys = prim.ParticleSys; }
public abstract IImage MakeIImage(LightImage lightImage);