/[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 106 by william, Sat Jul 17 14:52:37 2010 UTC revision 141 by william, Mon Jul 19 06:23:28 2010 UTC
# Line 6  using gr2lib.core.helpers; Line 6  using gr2lib.core.helpers;
6  using gr2lib.core.interfaces;  using gr2lib.core.interfaces;
7  using System.Diagnostics;  using System.Diagnostics;
8  using gr2lib.core.exceptions;  using gr2lib.core.exceptions;
9    using gr2lib.core.ui.helpers;
10    using System.ComponentModel;
11    using gr2lib.core.typedefs;
12    
13  namespace gr2lib.core.coretypes.implementation  namespace gr2lib.core.coretypes.implementation
14  {  {
15      public class Texture : ITexture      public class Texture : GrannyRigParentResource, ITexture
16      {      {
17            private GrannyRigResource _rigResource;
18    
19          private FilePath _FromFileName;          private FilePath _FromFileName;
20          private int _TextureType;          private int _TextureType;
21          private int _Width;          private int _Width;
# Line 21  namespace gr2lib.core.coretypes.implemen Line 26  namespace gr2lib.core.coretypes.implemen
26          private List<Image> _Images;          private List<Image> _Images;
27    
28    
29            public override string ToString()
30            {
31                return this.FromFileName.Name;
32            }
33                    
34    
35          public Texture()          public Texture() : base("Textures")
36          {          {
37              this.FromFileName = "";              this.FromFileName = "";
38              this.TextureType = 0;              this.TextureType = 0;
# Line 35  namespace gr2lib.core.coretypes.implemen Line 44  namespace gr2lib.core.coretypes.implemen
44              this.Images = new List<Image>();              this.Images = new List<Image>();
45              //this.ExtendedData = new IntPtr();              //this.ExtendedData = new IntPtr();
46              //this.NativePointer = IntPtr.Zero;              //this.NativePointer = IntPtr.Zero;
47                this._rigResource = new GrannyRigResource();
48            }
49            public Texture(int index)
50                : base("Textures")
51            {
52                this.FromFileName = "";
53                this.TextureType = 0;
54                this.Width = 0;
55                this.Height = 0;
56                this.Encoding = 0;
57                this.SubFormat = 0;
58                this.Layout = new Layout();
59                this.Images = new List<Image>();
60                //this.ExtendedData = new IntPtr();
61                //this.NativePointer = IntPtr.Zero;
62                this._rigResource = new GrannyRigResource();
63                this.Index = index;
64          }          }
   
65          internal static Texture ReadFromMemory(IntPtr pointer)          internal static Texture ReadFromMemory(IntPtr pointer)
66          {          {
67              try              try
# Line 96  namespace gr2lib.core.coretypes.implemen Line 121  namespace gr2lib.core.coretypes.implemen
121          }          }
122    
123          #region ITexture Members          #region ITexture Members
124    
125            [RefreshPropertiesAttribute(RefreshProperties.All)]
126            public string TextureTypeFormat
127            {
128                get
129                {
130                    string texture_type = "Unknown Texture Type";
131    
132                    foreach (int val in Enum.GetValues(typeof(granny_texture_type)))
133                    {
134                        if (val == this.TextureType)
135                        {
136                            texture_type = Enum.GetName(typeof(granny_texture_type),val);
137                            break;
138                        }
139                    }
140                    return texture_type;
141                }
142            }
143            [RefreshPropertiesAttribute(RefreshProperties.All)]
144            public string EncodingFormat
145            {
146                get
147                {
148                    string encodingformat = "Unknown Encoding Format";
149    
150                    foreach (int val in Enum.GetValues(typeof(granny_texture_encoding)))
151                    {
152                        if (val == this.Encoding)
153                        {
154                            encodingformat = Enum.GetName(typeof(granny_texture_encoding), val);
155                            break;
156                        }
157                    }
158                    return encodingformat;
159                }
160            }
161    
162            [RefreshPropertiesAttribute(RefreshProperties.All)]
163          public FilePath FromFileName { get { return _FromFileName; } set { _FromFileName = value; } }          public FilePath FromFileName { get { return _FromFileName; } set { _FromFileName = value; } }
164            [RefreshPropertiesAttribute(RefreshProperties.All)]
165          public int TextureType { get { return _TextureType; } set { _TextureType = value; } }          public int TextureType { get { return _TextureType; } set { _TextureType = value; } }
166            [RefreshPropertiesAttribute(RefreshProperties.All)]
167          public int Width { get { return _Width; } set { _Width = value; } }          public int Width { get { return _Width; } set { _Width = value; } }
168            [RefreshPropertiesAttribute(RefreshProperties.All)]
169          public int Height { get { return _Height; } set { _Height = value; } }          public int Height { get { return _Height; } set { _Height = value; } }
170            [RefreshPropertiesAttribute(RefreshProperties.All)]
171          public int Encoding { get { return _Encoding; } set { _Encoding = value; } }          public int Encoding { get { return _Encoding; } set { _Encoding = value; } }
172            [RefreshPropertiesAttribute(RefreshProperties.All)]
173          public int SubFormat { get { return _SubFormat; } set { _SubFormat = value; } }          public int SubFormat { get { return _SubFormat; } set { _SubFormat = value; } }
174            [RefreshPropertiesAttribute(RefreshProperties.All)]
175            [Browsable(true)]
176          public Layout Layout { get { return _Layout; } set { _Layout = value; } }          public Layout Layout { get { return _Layout; } set { _Layout = value; } }
177            [RefreshPropertiesAttribute(RefreshProperties.All)]
178          public List<Image> Images { get { return _Images; } set { _Images = value; } }          public List<Image> Images { get { return _Images; } set { _Images = value; } }
179          #endregion          #endregion
180    
# Line 115  namespace gr2lib.core.coretypes.implemen Line 187  namespace gr2lib.core.coretypes.implemen
187          private IntPtr _ExtendedData;          private IntPtr _ExtendedData;
188          public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }          public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
189          #endregion          #endregion
190    
191            #region IResource Members
192            private int _index;
193            [RefreshPropertiesAttribute(RefreshProperties.All)]
194            internal int Index { get { return _index; } set { _index = value; } }
195            #endregion
196            #region IEmbeddedResource Members
197            [RefreshPropertiesAttribute(RefreshProperties.All)]
198            internal string IndexName { get { return new GrannyRigResource("Texture", this.Index, this.Name).ResourceBlockIndexFormat; } }
199            [RefreshPropertiesAttribute(RefreshProperties.All)]
200            internal string FullName { get { return new GrannyRigResource("Texture", this.Index, this.Name).ResourceBlockFormat; } }
201            [RefreshPropertiesAttribute(RefreshProperties.All)]
202            internal string Name { get { return this.FromFileName; } set { this.FromFileName = value; } }
203            #endregion
204      }      }
205  }  }

Legend:
Removed from v.106  
changed lines
  Added in v.141

  ViewVC Help
Powered by ViewVC 1.1.22