internal static void Set(MyRenderVoxelMaterialData[] list, bool update = false)
        {
            if (!update)
            {
                Array.Resize(ref Table, list.Length);
            }

            for (int i = 0; i < list.Length; i++)
            {
                // copy data
                int index = update ? list[i].Index : i;

                Table[index].Near.ColorMetalXZnY_Texture  = X.TEXT(list[i].ColorMetalXZnY);
                Table[index].Near.ColorMetalpY_Texture    = X.TEXT(list[i].ColorMetalY);
                Table[index].Near.NormalGlossXZnY_Texture = X.TEXT(list[i].NormalGlossXZnY);
                Table[index].Near.NormalGlossY_Texture    = X.TEXT(list[i].NormalGlossY);
                Table[index].Near.ExtXZnY_Texture         = X.TEXT(list[i].ExtXZnY);
                Table[index].Near.ExtY_Texture            = X.TEXT(list[i].ExtY);

                Table[index].Far1.ColorMetalXZnY_Texture  = X.TEXT(list[i].ColorMetalXZnYFar1);
                Table[index].Far1.ColorMetalpY_Texture    = X.TEXT(list[i].ColorMetalYFar1);
                Table[index].Far1.NormalGlossXZnY_Texture = X.TEXT(list[i].NormalGlossXZnYFar1);
                Table[index].Far1.NormalGlossY_Texture    = X.TEXT(list[i].NormalGlossYFar1);
                Table[index].Far1.ExtXZnY_Texture         = X.TEXT(list[i].ExtXZnYFar1);
                Table[index].Far1.ExtY_Texture            = X.TEXT(list[i].ExtYFar1);

                Table[index].Far2.ColorMetalXZnY_Texture  = X.TEXT(list[i].ColorMetalXZnYFar2);
                Table[index].Far2.ColorMetalpY_Texture    = X.TEXT(list[i].ColorMetalYFar2);
                Table[index].Far2.NormalGlossXZnY_Texture = X.TEXT(list[i].NormalGlossXZnYFar2);
                Table[index].Far2.NormalGlossY_Texture    = X.TEXT(list[i].NormalGlossYFar2);
                Table[index].Far2.ExtXZnY_Texture         = X.TEXT(list[i].ExtXZnYFar2);
                Table[index].Far2.ExtY_Texture            = X.TEXT(list[i].ExtYFar2);

                Table[index].FoliageArray_Texture       = list[i].ExtensionTextureArray1;
                Table[index].FoliageArray_NormalTexture = list[i].ExtensionTextureArray2;

                Table[index].FoliageColorTextureArray  = MyTextureArray.FromStringArray(list[i].FoliageColorTextureArray, MyTextureEnum.COLOR_METAL, "CM Foliage");
                Table[index].FoliageNormalTextureArray = MyTextureArray.FromStringArray(list[i].FoliageNormalTextureArray, MyTextureEnum.NORMALMAP_GLOSS, "NG Foliage");

                Table[index].FoliageDensity        = list[i].ExtensionDensity;
                Table[index].FoliageScale          = list[i].ExtensionScale;
                Table[index].FoliageScaleVariation = list[i].ExtensionRandomRescaleMult;
                Table[index].FoliageType           = list[i].ExtensionType;

                Table[index].DistanceAndScale     = list[i].DistanceAndScale;
                Table[index].DistanceAndScaleFar  = list[i].DistanceAndScaleFar;
                Table[index].DistanceAndScaleFar3 = list[i].DistanceAndScaleFar3;
                Table[index].Far3Color            = list[i].Far3Color;
                Table[index].ExtensionDetailScale = list[i].ExtensionDetailScale;

                MaterialQueryResourcesTable.Add(index);
            }
        }
Exemple #2
0
 internal void Dispose()
 {
     if (ColorMetalArray != null)
     {
         ColorMetalArray.Dispose();
         ColorMetalArray = null;
     }
     if (NormalGlossArray != null)
     {
         NormalGlossArray.Dispose();
         NormalGlossArray = null;
     }
     if (ExtArray != null)
     {
         ExtArray.Dispose();
         ExtArray = null;
     }
 }
Exemple #3
0
        internal void BuildTextureArrays()
        {
            Dispose();

            ColorMetalArray = new MyTextureArray(new[] {
                MyTextureManager.GetColorMetalTexture(ColorMetal_XZ_nY_Texture),
                MyTextureManager.GetColorMetalTexture(ColorMetal_pY_Texture),
                MyTextureManager.GetColorMetalTexture(LowFreqColorMetal_XZ_nY_Texture),
                MyTextureManager.GetColorMetalTexture(LowFreqColorMetal_pY_Texture),
            });
            ColorMetalArray.SetDebugName(String.Format("voxel material {0} ColorMetal array", Id));

            NormalGlossArray = new MyTextureArray(new[] {
                MyTextureManager.GetNormalGlossTexture(NormalGloss_XZ_nY_Texture),
                MyTextureManager.GetNormalGlossTexture(NormalGloss_pY_Texture),
                MyTextureManager.GetNormalGlossTexture(LowFreqNormalGloss_XZ_nY_Texture),
                MyTextureManager.GetNormalGlossTexture(LowFreqNormalGloss_pY_Texture),
            });
            NormalGlossArray.SetDebugName(String.Format("voxel material {0} NormalGloss array", Id));

            ExtArray = new MyTextureArray(new[] {
                MyTextureManager.GetExtensionsTexture(Ext_XZ_nY_Texture),
                MyTextureManager.GetExtensionsTexture(Ext_pY_Texture),
                MyTextureManager.GetExtensionsTexture(LowFreqExt_XZ_nY_Texture),
                MyTextureManager.GetExtensionsTexture(LowFreqExt_pY_Texture),
            });
            ExtArray.SetDebugName(String.Format("voxel material {0} Ex6 array", Id));

            if (FoliageTextureArray1_Filename != null)
            {
                FoliageTextureArray1 = MyTextureManager.GetTexture(FoliageTextureArray1_Filename);
                FoliageArraySize     = (uint)((Texture2D)FoliageTextureArray1.Resource).Description.ArraySize;
            }
            if (FoliageTextureArray2_Filename != null)
            {
                FoliageTextureArray2 = MyTextureManager.GetTexture(FoliageTextureArray2_Filename);
            }
        }