first fix RGBA order
This commit is contained in:
parent
09f9f61829
commit
25c2ab644b
@ -96,8 +96,8 @@ bool TextureFileCreater::WriteFileHeader(const OSString &old_filename)
|
||||
dos->WriteUint32(image->width());
|
||||
dos->WriteUint32(image->height());
|
||||
dos->WriteUint8(fmt->channels); //颜色通道数
|
||||
dos->WriteUint8((uint8 *)fmt->color,fmt->channels); //颜色标记
|
||||
dos->WriteUint8(fmt->bits,fmt->channels); //颜色位数
|
||||
dos->WriteUint8((uint8 *)fmt->color,4); //颜色标记
|
||||
dos->WriteUint8(fmt->bits,4); //颜色位数
|
||||
dos->WriteUint8((uint8)fmt->type); //数据类型
|
||||
|
||||
return(true);
|
||||
|
@ -12,9 +12,9 @@ public:
|
||||
{
|
||||
for(uint i=0;i<size;i++)
|
||||
{
|
||||
*target=((src[2]<<8)&0xF800)
|
||||
*target=((src[0]<<8)&0xF800)
|
||||
|((src[1]<<3)&0x7E0)
|
||||
| (src[0]>>3);
|
||||
| (src[2]>>3);
|
||||
|
||||
++target;
|
||||
src+=3;
|
||||
|
@ -12,10 +12,10 @@ public:
|
||||
{
|
||||
for(uint i=0;i<size;i++)
|
||||
{
|
||||
*target=((src[3]<<8)&0xF000)
|
||||
|((src[2]<<4)&0xF00)
|
||||
|((src[1] )&0xF0)
|
||||
| (src[0]>>4);
|
||||
*target=((src[0]<<8)&0xF000)
|
||||
|((src[1]<<4)&0xF00)
|
||||
|((src[2] )&0xF0)
|
||||
| (src[3]>>4);
|
||||
|
||||
++target;
|
||||
src+=4;
|
||||
@ -27,9 +27,9 @@ public:
|
||||
for(uint i=0;i<size;i++)
|
||||
{
|
||||
*target=((src[3]<<8)&0x8000)
|
||||
|((src[2]<<7)&0x7C00)
|
||||
|((src[0]<<7)&0x7C00)
|
||||
|((src[1]<<2)&0x3E0)
|
||||
| (src[0]>>3);
|
||||
| (src[2]>>3);
|
||||
|
||||
++target;
|
||||
src+=4;
|
||||
@ -41,9 +41,9 @@ public:
|
||||
for(uint i=0;i<size;i++)
|
||||
{
|
||||
*target=((src[3]<<16)&0xC0000000)
|
||||
|((src[0]<<14)&0x3FF00000)
|
||||
|((src[2]<<14)&0x3FF00000)
|
||||
|((src[1]<< 4)&0xFFC00)
|
||||
| (src[2]>> 6);
|
||||
| (src[0]>> 6);
|
||||
|
||||
++target;
|
||||
src+=4;
|
||||
@ -54,8 +54,8 @@ public:
|
||||
|
||||
bool Write() override
|
||||
{
|
||||
if(fmt->format==ColorFormat::RGBA8UN
|
||||
||fmt->format==ColorFormat::RGBA16UN
|
||||
if(fmt->format==ColorFormat::RGBA8
|
||||
||fmt->format==ColorFormat::RGBA16
|
||||
||fmt->format==ColorFormat::RGBA16F
|
||||
||fmt->format==ColorFormat::RGBA32U
|
||||
||fmt->format==ColorFormat::RGBA32I
|
||||
@ -90,7 +90,7 @@ public:
|
||||
|
||||
return TextureFileCreater::Write(a1_rgb5);
|
||||
}
|
||||
else if(fmt->format==ColorFormat::A2BGR10UN)
|
||||
else if(fmt->format==ColorFormat::A2BGR10)
|
||||
{
|
||||
void *origin_rgba=image->GetRGBA(IL_UNSIGNED_SHORT);
|
||||
|
||||
|
6
main.cpp
6
main.cpp
@ -40,10 +40,10 @@ const PixelFormat *ParseParamFormat(const CmdParse &cmd,const os_char *flag,cons
|
||||
void ParseParamFormat(const CmdParse &cmd)
|
||||
{
|
||||
//指定格式
|
||||
pixel_fmt[0]=ParseParamFormat(cmd,OS_TEXT("/R:"), GetPixelFormat(ColorFormat::R8UN));
|
||||
pixel_fmt[1]=ParseParamFormat(cmd,OS_TEXT("/RG:"), GetPixelFormat(ColorFormat::RG8UN));
|
||||
pixel_fmt[0]=ParseParamFormat(cmd,OS_TEXT("/R:"), GetPixelFormat(ColorFormat::R8));
|
||||
pixel_fmt[1]=ParseParamFormat(cmd,OS_TEXT("/RG:"), GetPixelFormat(ColorFormat::RG8));
|
||||
pixel_fmt[2]=ParseParamFormat(cmd,OS_TEXT("/RGB:"), GetPixelFormat(ColorFormat::RGB565));
|
||||
pixel_fmt[3]=ParseParamFormat(cmd,OS_TEXT("/RGBA:"), GetPixelFormat(ColorFormat::RGBA8UN));
|
||||
pixel_fmt[3]=ParseParamFormat(cmd,OS_TEXT("/RGBA:"), GetPixelFormat(ColorFormat::RGBA8));
|
||||
|
||||
for(uint i=0;i<4;i++)
|
||||
std::cout<<(i+1)<<": "<<pixel_fmt[i]->name<<std::endl;
|
||||
|
@ -16,7 +16,8 @@ namespace hgl
|
||||
"UINT",
|
||||
"SINT",
|
||||
"UFLOAT",
|
||||
"SFLOAT"
|
||||
"SFLOAT",
|
||||
"sRGB"
|
||||
};
|
||||
|
||||
constexpr PixelFormat pf_list[]=
|
||||
@ -24,15 +25,15 @@ namespace hgl
|
||||
{ColorFormat::BGRA4, "BGRA4", 4,{'B','G','R','A'},{ 4, 4, 4, 4},ColorDataType::UNORM},
|
||||
{ColorFormat::RGB565, "RGB565", 3,{'R','G','B', 0 },{ 5, 6, 5, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::A1RGB5, "A1RGB5", 4,{'A','R','G','B'},{ 1, 5, 5, 5},ColorDataType::UNORM},
|
||||
{ColorFormat::R8UN, "R8UN", 1,{'R', 0 , 0 , 0 },{ 8, 0, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::RG8UN, "RG8UN", 2,{'R','G', 0 , 0 },{ 8, 8, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::RGBA8UN, "RGBA8UN", 4,{'R','G','B','A'},{ 8, 8, 8, 8},ColorDataType::UNORM},
|
||||
{ColorFormat::A2BGR10UN, "A2BGR10UN", 4,{'A','B','G','R'},{ 2,10,10,10},ColorDataType::UNORM},
|
||||
{ColorFormat::R16UN, "R16UN", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::R8, "R8", 1,{'R', 0 , 0 , 0 },{ 8, 0, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::RG8, "RG8", 2,{'R','G', 0 , 0 },{ 8, 8, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::RGBA8, "RGBA8", 4,{'R','G','B','A'},{ 8, 8, 8, 8},ColorDataType::UNORM},
|
||||
{ColorFormat::A2BGR10, "A2BGR10", 4,{'A','B','G','R'},{ 2,10,10,10},ColorDataType::UNORM},
|
||||
{ColorFormat::R16, "R16", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::R16F, "R16F", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0},ColorDataType::SFLOAT},
|
||||
{ColorFormat::RG16UN, "RG16UN", 2,{'R','G', 0 , 0 },{16,16, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::RG16, "RG16", 2,{'R','G', 0 , 0 },{16,16, 0, 0},ColorDataType::UNORM},
|
||||
{ColorFormat::RG16F, "RG16F", 2,{'R','G', 0 , 0 },{16,16, 0, 0},ColorDataType::SFLOAT},
|
||||
{ColorFormat::RGBA16UN, "RGBA16UN", 4,{'R','G','B','A'},{16,16,16,16},ColorDataType::UNORM},
|
||||
{ColorFormat::RGBA16, "RGBA16", 4,{'R','G','B','A'},{16,16,16,16},ColorDataType::UNORM},
|
||||
{ColorFormat::RGBA16F, "RGBA16F", 4,{'R','G','B','A'},{16,16,16,16},ColorDataType::SFLOAT},
|
||||
{ColorFormat::R32U, "R32U", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0},ColorDataType::UINT},
|
||||
{ColorFormat::R32I, "R32I", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0},ColorDataType::SINT},
|
||||
|
@ -11,15 +11,15 @@ enum class ColorFormat
|
||||
BGRA4,
|
||||
RGB565,
|
||||
A1RGB5,
|
||||
R8UN,
|
||||
RG8UN,
|
||||
RGBA8UN,
|
||||
A2BGR10UN,
|
||||
R16UN,
|
||||
R8,
|
||||
RG8,
|
||||
RGBA8,
|
||||
A2BGR10,
|
||||
R16,
|
||||
R16F,
|
||||
RG16UN,
|
||||
RG16,
|
||||
RG16F,
|
||||
RGBA16UN,
|
||||
RGBA16,
|
||||
RGBA16F,
|
||||
R32U,
|
||||
R32I,
|
||||
@ -43,12 +43,13 @@ enum class ColorDataType
|
||||
|
||||
UNORM,
|
||||
SNORM,
|
||||
UINT,
|
||||
SINT,
|
||||
USCALE,
|
||||
SSCALE,
|
||||
UINT,
|
||||
SINT,
|
||||
UFLOAT,
|
||||
SFLOAT,
|
||||
SRGB,
|
||||
|
||||
END
|
||||
};//enum class ColorDataType
|
||||
|
Loading…
x
Reference in New Issue
Block a user