/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/Texture.cs
ViewVC logotype

Diff of /trunk/gr2lib/core/coretypes/implementation/Texture.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 149 by william, Tue Jul 20 08:11:51 2010 UTC revision 160 by william, Thu Jul 22 10:20:55 2010 UTC
# Line 9  using gr2lib.core.exceptions; Line 9  using gr2lib.core.exceptions;
9  using gr2lib.core.ui.helpers;  using gr2lib.core.ui.helpers;
10  using System.ComponentModel;  using System.ComponentModel;
11  using gr2lib.core.typedefs;  using gr2lib.core.typedefs;
12    using gr2lib.core.ui.typeeditors;
13    using System.Drawing.Design;
14    
15  namespace gr2lib.core.coretypes.implementation  namespace gr2lib.core.coretypes.implementation
16  {  {
# Line 17  namespace gr2lib.core.coretypes.implemen Line 19  namespace gr2lib.core.coretypes.implemen
19          private GrannyRigResource _rigResource;          private GrannyRigResource _rigResource;
20    
21          private FilePath _FromFileName;          private FilePath _FromFileName;
22          private int _TextureType;          private NameValuePair<string, granny_texture_type> _TextureType;
23          private int _Width;          private int _Width;
24          private int _Height;          private int _Height;
25          private int _Encoding;          private NameValuePair<string, granny_texture_encoding> _Encoding;
26          private int _SubFormat;          private int _SubFormat;
27          private Layout _Layout;          private Layout _Layout;
28          private List<Image> _Images;          private List<Image> _Images;
# Line 37  namespace gr2lib.core.coretypes.implemen Line 39  namespace gr2lib.core.coretypes.implemen
39          public Texture()// : base("Textures")          public Texture()// : base("Textures")
40          {          {
41              this.FromFileName = "";              this.FromFileName = "";
42              this.TextureType = 0;              this.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyTextureTypeString(granny_texture_type.GrannyColorMapTextureType), granny_texture_type.GrannyColorMapTextureType);
43              this.Width = 0;              this.Width = 0;
44              this.Height = 0;              this.Height = 0;
45              this.Encoding = 0;              this.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyTextureEncodingString(granny_texture_encoding.GrannyBinkTextureEncoding), granny_texture_encoding.GrannyBinkTextureEncoding);
46              this.SubFormat = 0;              this.SubFormat = 0;
47              this.Layout = new Layout();              this.Layout = new Layout();
48              this.Images = new List<Image>();              this.Images = new List<Image>();
# Line 51  namespace gr2lib.core.coretypes.implemen Line 53  namespace gr2lib.core.coretypes.implemen
53          public Texture(int index)          public Texture(int index)
54          {          {
55              this.FromFileName = "";              this.FromFileName = "";
56              this.TextureType = 0;              this.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyTextureTypeString(granny_texture_type.GrannyColorMapTextureType), granny_texture_type.GrannyColorMapTextureType);
57              this.Width = 0;              this.Width = 0;
58              this.Height = 0;              this.Height = 0;
59              this.Encoding = 0;              this.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyTextureEncodingString(granny_texture_encoding.GrannyBinkTextureEncoding), granny_texture_encoding.GrannyBinkTextureEncoding);
60              this.SubFormat = 0;              this.SubFormat = 0;
61              this.Layout = new Layout();              this.Layout = new Layout();
62              this.Images = new List<Image>();              this.Images = new List<Image>();
# Line 107  namespace gr2lib.core.coretypes.implemen Line 109  namespace gr2lib.core.coretypes.implemen
109              {              {
110                  Texture managed = new Texture();                  Texture managed = new Texture();
111                  managed.FromFileName = native.FromFileName;                  managed.FromFileName = native.FromFileName;
112                  managed.TextureType = native.TextureType;                  managed.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyTextureTypeString((granny_texture_type)native.TextureType), (granny_texture_type)native.TextureType);
113                  managed.Width = native.Width;                  managed.Width = native.Width;
114                  managed.Height = native.Height;                  managed.Height = native.Height;
115                  managed.Encoding = native.Encoding;                  managed.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyTextureEncodingString((granny_texture_encoding)native.Encoding), (granny_texture_encoding)native.Encoding);
116                  managed.SubFormat = native.SubFormat;                  managed.SubFormat = native.SubFormat;
117                  managed.Layout = Layout.ReadFromNative(native.Layout);                  managed.Layout = Layout.ReadFromNative(native.Layout);
118                  IntPtr[] images = Helpers.ReadPtrArrayFromMemory<native.Image>(native.Images);                  IntPtr[] images = Helpers.ReadPtrArrayFromMemory<native.Image>(native.Images);
# Line 154  namespace gr2lib.core.coretypes.implemen Line 156  namespace gr2lib.core.coretypes.implemen
156    
157          #region ITexture Members          #region ITexture Members
158    
159          [RefreshPropertiesAttribute(RefreshProperties.All)]          //[RefreshPropertiesAttribute(RefreshProperties.All)]
160          public string TextureTypeFormat          //public string TextureTypeFormat
161          {          //{
162              get          //    get
163              {          //    {
164                  string texture_type = "Unknown Texture Type";          //        string texture_type = "Unknown Texture Type";
165    
166                  foreach (int val in Enum.GetValues(typeof(granny_texture_type)))          //        foreach (int val in Enum.GetValues(typeof(granny_texture_type)))
167                  {          //        {
168                      if (val == this.TextureType)          //            if (val == this.TextureType)
169                      {          //            {
170                          texture_type = Enum.GetName(typeof(granny_texture_type),val);          //                texture_type = Enum.GetName(typeof(granny_texture_type),val);
171                          break;          //                break;
172                      }          //            }
173                  }          //        }
174                  return texture_type;          //        return texture_type;
175              }          //    }
176          }          //}
177          [RefreshPropertiesAttribute(RefreshProperties.All)]          //[RefreshPropertiesAttribute(RefreshProperties.All)]
178          public string EncodingFormat          //public string EncodingFormat
179          {          //{
180              get          //    get
181              {          //    {
182                  string encodingformat = "Unknown Encoding Format";          //        string encodingformat = "Unknown Encoding Format";
183    
184                  foreach (int val in Enum.GetValues(typeof(granny_texture_encoding)))          //        foreach (int val in Enum.GetValues(typeof(granny_texture_encoding)))
185                  {          //        {
186                      if (val == this.Encoding)          //            if (val == this.Encoding)
187                      {          //            {
188                          encodingformat = Enum.GetName(typeof(granny_texture_encoding), val);          //                encodingformat = Enum.GetName(typeof(granny_texture_encoding), val);
189                          break;          //                break;
190                      }          //            }
191                  }          //        }
192                  return encodingformat;          //        return encodingformat;
193              }          //    }
194          }          //}
195    
196          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]
197          public FilePath FromFileName { get { return _FromFileName; } set { _FromFileName = value; } }          public FilePath FromFileName { get { return _FromFileName; } set { _FromFileName = value; } }
198          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]
199          public int TextureType { get { return _TextureType; } set { _TextureType = value; } }          [Editor(typeof(UIComboValueSelector<granny_texture_type, int>), typeof(UITypeEditor))]
200            public NameValuePair<string, granny_texture_type> TextureType { get { return _TextureType; } set { _TextureType = value; } }
201          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]
202          public int Width { get { return _Width; } set { _Width = value; } }          public int Width { get { return _Width; } set { _Width = value; } }
203          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]
204          public int Height { get { return _Height; } set { _Height = value; } }          public int Height { get { return _Height; } set { _Height = value; } }
205          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]
206          public int Encoding { get { return _Encoding; } set { _Encoding = value; } }          [Editor(typeof(UIComboValueSelector<granny_texture_encoding, int>), typeof(UITypeEditor))]
207            public NameValuePair<string, granny_texture_encoding> Encoding { get { return _Encoding; } set { _Encoding = value; } }
208          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]
209          public int SubFormat { get { return _SubFormat; } set { _SubFormat = value; } }          public int SubFormat { get { return _SubFormat; } set { _SubFormat = value; } }
210          [RefreshPropertiesAttribute(RefreshProperties.All)]          [RefreshPropertiesAttribute(RefreshProperties.All)]

Legend:
Removed from v.149  
changed lines
  Added in v.160

  ViewVC Help
Powered by ViewVC 1.1.22