/// <summary> /// 各種パラメータを指定して DebugText クラスの新しいインスタンスを初期化します。 /// </summary> /// <param name="options">デバッグ表示のテキストに用いられるテキストオプション。</param> /// <param name="Window">デバッグ表示が行われるウィンドウ。</param> public DebugText(TextOptions options, SitrineWindow window) { if (options == null) { throw new ArgumentNullException("options"); } if (window == null) { throw new ArgumentNullException("window"); } this.textOptions = options; this.textOptions.SetSolidBrushes(Color.White, Color.FromArgb(128, Color.Black), Color.Green, Color.Yellow, Color.Red); this.textOptions.ShadowIndex = 1; this.textOptions.DrawShadow = true; this.debugTexture = new TextTexture(this.textOptions, new Size(window.TargetSize.Width, (int)options.LineHeight + 1)); this.debugTextTexture = new TextTexture(this.textOptions, new Size(window.TargetSize.Width, (int)(options.LineHeight + 1) * 4 + 1)); this.debugTextTexture.Position = new PointF(0f, options.LineHeight + 1); this.window = window; this.textures = window.Textures; this.textQueue = new LinkedList <TextItem>(); #if DEBUG this.IsVisible = true; #else this.IsVisible = false; #endif }
public ANIM(int APIversion, EventHandler handler, uint version, float framerate, IList <TextureFrame> textures) : this(APIversion, handler) { mVersion = version; mFramerate = framerate; mFrames = new TextureList(handler, textures); }
public void GetData(PmxModelData data) { var header = new PmxHeaderData() { Version = 2.0F }; var boneSlot = new PmxSlotData() { SlotName = "弾ボーン", Type = PmxSlotData.SLOT_TYPE_BONE, Indices = Enumerable.Range(0, BoneList.Count).ToArray() }; var morphSlot = new PmxSlotData() { SlotName = "弾モーフ", Type = PmxSlotData.SLOT_TYPE_MORPH, Indices = Enumerable.Range(0, MorphList.Count).ToArray() }; data.Header = header; data.VertexIndices = IndexList.ToArray(); data.TextureFiles = TextureList.ToArray(); data.VertexArray = VertexList.ToArray(); data.MaterialArray = MaterialList.ToArray(); data.BoneArray = BoneList.ToArray(); data.MorphArray = MorphList.ToArray(); data.SlotArray = new PmxSlotData[] { boneSlot, morphSlot }; }
public void SetupMaterials(ShotProperty prop, PmxMaterialData[] materials, string[] textures) { foreach (var texture in textures) { if (!TextureList.Contains(texture)) { TextureList.Add(texture); } } foreach (PmxMaterialData material in materials) { material.MaterialName = "MA_" + MaterialList.Count.ToString(); if (0 <= material.TextureId && material.TextureId < textures.Length) { material.TextureId = TextureList.IndexOf(textures[material.TextureId]); } else { material.TextureId = -1; } if (0 <= material.SphereId && material.SphereId < textures.Length) { material.SphereId = TextureList.IndexOf(textures[material.SphereId]); } else { material.SphereId = -1; } MaterialList.Add(material); } }
public SequenceEditorWindow(TextureList seq) { InitializeComponent(); Value = seq; Width = 600; Height = 400; this.Text = "Редактор анимации"; this.StartPosition = FormStartPosition.CenterParent; // for (int i = 0; i < seq.Count; i++) { PictureBox img = new PictureBox(); img.Parent = panel; img.Width = 128; img.Height = 128; img.SizeMode = PictureBoxSizeMode.Zoom; img.Tag = seq[i]; img.Click += img_Click; MemoryStream ms = new MemoryStream(); ms.Write(seq[i].bytes, 0, seq[i].bytes.Length); ms.Seek(0, SeekOrigin.Begin); Bitmap bmp = new Bitmap(ms); ms.Dispose(); img.Image = bmp; } }
public TextureBrowser() { var sz = GetMemory("SizeMode", 2); var so = GetMemory("SortBy", 0); InitializeComponent(); TextureList.TextureSelected += TextureSelected; TextureList.SelectionChanged += SelectionChanged; SizeCombo.SelectedIndex = 2; _textures = new List <TextureItem>(); _packages = new List <TexturePackage>(); SelectedTexture = null; SortOrderCombo.Items.Clear(); foreach (var tso in Enum.GetValues(typeof(TextureListPanel.TextureSortOrder))) { SortOrderCombo.Items.Add(tso); } SortOrderCombo.SelectedIndex = 0; FilterTextbox.Text = GetMemory("Filter", ""); UsedTexturesOnlyBox.Checked = GetMemory("UsedTexturesOnly", false); SizeCombo.SelectedIndex = sz; SortOrderCombo.SelectedIndex = so; SortDescendingCheckbox.Checked = GetMemory("SortDescending", false); SelectionChanged(null, TextureList.GetSelectedTextures()); }
private void UpdateTextureList() { var list = FavouritesTree.SelectedNode != null?GetFavouriteFolderTextures() : GetPackageTextures(); if (!String.IsNullOrEmpty(FilterTextbox.Text)) { list = list.Where(x => x.Name.ToLower().Contains(FilterTextbox.Text.ToLower())); } if (UsedTexturesOnlyBox.Checked && DocumentManager.CurrentDocument != null) { var used = DocumentManager.CurrentDocument.GetUsedTextures().ToList(); list = list.Where(x => used.Any(y => String.Equals(x.Name, y, StringComparison.InvariantCultureIgnoreCase))); } var l = list.ToList(); TextureList.SetTextureList(l); var sel = DocumentManager.CurrentDocument == null ? null : DocumentManager.CurrentDocument.TextureCollection.SelectedTexture; if (sel != null) { TextureList.SetSelectedTextures(new [] { sel }); TextureList.ScrollToItem(sel); } }
public MouseCursor(string filename, int offsx, int offsy, long delay) { Sprite = Images.LoadSprite(filename); OffsetX = offsx; OffsetY = offsy; Delay = delay; OwnImage = true; }
public MouseCursor(TextureList sprite, int offsx, int offsy, long delay) { Sprite = sprite; OffsetX = offsx; OffsetY = offsy; Delay = delay; OwnImage = false; }
private void BtnClear_Click(object sender, EventArgs e) { TextureList.flush(true); if (renderer != null) { renderer.removeAllTextures(); } }
/// <summary> /// テクスチャをすべて削除します。 /// </summary> public void Destroy() { foreach (var texture in TextureList) { texture.Destroy(); } TextureList.Clear(); }
private void updateTexturesList() { TextureList.flush(); PicPreview.Image = null; foreach (loadedTexture tex in bch.mips[mipSel].textures) { TextureList.addItem(tex.texture.name); } TextureList.Refresh(); }
void MissingTexturesForm_Load(object sender, EventArgs e) { // Populate the list TextureList.Items.Clear(); foreach (var item in _missingTextures) { var listItem = new TextureListItem(item.Key, item.Value); TextureList.AddItemAndReselect(listItem); } }
public static void SetCursor(TextureList tl, int offsx, int offsy, long delay) { if (ActiveCursor == null || ActiveCursor.Sprite != tl || ActiveCursor.OffsetX != offsx || ActiveCursor.OffsetY != offsy || ActiveCursor.Delay != delay) { ActiveCursor = new MouseCursor(tl, offsx, offsy, delay); } }
private void SelectButtonClicked(object sender, EventArgs e) { var sel = TextureList.GetSelectedTextures().ToList(); if (!sel.Any()) { return; } Mediator.Publish(EditorMediator.SelectMatchingTextures, sel.Select(x => x.Name).ToList()); Close(); }
protected override void Parse(Stream s) { var br = new BinaryReader(s); string tag = FOURCC(br.ReadUInt32()); if (checking && !tag.Equals(Tag)) { throw new InvalidDataException("Bad tag: expected " + Tag + ", but got " + tag); } mVersion = br.ReadUInt32(); mFramerate = br.ReadSingle(); mFrames = new TextureList(handler, s); }
private void TextureListEditor_Load(object sender, EventArgs e) { levelList.BeginUpdate(); foreach (KeyValuePair <string, SplitTools.FileInfo> item in Program.IniData.SelectMany(a => a.Files).Where(b => b.Value.Type.Equals("texlist", StringComparison.OrdinalIgnoreCase))) { string path = Path.Combine(Program.project.GameInfo.ProjectFolder, item.Value.Filename); textureLists.Add(new KeyValuePair <string, TextureListEntry[]>(path, TextureList.Load(path))); levelList.Items.Add(item.Key); } levelList.EndUpdate(); levelList.SelectedIndex = 0; textureName.Directory = Path.Combine(SAModel.SAEditorCommon.ProjectManagement.ProjectFunctions.GetGamePath(Program.project.GameInfo.GameName), Program.project.GameInfo.GameDataFolder); }
/// <summary> /// Returns a texture. /// </summary> /// <param name="name">The name of the texture.</param> /// <param name="r">The rectangle to get the texture from.</param> /// <param name="texturePath">The texture path to load a texture from.</param> public static Texture2D GetTexture(string name, Rectangle r, string texturePath) { // -- Temp workaround texturePath = texturePath.Replace(@"\", @"|"); var path = !string.IsNullOrEmpty(texturePath) ? $"{texturePath}|{name}" : name; var key = path + "," + r.X + "," + r.Y + "," + r.Width + "," + r.Height; if (!TextureList.ContainsKey(key)) { TextureList.Add(key, TextureRectangle(GetTexture(path), r)); } return(TextureList[key]); }
public void BuildFace(BlockCorners corners, TextureList texture, int rotation) { float light = 0.5f; Color color = Color.White; Vector2[] textureMapping = TextureHelper.RequestTexture(texture, rotation); addVertex(corners.FrontUpperRight, textureMapping[0], light, color); addVertex(corners.BackUpperRight, textureMapping[1], light, color); addVertex(corners.FrontLowerRight, textureMapping[2], light, color); addVertex(corners.BackLowerRight, textureMapping[3], light, color); addIndex(0, 1, 3, 0, 3, 2); }
public void Write(FileWriter writer) { RecalculateMaterialReferences(); writer.SetByteOrder(IsBigEndian); writer.WriteSignature(Magic); if (Magic == "TYLR") { writer.ReverseMagic = true; } writer.Write(ByteOrderMark); writer.Write((ushort)Version); writer.Write(uint.MaxValue); //Reserve space for file size later writer.Write(HeaderSize); writer.Write(ushort.MaxValue); //Reserve space for section count later int sectionCount = 1; WriteSection(writer, "lyt1", LayoutInfo, () => LayoutInfo.Write(writer, this)); if (TextureList != null && TextureList.Textures.Count > 0) { WriteSection(writer, "txl1", TextureList, () => TextureList.Write(writer, this)); sectionCount++; } if (FontList != null && FontList.Fonts.Count > 0) { WriteSection(writer, "fnl1", FontList, () => FontList.Write(writer, this)); sectionCount++; } if (MaterialList != null && MaterialList.Materials.Count > 0) { WriteSection(writer, "mat1", MaterialList, () => MaterialList.Write(writer, this)); sectionCount++; } WritePanes(writer, RootPane, this, ref sectionCount); WriteGroupPanes(writer, RootGroup, this, ref sectionCount); //Write the total section count using (writer.TemporarySeek(14, System.IO.SeekOrigin.Begin)) { writer.Write((ushort)sectionCount); } //Write the total file size using (writer.TemporarySeek(8, System.IO.SeekOrigin.Begin)) { writer.Write((uint)writer.BaseStream.Length); } }
private void updateList(List <RenderBase.OTexture> textures) { TextureList.flush(); TextureList.addColumn(new OList.columnHeader(128, "#")); TextureList.addColumn(new OList.columnHeader(128, "Name")); foreach (RenderBase.OTexture texture in textures) { OList.listItemGroup item = new OList.listItemGroup(); item.columns.Add(new OList.listItem(null, texture.texture)); item.columns.Add(new OList.listItem(texture.name)); TextureList.addItem(item); } TextureList.Refresh(); }
private void BtnDelete_Click(object sender, EventArgs e) { if (TextureList.SelectedIndex == -1) { return; } if (renderer != null) { renderer.removeTexture(TextureList.SelectedIndex); } //Note: The SelectedIndex will change after this is called, so don't add it before the removeTexture! TextureList.removeItem(TextureList.SelectedIndex); }
/// <summary> /// Returns a texture. /// </summary> /// <param name="path">The path to the texture.</param> public static Texture2D GetTexture(string path) { // -- Temp workaround path = path.Replace(@"\", @"|"); var key = $"{path},FULL_IMAGE"; if (!TextureList.ContainsKey(key)) { TextureList.Add(key, new ContentFolder().GetTexture(path)); } return(TextureList[key]); }
public override Stream UnParse() { var s = new MemoryStream(); var bw = new BinaryWriter(s); bw.Write((uint)FOURCC(Tag)); bw.Write(mVersion); bw.Write(mFramerate); if (mFrames == null) { mFrames = new TextureList(handler); } mFrames.UnParse(s); return(s); }
public Game1() { defColor = Color.CornflowerBlue; graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferHeight = 720; graphics.PreferredBackBufferWidth = 1280; _world = new World(new Vector2(0, 0));// textures = new TextureList(); Content.RootDirectory = "Content"; currentState = new ServerState(); currentState = ServerState.waitingPlayers; previousState = new ServerState(); previousState = ServerState.waitingPlayers; server.StartServer(); _currentState = new WaitingPlayersState(this, graphics.GraphicsDevice, Content); }
public static Vector2[] RequestTexture(TextureList texture, int rotation) { Vector2[] UVList = new Vector2[4]; int y = (int)texture / ATLAS_SIZE; int x = (int)texture % ATLAS_SIZE; float ofs = 1f / ((float)ATLAS_SIZE); float yOfs = y * ofs; float xOfs = x * ofs; switch (rotation) { case 1: UVList[1] = new Vector2(xOfs, yOfs); // 0,0 UVList[3] = new Vector2(xOfs + ofs, yOfs); // 1,0 UVList[0] = new Vector2(xOfs, yOfs + ofs); // 0,1 UVList[2] = new Vector2(xOfs + ofs, yOfs + ofs); // 1,1 break; case 2: UVList[3] = new Vector2(xOfs, yOfs); // 0,0 UVList[2] = new Vector2(xOfs + ofs, yOfs); // 1,0 UVList[1] = new Vector2(xOfs, yOfs + ofs); // 0,1 UVList[0] = new Vector2(xOfs + ofs, yOfs + ofs); // 1,1 break; case 3: UVList[2] = new Vector2(xOfs, yOfs); // 0,0 UVList[0] = new Vector2(xOfs + ofs, yOfs); // 1,0 UVList[3] = new Vector2(xOfs, yOfs + ofs); // 0,1 UVList[1] = new Vector2(xOfs + ofs, yOfs + ofs); // 1,1 break; default: UVList[0] = new Vector2(xOfs, yOfs); // 0,0 UVList[1] = new Vector2(xOfs + ofs, yOfs); // 1,0 UVList[2] = new Vector2(xOfs, yOfs + ofs); // 0,1 UVList[3] = new Vector2(xOfs + ofs, yOfs + ofs); // 1,1 break; } return(UVList); }
private void RemoveFavouriteItemButtonClicked(object sender, EventArgs e) { var selection = TextureList.GetSelectedTextures().Select(x => x.Name); var folder = FavouritesTree.SelectedNode; var node = folder == null ? null : folder.Tag as FavouriteTextureFolder; var nodes = new List <FavouriteTextureFolder>(); CollectNodes(nodes, node == null ? SettingsManager.FavouriteTextureFolders : node.Children); if (node != null) { nodes.Add(node); } nodes.ForEach(x => x.Items.RemoveAll(selection.Contains)); UpdateFavouritesList(); UpdateTextureList(); }
private void ConvertTexture2D(Texture2D tex2D, string name) { ImportedTexture iTex = ImportedHelpers.FindTexture(name, TextureList); if (iTex != null) { return; } using (MemoryStream memStream = new MemoryStream()) { tex2D.Export(memStream); memStream.Position = 0; iTex = new ImportedTexture(memStream, name); } TextureList.Add(iTex); }
public override AssetList ImportMany(string path) { TextureList textures = new TextureList(); PIX pix = PIX.Load(path); foreach (PIXIE pixelmap in pix.Pixies) { Texture texture = new Texture { FileName = pixelmap.Name }; texture.CreateFromBitmap(pixelmap.GetBitmap(), pixelmap.Name); textures.Entries.Add(texture); } return(textures); }
public static void Load(string name) { TextureList target = new TextureList(name); Object [] ResourcesList = Resources.LoadAll("Animations/" + name, typeof(Texture)); if (ResourcesList.Length == 0) { Debug.LogError("No animation: '" + name + "'"); } target.textures = new List <Texture> (); for (int i = 0; i < ResourcesList.Length; i++) { target.textures.Add(ResourcesList[i] as Texture); } animations_.Add(target); }
private void UpdateTextureList() { var OpenglGpuImpl = (OpenglGpuImpl)PspDisplayForm.Singleton.IGuiExternalInterface.InjectContext.GetInstance <GpuImpl>(); TextureList.SuspendLayout(); try { TextureList.Items.Clear(); foreach (var Element in OpenglGpuImpl.TextureCache.Cache.Values) { TextureList.Items.Add(new TextureElement(Element)); } } finally { TextureList.ResumeLayout(); } }
/// <summary> /// ウィンドウオプションを指定して SitrineWindow クラスの新しいインスタンスを初期化します。 /// </summary> /// <param name="options">ウィンドウオプション。</param> public SitrineWindow(WindowOptions options) : base(options.WindowSize.Width, options.WindowSize.Height, GraphicsMode.Default, options.Title) { if (options == null) throw new ArgumentNullException("options"); this.music = new MusicPlayer(new MusicOptions()); this.textures = new TextureList(); this.TargetSize = options.TargetSize; this.textOptions = options.TextOptions; this.stories = new List<Storyboard>(); this.renderStories = new List<RenderStoryboard>(); this.reservedStories = new List<Storyboard>(); this.removingStories = new List<Storyboard>(); this.debugText = new DebugText(options.DebugTextOptions, this); Trace.Listeners.Add(new DebugTextListener(this.debugText)); Trace.WriteLine("Window", "Init"); }
public override AssetList ImportMany(string path) { TextureList textures = new TextureList(); var pix = PIX.Load(path); foreach (var pixelmap in pix.Pixies) { Texture texture = new Texture(); texture.CreateFromBitmap(pixelmap.GetBitmap(), pixelmap.Name); textures.Entries.Add(texture); } //texture.SetData(tdx.Name, tdx.Format.ToString(), tdx.MipMaps[0].Width, tdx.MipMaps[0].Height, tdx.MipMaps[0].Data); //texture.SupportingDocuments["Source"] = tdx; //texture.FileName = path; return textures; }
public static WLD Load(Stream stream,string name="default.wld") { WLD wld = new WLD(); wld.Name = name; int size = Marshal.SizeOf(typeof(WLDHeader)); var barray = new byte[size]; stream.Read(barray, 0, size); var header = Functions.ByteArrayToStructure<WLDHeader>(barray); if (header.Magic != 0x54503d02) { throw new Exception("Invalid file format"); } if (header.Version == 0x00015500) { wld._format = Format.Old; } else if (header.Version == 0x1000C800) { wld._format = Format.New; } else { throw new Exception("Unknown file version"); } //var shash = stream.Position; barray = new byte[header.StringHashSize]; stream.Read(barray, 0, (int)header.StringHashSize); wld._sHash = WLD.DecodeFileName(barray); wld._strings = wld._sHash.Split('\0'); var fragCount = header.FragmentCount; stream.Seek(size + header.StringHashSize, SeekOrigin.Begin); int fragSize = Marshal.SizeOf(typeof(BasicWLDFragment)); for (int i = 0; i < header.FragmentCount; i++) { barray = new byte[fragSize]; stream.Read(barray, 0, fragSize); var fragment = Functions.ByteArrayToStructure<BasicWLDFragment>(barray); int nameRef = (int)fragment.NameRef; var position = stream.Position; switch (fragment.Id) { case 0x03: var bmpname = new BitmapName(i, nameRef); bmpname.Handler(stream); wld._fragments.Add(bmpname); break; case 0x04: var binfo = new BitmapInfo(i, nameRef); binfo.Handler(stream); wld._fragments.Add(binfo); break; case 0x05: var bitmapInfoRef = new BitmapInfoReference(i, nameRef); bitmapInfoRef.Handler(stream); wld._fragments.Add(bitmapInfoRef); break; case 0x09: break; case 0x10: var skelset = new SkeletonTrackSet(i, nameRef); skelset.Handler(stream); skelset.FragmentName = wld.GetStringAtHashIndex(0-skelset.FragmentNameRef); wld._fragments.Add(skelset); break; case 0x11: var skeltrackRef = new SkeletonTrackReference(i, nameRef); skeltrackRef.Handler(stream); wld._fragments.Add(skeltrackRef); break; case 0x12: var skelpiece = new SkeletonPieceTrack(i, nameRef); skelpiece.Handler(stream); wld._fragments.Add(skelpiece); break; case 0x13: var skelpref = new SkeletonPieceTrackReference(i, nameRef); skelpref.Handler(stream); //skelpref.FragmentName = wld.GetStringAtHashIndex(0 - skelpref.FragmentNameRef); wld._fragments.Add(skelpref); break; case 0x14: var modelref = new ModelReference(i, nameRef); modelref.Handler(stream); modelref.FragmentName = wld.GetStringAtHashIndex(0 - modelref.FragmentNameRef); wld._fragments.Add(modelref); modelref.MagicString = wld.GetStringAtHashIndex(modelref.MagicStringRef); break; case 0x15: var objlocation = new ObjectLocation(i, nameRef); objlocation.Handler(stream); wld._fragments.Add(objlocation); break; case 0x22: //num_0x22++; break; case 0x2d: var meshref = new MeshReference(i, nameRef); meshref.Handler(stream); wld._fragments.Add(meshref); break; case 0x31: var tlist = new TextureList(i, nameRef); tlist.Handler(stream); wld._fragments.Add(tlist); break; case 0x30: var texture = new Texture(i, nameRef); texture.Handler(stream); wld._fragments.Add(texture); break; // Grab the number of vertices and polygons case 0x36: var mesh = new Mesh(i, nameRef); mesh.Handler(stream); wld._fragments.Add(mesh); break; } stream.Seek(position + fragment.Size - 4, SeekOrigin.Begin); } return wld; }
public BitmapImageInfo GetImage(TextureList list, int index) { var textIndex = list.TextureReference.ElementAt(index); var texture = Textures.FirstOrDefault(x => x.FragmentNumber == textIndex); if (texture == null) return null; var infoRef = BitmapInfoReferences.FirstOrDefault(x => x.FragmentNumber == texture.FragmentReference); if (infoRef == null) return null; var bmpInfo = BitmapInfos.FirstOrDefault(x => x.FragmentNumber == infoRef.FragmentReference); if (bmpInfo == null) return null; if (bmpInfo.FragmentReferences.Count > 0) { var name = BitmapNames.FirstOrDefault(x => x.FragmentNumber == bmpInfo.FragmentReferences.ElementAt(0)); if (name == null) return null; var f = name.File.ToLower(); if (_bitmaps.ContainsKey(f)) { return _bitmaps[f]; //return new BitmapImageInfo(_bitmaps[name.File.ToLower()],name.File.ToLower()); } else return null; } else return null; }
/// <summary> /// 各種パラメータを指定して DebugText クラスの新しいインスタンスを初期化します。 /// </summary> /// <param name="options">デバッグ表示のテキストに用いられるテキストオプション。</param> /// <param name="Window">デバッグ表示が行われるウィンドウ。</param> public DebugText(TextOptions options, SitrineWindow window) { if (options == null) throw new ArgumentNullException("options"); if (window == null) throw new ArgumentNullException("window"); this.textOptions = options; this.textOptions.SetSolidBrushes(Color.White, Color.FromArgb(128, Color.Black), Color.Green, Color.Yellow, Color.Red); this.textOptions.ShadowIndex = 1; this.textOptions.DrawShadow = true; this.debugTexture = new TextTexture(this.textOptions, new Size(window.TargetSize.Width, (int)options.LineHeight + 1)); this.debugTextTexture = new TextTexture(this.textOptions, new Size(window.TargetSize.Width, (int)(options.LineHeight + 1) * 4 + 1)); this.debugTextTexture.Position = new PointF(0f, options.LineHeight + 1); this.window = window; this.textures = window.Textures; this.textQueue = new LinkedList<TextItem>(); #if DEBUG this.IsVisible = true; #else this.IsVisible = false; #endif }