Esempio n. 1
0
        void calculateXSDMemory()
        {
            ECFReader ecfR = new ECFReader();

            string XTDName = Path.ChangeExtension(gameDirectory + @"\scenario\" + scnName, ".XSD");

            if (!ecfR.openForRead(XTDName))
            {
                return;
            }

            for (uint i = 0; i < ecfR.getNumChunks(); i++)
            {
                ECF.BECFChunkHeader chunkHeader = ecfR.getChunkHeader(i);
                eXSD_ChunkID        id          = (eXSD_ChunkID)chunkHeader.mID;
                switch (id)
                {
                case eXSD_ChunkID.cXSD_SimHeights:
                case eXSD_ChunkID.cXSD_Obstructions:
                case eXSD_ChunkID.cXSD_TileTypes:
                case eXSD_ChunkID.cXSD_CameraHeights:
                case eXSD_ChunkID.cXSD_Buildable:
                case eXSD_ChunkID.cXSD_FloodObstructions:
                case eXSD_ChunkID.cXSD_ScarabObstructions:

                    mMemEst.setOrAddMemoryElement("Terrain Sim Rep", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;
                }
            }

            ecfR.close();
            ecfR = null;
        }
Esempio n. 2
0
        void calculateXTHMemory()
        {
            ECFReader ecfR = new ECFReader();

            string XTDName = Path.ChangeExtension(gameDirectory + @"\scenario\" + scnName, ".XTH");

            if (!ecfR.openForRead(XTDName))
            {
                return;
            }

            for (uint i = 0; i < ecfR.getNumChunks(); i++)
            {
                ECF.BECFChunkHeader chunkHeader = ecfR.getChunkHeader(i);
                eXTH_ChunkID        id          = (eXTH_ChunkID)chunkHeader.mID;
                switch (id)
                {
                case eXTH_ChunkID.cXTH_TerrainHeightfield:
                    mMemEst.setOrAddMemoryElement("Terrain Decal Mesh", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;
                }
            }

            ecfR.close();
            ecfR = null;
        }
Esempio n. 3
0
        void calculateXTDMemory()
        {
            ECFReader ecfR = new ECFReader();

            string XTDName = Path.ChangeExtension(gameDirectory + @"\scenario\" + scnName, ".XTD");

            if (!ecfR.openForRead(XTDName))
            {
                return;
            }

            for (uint i = 0; i < ecfR.getNumChunks(); i++)
            {
                ECF.BECFChunkHeader chunkHeader = ecfR.getChunkHeader(i);
                eXTD_ChunkID        id          = (eXTD_ChunkID)chunkHeader.mID;
                switch (id)
                {
                case eXTD_ChunkID.cXTD_XTDHeader:
                    break;

                case eXTD_ChunkID.cXTD_AOChunk:
                    mMemEst.setOrAddMemoryElement("Terrain AO", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTD_ChunkID.cXTD_AtlasChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Verts & Normals", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTD_ChunkID.cXTD_TessChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Tessellation", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTD_ChunkID.cXTD_LightingChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Lighting", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTD_ChunkID.cXTD_AlphaChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Alpha", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;
                }
            }

            ecfR.close();
            ecfR = null;
        }
Esempio n. 4
0
        void calculateXTTMemory()
        {
            ECFReader ecfR = new ECFReader();

            string XTDName = Path.ChangeExtension(gameDirectory + @"\scenario\" + scnName, ".XTT");

            if (!ecfR.openForRead(XTDName))
            {
                return;
            }

            for (uint i = 0; i < ecfR.getNumChunks(); i++)
            {
                ECF.BECFChunkHeader chunkHeader = ecfR.getChunkHeader(i);
                eXTT_ChunkID        id          = (eXTT_ChunkID)chunkHeader.mID;
                switch (id)
                {
                case eXTT_ChunkID.cXTT_XTTHeader:

                    //CACHES
                    //add in our 360 cache data
                    int       cacheMemCount = 0;
                    const int numCachePages = 20;
                    const int cachePageSize = 512;
                    const int numMips       = 2;
                    bool      albedoCache   = true;
                    bool      normalCache   = true;
                    bool      specCache     = false;
                    bool      selfCache     = false;
                    bool      envCache      = false;


                    //find our textures in the list
                    int version                 = ecfR.readInt32();
                    int numActiveTextures       = Xbox_EndianSwap.endSwapI32(ecfR.readInt32());
                    int numActiveDecals         = Xbox_EndianSwap.endSwapI32(ecfR.readInt32());
                    int numActiveDecalInstances = ecfR.readInt32();

                    System.Text.Encoding enc = System.Text.Encoding.ASCII;

                    int totalArtistTextureMem = 0;
                    for (int k = 0; k < numActiveTextures; k++)
                    {
                        byte[] fName       = ecfR.readBytes(256);
                        string textureName = enc.GetString(fName);
                        textureName            = textureName.TrimEnd('\0');
                        textureName            = textureName.TrimStart('\0');
                        totalArtistTextureMem += giveDependentTextureMemoryFootprint(textureName, ref specCache, ref selfCache, ref envCache);

                        int b = ecfR.readInt32();
                        b = ecfR.readInt32();
                        b = ecfR.readInt32();
                    }

                    for (int k = 0; k < numActiveDecals; k++)
                    {
                        byte[] fName       = ecfR.readBytes(256);
                        string textureName = enc.GetString(fName);
                        textureName            = textureName.TrimEnd('\0');
                        textureName            = textureName.TrimStart('\0');
                        totalArtistTextureMem += giveDependentTextureMemoryFootprint(textureName, ref specCache, ref selfCache, ref envCache);
                    }

                    mMemEst.setOrAddMemoryElement("Terrain Artist Texture", totalArtistTextureMem, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);


                    if (albedoCache)
                    {
                        cacheMemCount += giveTextureCacheMemoryRequirement(numCachePages, cachePageSize, numMips, 0);              //DXT1 * numCachePages (mip0 & mip1)
                    }
                    if (normalCache)
                    {
                        cacheMemCount += giveTextureCacheMemoryRequirement(numCachePages, cachePageSize, numMips, 1);
                    }
                    ;                                                                                                             //DXN
                    if (specCache)
                    {
                        cacheMemCount += giveTextureCacheMemoryRequirement(numCachePages, cachePageSize, numMips, 0);           //DXT1
                    }
                    if (envCache)
                    {
                        cacheMemCount += giveTextureCacheMemoryRequirement(numCachePages, cachePageSize, numMips, 0);           //DXT1
                    }
                    if (selfCache)
                    {
                        cacheMemCount += giveTextureCacheMemoryRequirement(numCachePages, cachePageSize, numMips, 1);           //DXT5
                    }
                    mMemEst.setOrAddMemoryElement("Terrain Texture Cache", cacheMemCount, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);



                    //cache calculation
                    break;

                case eXTT_ChunkID.cXTT_AtlasChunkAlbedo:
                    mMemEst.setOrAddMemoryElement("Terrain Skirt Texture", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTT_ChunkID.cXTT_RoadsChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Roads", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTT_ChunkID.cXTT_FoliageQNChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Foliage", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;

                case eXTT_ChunkID.cXTT_TerrainAtlasLinkChunk:
                    mMemEst.setOrAddMemoryElement("Terrain Blends", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain);
                    break;
                }
            }

            ecfR.close();
            ecfR = null;
        }