Beispiel #1
0
        internal static void RequestResources(ref MyVoxelMaterialDetailSet set)
        {
            MyFileTextureManager texManager = MyManagers.FileTextures;

            foreach (var filepath in set.ColorMetalXZnY_Filepaths)
            {
                texManager.GetTexture(filepath, MyFileTextureEnum.COLOR_METAL);
            }
            foreach (var filepath in set.ColorMetalY_Filepaths)
            {
                texManager.GetTexture(filepath, MyFileTextureEnum.COLOR_METAL);
            }

            foreach (var filepath in set.NormalGlossXZnY_Filepaths)
            {
                texManager.GetTexture(filepath, MyFileTextureEnum.NORMALMAP_GLOSS);
            }
            foreach (var filepath in set.NormalGlossY_Filepaths)
            {
                texManager.GetTexture(filepath, MyFileTextureEnum.NORMALMAP_GLOSS);
            }

            foreach (var filepath in set.ExtXZnY_Filepaths)
            {
                texManager.GetTexture(filepath, MyFileTextureEnum.EXTENSIONS);
            }
            foreach (var filepath in set.ExtY_Filepaths)
            {
                texManager.GetTexture(filepath, MyFileTextureEnum.EXTENSIONS);
            }
        }
        internal static void OnResourcesGather()
        {
            foreach (var id in MaterialQueryResourcesTable)
            {
                MyVoxelMaterialDetailSet.ReleaseResources(ref Table[id].Near);
                MyVoxelMaterialDetailSet.PrepareArrays(ref Table[id].Near);

                MyVoxelMaterialDetailSet.ReleaseResources(ref Table[id].Far1);
                MyVoxelMaterialDetailSet.PrepareArrays(ref Table[id].Far1);

                MyVoxelMaterialDetailSet.ReleaseResources(ref Table[id].Far2);
                MyVoxelMaterialDetailSet.PrepareArrays(ref Table[id].Far2);
            }

            if (MaterialQueryResourcesTable.Count > 0)
            {
                // because array of foliage might have changed
                RebuildMaterialFoliageTable();

                // traverse and update all existing proxies
                foreach (var kv in MaterialProxyTripleIndex)
                {
                    MyMaterials1.ProxyPool.Data[kv.Value.Index] = CreateProxy(kv.Key);
                }
            }

            MaterialQueryResourcesTable.Clear();
        }
Beispiel #3
0
        internal static void ReleaseResources(ref MyVoxelMaterialDetailSet set)
        {
            MyFileArrayTextureManager texManager = MyManagers.FileArrayTextures;

            texManager.DisposeTex(ref set.ColorMetalArray);
            texManager.DisposeTex(ref set.NormalGlossArray);
            texManager.DisposeTex(ref set.ExtArray);
        }
 internal static void ReleaseResources()
 {
     for (int i = 0; i < Table.Length; i++)
     {
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Near);
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Far1);
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Far2);
     }
 }
Beispiel #5
0
        internal static void RequestResources(ref MyVoxelMaterialDetailSet set)
        {
            MyTextureManager.GetColorMetalTexture(set.ColorMetalXZnY_Texture);
            MyTextureManager.GetColorMetalTexture(set.ColorMetalpY_Texture);

            MyTextureManager.GetNormalGlossTexture(set.NormalGlossXZnY_Texture);
            MyTextureManager.GetNormalGlossTexture(set.NormalGlosspY_Texture);

            MyTextureManager.GetExtensionsTexture(set.ExtXZnY_Texture);
            MyTextureManager.GetExtensionsTexture(set.ExtpY_Texture);
        }
        //internal static void ReleaseResources()
        //{
        //    for (int i = 0; i < Table.Length; i++)
        //    {
        //        MyFileArrayTextureManager manager = MyManagers.FileArrayTextures;
        //        if (Table[i].FoliageColorTextureArray != null)
        //            manager.DisposeTex(ref Table[i].FoliageColorTextureArray);
        //        if (Table[i].FoliageNormalTextureArray != null)
        //            manager.DisposeTex(ref Table[i].FoliageNormalTextureArray);
        //    }
        //}

        internal static void OnResourcesRequesting()
        {
            foreach (var id in MaterialQueryResourcesTable)
            {
                // query all textures
                MyVoxelMaterialDetailSet.RequestResources(ref Table[id].Resource);
                //MyTextureManager.GetTexture(Table[id].FoliageArray_Texture);
                MyFileTextureManager texManager = MyManagers.FileTextures;
                texManager.GetTexture(Table[id].FoliageArray_Texture, MyFileTextureEnum.COLOR_METAL);
            }
        }
