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

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

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

revision 79 by william, Thu Jul 15 21:50:56 2010 UTC revision 80 by william, Thu Jul 15 22:18:17 2010 UTC
# Line 10  namespace gr2lib.core.coretypes.implemen Line 10  namespace gr2lib.core.coretypes.implemen
10    
11      public class Material : IMaterial      public class Material : IMaterial
12      {      {
13            public Material()
14            {
15                this.NativePointer = IntPtr.Zero;
16                this.Name = "";
17                this.Maps = new List<Map>();
18                this.Texture = new Texture();
19                this.ExtendedData = IntPtr.Zero;
20            }
21    
22         internal static Material ReadFromMemory(IntPtr pointer)         internal static Material ReadFromMemory(IntPtr pointer)
23          {          {
24              if (pointer == IntPtr.Zero) return null;              if (pointer == IntPtr.Zero) return null;
# Line 26  namespace gr2lib.core.coretypes.implemen Line 35  namespace gr2lib.core.coretypes.implemen
35              IntPtr[] maps = Helpers.ReadPtrArrayFromMemory<native.Map>(native.Maps);              IntPtr[] maps = Helpers.ReadPtrArrayFromMemory<native.Map>(native.Maps);
36              int length = maps.Length;              int length = maps.Length;
37              managed.Maps = new List<Map>(length);              managed.Maps = new List<Map>(length);
38                foreach (IntPtr ptr in maps)
39                {
40                    managed.Maps.Add(new Map());
41                }
42              for (int i = 0; i < length; i++)              for (int i = 0; i < length; i++)
43              {              {
44                  managed.Maps[i] = Map.ReadFromMemory(maps[i]);                  managed.Maps[i] = Map.ReadFromMemory(maps[i]);
# Line 51  namespace gr2lib.core.coretypes.implemen Line 64  namespace gr2lib.core.coretypes.implemen
64          public List<Map> Maps { get { return _Maps; } set { _Maps = value; } }          public List<Map> Maps { get { return _Maps; } set { _Maps = value; } }
65          public Texture Texture { get { return _Texture; } set { _Texture = value; } }          public Texture Texture { get { return _Texture; } set { _Texture = value; } }
66          public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }          public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
67            public bool IsTexture { get { if (Texture == null) { return false; } else { return true; } } }
68          #endregion          #endregion
69      }      }
70  }  }

Legend:
Removed from v.79  
changed lines
  Added in v.80

  ViewVC Help
Powered by ViewVC 1.1.22