Exemple #1
0
        public void loadTextures()
        {
            if (mTexChannels == null)
            {
                mTexChannels = new TextureHandle[(int)BTerrainTexturing.eTextureChannels.cSplatChannelCount];
            }

            if (!File.Exists(mFilename))
            {
                mFilename       = EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName;
                mTexChannels[0] = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(),mFilename);
                mTexChannels[1] = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);

                return;
            }


            mTexChannels[0] = BRenderDevice.getTextureManager().getTexture(mFilename, TerrainGlobals.getTexturing().activeTextureReloaded);//         mTexChannels[0] = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);

            String ext   = Path.GetExtension(mFilename);
            string tName = mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_nm" + ext;

            mTexChannels[1] = BRenderDevice.getTextureManager().getTexture(tName, TerrainGlobals.getTexturing().activeTextureReloaded);// = TextureLoader.FromFile(BRenderDevice.getDevice(), tName);


            //gather our information data for the editor
            mMatHasEmissive = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_em" + ext);
            mMatHasEnvMask  = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_rm" + ext);
            mMatHasSpecular = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_sp" + ext);
            mMatHasMask     = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_mk" + ".bmp");

            //calculate our total memory footprint for this texture
            m360MemoryFootprint  = 0;
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_df.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_nm.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_em.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_rm.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_sp.ddx");
        }
Exemple #2
0
        static void processFileList(string listfilename, out int UGXMem, out int UAXMem, out int DDXMem)
        {
            using (PerfSection p3 = new PerfSection("processFileList"))
            {
                UGXMem = 0;
                UAXMem = 0;
                DDXMem = 0;

                if (!File.Exists(listfilename))
                {
                    return;
                }

                Stream st = null;
                // if we're in async mode, we may not have access to this yet.
                while (st == null)
                {
                    try
                    {
                        st = File.OpenRead(listfilename);
                    }
                    catch (IOException e)
                    {
                    }
                }

                StreamReader tr         = new StreamReader(st);
                int          otherFiles = 0;

                List <string> ddxFiles = new List <string>();

                try
                {
                    string filename = tr.ReadLine();
                    do
                    {
                        if (!File.Exists(filename))
                        {
                            continue;
                        }

                        if (filename.ToLower().Contains(".xmb"))
                        {
                            continue;
                        }
                        if (filename.ToLower().Contains(".lgt"))
                        {
                            continue;
                        }
                        if (filename.ToLower().Contains(".tfx"))
                        {
                            continue;
                        }
                        if (filename.ToLower().Contains(".xpr"))
                        {
                            continue;
                        }
                        if (filename.ToLower().Contains(".scn"))
                        {
                            continue;
                        }
                        if (filename.ToLower().Contains(".txt"))
                        {
                            continue;
                        }
                        if (filename.ToLower().Contains(".gls"))
                        {
                            continue;
                        }

                        if (filename.ToLower().Contains(".ddx"))
                        {
                            ddxFiles.Add(filename);
                            //DDXMem += DDXBridge.give360TextureMemFootprint(filename);
                        }
                        else if (filename.ToLower().Contains(".ugx"))
                        {
                            System.IO.FileInfo fi = new System.IO.FileInfo(filename);
                            UGXMem += (int)fi.Length;
                            fi      = null;
                        }
                        else if (filename.ToLower().Contains(".uax"))
                        {
                            System.IO.FileInfo fi = new System.IO.FileInfo(filename);
                            UAXMem += (int)fi.Length;
                            fi      = null;
                        }
                        else
                        {
                            otherFiles++;
                        }
                    } while ((filename = tr.ReadLine()) != null);

                    //using (PerfSection p4 = new PerfSection("give360TextureMemFootprint"))
                    {
                        foreach (string s in ddxFiles)
                        {
                            DDXMem += DDXBridge.give360TextureMemFootprint(s);
                        }
                    }
                }
                catch (IOException e)
                {
                }
                finally
                {
                    tr.Close();
                    st.Close();
                }
            }
        }