Beispiel #7
0
        internal static void RequestResources(ref MyVoxelMaterialDetailSet set)
        {
            MyTextures.GetTexture(set.ColorMetalXZnY_Texture, null, MyTextureEnum.COLOR_METAL);
            MyTextures.GetTexture(set.ColorMetalpY_Texture, null, MyTextureEnum.COLOR_METAL);

            MyTextures.GetTexture(set.NormalGlossXZnY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS);
            MyTextures.GetTexture(set.NormalGlosspY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS);

            MyTextures.GetTexture(set.ExtXZnY_Texture, null, MyTextureEnum.EXTENSIONS);
            MyTextures.GetTexture(set.ExtpY_Texture, null, MyTextureEnum.EXTENSIONS);
        }
        internal static void RequestResources(ref MyVoxelMaterialDetailSet set)
        {
            MyTextures.GetTexture(set.ColorMetalXZnY_Texture, null, MyTextureEnum.COLOR_METAL);
            MyTextures.GetTexture(set.ColorMetalpY_Texture, null, MyTextureEnum.COLOR_METAL);

            MyTextures.GetTexture(set.NormalGlossXZnY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS);
            MyTextures.GetTexture(set.NormalGlosspY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS);

            MyTextures.GetTexture(set.ExtXZnY_Texture, null, MyTextureEnum.EXTENSIONS);
            MyTextures.GetTexture(set.ExtpY_Texture, null, MyTextureEnum.EXTENSIONS);
        }
Beispiel #9
0
        internal static void RequestResources(ref MyVoxelMaterialDetailSet set)
        {
            MyFileTextureManager texManager = MyManagers.FileTextures;

            texManager.GetTexture(set.ColorMetalXZnY_Texture.ToString(), MyFileTextureEnum.COLOR_METAL);
            texManager.GetTexture(set.ColorMetalpY_Texture.ToString(), MyFileTextureEnum.COLOR_METAL);

            texManager.GetTexture(set.NormalGlossXZnY_Texture.ToString(), MyFileTextureEnum.NORMALMAP_GLOSS);
            texManager.GetTexture(set.NormalGlossY_Texture.ToString(), MyFileTextureEnum.NORMALMAP_GLOSS);

            texManager.GetTexture(set.ExtXZnY_Texture.ToString(), MyFileTextureEnum.EXTENSIONS);
            texManager.GetTexture(set.ExtY_Texture.ToString(), MyFileTextureEnum.EXTENSIONS);
        }
        internal static void ReleaseResources(ref MyVoxelMaterialDetailSet set)
        {
            if (set.ColorMetalArray != null)
            {
                set.ColorMetalArray.Dispose();
                set.NormalGlossArray.Dispose();
                set.ExtArray.Dispose();

                set.ColorMetalArray  = null;
                set.NormalGlossArray = null;
                set.ExtArray         = null;
            }
        }
Beispiel #11
0
        internal static void ReleaseResources(ref MyVoxelMaterialDetailSet set)
        {
            if (set.ColorMetalArray != null)
            {
                set.ColorMetalArray.Dispose();
                set.NormalGlossArray.Dispose();
                set.ExtArray.Dispose();

                set.ColorMetalArray = null;
                set.NormalGlossArray = null;
                set.ExtArray = null;
            }
        }
