/[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

--- trunk/gr2lib/core/coretypes/implementation/Material.cs	2010/07/15 21:50:56	79
+++ trunk/gr2lib/core/coretypes/implementation/Material.cs	2010/07/15 22:18:17	80
@@ -10,6 +10,15 @@
 
     public class Material : IMaterial
     {
+        public Material()
+        {
+            this.NativePointer = IntPtr.Zero;
+            this.Name = "";
+            this.Maps = new List<Map>();
+            this.Texture = new Texture();
+            this.ExtendedData = IntPtr.Zero;
+        }
+
        internal static Material ReadFromMemory(IntPtr pointer)
         {
             if (pointer == IntPtr.Zero) return null;
@@ -26,6 +35,10 @@
             IntPtr[] maps = Helpers.ReadPtrArrayFromMemory<native.Map>(native.Maps);
             int length = maps.Length;
             managed.Maps = new List<Map>(length);
+            foreach (IntPtr ptr in maps)
+            {
+                managed.Maps.Add(new Map());
+            }
             for (int i = 0; i < length; i++)
             {
                 managed.Maps[i] = Map.ReadFromMemory(maps[i]);
@@ -51,6 +64,7 @@
         public List<Map> Maps { get { return _Maps; } set { _Maps = value; } }
         public Texture Texture { get { return _Texture; } set { _Texture = value; } }
         public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
+        public bool IsTexture { get { if (Texture == null) { return false; } else { return true; } } }
         #endregion
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22