mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Renamed CompressedData:getType to CompressedData:getFormat
This commit is contained in:
@@ -157,7 +157,7 @@ void Image::drawg(love::graphics::Geometry *geom, float x, float y, float angle,
|
|||||||
|
|
||||||
void Image::uploadCompressedMipmaps()
|
void Image::uploadCompressedMipmaps()
|
||||||
{
|
{
|
||||||
if (!isCompressed() || !cdata || !hasCompressedTextureSupport(cdata->getType()))
|
if (!isCompressed() || !cdata || !hasCompressedTextureSupport(cdata->getFormat()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bind();
|
bind();
|
||||||
@@ -180,7 +180,7 @@ void Image::uploadCompressedMipmaps()
|
|||||||
{
|
{
|
||||||
glCompressedTexImage2DARB(GL_TEXTURE_2D,
|
glCompressedTexImage2DARB(GL_TEXTURE_2D,
|
||||||
i,
|
i,
|
||||||
getCompressedFormat(cdata->getType()),
|
getCompressedFormat(cdata->getFormat()),
|
||||||
cdata->getWidth(i),
|
cdata->getWidth(i),
|
||||||
cdata->getHeight(i),
|
cdata->getHeight(i),
|
||||||
0,
|
0,
|
||||||
@@ -251,7 +251,7 @@ void Image::checkMipmapsCreated()
|
|||||||
if (mipmapsCreated || filter.mipmap == FILTER_NONE || usingDefaultTexture)
|
if (mipmapsCreated || filter.mipmap == FILTER_NONE || usingDefaultTexture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isCompressed() && cdata && hasCompressedTextureSupport(cdata->getType()))
|
if (isCompressed() && cdata && hasCompressedTextureSupport(cdata->getFormat()))
|
||||||
uploadCompressedMipmaps();
|
uploadCompressedMipmaps();
|
||||||
else if (data)
|
else if (data)
|
||||||
createMipmaps();
|
createMipmaps();
|
||||||
@@ -362,10 +362,10 @@ void Image::unload()
|
|||||||
|
|
||||||
bool Image::loadVolatile()
|
bool Image::loadVolatile()
|
||||||
{
|
{
|
||||||
if (isCompressed() && cdata && !hasCompressedTextureSupport(cdata->getType()))
|
if (isCompressed() && cdata && !hasCompressedTextureSupport(cdata->getFormat()))
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
if (image::CompressedData::getConstant(cdata->getType(), str))
|
if (image::CompressedData::getConstant(cdata->getFormat(), str))
|
||||||
{
|
{
|
||||||
throw love::Exception("Cannot create image: "
|
throw love::Exception("Cannot create image: "
|
||||||
"%s compressed images are not supported on this system.", str);
|
"%s compressed images are not supported on this system.", str);
|
||||||
@@ -424,7 +424,7 @@ bool Image::loadVolatilePOT()
|
|||||||
|
|
||||||
glCompressedTexImage2DARB(GL_TEXTURE_2D,
|
glCompressedTexImage2DARB(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
getCompressedFormat(cdata->getType()),
|
getCompressedFormat(cdata->getFormat()),
|
||||||
cdata->getWidth(0),
|
cdata->getWidth(0),
|
||||||
cdata->getHeight(0),
|
cdata->getHeight(0),
|
||||||
0,
|
0,
|
||||||
@@ -488,7 +488,7 @@ bool Image::loadVolatileNPOT()
|
|||||||
|
|
||||||
if (isCompressed() && cdata)
|
if (isCompressed() && cdata)
|
||||||
{
|
{
|
||||||
GLenum format = getCompressedFormat(cdata->getType());
|
GLenum format = getCompressedFormat(cdata->getFormat());
|
||||||
glCompressedTexImage2DARB(GL_TEXTURE_2D,
|
glCompressedTexImage2DARB(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
format,
|
format,
|
||||||
@@ -548,7 +548,7 @@ bool Image::refresh()
|
|||||||
|
|
||||||
if (isCompressed() && cdata)
|
if (isCompressed() && cdata)
|
||||||
{
|
{
|
||||||
GLenum format = getCompressedFormat(cdata->getType());
|
GLenum format = getCompressedFormat(cdata->getFormat());
|
||||||
glCompressedTexSubImage2DARB(GL_TEXTURE_2D,
|
glCompressedTexSubImage2DARB(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
0, 0,
|
0, 0,
|
||||||
@@ -671,23 +671,23 @@ bool Image::isCompressed() const
|
|||||||
return compressed;
|
return compressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum Image::getCompressedFormat(image::CompressedData::TextureType type) const
|
GLenum Image::getCompressedFormat(image::CompressedData::Format format) const
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (format)
|
||||||
{
|
{
|
||||||
case image::CompressedData::TYPE_DXT1:
|
case image::CompressedData::FORMAT_DXT1:
|
||||||
return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||||
case image::CompressedData::TYPE_DXT3:
|
case image::CompressedData::FORMAT_DXT3:
|
||||||
return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||||
case image::CompressedData::TYPE_DXT5:
|
case image::CompressedData::FORMAT_DXT5:
|
||||||
return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||||
case image::CompressedData::TYPE_BC4:
|
case image::CompressedData::FORMAT_BC4:
|
||||||
return GL_COMPRESSED_RED_RGTC1;
|
return GL_COMPRESSED_RED_RGTC1;
|
||||||
case image::CompressedData::TYPE_BC4s:
|
case image::CompressedData::FORMAT_BC4s:
|
||||||
return GL_COMPRESSED_SIGNED_RED_RGTC1;
|
return GL_COMPRESSED_SIGNED_RED_RGTC1;
|
||||||
case image::CompressedData::TYPE_BC5:
|
case image::CompressedData::FORMAT_BC5:
|
||||||
return GL_COMPRESSED_RG_RGTC2;
|
return GL_COMPRESSED_RG_RGTC2;
|
||||||
case image::CompressedData::TYPE_BC5s:
|
case image::CompressedData::FORMAT_BC5s:
|
||||||
return GL_COMPRESSED_SIGNED_RG_RGTC2;
|
return GL_COMPRESSED_SIGNED_RG_RGTC2;
|
||||||
default:
|
default:
|
||||||
return GL_RGBA8;
|
return GL_RGBA8;
|
||||||
@@ -719,21 +719,21 @@ bool Image::hasCompressedTextureSupport()
|
|||||||
return GLEE_VERSION_1_3 || GLEE_ARB_texture_compression;
|
return GLEE_VERSION_1_3 || GLEE_ARB_texture_compression;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Image::hasCompressedTextureSupport(image::CompressedData::TextureType type)
|
bool Image::hasCompressedTextureSupport(image::CompressedData::Format format)
|
||||||
{
|
{
|
||||||
if (!hasCompressedTextureSupport())
|
if (!hasCompressedTextureSupport())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (type)
|
switch (format)
|
||||||
{
|
{
|
||||||
case image::CompressedData::TYPE_DXT1:
|
case image::CompressedData::FORMAT_DXT1:
|
||||||
case image::CompressedData::TYPE_DXT3:
|
case image::CompressedData::FORMAT_DXT3:
|
||||||
case image::CompressedData::TYPE_DXT5:
|
case image::CompressedData::FORMAT_DXT5:
|
||||||
return GLEE_EXT_texture_compression_s3tc;
|
return GLEE_EXT_texture_compression_s3tc;
|
||||||
case image::CompressedData::TYPE_BC4:
|
case image::CompressedData::FORMAT_BC4:
|
||||||
case image::CompressedData::TYPE_BC4s:
|
case image::CompressedData::FORMAT_BC4s:
|
||||||
case image::CompressedData::TYPE_BC5:
|
case image::CompressedData::FORMAT_BC5:
|
||||||
case image::CompressedData::TYPE_BC5s:
|
case image::CompressedData::FORMAT_BC5s:
|
||||||
return (GLEE_VERSION_3_0 || GLEE_ARB_texture_compression_rgtc || GLEE_EXT_texture_compression_rgtc);
|
return (GLEE_VERSION_3_0 || GLEE_ARB_texture_compression_rgtc || GLEE_EXT_texture_compression_rgtc);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
static bool hasMipmapSharpnessSupport();
|
static bool hasMipmapSharpnessSupport();
|
||||||
|
|
||||||
static bool hasCompressedTextureSupport();
|
static bool hasCompressedTextureSupport();
|
||||||
static bool hasCompressedTextureSupport(image::CompressedData::TextureType type);
|
static bool hasCompressedTextureSupport(image::CompressedData::Format format);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ private:
|
|||||||
static FilterMode defaultMipmapFilter;
|
static FilterMode defaultMipmapFilter;
|
||||||
static float defaultMipmapSharpness;
|
static float defaultMipmapSharpness;
|
||||||
|
|
||||||
GLenum getCompressedFormat(image::CompressedData::TextureType type) const;
|
GLenum getCompressedFormat(image::CompressedData::Format format) const;
|
||||||
|
|
||||||
}; // Image
|
}; // Image
|
||||||
|
|
||||||
|
|||||||
@@ -1084,11 +1084,11 @@ int w_isSupported(lua_State *L)
|
|||||||
supported = false;
|
supported = false;
|
||||||
break;
|
break;
|
||||||
case Graphics::SUPPORT_DXT:
|
case Graphics::SUPPORT_DXT:
|
||||||
if (!Image::hasCompressedTextureSupport(image::CompressedData::TYPE_DXT5))
|
if (!Image::hasCompressedTextureSupport(image::CompressedData::FORMAT_DXT5))
|
||||||
supported = false;
|
supported = false;
|
||||||
break;
|
break;
|
||||||
case Graphics::SUPPORT_BC5:
|
case Graphics::SUPPORT_BC5:
|
||||||
if (!Image::hasCompressedTextureSupport(image::CompressedData::TYPE_BC5))
|
if (!Image::hasCompressedTextureSupport(image::CompressedData::FORMAT_BC5))
|
||||||
supported = false;
|
supported = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace image
|
|||||||
{
|
{
|
||||||
|
|
||||||
CompressedData::CompressedData()
|
CompressedData::CompressedData()
|
||||||
: type(TYPE_UNKNOWN)
|
: format(FORMAT_UNKNOWN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ int CompressedData::getHeight(int miplevel) const
|
|||||||
return dataImages[miplevel].height;
|
return dataImages[miplevel].height;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompressedData::TextureType CompressedData::getType() const
|
CompressedData::Format CompressedData::getFormat() const
|
||||||
{
|
{
|
||||||
return type;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompressedData::checkMipmapLevelExists(int miplevel) const
|
void CompressedData::checkMipmapLevelExists(int miplevel) const
|
||||||
@@ -99,29 +99,29 @@ void CompressedData::checkMipmapLevelExists(int miplevel) const
|
|||||||
throw love::Exception("Mipmap level %d does not exist", miplevel);
|
throw love::Exception("Mipmap level %d does not exist", miplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompressedData::getConstant(const char *in, CompressedData::TextureType &out)
|
bool CompressedData::getConstant(const char *in, CompressedData::Format &out)
|
||||||
{
|
{
|
||||||
return types.find(in, out);
|
return formats.find(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompressedData::getConstant(CompressedData::TextureType in, const char *&out)
|
bool CompressedData::getConstant(CompressedData::Format in, const char *&out)
|
||||||
{
|
{
|
||||||
return types.find(in, out);
|
return formats.find(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringMap<CompressedData::TextureType, CompressedData::TYPE_MAX_ENUM>::Entry CompressedData::typeEntries[] =
|
StringMap<CompressedData::Format, CompressedData::FORMAT_MAX_ENUM>::Entry CompressedData::formatEntries[] =
|
||||||
{
|
{
|
||||||
{"unknown", CompressedData::TYPE_UNKNOWN},
|
{"unknown", CompressedData::FORMAT_UNKNOWN},
|
||||||
{"dxt1", CompressedData::TYPE_DXT1},
|
{"dxt1", CompressedData::FORMAT_DXT1},
|
||||||
{"dxt3", CompressedData::TYPE_DXT3},
|
{"dxt3", CompressedData::FORMAT_DXT3},
|
||||||
{"dxt5", CompressedData::TYPE_DXT5},
|
{"dxt5", CompressedData::FORMAT_DXT5},
|
||||||
{"bc4", CompressedData::TYPE_BC4},
|
{"bc4", CompressedData::FORMAT_BC4},
|
||||||
{"bc4s", CompressedData::TYPE_BC4s},
|
{"bc4s", CompressedData::FORMAT_BC4s},
|
||||||
{"bc5", CompressedData::TYPE_BC5},
|
{"bc5", CompressedData::FORMAT_BC5},
|
||||||
{"bc5s", CompressedData::TYPE_BC5s},
|
{"bc5s", CompressedData::FORMAT_BC5s},
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap<CompressedData::TextureType, CompressedData::TYPE_MAX_ENUM> CompressedData::types(CompressedData::typeEntries, sizeof(CompressedData::typeEntries));
|
StringMap<CompressedData::Format, CompressedData::FORMAT_MAX_ENUM> CompressedData::formats(CompressedData::formatEntries, sizeof(CompressedData::formatEntries));
|
||||||
|
|
||||||
} // image
|
} // image
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -43,18 +43,18 @@ class CompressedData : public Data
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Types of compressed image data.
|
// Recognized compressed image data formats.
|
||||||
enum TextureType
|
enum Format
|
||||||
{
|
{
|
||||||
TYPE_UNKNOWN,
|
FORMAT_UNKNOWN,
|
||||||
TYPE_DXT1,
|
FORMAT_DXT1,
|
||||||
TYPE_DXT3,
|
FORMAT_DXT3,
|
||||||
TYPE_DXT5,
|
FORMAT_DXT5,
|
||||||
TYPE_BC4,
|
FORMAT_BC4,
|
||||||
TYPE_BC4s,
|
FORMAT_BC4s,
|
||||||
TYPE_BC5,
|
FORMAT_BC5,
|
||||||
TYPE_BC5s,
|
FORMAT_BC5s,
|
||||||
TYPE_MAX_ENUM
|
FORMAT_MAX_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
// Compressed image data can have multiple mipmap levels, each represented
|
// Compressed image data can have multiple mipmap levels, each represented
|
||||||
@@ -102,16 +102,16 @@ public:
|
|||||||
int getHeight(int miplevel) const;
|
int getHeight(int miplevel) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of the compressed data.
|
* Gets the format of the compressed data.
|
||||||
**/
|
**/
|
||||||
TextureType getType() const;
|
Format getFormat() const;
|
||||||
|
|
||||||
static bool getConstant(const char *in, TextureType &out);
|
static bool getConstant(const char *in, Format &out);
|
||||||
static bool getConstant(TextureType in, const char *&out);
|
static bool getConstant(Format in, const char *&out);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
TextureType type;
|
Format format;
|
||||||
|
|
||||||
// Texture info for each mipmap level.
|
// Texture info for each mipmap level.
|
||||||
std::vector<SubImage> dataImages;
|
std::vector<SubImage> dataImages;
|
||||||
@@ -120,8 +120,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static StringMap<TextureType, TYPE_MAX_ENUM>::Entry typeEntries[];
|
static StringMap<Format, FORMAT_MAX_ENUM>::Entry formatEntries[];
|
||||||
static StringMap<TextureType, TYPE_MAX_ENUM> types;
|
static StringMap<Format, FORMAT_MAX_ENUM> formats;
|
||||||
|
|
||||||
}; // CompressedData
|
}; // CompressedData
|
||||||
|
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ void CompressedData::load(love::filesystem::FileData *data)
|
|||||||
{
|
{
|
||||||
// SubImage vector will be populated by a parser.
|
// SubImage vector will be populated by a parser.
|
||||||
std::vector<SubImage> parsedimages;
|
std::vector<SubImage> parsedimages;
|
||||||
TextureType textype = TYPE_UNKNOWN;
|
Format texformat = FORMAT_UNKNOWN;
|
||||||
|
|
||||||
if (ddsHandler::canParse(data))
|
if (ddsHandler::canParse(data))
|
||||||
textype = ddsHandler::parse(data, parsedimages);
|
texformat = ddsHandler::parse(data, parsedimages);
|
||||||
|
|
||||||
if (textype == TYPE_UNKNOWN)
|
if (texformat == FORMAT_UNKNOWN)
|
||||||
throw love::Exception("Could not parse compressed data: Unknown format.");
|
throw love::Exception("Could not parse compressed data: Unknown format.");
|
||||||
|
|
||||||
if (parsedimages.size() == 0)
|
if (parsedimages.size() == 0)
|
||||||
@@ -64,7 +64,7 @@ void CompressedData::load(love::filesystem::FileData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataImages = parsedimages;
|
dataImages = parsedimages;
|
||||||
type = textype;
|
format = texformat;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompressedData::isCompressed(love::filesystem::FileData *data)
|
bool CompressedData::isCompressed(love::filesystem::FileData *data)
|
||||||
|
|||||||
@@ -40,21 +40,21 @@ bool ddsHandler::canParse(const filesystem::FileData *data)
|
|||||||
return dds::isCompressedDDS(data->getData(), data->getSize());
|
return dds::isCompressedDDS(data->getData(), data->getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
CompressedData::TextureType ddsHandler::parse(filesystem::FileData *data, std::vector<CompressedData::SubImage> &images)
|
CompressedData::Format ddsHandler::parse(filesystem::FileData *data, std::vector<CompressedData::SubImage> &images)
|
||||||
{
|
{
|
||||||
if (!dds::isDDS(data->getData(), data->getSize()))
|
if (!dds::isDDS(data->getData(), data->getSize()))
|
||||||
throw love::Exception("Could not decode compressed data (not a DDS file?)");
|
throw love::Exception("Could not decode compressed data (not a DDS file?)");
|
||||||
|
|
||||||
CompressedData::TextureType textype = CompressedData::TYPE_UNKNOWN;
|
CompressedData::Format texformat = CompressedData::FORMAT_UNKNOWN;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Attempt to parse the dds file.
|
// Attempt to parse the dds file.
|
||||||
dds::Parser parser(data->getData(), data->getSize());
|
dds::Parser parser(data->getData(), data->getSize());
|
||||||
|
|
||||||
textype = convertFormat(parser.getFormat());
|
texformat = convertFormat(parser.getFormat());
|
||||||
|
|
||||||
if (textype == CompressedData::TYPE_UNKNOWN)
|
if (texformat == CompressedData::FORMAT_UNKNOWN)
|
||||||
throw love::Exception("Could not parse compressed data: Unsupported format.");
|
throw love::Exception("Could not parse compressed data: Unsupported format.");
|
||||||
|
|
||||||
if (parser.getMipmapCount() == 0)
|
if (parser.getMipmapCount() == 0)
|
||||||
@@ -88,32 +88,32 @@ CompressedData::TextureType ddsHandler::parse(filesystem::FileData *data, std::v
|
|||||||
throw love::Exception(e.what());
|
throw love::Exception(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return textype;
|
return texformat;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompressedData::TextureType ddsHandler::convertFormat(dds::Format ddsformat)
|
CompressedData::Format ddsHandler::convertFormat(dds::Format ddsformat)
|
||||||
{
|
{
|
||||||
switch (ddsformat)
|
switch (ddsformat)
|
||||||
{
|
{
|
||||||
case dds::FORMAT_DXT1:
|
case dds::FORMAT_DXT1:
|
||||||
return CompressedData::TYPE_DXT1;
|
return CompressedData::FORMAT_DXT1;
|
||||||
case dds::FORMAT_DXT3:
|
case dds::FORMAT_DXT3:
|
||||||
return CompressedData::TYPE_DXT3;
|
return CompressedData::FORMAT_DXT3;
|
||||||
case dds::FORMAT_DXT5:
|
case dds::FORMAT_DXT5:
|
||||||
return CompressedData::TYPE_DXT5;
|
return CompressedData::FORMAT_DXT5;
|
||||||
case dds::FORMAT_BC4:
|
case dds::FORMAT_BC4:
|
||||||
return CompressedData::TYPE_BC4;
|
return CompressedData::FORMAT_BC4;
|
||||||
case dds::FORMAT_BC4s:
|
case dds::FORMAT_BC4s:
|
||||||
return CompressedData::TYPE_BC4s;
|
return CompressedData::FORMAT_BC4s;
|
||||||
case dds::FORMAT_BC5:
|
case dds::FORMAT_BC5:
|
||||||
return CompressedData::TYPE_BC5;
|
return CompressedData::FORMAT_BC5;
|
||||||
case dds::FORMAT_BC5s:
|
case dds::FORMAT_BC5s:
|
||||||
return CompressedData::TYPE_BC5s;
|
return CompressedData::FORMAT_BC5s;
|
||||||
default:
|
default:
|
||||||
return CompressedData::TYPE_UNKNOWN;
|
return CompressedData::FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompressedData::TYPE_UNKNOWN;
|
return CompressedData::FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // magpie
|
} // magpie
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ public:
|
|||||||
* @param[in] data The data to parse.
|
* @param[in] data The data to parse.
|
||||||
* @param[out] images The list of sub-images (including byte data for each)
|
* @param[out] images The list of sub-images (including byte data for each)
|
||||||
* parsed from the file data.
|
* parsed from the file data.
|
||||||
* @return The type of CompressedData.
|
* @return The format of the CompressedData.
|
||||||
**/
|
**/
|
||||||
static CompressedData::TextureType parse(filesystem::FileData *data, std::vector<CompressedData::SubImage> &images);
|
static CompressedData::Format parse(filesystem::FileData *data, std::vector<CompressedData::SubImage> &images);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static CompressedData::TextureType convertFormat(dds::Format ddsformat);
|
static CompressedData::Format convertFormat(dds::Format ddsformat);
|
||||||
|
|
||||||
}; // ddsHandler
|
}; // ddsHandler
|
||||||
|
|
||||||
|
|||||||
@@ -147,14 +147,14 @@ int w_CompressedData_getMipmapCount(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_CompressedData_getType(lua_State *L)
|
int w_CompressedData_getFormat(lua_State *L)
|
||||||
{
|
{
|
||||||
CompressedData *t = luax_checkcompresseddata(L, 1);
|
CompressedData *t = luax_checkcompresseddata(L, 1);
|
||||||
|
|
||||||
image::CompressedData::TextureType type = t->getType();
|
image::CompressedData::Format format = t->getFormat();
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if (image::CompressedData::getConstant(type, str))
|
if (image::CompressedData::getConstant(format, str))
|
||||||
lua_pushstring(L, str);
|
lua_pushstring(L, str);
|
||||||
else
|
else
|
||||||
lua_pushstring(L, "unknown");
|
lua_pushstring(L, "unknown");
|
||||||
@@ -173,7 +173,7 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getHeight", w_CompressedData_getHeight },
|
{ "getHeight", w_CompressedData_getHeight },
|
||||||
{ "getDimensions", w_CompressedData_getDimensions },
|
{ "getDimensions", w_CompressedData_getDimensions },
|
||||||
{ "getMipmapCount", w_CompressedData_getMipmapCount },
|
{ "getMipmapCount", w_CompressedData_getMipmapCount },
|
||||||
{ "getType", w_CompressedData_getType },
|
{ "getFormat", w_CompressedData_getFormat },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int w_CompressedData_getWidth(lua_State *L);
|
|||||||
int w_CompressedData_getHeight(lua_State *L);
|
int w_CompressedData_getHeight(lua_State *L);
|
||||||
int w_CompressedData_getDimensions(lua_State *L);
|
int w_CompressedData_getDimensions(lua_State *L);
|
||||||
int w_CompressedData_getMipmapCount(lua_State *L);
|
int w_CompressedData_getMipmapCount(lua_State *L);
|
||||||
int w_CompressedData_getType(lua_State *L);
|
int w_CompressedData_getFormat(lua_State *L);
|
||||||
extern "C" int luaopen_compresseddata(lua_State *L);
|
extern "C" int luaopen_compresseddata(lua_State *L);
|
||||||
|
|
||||||
} // image
|
} // image
|
||||||
|
|||||||
Reference in New Issue
Block a user