Beispiel #12
0
        internal static void PrepareArrays(ref MyVoxelMaterialDetailSet set)
        {
            MyFileArrayTextureManager texManager = MyManagers.FileArrayTextures;

            set.ColorMetalArray = texManager.CreateFromFiles("VoxelMaterial CM Array " + set.ColorMetalXZnY_Texture.ToString(),
                                                             new string[] { set.ColorMetalXZnY_Texture.ToString(), set.ColorMetalpY_Texture.ToString() },
                                                             MyFileTextureEnum.COLOR_METAL);
            set.NormalGlossArray = texManager.CreateFromFiles("VoxelMaterial NG Array " + set.NormalGlossXZnY_Texture.ToString(),
                                                              new string[] { set.NormalGlossXZnY_Texture.ToString(), set.NormalGlossY_Texture.ToString() },
                                                              MyFileTextureEnum.NORMALMAP_GLOSS);
            set.ExtArray = texManager.CreateFromFiles("VoxelMaterial EA Array " + set.ExtXZnY_Texture.ToString(),
                                                      new string[] { set.ExtXZnY_Texture.ToString(), set.ExtY_Texture.ToString() },
                                                      MyFileTextureEnum.EXTENSIONS);
        }
Beispiel #13
0
 internal static void ReleaseResources()
 {
     for (int i = 0; i < Table.Length; i++)
     {
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Near);
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Far1);
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Far2);
         if (Table[i].FoliageColorTextureArray != null)
         {
             Table[i].FoliageColorTextureArray.Dispose();
         }
         if (Table[i].FoliageNormalTextureArray != null)
         {
             Table[i].FoliageNormalTextureArray.Dispose();
         }
     }
 }
Beispiel #14
0
 internal static void PrepareArrays(ref MyVoxelMaterialDetailSet set)
 {
     set.ColorMetalArray = new MyTextureArray(
             new[] { 
                 MyTextures.GetTexture(set.ColorMetalXZnY_Texture, null, MyTextureEnum.COLOR_METAL),
                 MyTextures.GetTexture(set.ColorMetalpY_Texture, null, MyTextureEnum.COLOR_METAL)
             }); 
     set.NormalGlossArray = new MyTextureArray(
             new[] { 
                 MyTextures.GetTexture(set.NormalGlossXZnY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS),
                 MyTextures.GetTexture(set.NormalGlosspY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS)
             });
     set.ExtArray = new MyTextureArray(
             new[] { 
                 MyTextures.GetTexture(set.ExtXZnY_Texture, null, MyTextureEnum.EXTENSIONS),
                 MyTextures.GetTexture(set.ExtpY_Texture, null, MyTextureEnum.EXTENSIONS) 
             });
 }
Beispiel #15
0
 internal static void PrepareArrays(ref MyVoxelMaterialDetailSet set)
 {
     set.ColorMetalArray = new MyTextureArray(
         new[] {
         MyTextureManager.GetColorMetalTexture(set.ColorMetalXZnY_Texture),
         MyTextureManager.GetColorMetalTexture(set.ColorMetalpY_Texture)
     });
     set.NormalGlossArray = new MyTextureArray(
         new[] {
         MyTextureManager.GetNormalGlossTexture(set.NormalGlossXZnY_Texture),
         MyTextureManager.GetNormalGlossTexture(set.NormalGlosspY_Texture)
     });
     set.ExtArray = new MyTextureArray(
         new[] {
         MyTextureManager.GetExtensionsTexture(set.ExtXZnY_Texture),
         MyTextureManager.GetExtensionsTexture(set.ExtpY_Texture)
     });
 }
 internal static void PrepareArrays(ref MyVoxelMaterialDetailSet set)
 {
     set.ColorMetalArray = new MyTextureArray(
         new[] {
         MyTextures.GetTexture(set.ColorMetalXZnY_Texture, null, MyTextureEnum.COLOR_METAL),
         MyTextures.GetTexture(set.ColorMetalpY_Texture, null, MyTextureEnum.COLOR_METAL)
     });
     set.NormalGlossArray = new MyTextureArray(
         new[] {
         MyTextures.GetTexture(set.NormalGlossXZnY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS),
         MyTextures.GetTexture(set.NormalGlosspY_Texture, null, MyTextureEnum.NORMALMAP_GLOSS)
     });
     set.ExtArray = new MyTextureArray(
         new[] {
         MyTextures.GetTexture(set.ExtXZnY_Texture, null, MyTextureEnum.EXTENSIONS),
         MyTextures.GetTexture(set.ExtpY_Texture, null, MyTextureEnum.EXTENSIONS)
     });
 }
