81 lines
No EOL
3.1 KiB
C++
81 lines
No EOL
3.1 KiB
C++
#ifndef _ITF_PBKMERGER_H_
|
|
#define _ITF_PBKMERGER_H_
|
|
|
|
#ifndef _ITF_PACKEDTEXTUREAREA_H_
|
|
#include "AnimTexPacker/PackedTextureArea.h"
|
|
#endif
|
|
|
|
#ifndef _ITF_SAFEARRAY_H_
|
|
#include "core/container/SafeArray.h"
|
|
#endif //_ITF_SAFEARRAY_H_
|
|
|
|
#include <nvimage/Image.h>
|
|
|
|
namespace ITF
|
|
{
|
|
class AnimPatchBank;
|
|
|
|
namespace AnimTexPacker
|
|
{
|
|
class Patch;
|
|
class PatchList;
|
|
class AnimPackerConfiguration;
|
|
class PatchDepot;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
///Class for merging PBKs
|
|
class PbkMerger
|
|
{
|
|
public:
|
|
PbkMerger(int _serial, const String8 & _baseName)
|
|
: m_compositeAnimPatchBank(NULL)
|
|
, m_serialNumber(_serial)
|
|
{
|
|
m_compositeName.setTextFormat("%s_%03d",_baseName.cStr(), _serial+1);
|
|
m_imgMask = 0;
|
|
m_imgUseAlphaMask = 0;
|
|
m_hdDownscaleMask = U32_INVALID;
|
|
}
|
|
|
|
ITF_LIST<PatchList*> m_listOfPatchLists;
|
|
AnimPatchBank * m_compositeAnimPatchBank;
|
|
int m_serialNumber;
|
|
String8 m_compositeName;
|
|
|
|
ITF_VECTOR<i32> m_grid;
|
|
u32 m_gridWidth;
|
|
u32 m_gridHeight;
|
|
u32 m_imgMask;
|
|
u32 m_imgUseAlphaMask;
|
|
u32 m_hdDownscaleMask;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
const String8 &getCompositeName() const {return m_compositeName;}
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
Patch *findPatch(const StringID &_templateID);
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
void computeFinalMapStartupSize(int &mapWidth, int &mapHeight, int &totalArea);
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
void buildSortedPatches(SafeArray<Patch*> &_sortedPatchList);
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
void createCompositePatchBank(PatchDepot *_patchDepot);
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
void destroyCompositePatchBank();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
bbool buildPackedMap(const AnimPackerConfiguration &_config);
|
|
|
|
private:
|
|
static void buildSortedMapSizes(SafeArray<BoxI> &_sortedMapSizes, int mapWidth/*must be pow of 2*/, int mapHeight, int maxUV);
|
|
void blitFinalImage(nv::Image &newImage, int offsetX, int offsetY, const SafeArray<Patch*> &_inputPatchList, u32 _textureId);
|
|
void blitFinalImageData(int mapWidth, int mapHeight, const SafeArray<Patch*> &_inputPatchList);
|
|
};
|
|
}
|
|
|
|
}
|
|
|
|
#endif |