TexConv/TextureFileCreaterR.cpp

32 lines
744 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include"TextureFileCreater.h"
#include"ILImage.h"
class TextureFileCreaterR:public TextureFileCreater
{
public:
using TextureFileCreater::TextureFileCreater;
public:
bool Write() override
{
ILuint type;
if(!ToILType(type,fmt->bits[0],fmt->type))
return(nullptr);
void *data=image->GetR(type);
if(!data)
return(nullptr);
//目前仅有R8UN,R16UN,R16F,R32U,R32I,R32F几种都是8的整倍数所以直接写
return TextureFileCreater::Write(data);
}
};//class TextureFileCreaterR:public TextureFileCreater
TextureFileCreater *CreateTextureFileCreaterR(const PixelFormat *pf,ILImage *image)
{
return(new TextureFileCreaterR(pf,image));
}