PtexImporter/PtexPaintLayerImporter.h

PtexImporter/PtexPaintLayerImporter.h
#if !defined PTEX_PAINT_LAYER_IMPORTER
#define PTEX_PAINT_LAYER_IMPORTER
//**************************************************************************/
// Copyright (c) 2011, 2012 Autodesk, Inc.
// All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license
// agreement provided at the time of installation or download, or which
// otherwise accompanies this software in either electronic or hard copy form.
//
//**************************************************************************/
// DESCRIPTION: PTEX texture importer
// CREATED: January 2011
//**************************************************************************/
#if defined(JAMBUILD) || defined(__APPLE__)
#include <Mudbox/mudbox.h>
#else
#include "../../include/Mudbox/mudbox.h"
#include "../../include/UVlessPainting/UVGeneratorInterface.h"
#include "../../include/EdgeBleeding/EdgeBleeding.h"
#endif
#include "ptex/Ptexture.h"
#include "PtexImporter.h"
using namespace mudbox;
class PtexPaintLayerImporter : public PaintLayerImporter
{
Q_DECLARE_TR_FUNCTIONS(PtexPaintLayerImporter);
PtexPaintLayerImporter() : m_Importer(0) {}
// Returns the file extension and description of the supported file by the plugin.
QVector<FileExtension> SupportedExtensions( void ) const
ret.push_back(FileExtension(NTR("ptx"), tr("Ptex File"),
return ret;
};
virtual bool Prepare( const QString &sFileName, Mesh *pMesh, bool bAsMask, bool bSilentMode );
// Import a file, main function of the class.
virtual bool Import( const QString &sFileName, int iFileTypeIndex, Mesh *pMesh, TexturePool *pTargetPool );
// Setup mesh for Ptex painting when necessary
void SetPtexImporter(PtexImporter *ptImporter)
{
m_Importer = ptImporter;
}
private:
// This function reads the texture data from a ptex file to an existing
// mesh with existing compatible UV layout.
void LoadPtexTexture( PtexTexture *, TexturePool *, const Mesh *, UVGeneratorNode * );
// Load the color data from a ptex texture for a given face.
template <typename eFormat, const int iMax>
void *PrepareFaceBuffer( PtexTexture *pTexture,
unsigned int pTexSubFaceIndex,
char iDirection, bool bSwapUV );
PtexImporter *m_Importer;
};
#endif