TextureLoad.h#

Parent directory (texture)

Functionality for loading a texture from disk or other sources.

Includes#

  • PVRCore/textureio/TextureReaderBMP.h

  • PVRCore/textureio/TextureReaderDDS.h

  • PVRCore/textureio/TextureReaderKTX.h

  • PVRCore/textureio/TextureReaderPVR.h

  • PVRCore/textureio/TextureReaderTGA.h

  • PVRCore/textureio/TextureReaderXNB.h

Included By#

Namespaces#

Functions#

Source Code#

#pragma once
#include "PVRCore/textureio/TextureReaderPVR.h"
#include "PVRCore/textureio/TextureReaderBMP.h"
#include "PVRCore/textureio/TextureReaderKTX.h"
#include "PVRCore/textureio/TextureReaderDDS.h"
#include "PVRCore/textureio/TextureReaderXNB.h"
#include "PVRCore/textureio/TextureReaderTGA.h"

namespace pvr {

inline Texture textureLoad(const Stream& textureStream, TextureFileFormat type)
{
    switch (type)
    {
    case TextureFileFormat::KTX: return assetReaders::readKTX(textureStream);
    case TextureFileFormat::PVR: return assetReaders::readPVR(textureStream);
    case TextureFileFormat::TGA: return assetReaders::readTGA(textureStream);
    case TextureFileFormat::BMP: return assetReaders::readBMP(textureStream);
    case TextureFileFormat::DDS: return assetReaders::readDDS(textureStream);
    default: throw InvalidArgumentError("type", "Unknown texture file format passed");
    }
}

inline Texture textureLoad(const Stream& textureStream) { return textureLoad(textureStream, getTextureFormatFromFilename(textureStream.getFileName().c_str())); }
} // namespace pvr