/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ #ifndef SE_INCL_ARRAY_HOLDER_H #define SE_INCL_ARRAY_HOLDER_H #ifdef PRAGMA_ONCE #pragma once #endif #include #include #include #include #include struct TileLayer { CStaticStackArray tl_auiIndices; // Array of indices for one layer CStaticStackArray tl_acColors; // Array of colors for one layer CStaticStackArray tl_atcTexCoords; // Array of texcoords for one layer CStaticStackArray tl_avVertices; // Array of vertices for one layer (used only if tile layer) }; struct TileArrays { void operator=(const TileArrays &taOther) { this->ta_avVertices = taOther.ta_avVertices; this->ta_auvTexCoords = taOther.ta_auvTexCoords; this->ta_auvShadowMap = taOther.ta_auvShadowMap; this->ta_auvDetailMap = taOther.ta_auvDetailMap; this->ta_auiIndices = taOther.ta_auiIndices; this->ta_atlLayers = taOther.ta_atlLayers; this->ta_ptdTopMap = taOther.ta_ptdTopMap; } CStaticStackArray ta_avVertices; // Array of vertices for one tile CStaticStackArray ta_auvTexCoords; // Array of texcoords for one tile (not used in highest lod) CStaticStackArray ta_auvShadowMap; // Array of texcoords for shadow map CStaticStackArray ta_auvDetailMap; // Array of texcoords for detail map CStaticStackArray ta_auiIndices; // Array of indices for one tile CStaticStackArray ta_atlLayers; // Array if layers per tile (used only in highest lod) CTextureData *ta_ptdTopMap; // Pointer to tile top map }; class ENGINE_API CArrayHolder { public: CArrayHolder(); ~CArrayHolder(); void operator=(const CArrayHolder &ahOther); // Returns index of new tile arrays INDEX GetNewArrays(); // Mark tile arrays as unused void FreeArrays(SINT iOldArraysIndex); // Just do popall on all arrays void EmptyArrays(INDEX iArrayIndex); // Release array holder void Clear(void); // Count used memory SLONG GetUsedMemory(void); public: CTerrain *ah_ptrTerrain; // Terrain that owns this array holder CStaticStackArray ah_ataTileArrays; // array of tile arrays CStaticStackArray ah_aiFreeArrays; // array of indices of free arrays INDEX ah_iLod; // this array holder works in this lod }; #endif