public OpenGLTextureReference(System.Xml.XmlReader r, List<OpenGLTexture> textures) { var icult = System.Globalization.CultureInfo.InvariantCulture; while (r.Read ()) { if (r.IsStartElement ("Texture")) { var ti = int.Parse (r.GetAttribute ("Id"), icult); if (ti >= 0 && ti < textures.Count) { Texture = textures[ti]; Texture.AddReference (this); } else { Texture = null; return; } X = float.Parse (r.GetAttribute ("X"), icult); Y = float.Parse (r.GetAttribute ("Y"), icult); Width = float.Parse (r.GetAttribute ("Width"), icult); Height = float.Parse (r.GetAttribute ("Height"), icult); U = float.Parse (r.GetAttribute ("U"), icult); V = float.Parse (r.GetAttribute ("V"), icult); TexWidth = float.Parse (r.GetAttribute ("TexWidth"), icult); TexHeight = float.Parse (r.GetAttribute ("TexHeight"), icult); var soX = float.Parse (r.GetAttribute ("OffsetX"), icult); var soY = float.Parse (r.GetAttribute ("OffsetY"), icult); ShapeOffset = new Vector2 (soX, soY); } } }
protected override void WriteTexture(int id, OpenGLTexture texture) { var bmp = (BitmapTexture)texture; var path = System.IO.Path.Combine (ShapeStorePath, "Texture" + id + ".png"); bmp.WritePng (path); }
protected virtual void WriteTexture(int id, OpenGLTexture texture) { throw new NotSupportedException (); }