Beispiel #17
0
 internal static void ReleaseResources()
 {
     for (int i = 0; i < Table.Length; i++)
     {
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Near);
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Far1);
         MyVoxelMaterialDetailSet.ReleaseResources(ref Table[i].Far2);
         MyFileArrayTextureManager manager = MyManagers.FileArrayTextures;
         if (Table[i].FoliageColorTextureArray != null)
         {
             manager.DisposeTex(ref Table[i].FoliageColorTextureArray);
         }
         if (Table[i].FoliageNormalTextureArray != null)
         {
             manager.DisposeTex(ref Table[i].FoliageNormalTextureArray);
         }
     }
 }
Beispiel #18
0
        static void FillVoxelMaterialEntry(ref MyVoxelMaterialEntry entry, ref MyVoxelMaterial1 voxelMaterial1)
        {
            entry.DistancesAndScale     = voxelMaterial1.DistanceAndScale;
            entry.DistancesAndScaleFar  = new Vector3(voxelMaterial1.DistanceAndScaleFar.X, voxelMaterial1.DistanceAndScaleFar.Y, 1);
            entry.DistancesAndScaleFar2 = new Vector3(voxelMaterial1.DistanceAndScaleFar.Z, voxelMaterial1.DistanceAndScaleFar.W, 2);
            entry.DistancesAndScaleFar3 = new Vector3(voxelMaterial1.DistanceAndScaleFar3.X, voxelMaterial1.DistanceAndScaleFar3.Y, 3);
            entry.Far3Color             = voxelMaterial1.Far3Color;
            entry.ExtensionDetailScale  = voxelMaterial1.ExtensionDetailScale;

            IDynamicFileArrayTexture texColorMetal  = MyGlobalResources.FileArrayTextureVoxelCM;
            IDynamicFileArrayTexture texNormalGloss = MyGlobalResources.FileArrayTextureVoxelNG;
            IDynamicFileArrayTexture texExt         = MyGlobalResources.FileArrayTextureVoxelExt;

            MyVoxelMaterialDetailSet set = voxelMaterial1.Resource;

            UpdateVoxelSlices(ref entry, texColorMetal, set.ColorMetalXZnY_Filepaths, set.ColorMetalY_Filepaths,
                              texNormalGloss, set.NormalGlossXZnY_Filepaths, set.NormalGlossY_Filepaths,
                              texExt, set.ExtY_Filepaths, set.ExtY_Filepaths);
        }
Beispiel #19
0
 internal static void PrepareArrays(ref MyVoxelMaterialDetailSet set)
 {
     set.ColorMetalArray = new MyTextureArray(
             new[] { 
                 MyTextureManager.GetColorMetalTexture(set.ColorMetalXZnY_Texture),
                 MyTextureManager.GetColorMetalTexture(set.ColorMetalpY_Texture) 
             });
     set.NormalGlossArray = new MyTextureArray(
             new[] { 
                 MyTextureManager.GetNormalGlossTexture(set.NormalGlossXZnY_Texture),
                 MyTextureManager.GetNormalGlossTexture(set.NormalGlosspY_Texture) 
             });
     set.ExtArray = new MyTextureArray(
             new[] { 
                 MyTextureManager.GetExtensionsTexture(set.ExtXZnY_Texture),
                 MyTextureManager.GetExtensionsTexture(set.ExtpY_Texture) 
             });
 }
Beispiel #20
0
        internal static void RequestResources(ref MyVoxelMaterialDetailSet set)
        {
            MyTextureManager.GetColorMetalTexture(set.ColorMetalXZnY_Texture);
            MyTextureManager.GetColorMetalTexture(set.ColorMetalpY_Texture);

            MyTextureManager.GetNormalGlossTexture(set.NormalGlossXZnY_Texture);
            MyTextureManager.GetNormalGlossTexture(set.NormalGlosspY_Texture);

            MyTextureManager.GetExtensionsTexture(set.ExtXZnY_Texture);
            MyTextureManager.GetExtensionsTexture(set.ExtpY_Texture);
        }